@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) |
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) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTruecustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatepublic 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 AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentpublic Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected 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 AbstractProcessorProcessExceptionCopyright © 2023 Apache NiFi Project. All rights reserved.