use of com.liferay.ide.kaleo.core.model.WorkflowNode in project liferay-ide by liferay.
the class JoinNodeAddActionHandler method postDiagramNodePartAdded.
@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
NewJoinNodeOp newJoinNodeOp = op.nearest(NewJoinNodeOp.class);
Join newJoin = newNode.nearest(Join.class);
WorkflowDefinition workflowDefinition = newJoin.nearest(WorkflowDefinition.class);
for (Node nodeName : newJoinNodeOp.getConnectedNodes()) {
for (WorkflowNode diagramNode : workflowDefinition.getDiagramNodes()) {
if (nodeName.getName().content() != null) {
String name = nodeName.getName().content();
if (name.equals(diagramNode.getName().content())) {
CanTransition canTransition = diagramNode.nearest(CanTransition.class);
Transition newTransition = canTransition.getTransitions().insert();
newTransition.setName(newJoin.getName().content());
newTransition.setTarget(newJoin.getName().content());
}
}
}
}
if (newJoinNodeOp.getExitTransitionName().content() != null) {
Transition newTransition = newJoin.getTransitions().insert();
newTransition.setTarget(newJoinNodeOp.getExitTransitionName().content());
newTransition.setName(newJoinNodeOp.getExitTransitionName().content());
}
}
use of com.liferay.ide.kaleo.core.model.WorkflowNode in project liferay-ide by liferay.
the class JoinXorNodeAddActionHandler method postDiagramNodePartAdded.
@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
NewJoinXorNodeOp newJoinXorNodeOp = op.nearest(NewJoinXorNodeOp.class);
JoinXor newJoinXor = newNode.nearest(JoinXor.class);
WorkflowDefinition workflowDefinition = newJoinXor.nearest(WorkflowDefinition.class);
for (Node nodeName : newJoinXorNodeOp.getConnectedNodes()) {
for (WorkflowNode diagramNode : workflowDefinition.getDiagramNodes()) {
if (nodeName.getName().content() != null) {
String name = nodeName.getName().content();
if (name.equals(diagramNode.getName().content())) {
CanTransition canTransition = diagramNode.nearest(CanTransition.class);
Transition newTransition = canTransition.getTransitions().insert();
newTransition.setName(newJoinXor.getName().content());
newTransition.setTarget(newJoinXor.getName().content());
}
}
}
}
if (newJoinXorNodeOp.getExitTransitionName().content() != null) {
Transition newTransition = newJoinXor.getTransitions().insert();
newTransition.setTarget(newJoinXorNodeOp.getExitTransitionName().content());
newTransition.setName(newJoinXorNodeOp.getExitTransitionName().content());
}
}
use of com.liferay.ide.kaleo.core.model.WorkflowNode in project liferay-ide by liferay.
the class NewNodeNameValidationService method compute.
@Override
public Status compute() {
Status retval = Status.createOkStatus();
WorkflowNode newNode = context(WorkflowNode.class);
WorkflowDefinition workflowDefinition = newNode.adapt(WorkflowDefinition.class);
if (workflowDefinition != null) {
for (WorkflowNode node : workflowDefinition.getDiagramNodes()) {
Value<String> nodeName = node.getName();
String name = nodeName.content();
if ((name != null) && name.equals(newNode.getName().content())) {
retval = Status.createErrorStatus("Name already in use.");
break;
}
}
}
return retval;
}
Aggregations