@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"attributes","modification","update","delete","Attribute Expression Language","state"}) @CapabilityDescription(value="Updates the Attributes for a FlowFile by using the Attribute Expression Language and/or deletes the attributes based on a regular expression") @DynamicProperty(name="A FlowFile attribute to update", value="The value to set it to", supportsExpressionLanguage=true, description="Updates a FlowFile attribute specified by the Dynamic Property\'s key with the value specified by the Dynamic Property\'s value") @WritesAttribute(attribute="See additional details", description="This processor may write or remove zero or more attributes as described in additional details") @Stateful(scopes=LOCAL, description="Gives the option to store values not only on the FlowFile but as stateful variables to be referenced in a recursive manner.") public class UpdateAttribute extends AbstractProcessor implements Searchable
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
DELETE_ATTRIBUTES |
static java.lang.String |
DELETE_ATTRIBUTES_EXPRESSION_NAME |
static java.lang.String |
DO_NOT_STORE_STATE |
static Relationship |
REL_FAILED_SET_STATE |
static Relationship |
REL_SUCCESS |
static PropertyDescriptor |
STATEFUL_VARIABLES_INIT_VALUE |
static java.lang.String |
STATEFUL_VARIABLES_INIT_VALUE_NAME |
static PropertyDescriptor |
STORE_STATE |
static java.lang.String |
STORE_STATE_LOCALLY |
static java.lang.String |
STORE_STATE_NAME |
Constructor and Description |
---|
UpdateAttribute() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Collection<ValidationResult> |
customValidate(ValidationContext context)
Allows subclasses to perform their own validation on the already set
properties.
|
java.util.Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(java.lang.String propertyDescriptorName)
Used to allow subclasses to determine what PropertyDescriptor if any to
use when a property is requested for which a descriptor is not already
registered.
|
protected java.util.List<PropertyDescriptor> |
getSupportedPropertyDescriptors()
Allows subclasses to register which property descriptor objects are
supported.
|
void |
onPropertyModified(PropertyDescriptor descriptor,
java.lang.String oldValue,
java.lang.String newValue)
Hook method allowing subclasses to eagerly react to a configuration
change for the given property descriptor.
|
void |
onScheduled(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
java.util.Collection<SearchResult> |
search(SearchContext context) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, validate
public static final java.lang.String DO_NOT_STORE_STATE
public static final java.lang.String STORE_STATE_LOCALLY
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILED_SET_STATE
public static final java.lang.String DELETE_ATTRIBUTES_EXPRESSION_NAME
public static final PropertyDescriptor DELETE_ATTRIBUTES
public static final java.lang.String STORE_STATE_NAME
public static final PropertyDescriptor STORE_STATE
public static final java.lang.String STATEFUL_VARIABLES_INIT_VALUE_NAME
public static final PropertyDescriptor STATEFUL_VARIABLES_INIT_VALUE
public java.util.Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected java.util.List<PropertyDescriptor> getSupportedPropertyDescriptors()
AbstractConfigurableComponent
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(java.lang.String propertyDescriptorName)
AbstractConfigurableComponent
Used to allow subclasses to determine what PropertyDescriptor if any to use when a property is requested for which a descriptor is not already registered. By default this method simply returns a null descriptor. By overriding this method processor implementations can support dynamic properties since this allows them to register properties on demand. It is acceptable for a dynamically generated property to indicate it is required so long as it is understood it is only required once set. Dynamic properties by definition cannot be required until used.
This method should be side effect free in the subclasses in terms of how often it is called for a given property name because there is guarantees how often it will be called for a given property name.
Default is null.
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
propertyDescriptorName
- used to lookup if any property descriptors exist for that namepublic void onPropertyModified(PropertyDescriptor descriptor, java.lang.String oldValue, java.lang.String newValue)
AbstractConfigurableComponent
onPropertyModified
in interface ConfigurableComponent
onPropertyModified
in class AbstractConfigurableComponent
descriptor
- of the modified propertyoldValue
- non-null property value (previous)newValue
- the new property value or if null indicates the property
was removed@OnScheduled public void onScheduled(ProcessContext context) throws java.io.IOException
java.io.IOException
protected java.util.Collection<ValidationResult> customValidate(ValidationContext context)
AbstractConfigurableComponent
customValidate
in class AbstractConfigurableComponent
context
- provides a mechanism for obtaining externally
managed values, such as property values and supplies convenience methods
for operating on those valuespublic java.util.Collection<SearchResult> search(SearchContext context)
search
in interface Searchable
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor