mirror of https://github.com/apache/nifi.git
NIFI-7762 - support copy-paste on Disabled ports
This commit is contained in:
parent
87685dd4e1
commit
bdead4d040
|
@ -28,4 +28,6 @@ public interface Port extends Connectable {
|
|||
* Port a chance to initialize any resources needed.</p>
|
||||
*/
|
||||
void onSchedulingStart();
|
||||
|
||||
void disable();
|
||||
}
|
||||
|
|
|
@ -423,6 +423,7 @@ public abstract class AbstractPort implements Port {
|
|||
scheduledState.set(ScheduledState.RUNNING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
final boolean updated = scheduledState.compareAndSet(ScheduledState.STOPPED, ScheduledState.DISABLED);
|
||||
if (!updated) {
|
||||
|
|
|
@ -308,6 +308,9 @@ public class StandardFlowSnippet implements FlowSnippet {
|
|||
inputPort.setProcessGroup(group);
|
||||
inputPort.setMaxConcurrentTasks(portDTO.getConcurrentlySchedulableTaskCount());
|
||||
inputPort.setComments(portDTO.getComments());
|
||||
if (portDTO.getState().equals(ScheduledState.DISABLED.toString())) {
|
||||
inputPort.disable();
|
||||
}
|
||||
group.addInputPort(inputPort);
|
||||
}
|
||||
|
||||
|
@ -333,6 +336,9 @@ public class StandardFlowSnippet implements FlowSnippet {
|
|||
outputPort.setProcessGroup(group);
|
||||
outputPort.setMaxConcurrentTasks(portDTO.getConcurrentlySchedulableTaskCount());
|
||||
outputPort.setComments(portDTO.getComments());
|
||||
if (portDTO.getState().equals(ScheduledState.DISABLED.toString())) {
|
||||
outputPort.disable();
|
||||
}
|
||||
group.addOutputPort(outputPort);
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,11 @@ public final class SnippetUtils {
|
|||
final PortDTO cp = dtoFactory.copy(portDTO);
|
||||
cp.setId(generateId(portDTO.getId(), idGenerationSeed, isCopy));
|
||||
cp.setParentGroupId(groupId);
|
||||
cp.setState(ScheduledState.STOPPED.toString());
|
||||
if (portDTO.getState() != null && portDTO.getState().equals(ScheduledState.DISABLED.toString())) {
|
||||
cp.setState(ScheduledState.DISABLED.toString());
|
||||
} else {
|
||||
cp.setState(ScheduledState.STOPPED.toString());
|
||||
}
|
||||
inputPorts.add(cp);
|
||||
|
||||
final ConnectableDTO portConnectable = dtoFactory.createConnectableDto(cp, ConnectableType.INPUT_PORT);
|
||||
|
@ -576,7 +580,11 @@ public final class SnippetUtils {
|
|||
final PortDTO cp = dtoFactory.copy(portDTO);
|
||||
cp.setId(generateId(portDTO.getId(), idGenerationSeed, isCopy));
|
||||
cp.setParentGroupId(groupId);
|
||||
cp.setState(ScheduledState.STOPPED.toString());
|
||||
if (portDTO.getState() != null && portDTO.getState().equals(ScheduledState.DISABLED.toString())) {
|
||||
cp.setState(ScheduledState.DISABLED.toString());
|
||||
} else {
|
||||
cp.setState(ScheduledState.STOPPED.toString());
|
||||
}
|
||||
outputPorts.add(cp);
|
||||
|
||||
final ConnectableDTO portConnectable = dtoFactory.createConnectableDto(cp, ConnectableType.OUTPUT_PORT);
|
||||
|
|
Loading…
Reference in New Issue