Search in sources :

Example 1 with NifiPropertyGroup

use of com.thinkbiganalytics.nifi.rest.model.NifiPropertyGroup in project kylo by Teradata.

the class NifiPropertyUtil method groupPropertiesByProcessGroupAndProcessor.

/**
 * Return a map of processGroupId to a map of that groups processors and its respective propeties
 *
 * @param properties the properties to inspect
 * @return a map with the key being the processGroupId and the value being a map of properties with its key being the processorId
 */
public static Map<String, Map<String, NifiPropertyGroup>> groupPropertiesByProcessGroupAndProcessor(List<NifiProperty> properties) {
    Map<String, Map<String, NifiPropertyGroup>> processGroupProperties = new HashMap();
    for (NifiProperty property : properties) {
        String processGroup = property.getProcessGroupId();
        String processorId = property.getProcessorId();
        if (!processGroupProperties.containsKey(processGroup)) {
            processGroupProperties.put(processGroup, new HashMap<String, NifiPropertyGroup>());
        }
        if (!processGroupProperties.get(processGroup).containsKey(processorId)) {
            processGroupProperties.get(processGroup).put(processorId, new NifiPropertyGroup(processorId));
        }
        processGroupProperties.get(processGroup).get(processorId).add(property);
    }
    return processGroupProperties;
}
Also used : HashMap(java.util.HashMap) NifiProperty(com.thinkbiganalytics.nifi.rest.model.NifiProperty) HashMap(java.util.HashMap) Map(java.util.Map) NifiPropertyGroup(com.thinkbiganalytics.nifi.rest.model.NifiPropertyGroup)

Aggregations

NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)1 NifiPropertyGroup (com.thinkbiganalytics.nifi.rest.model.NifiPropertyGroup)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1