Skip to content

Commit 11ce651

Browse files
committed
Update GSS with dynamic attribute for table name
1 parent 6956b26 commit 11ce651

File tree

1 file changed

+11
-3
lines changed
  • nifi-nar-bundles/nifi-geometry-bundle/nifi-geometry-processors/src/main/java/com/jdvn/setl/geos/processors/gss

1 file changed

+11
-3
lines changed

nifi-nar-bundles/nifi-geometry-bundle/nifi-geometry-processors/src/main/java/com/jdvn/setl/geos/processors/gss/PutGSS.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,19 @@ private boolean checkColumnExisted(Connection connection, String tableName, Stri
494494
return false;
495495

496496
}
497-
private boolean checkAndFillSETLCondition(final ProcessContext context) {
497+
private boolean checkAndFillSETLCondition(final ProcessContext context, FlowFile flowFile) {
498498

499499
final GSSService gssService = context.getProperty(GSS_SERVICE).asControllerService(GSSService.class);
500500
final Connection connection = gssService.getConnection();
501-
final String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions().getValue();
501+
502+
String tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions().getValue();
503+
// If table name is setting to get from attribute of flow file
504+
if (tableName == null || tableName.isEmpty())
505+
tableName = context.getProperty(TABLE_NAME).evaluateAttributeExpressions(flowFile).getValue();
506+
// if get table name is not okay, then exit
507+
if (tableName == null || tableName.isEmpty()) {
508+
return false;
509+
}
502510
Statement stmt = null;
503511
try {
504512

@@ -535,7 +543,7 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
535543
return;
536544
}
537545

538-
boolean capableToPut = checkAndFillSETLCondition(context);
546+
boolean capableToPut = checkAndFillSETLCondition(context, flowFile);
539547
if (!capableToPut) {
540548
return;
541549
}

0 commit comments

Comments
 (0)