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;
}
Aggregations