Merging NIFI-1941 Child Group Contents in Exported Templates

Signed-off-by: James Wing <jvwing@gmail.com>
This closes #532
This commit is contained in:
James Wing 2016-06-16 22:03:26 -07:00
commit c2b26eb311
2 changed files with 32 additions and 35 deletions

View File

@ -16,32 +16,6 @@
*/
package org.apache.nifi.web.api.dto;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.ws.rs.WebApplicationException;
import org.apache.nifi.action.Action;
import org.apache.nifi.action.component.details.ComponentDetails;
import org.apache.nifi.action.component.details.ExtensionDetails;
@ -164,6 +138,31 @@ import org.apache.nifi.web.api.entity.FlowBreadcrumbEntity;
import org.apache.nifi.web.controller.ControllerFacade;
import org.apache.nifi.web.revision.RevisionManager;
import javax.ws.rs.WebApplicationException;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
public final class DtoFactory {
@SuppressWarnings("rawtypes")
@ -1556,9 +1555,6 @@ public final class DtoFactory {
}
for (final ProcessGroupDTO processGroup : snippet.getProcessGroups()) {
// clear the contents as we only return a single level/group at a time
processGroup.setContents(null);
final RevisionDTO revision = createRevisionDTO(revisionManager.getRevision(processGroup.getId()));
final AccessPolicyDTO accessPolicy = createAccessPolicyDto(group.getProcessGroup(processGroup.getId()));
final ProcessGroupStatusDTO status = getComponentStatus(
@ -2557,6 +2553,7 @@ public final class DtoFactory {
public ProcessGroupDTO copy(final ProcessGroupDTO original, final boolean deep) {
final ProcessGroupDTO copy = new ProcessGroupDTO();
copy.setComments(original.getComments());
copy.setContents(copy(original.getContents(), deep));
copy.setPosition(original.getPosition());
copy.setId(original.getId());
copy.setInputPortCount(original.getInputPortCount());

View File

@ -106,19 +106,19 @@ public class StandardProcessGroupDAO extends ComponentDAO implements ProcessGrou
final Connectable connectable = group.findConnectable(componentId);
if (ScheduledState.RUNNING.equals(state)) {
if (ConnectableType.PROCESSOR.equals(connectable.getConnectableType())) {
group.startProcessor((ProcessorNode) connectable);
connectable.getProcessGroup().startProcessor((ProcessorNode) connectable);
} else if (ConnectableType.INPUT_PORT.equals(connectable.getConnectableType())) {
group.startInputPort((Port) connectable);
connectable.getProcessGroup().startInputPort((Port) connectable);
} else if (ConnectableType.OUTPUT_PORT.equals(connectable.getConnectableType())) {
group.startOutputPort((Port) connectable);
connectable.getProcessGroup().startOutputPort((Port) connectable);
}
} else {
if (ConnectableType.PROCESSOR.equals(connectable.getConnectableType())) {
group.stopProcessor((ProcessorNode) connectable);
connectable.getProcessGroup().stopProcessor((ProcessorNode) connectable);
} else if (ConnectableType.INPUT_PORT.equals(connectable.getConnectableType())) {
group.stopInputPort((Port) connectable);
connectable.getProcessGroup().stopInputPort((Port) connectable);
} else if (ConnectableType.OUTPUT_PORT.equals(connectable.getConnectableType())) {
group.stopOutputPort((Port) connectable);
connectable.getProcessGroup().stopOutputPort((Port) connectable);
}
}
}