NIFI-810:

- Adding basic support for preventing connection when appropriate.
- Updating validation when [dis]connecting processors.
This commit is contained in:
Matt Gilman 2015-09-25 17:46:58 -04:00 committed by Mark Payne
parent 4afd8f88f8
commit 13edcfda2e
6 changed files with 36 additions and 6 deletions

View File

@ -36,6 +36,7 @@ public class ProcessorDTO extends NiFiComponentDTO {
private String description;
private Boolean supportsParallelProcessing;
private Boolean supportsEventDriven;
private String inputRequirement;
private ProcessorConfigDTO config;
@ -120,6 +121,20 @@ public class ProcessorDTO extends NiFiComponentDTO {
this.supportsParallelProcessing = supportsParallelProcessing;
}
/**
* @return the input requirement of this processor
*/
@ApiModelProperty(
value = "The input requirement for this processor."
)
public String getInputRequirement() {
return inputRequirement;
}
public void setInputRequirement(String inputRequirement) {
this.inputRequirement = inputRequirement;
}
/**
* @return whether this processor supports event driven scheduling
*/

View File

@ -320,6 +320,7 @@ public class TemplateManager {
// remove validation errors
processorDTO.setValidationErrors(null);
processorDTO.setInputRequirement(null);
}
}

View File

@ -1402,6 +1402,7 @@ public final class DtoFactory {
dto.setPosition(createPositionDto(node.getPosition()));
dto.setStyle(node.getStyle());
dto.setParentGroupId(node.getProcessGroup().getIdentifier());
dto.setInputRequirement(node.getInputRequirement().name());
dto.setType(node.getProcessor().getClass().getCanonicalName());
dto.setName(node.getName());

View File

@ -737,7 +737,9 @@ nf.Actions = (function () {
var destinationData = destination.datum();
// update the destination component accordingly
if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
if (nf.CanvasUtils.isProcessor(destination)) {
nf.Processor.reload(destinationData.component);
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
nf.RemoteProcessGroup.reload(destinationData.component);
}
} else {

View File

@ -1371,9 +1371,16 @@ nf.CanvasUtils = (function () {
return false;
}
return nf.CanvasUtils.isProcessor(selection) || nf.CanvasUtils.isProcessGroup(selection) ||
nf.CanvasUtils.isRemoteProcessGroup(selection) || nf.CanvasUtils.isOutputPort(selection) ||
nf.CanvasUtils.isFunnel(selection);
if (nf.CanvasUtils.isProcessGroup(selection) || nf.CanvasUtils.isRemoteProcessGroup(selection) ||
nf.CanvasUtils.isOutputPort(selection) || nf.CanvasUtils.isFunnel(selection)) {
return true;
}
// if processor, ensure it supports input
if (nf.CanvasUtils.isProcessor(selection)) {
var destinationData = selection.datum();
return destinationData.component.inputRequirement !== 'INPUT_FORBIDDEN';
}
}
};
}());

View File

@ -870,7 +870,9 @@ nf.ConnectionConfiguration = (function () {
}
// update the destination component accordingly
if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
if (nf.CanvasUtils.isProcessor(destination)) {
nf.Processor.reload(destinationData.component);
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
nf.RemoteProcessGroup.reload(destinationData.component);
}
@ -958,7 +960,9 @@ nf.ConnectionConfiguration = (function () {
}
// update the destination component accordingly
if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
if (nf.CanvasUtils.isProcessor(destination)) {
nf.Processor.reload(destinationData.component);
} else if (nf.CanvasUtils.isRemoteProcessGroup(destination)) {
nf.RemoteProcessGroup.reload(destinationData.component);
}
}