@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"json","attributes","flowfile"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Generates a JSON representation of the input FlowFile Attributes. The resulting JSON can be written to either a new Attribute \'JSONAttributes\' or written to the FlowFile as content.") @WritesAttribute(attribute="JSONAttributes", description="JSON representation of Attributes") public class AttributesToJSON extends AbstractProcessor
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_JSON |
private static String |
AT_LIST_SEPARATOR |
private Set<String> |
attributes |
static PropertyDescriptor |
ATTRIBUTES_LIST |
static PropertyDescriptor |
ATTRIBUTES_REGEX |
private Set<String> |
attributesToRemove |
static PropertyDescriptor |
DESTINATION |
static String |
DESTINATION_ATTRIBUTE |
static String |
DESTINATION_CONTENT |
private boolean |
destinationContent |
static PropertyDescriptor |
INCLUDE_CORE_ATTRIBUTES |
static String |
JSON_ATTRIBUTE_NAME |
static PropertyDescriptor |
NULL_VALUE_FOR_EMPTY_STRING |
private Boolean |
nullValueForEmptyString |
private static com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
private Pattern |
pattern |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_SUCCESS |
private Set<Relationship> |
relationships |
Constructor and Description |
---|
AttributesToJSON() |
Modifier and Type | Method and Description |
---|---|
private Set<String> |
buildAtrs(String atrList,
Set<String> atrsToExclude) |
protected Map<String,String> |
buildAttributesMapForFlowFile(FlowFile ff,
Set<String> attributes,
Set<String> attributesToRemove,
boolean nullValForEmptyString,
Pattern attPattern)
Builds the Map of attributes that should be included in the JSON that is emitted from this process.
|
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onScheduled(ProcessContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final String JSON_ATTRIBUTE_NAME
private static final String AT_LIST_SEPARATOR
public static final String DESTINATION_ATTRIBUTE
public static final String DESTINATION_CONTENT
public static final String APPLICATION_JSON
public static final PropertyDescriptor ATTRIBUTES_LIST
public static final PropertyDescriptor ATTRIBUTES_REGEX
public static final PropertyDescriptor DESTINATION
public static final PropertyDescriptor INCLUDE_CORE_ATTRIBUTES
public static final PropertyDescriptor NULL_VALUE_FOR_EMPTY_STRING
public static final Relationship REL_SUCCESS
public static final Relationship REL_FAILURE
private List<PropertyDescriptor> properties
private Set<Relationship> relationships
private static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
private volatile Boolean nullValueForEmptyString
private volatile boolean destinationContent
private volatile Pattern pattern
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected Map<String,String> buildAttributesMapForFlowFile(FlowFile ff, Set<String> attributes, Set<String> attributesToRemove, boolean nullValForEmptyString, Pattern attPattern)
@OnScheduled public void onScheduled(ProcessContext context)
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
Copyright © 2021 Apache NiFi Project. All rights reserved.