Search in sources :

Example 1 with AddHeaderTransform

use of com.hortonworks.streamline.streams.layout.component.rule.action.transform.AddHeaderTransform in project streamline by hortonworks.

the class NotifierActionRuntime method getNotificationTransforms.

/**
 * Returns the necessary transforms to perform based on the action.
 */
private List<Transform> getNotificationTransforms(NotifierAction action, Long ruleId) {
    List<Transform> transforms = new ArrayList<>();
    if (action.getOutputFieldsAndDefaults() != null && !action.getOutputFieldsAndDefaults().isEmpty()) {
        transforms.add(new MergeTransform(action.getOutputFieldsAndDefaults()));
        transforms.add(new SubstituteTransform(action.getOutputFieldsAndDefaults().keySet()));
        transforms.add(new ProjectionTransform("projection-" + ruleId, action.getOutputFieldsAndDefaults().keySet()));
    }
    Map<String, Object> headers = new HashMap<>();
    headers.put(AddHeaderTransformRuntime.HEADER_FIELD_NOTIFIER_NAME, action.getNotifierName());
    headers.put(AddHeaderTransformRuntime.HEADER_FIELD_RULE_ID, ruleId);
    transforms.add(new AddHeaderTransform(headers));
    return transforms;
}
Also used : ProjectionTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.ProjectionTransform) AddHeaderTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.AddHeaderTransform) MergeTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.MergeTransform) SubstituteTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.SubstituteTransform) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Transform(com.hortonworks.streamline.streams.layout.Transform) ProjectionTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.ProjectionTransform) MergeTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.MergeTransform) AddHeaderTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.AddHeaderTransform) SubstituteTransform(com.hortonworks.streamline.streams.layout.component.rule.action.transform.SubstituteTransform)

Aggregations

Transform (com.hortonworks.streamline.streams.layout.Transform)1 AddHeaderTransform (com.hortonworks.streamline.streams.layout.component.rule.action.transform.AddHeaderTransform)1 MergeTransform (com.hortonworks.streamline.streams.layout.component.rule.action.transform.MergeTransform)1 ProjectionTransform (com.hortonworks.streamline.streams.layout.component.rule.action.transform.ProjectionTransform)1 SubstituteTransform (com.hortonworks.streamline.streams.layout.component.rule.action.transform.SubstituteTransform)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1