use of org.talend.designer.joblet.model.JobletNode in project tdi-studio-se by Talend.
the class JobletUtil method isJobletInput.
public boolean isJobletInput(Node connNode, IProcess2 process) {
if (process.getProperty().getItem() instanceof JobletProcessItem) {
JobletProcess jobletProcess = ((JobletProcessItem) process.getProperty().getItem()).getJobletProcess();
List<JobletNode> jobletNodes = jobletProcess.getJobletNodes();
for (JobletNode jnode : jobletNodes) {
List list = jnode.getElementParameter();
for (Object obj : list) {
if (obj instanceof ElementParameterType) {
if (((ElementParameterType) obj).getValue().equals(connNode.getJoblet_unique_name())) {
return jnode.isInput();
}
}
}
}
}
return false;
}
use of org.talend.designer.joblet.model.JobletNode in project tdi-studio-se by Talend.
the class JobletUtil method createConnectors.
public List<INodeConnector> createConnectors(INode node, IProcess2 process) {
List<INodeConnector> listConnector = new ArrayList<INodeConnector>();
if (process == null) {
return listConnector;
}
if (process.getProperty().getItem() instanceof JobletProcessItem) {
JobletProcess jobletProcess = ((JobletProcessItem) process.getProperty().getItem()).getJobletProcess();
EList<JobletNode> jobletLinks = jobletProcess.getJobletNodes();
INodeConnector nodeConnector;
int nbInput = 0;
int nbOutput = 0;
int jobletNbInput = 0;
for (JobletNode jNode : jobletLinks) {
if (jNode.isInput()) {
jobletNbInput++;
}
}
boolean multipleInput = jobletNbInput > 1;
for (JobletNode jNode : jobletLinks) {
String name = ComponentUtilities.getNodeUniqueName(jNode);
if (jNode.isTrigger()) {
// createTriggerConnector(listConnector, node);
} else {
if (jNode.isInput()) {
if (multipleInput) {
nodeConnector = new NodeConnector(node);
nodeConnector.setName(name);
nodeConnector.setBaseSchema(EConnectionType.FLOW_MAIN.getName());
nodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
nodeConnector.setMaxLinkInput(1);
nodeConnector.setMinLinkInput(0);
nodeConnector.setMaxLinkOutput(0);
nodeConnector.setMinLinkOutput(0);
listConnector.add(nodeConnector);
}
nbInput++;
} else {
nodeConnector = new NodeConnector(node);
nodeConnector.setName(name);
nodeConnector.setBaseSchema(EConnectionType.FLOW_MAIN.getName());
nodeConnector.setBuiltIn(true);
nodeConnector.setMaxLinkOutput(1);
nodeConnector.setMinLinkOutput(1);
// achen modify to fix bug 6205
String displayName = getDisplayName(jNode);
nodeConnector.setLinkName("Joblet " + name);
nodeConnector.setMenuName(displayName);
nodeConnector.setDefaultConnectionType(EConnectionType.FLOW_MAIN);
nodeConnector.addConnectionProperty(EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getRGB(), EConnectionType.FLOW_MAIN.getDefaultLineStyle());
nodeConnector.addConnectionProperty(EConnectionType.FLOW_REF, EConnectionType.FLOW_REF.getRGB(), EConnectionType.FLOW_REF.getDefaultLineStyle());
nodeConnector.addConnectionProperty(EConnectionType.FLOW_MERGE, EConnectionType.FLOW_MERGE.getRGB(), EConnectionType.FLOW_MERGE.getDefaultLineStyle());
listConnector.add(nodeConnector);
nbOutput++;
}
}
}
}
createTriggerConnector(listConnector, node);
return listConnector;
}
Aggregations