Search in sources :

Example 1 with JobletNode

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;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) JobletNode(org.talend.designer.joblet.model.JobletNode) JobletProcess(org.talend.designer.joblet.model.JobletProcess)

Example 2 with JobletNode

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;
}
Also used : JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) INodeConnector(org.talend.core.model.process.INodeConnector) NodeConnector(org.talend.designer.core.model.components.NodeConnector) ArrayList(java.util.ArrayList) JobletNode(org.talend.designer.joblet.model.JobletNode) JobletProcess(org.talend.designer.joblet.model.JobletProcess) INodeConnector(org.talend.core.model.process.INodeConnector) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ArrayList (java.util.ArrayList)2 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)2 JobletNode (org.talend.designer.joblet.model.JobletNode)2 JobletProcess (org.talend.designer.joblet.model.JobletProcess)2 List (java.util.List)1 Point (org.eclipse.draw2d.geometry.Point)1 EList (org.eclipse.emf.common.util.EList)1 INodeConnector (org.talend.core.model.process.INodeConnector)1 NodeConnector (org.talend.designer.core.model.components.NodeConnector)1 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)1