You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/02/05 10:28:02 UTC

[GitHub] [nifi] tpalfy commented on a change in pull request #3977: NIFI-7007 Add update functionality to the PutCassandraRecord processor.

tpalfy commented on a change in pull request #3977: NIFI-7007 Add update functionality to the PutCassandraRecord processor.
URL: https://github.com/apache/nifi/pull/3977#discussion_r375168357
 
 

 ##########
 File path: nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraRecord.java
 ##########
 @@ -362,6 +381,38 @@ private Long convertFieldObjectToLong(String name, Object value) {
         return ((Number) value).longValue();
     }
 
+    @Override
+    protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
+        Set<ValidationResult> results = (Set<ValidationResult>) super.customValidate(validationContext);
+
+        String statementType = validationContext.getProperty(STATEMENT_TYPE).getValue();
+
+        if (UPDATE_TYPE.getValue().equalsIgnoreCase(statementType)) {
+            // Check that update keys and update method are set
+            String updateKeys = validationContext.getProperty(UPDATE_KEYS).getValue();
+            String updateMethod = validationContext.getProperty(UPDATE_METHOD).getValue();
+            if (StringUtils.isEmpty(updateKeys)) {
+                results.add(new ValidationResult.Builder().subject("Update statement configuration").valid(false).explanation(
+                        "if the Statement Type is set to Update, then the Update Keys must be specified as well").build());
+            }
+            if (StringUtils.isEmpty(updateMethod)) {
 
 Review comment:
   Minor: It's impossible for the `updateMethod` to be empty and reach `customValidate`. (The property is assigned allowed values.)
   I would remove this check. (Current tests don't cover it either.)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services