[ 
https://issues.apache.org/jira/browse/NIFI-9311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matt Burgess updated NIFI-9311:
-------------------------------
    Description: 
If scripted properties are removed from a script in InvokeScriptedProcessor, 
they do not become unsupported properties when the script is reloaded. For 
example, load the following script:

class GroovyProcessor implements Processor {
 def ComponentLog log

def REL_SUCCESS = new Relationship.Builder().name("success")
 .description("FlowFiles that were successfully processed").build()

@Override
 Set<Relationship> getRelationships()

{ return [REL_SUCCESS] as Set }

def PASS = new PropertyDescriptor.Builder().name('Password')
 .required(true).sensitive(true).addValidator(Validator.VALID).build()

def NS_USER = new PropertyDescriptor.Builder().name('NS Username')
 .required(true).sensitive(false).addValidator(Validator.VALID).build()

@Override
 List<PropertyDescriptor> getPropertyDescriptors()

{ return [NS_USER, PASS] as List }

@Override
 PropertyDescriptor getPropertyDescriptor(String name) {
 switch(name)

{ case 'Password': return PASS case 'NS Username': return NS_USER default: 
return null }

}

@Override
 void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) 
throws ProcessException {
 try

{ def session = sessionFactory.createSession() def flowFile = session.get() 
if(!flowFile) return def pass = context.getProperty(PASS).getValue() // do 
something with pass session.transfer(flowFile,REL_SUCCESS) session.commit() }

catch (e)

{ throw new ProcessException(e) }

}

@Override
 void initialize(ProcessorInitializationContext context)

{ log = context.getLogger() }

@Override
 Collection<ValidationResult> validate(ValidationContext context)

{ return null }

@Override
 void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String 
newValue) \{ }

@Override
 String getIdentifier() \{ return null }

}

processor = new GroovyProcessor()

 

Then go back into the configuration dialog and remove one of the properties, 
then click Apply. The removed property should now be an unsupported property 
(not a dynamic property).

  was:
If scripted properties are removed from a script in InvokeScriptedProcessor, 
they do not become unsupported properties when the script is reloaded. For 
example, load the following script:


 class GroovyProcessor implements Processor {
 def ComponentLog log

def REL_SUCCESS = new Relationship.Builder().name("success")
 .description("FlowFiles that were successfully processed").build()

@Override
 Set<Relationship> getRelationships()

{ return [REL_SUCCESS] as Set }

def PASS = new PropertyDescriptor.Builder().name('Password')
 .required(true).sensitive(true).addValidator(Validator.VALID).build()

def NS_USER = new PropertyDescriptor.Builder().name('NS Username')
 .required(true).sensitive(false).addValidator(Validator.VALID).build()

@Override
 List<PropertyDescriptor> getPropertyDescriptors()

{ return [NS_USER, PASS] as List }

@Override
 PropertyDescriptor getPropertyDescriptor(String name) {
 switch(name)

{ case 'Password': return PASS case 'NS Username': return NS_USER default: 
return null }

}

@Override
 void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) 
throws ProcessException {
 try

{ def session = sessionFactory.createSession() def flowFile = session.get() 
if(!flowFile) return def pass = context.getProperty(PASS).getValue() // do 
something with pass session.transfer(flowFile,REL_SUCCESS) session.commit() }

catch (e)

{ throw new ProcessException(e) }

}

@Override
 void initialize(ProcessorInitializationContext context)

{ log = context.getLogger() }

@Override
 Collection<ValidationResult> validate(ValidationContext context)

{ return null }
 
 @Override
 void onPropertyModified(PropertyDescriptor descriptor, String oldValue, String 
newValue) \{ }
 
 @Override
 String getIdentifier() \{ return null }

}

processor = new GroovyProcessor()



 

Then go back into the configuration dialog and remove one of the properties, 
then click Apply. The removed property should now be an unsupported property or 
at the least a dynamic property (not required).


> Cannot remove scripted properties in InvokeScriptedProcessor
> ------------------------------------------------------------
>
>                 Key: NIFI-9311
>                 URL: https://issues.apache.org/jira/browse/NIFI-9311
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Matt Burgess
>            Priority: Major
>
> If scripted properties are removed from a script in InvokeScriptedProcessor, 
> they do not become unsupported properties when the script is reloaded. For 
> example, load the following script:
> class GroovyProcessor implements Processor {
>  def ComponentLog log
> def REL_SUCCESS = new Relationship.Builder().name("success")
>  .description("FlowFiles that were successfully processed").build()
> @Override
>  Set<Relationship> getRelationships()
> { return [REL_SUCCESS] as Set }
> def PASS = new PropertyDescriptor.Builder().name('Password')
>  .required(true).sensitive(true).addValidator(Validator.VALID).build()
> def NS_USER = new PropertyDescriptor.Builder().name('NS Username')
>  .required(true).sensitive(false).addValidator(Validator.VALID).build()
> @Override
>  List<PropertyDescriptor> getPropertyDescriptors()
> { return [NS_USER, PASS] as List }
> @Override
>  PropertyDescriptor getPropertyDescriptor(String name) {
>  switch(name)
> { case 'Password': return PASS case 'NS Username': return NS_USER default: 
> return null }
> }
> @Override
>  void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) 
> throws ProcessException {
>  try
> { def session = sessionFactory.createSession() def flowFile = session.get() 
> if(!flowFile) return def pass = context.getProperty(PASS).getValue() // do 
> something with pass session.transfer(flowFile,REL_SUCCESS) session.commit() }
> catch (e)
> { throw new ProcessException(e) }
> }
> @Override
>  void initialize(ProcessorInitializationContext context)
> { log = context.getLogger() }
> @Override
>  Collection<ValidationResult> validate(ValidationContext context)
> { return null }
> @Override
>  void onPropertyModified(PropertyDescriptor descriptor, String oldValue, 
> String newValue) \{ }
> @Override
>  String getIdentifier() \{ return null }
> }
> processor = new GroovyProcessor()
>  
> Then go back into the configuration dialog and remove one of the properties, 
> then click Apply. The removed property should now be an unsupported property 
> (not a dynamic property).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to