use of org.apache.nifi.connectable.Position in project nifi by apache.
the class StandardFunnelDAO method updateFunnel.
@Override
public Funnel updateFunnel(FunnelDTO funnelDTO) {
// get the funnel being updated
Funnel funnel = locateFunnel(funnelDTO.getId());
// update the label state
if (isNotNull(funnelDTO.getPosition())) {
if (funnelDTO.getPosition() != null) {
funnel.setPosition(new Position(funnelDTO.getPosition().getX(), funnelDTO.getPosition().getY()));
}
}
funnel.getProcessGroup().onComponentModified();
return funnel;
}
use of org.apache.nifi.connectable.Position in project nifi by apache.
the class StandardInputPortDAO method createPort.
@Override
public Port createPort(String groupId, PortDTO portDTO) {
if (isNotNull(portDTO.getParentGroupId()) && !flowController.areGroupsSame(groupId, portDTO.getParentGroupId())) {
throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the InputPort is being added.");
}
// ensure the name has been specified
if (portDTO.getName() == null) {
throw new IllegalArgumentException("Port name must be specified.");
}
// get the desired group
ProcessGroup group = locateProcessGroup(flowController, groupId);
// determine if this is the root group
Port port;
if (group.getParent() == null) {
port = flowController.createRemoteInputPort(portDTO.getId(), portDTO.getName());
} else {
port = flowController.createLocalInputPort(portDTO.getId(), portDTO.getName());
}
// ensure we can perform the update before we add the processor to the flow
verifyUpdate(port, portDTO);
// configure
if (portDTO.getPosition() != null) {
port.setPosition(new Position(portDTO.getPosition().getX(), portDTO.getPosition().getY()));
}
port.setComments(portDTO.getComments());
// add the port
group.addInputPort(port);
return port;
}
use of org.apache.nifi.connectable.Position in project nifi by apache.
the class StandardLabelDAO method createLabel.
@Override
public Label createLabel(String groupId, LabelDTO labelDTO) {
if (labelDTO.getParentGroupId() != null && !flowController.areGroupsSame(groupId, labelDTO.getParentGroupId())) {
throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Label is being added.");
}
// get the desired group
ProcessGroup group = locateProcessGroup(flowController, groupId);
// create the label
Label label = flowController.createLabel(labelDTO.getId(), labelDTO.getLabel());
if (labelDTO.getPosition() != null) {
label.setPosition(new Position(labelDTO.getPosition().getX(), labelDTO.getPosition().getY()));
}
if (labelDTO.getWidth() != null && labelDTO.getHeight() != null) {
label.setSize(new Size(labelDTO.getWidth(), labelDTO.getHeight()));
}
label.setStyle(labelDTO.getStyle());
// add the label
group.addLabel(label);
return label;
}
use of org.apache.nifi.connectable.Position in project nifi by apache.
the class StandardLabelDAO method updateLabel.
@Override
public Label updateLabel(LabelDTO labelDTO) {
// get the label being updated
Label label = locateLabel(labelDTO.getId());
// update the label state
if (labelDTO.getPosition() != null) {
label.setPosition(new Position(labelDTO.getPosition().getX(), labelDTO.getPosition().getY()));
}
if (labelDTO.getStyle() != null) {
label.setStyle(labelDTO.getStyle());
}
if (labelDTO.getLabel() != null) {
label.setValue(labelDTO.getLabel());
}
if (labelDTO.getWidth() != null && labelDTO.getHeight() != null) {
label.setSize(new Size(labelDTO.getWidth(), labelDTO.getHeight()));
}
label.getProcessGroup().onComponentModified();
return label;
}
use of org.apache.nifi.connectable.Position in project nifi by apache.
the class StandardProcessGroupDAO method createProcessGroup.
@Override
public ProcessGroup createProcessGroup(String parentGroupId, ProcessGroupDTO processGroup) {
if (processGroup.getParentGroupId() != null && !flowController.areGroupsSame(processGroup.getParentGroupId(), parentGroupId)) {
throw new IllegalArgumentException("Cannot specify a different Parent Group ID than the Group to which the Process Group is being added.");
}
// get the parent group
ProcessGroup parentGroup = locateProcessGroup(flowController, parentGroupId);
// create the process group
ProcessGroup group = flowController.createProcessGroup(processGroup.getId());
if (processGroup.getName() != null) {
group.setName(processGroup.getName());
}
if (processGroup.getPosition() != null) {
group.setPosition(new Position(processGroup.getPosition().getX(), processGroup.getPosition().getY()));
}
// add the process group
group.setParent(parentGroup);
parentGroup.addProcessGroup(group);
return group;
}
Aggregations