Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/3113#discussion_r232159628
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutSQL.java
---
@@ -189,13 +201,40 @@
properties.add(CONNECTION_POOL);
properties.add(SQL_STATEMENT);
properties.add(SUPPORT_TRANSACTIONS);
+ properties.add(AUTO_COMMIT);
properties.add(TRANSACTION_TIMEOUT);
properties.add(BATCH_SIZE);
properties.add(OBTAIN_GENERATED_KEYS);
properties.add(RollbackOnFailure.ROLLBACK_ON_FAILURE);
return properties;
}
+ @Override
+ protected final Collection<ValidationResult>
customValidate(ValidationContext context) {
+ final Collection<ValidationResult> results = new ArrayList<>();
+ final String support_transactions =
context.getProperty(SUPPORT_TRANSACTIONS).getValue();
+ final String rollback_on_failure =
context.getProperty(RollbackOnFailure.ROLLBACK_ON_FAILURE).getValue();
+ final String auto_commit =
context.getProperty(AUTO_COMMIT).getValue();
+
+ if(auto_commit.equalsIgnoreCase("true")) {
+ if(support_transactions.equalsIgnoreCase("true")) {
+ results.add(new ValidationResult.Builder()
+
.subject(SUPPORT_TRANSACTIONS.getDisplayName())
+ .explanation(format("'%s' cannot be set to
'true' when '%s' is also set to 'true'."
+ + "Transactions for batch updates
cannot be supported when auto commit is set to 'true'",
SUPPORT_TRANSACTIONS.getDisplayName(), AUTO_COMMIT.getDisplayName()))
+ .build());
+ }
+ if(rollback_on_failure.equalsIgnoreCase("true")) {
+ results.add(new ValidationResult.Builder()
+
.subject(RollbackOnFailure.ROLLBACK_ON_FAILURE.getDisplayName())
+ .explanation(format("'%s' cannot be set to 'true'
when '%s' is also set to 'true'."
+ + "Transaction rollbacks for batch updates
cannot be supported when auto commit is set to 'true'",
RollbackOnFailure.ROLLBACK_ON_FAILURE.getDisplayName(),
AUTO_COMMIT.getDisplayName()))
--- End diff --
This line causes following check-style error. Please build with
`-Pcontrib-check` to confirm styles locally.
```
src/main/java/org/apache/nifi/processors/standard/PutSQL.java:[231] (sizes)
LineLength: Line is longer than 200 characters (found 217).
```
---