Search in sources :

Example 1 with ProcessGroupAndConnections

use of com.thinkbiganalytics.nifi.rest.client.layout.ProcessGroupAndConnections in project kylo by Teradata.

the class CleanupStaleFeedRevisions method doCleanup.

private void doCleanup(String processGroupId) {
    stoppedPorts.clear();
    AlignProcessGroupComponents alignProcessGroupComponents = new AlignProcessGroupComponents(restClient.getNiFiRestClient(), processGroupId);
    alignProcessGroupComponents.groupItems();
    final Map<String, ProcessGroupAndConnections> groups = alignProcessGroupComponents.getProcessGroupWithConnectionsMap();
    Set<ProcessGroupAndConnections> deletedItems = new HashSet<>();
    groups.values().stream().filter(groupAndConnections -> NifiTemplateNameUtil.isVersionedProcessGroup(groupAndConnections.getProcessGroup().getName())).filter(groupAndConnections -> canDelete(groupAndConnections.getProcessGroup())).forEach(groupAndConnections -> {
        cleanup(groupAndConnections);
        deletedItems.add(groupAndConnections);
    });
    startPorts();
    // relayout the group
    if (!deletedItems.isEmpty()) {
        new AlignProcessGroupComponents(restClient.getNiFiRestClient(), processGroupId).autoLayout();
    }
}
Also used : NifiTemplateNameUtil(com.thinkbiganalytics.nifi.rest.support.NifiTemplateNameUtil) Logger(org.slf4j.Logger) ProcessGroupStatusDTO(org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) ProcessGroupAndConnections(com.thinkbiganalytics.nifi.rest.client.layout.ProcessGroupAndConnections) StringUtils(org.apache.commons.lang3.StringUtils) NiFiPropertyDescriptorTransform(com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptorTransform) HashSet(java.util.HashSet) PortDTO(org.apache.nifi.web.api.dto.PortDTO) ProcessGroupDTO(org.apache.nifi.web.api.dto.ProcessGroupDTO) AlignProcessGroupComponents(com.thinkbiganalytics.nifi.rest.client.layout.AlignProcessGroupComponents) Map(java.util.Map) Optional(java.util.Optional) LegacyNifiRestClient(com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient) NifiConstants(com.thinkbiganalytics.nifi.rest.support.NifiConstants) AlignProcessGroupComponents(com.thinkbiganalytics.nifi.rest.client.layout.AlignProcessGroupComponents) ProcessGroupAndConnections(com.thinkbiganalytics.nifi.rest.client.layout.ProcessGroupAndConnections) HashSet(java.util.HashSet)

Aggregations

LegacyNifiRestClient (com.thinkbiganalytics.nifi.rest.client.LegacyNifiRestClient)1 AlignProcessGroupComponents (com.thinkbiganalytics.nifi.rest.client.layout.AlignProcessGroupComponents)1 ProcessGroupAndConnections (com.thinkbiganalytics.nifi.rest.client.layout.ProcessGroupAndConnections)1 NiFiPropertyDescriptorTransform (com.thinkbiganalytics.nifi.rest.model.NiFiPropertyDescriptorTransform)1 NifiConstants (com.thinkbiganalytics.nifi.rest.support.NifiConstants)1 NifiTemplateNameUtil (com.thinkbiganalytics.nifi.rest.support.NifiTemplateNameUtil)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 StringUtils (org.apache.commons.lang3.StringUtils)1 PortDTO (org.apache.nifi.web.api.dto.PortDTO)1 ProcessGroupDTO (org.apache.nifi.web.api.dto.ProcessGroupDTO)1 ProcessGroupStatusDTO (org.apache.nifi.web.api.dto.status.ProcessGroupStatusDTO)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1