nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JPercivall <...@git.apache.org>
Subject [GitHub] nifi pull request: NIFI-1582 added state to UpdateAttribute as wel...
Date Mon, 18 Apr 2016 15:53:29 GMT
Github user JPercivall commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/319#discussion_r60083778
  
    --- Diff: nifi-nar-bundles/nifi-update-attribute-bundle/nifi-update-attribute-processor/src/main/java/org/apache/nifi/processors/attributes/UpdateAttribute.java
---
    @@ -187,24 +167,83 @@ public UpdateAttribute() {
         protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
             List<PropertyDescriptor> descriptors = new ArrayList<>();
             descriptors.add(DELETE_ATTRIBUTES);
    +        descriptors.add(STORE_STATE);
    +        descriptors.add(STATEFUL_VARIABLES_INIT_VALUE);
             return Collections.unmodifiableList(descriptors);
         }
     
         @Override
         protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName)
{
    -        return new PropertyDescriptor.Builder()
    -                .name(propertyDescriptorName)
    -                .required(false)
    -                .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING,
true))
    -                .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR)
    -                .expressionLanguageSupported(true)
    -                .dynamic(true)
    -                .build();
    +        if(!stateful){
    +            return new PropertyDescriptor.Builder()
    +                    .name(propertyDescriptorName)
    +                    .required(false)
    +                    .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR)
    +                    .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +                    .expressionLanguageSupported(true)
    +                    .dynamic(true)
    +                    .build();
    +        } else {
    +            return new PropertyDescriptor.Builder()
    +                    .name(propertyDescriptorName)
    +                    .required(false)
    +                    .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING,
true))
    +                    .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR)
    +                    .expressionLanguageSupported(true)
    +                    .dynamic(true)
    +                    .build();
    +        }
    --- End diff --
    
    That would be a cleaner approach. I will change. Thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message