Search in sources :

Example 81 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class Problems method refreshNodeStatus.

/**
     * DOC bqian Comment method "refreshNodeStatus".
     * 
     * @param node
     * @param problemList2
     */
private static void refreshNodeStatus(Node node, List<Problem> problemList) {
    boolean hasWarning = false;
    boolean hasError = false;
    boolean hasInfo = false;
    IProcess process = node.getProcess();
    if (process == null) {
        return;
    }
    for (Problem problem : problemList) {
        // if problem not instanceof TalendProblem ,node don't operate it.for bug 23088
        if (problem.getJobInfo() != null && problem.getJobInfo().getJobId() != null && problem.getJobInfo().getJobId().equals(process.getId()) && !(problem instanceof TalendProblem)) {
            if (problem.getJobInfo().getJobVersion() != null && problem.getJobInfo().getJobVersion().equals(process.getVersion())) {
                if (problem.getNodeName() == null) {
                    continue;
                } else if (problem.getNodeName() != null && (!problem.getNodeName().equals(node.getUniqueName()))) {
                    continue;
                }
                if (problem.getStatus().equals(ProblemStatus.INFO)) {
                    hasInfo = true;
                    node.addStatus(Process.INFO_STATUS);
                } else if (problem.getStatus().equals(ProblemStatus.WARNING)) {
                    hasWarning = true;
                    node.addStatus(Process.WARNING_STATUS);
                } else if (problem.getStatus().equals(ProblemStatus.ERROR)) {
                    hasError = true;
                    node.addStatus(Process.ERROR_STATUS);
                }
            }
        }
    }
    if (!hasWarning) {
        node.removeStatus(Process.WARNING_STATUS);
    }
    if (!hasError) {
        node.removeStatus(Process.ERROR_STATUS);
    }
    if (!hasInfo) {
        node.removeStatus(Process.INFO_STATUS);
    }
    node.updateStatus();
}
Also used : TalendProblem(org.talend.core.model.process.TalendProblem) Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem) IProcess(org.talend.core.model.process.IProcess)

Example 82 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class Problems method removeProblemsByElement.

public static void removeProblemsByElement(Node element) {
    IProcess process = element.getProcess();
    for (Iterator<Problem> iter = problemList.getProblemList().iterator(); iter.hasNext(); ) {
        Problem problem = iter.next();
        if (problem.getJobInfo() != null && (problem.getJobInfo().getJobId().equals(process.getId()) && problem.getJobInfo().getJobVersion().equals(process.getVersion()))) {
            if (problem.getNodeName() != null && (problem.getNodeName().equals(element.getUniqueName()))) {
                iter.remove();
            }
        }
    }
    refreshProblemTreeView();
}
Also used : Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem) IProcess(org.talend.core.model.process.IProcess)

Example 83 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class Problems method addErrorMark.

public static void addErrorMark() {
    nodeList.clear();
    String befor = "Error in the component's properties:";
    for (IProcess process : openJobs) {
        if (((Process) process).isActivate()) {
            for (INode inode : ((Process) process).getGraphicalNodes()) {
                if (inode instanceof Node) {
                    Node node = (Node) inode;
                    if (problemList.getProblemList().size() > 0) {
                        for (int i = 0; i < problemList.getProblemList().size(); i++) {
                            Problem problem = problemList.getProblemList().get(i);
                            if (node.isActivate()) {
                                if (problem.getStatus().equals(ProblemStatus.ERROR)) {
                                    if (problem instanceof TalendProblem) {
                                        TalendProblem tProblem = (TalendProblem) problem;
                                        if (!tProblem.getJavaUnitName().equals(node.getProcess().getName())) {
                                            continue;
                                        }
                                        if (tProblem.getVersion() != null) {
                                            if (!tProblem.getVersion().equals(node.getProcess().getVersion())) {
                                                continue;
                                            }
                                        }
                                        if (tProblem.getUnitName() != null && tProblem.getUnitName().equals(node.getUniqueName())) {
                                            // nodeList.add(node);
                                            if (nodeList.get(node) != null) {
                                                nodeList.get(node).append("\r\n");
                                                nodeList.get(node).append(tProblem.getDescription());
                                            } else {
                                                nodeList.put(node, new StringBuffer(tProblem.getDescription()));
                                            }
                                        } else {
                                            if (node.isErrorFlag() == true) {
                                                node.setErrorFlag(false);
                                                node.setCompareFlag(false);
                                                node.setErrorInfo(befor + tProblem.getDescription());
                                                //$NON-NLS-1$
                                                node.getNodeError().updateState("UPDATE_STATUS", false);
                                                //$NON-NLS-1$
                                                node.setErrorInfoChange("ERRORINFO", false);
                                            } else {
                                                continue;
                                            }
                                        }
                                    }
                                } else {
                                    if (node.isErrorFlag() == true) {
                                        node.setErrorFlag(false);
                                        node.setCompareFlag(false);
                                        //$NON-NLS-1$
                                        node.setErrorInfoChange("ERRORINFO", false);
                                    } else {
                                        continue;
                                    }
                                }
                            } else {
                                continue;
                            }
                        }
                    } else {
                        if (node.isErrorFlag() == true) {
                            node.setErrorFlag(false);
                            node.setCompareFlag(false);
                            node.setErrorInfo(null);
                            //$NON-NLS-1$
                            node.getNodeError().updateState("UPDATE_STATUS", false);
                            //$NON-NLS-1$
                            node.setErrorInfoChange("ERRORINFO", false);
                        } else {
                            continue;
                        }
                    }
                }
            }
        } else {
            continue;
        }
    }
    Iterator<Entry<Node, StringBuffer>> set = nodeList.entrySet().iterator();
    while (set.hasNext()) {
        Entry<Node, StringBuffer> en = set.next();
        Node node = en.getKey();
        String des = en.getValue().toString();
        if (node.isErrorFlag() == false) {
            node.setErrorFlag(true);
            node.setCompareFlag(false);
            node.setErrorInfo(befor + des);
            //$NON-NLS-1$
            node.getNodeError().updateState("UPDATE_STATUS", false);
            //$NON-NLS-1$
            node.setErrorInfoChange("ERRORINFO", true);
        }
    }
}
Also used : INode(org.talend.core.model.process.INode) Entry(java.util.Map.Entry) TalendProblem(org.talend.core.model.process.TalendProblem) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) Problem(org.talend.core.model.process.Problem) IProblem(org.eclipse.jdt.core.compiler.IProblem) TalendProblem(org.talend.core.model.process.TalendProblem) IProcess(org.talend.core.model.process.IProcess)

Example 84 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class MissingSettingsMultiThreadDynamicComposite method afterChangingLibraries.

@Override
public void afterChangingLibraries() {
    final Element ele = this.getElement();
    if (ele instanceof Node) {
        final Node node = (Node) ele;
        // after install, need update the error marks for node
        IProcess process = node.getProcess();
        if (process instanceof IProcess2) {
            // check whole process to make sure other related nodes can be updated also.
            ((IProcess2) process).checkProcess();
        }
    }
}
Also used : Element(org.talend.core.model.process.Element) Node(org.talend.designer.core.ui.editor.nodes.Node) IProcess2(org.talend.core.model.process.IProcess2) IProcess(org.talend.core.model.process.IProcess)

Example 85 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class ElementParameter2ParameterType method loadProjectsettingsParameters.

/**
     * DOC zli Comment method "loadProjectsettingsParameters".
     *
     * @param parameters
     */
public static void loadProjectsettingsParameters(ParametersType parameters) {
    IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
    IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
    designerCoreService.switchToCurJobSettingsView();
    List<IProcess2> openedProcess = designerCoreService.getOpenedProcess(reference);
    for (IProcess2 process : openedProcess) {
        if (process instanceof Element) {
            Element processElem = (Element) process;
            ElementParameter2ParameterType.loadElementParameters(processElem, parameters, null);
        }
        process.setNeedRegenerateCode(true);
    }
    IProxyRepositoryFactory repositoryFactory = CorePlugin.getDefault().getProxyRepositoryFactory();
    IProcess process = null;
    try {
        List<IRepositoryViewObject> all = repositoryFactory.getAll(ERepositoryObjectType.PROCESS);
        for (IRepositoryViewObject object : all) {
            if (!openedProcess.contains(object)) {
                Item item = object.getProperty().getItem();
                if (item instanceof ProcessItem) {
                    process = designerCoreService.getProcessFromProcessItem((ProcessItem) item);
                    if (process != null && process instanceof IProcess2) {
                        IProcess2 process2 = (IProcess2) process;
                        if (process2 instanceof Element) {
                            Element processElem = (Element) process2;
                            ElementParameter2ParameterType.loadElementParameters(processElem, parameters, null);
                            ProcessType processType = process2.saveXmlFile();
                            if (processType != null) {
                                ((ProcessItem) item).setProcess(processType);
                            }
                            repositoryFactory.save(item);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Element(org.talend.core.model.process.Element) ProcessItem(org.talend.core.model.properties.ProcessItem) Item(org.talend.core.model.properties.Item) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IEditorReference(org.eclipse.ui.IEditorReference) ProcessItem(org.talend.core.model.properties.ProcessItem) IProcess2(org.talend.core.model.process.IProcess2) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) IProcess(org.talend.core.model.process.IProcess) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

IProcess (org.talend.core.model.process.IProcess)102 INode (org.talend.core.model.process.INode)33 ArrayList (java.util.ArrayList)28 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)24 IProcess2 (org.talend.core.model.process.IProcess2)22 ProcessItem (org.talend.core.model.properties.ProcessItem)21 Node (org.talend.designer.core.ui.editor.nodes.Node)20 List (java.util.List)17 Item (org.talend.core.model.properties.Item)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 IOException (java.io.IOException)15 PersistenceException (org.talend.commons.exception.PersistenceException)14 IElementParameter (org.talend.core.model.process.IElementParameter)14 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)13 IEditorPart (org.eclipse.ui.IEditorPart)11 ProcessorException (org.talend.designer.runprocess.ProcessorException)10 File (java.io.File)9 Element (org.talend.core.model.process.Element)9 IConnection (org.talend.core.model.process.IConnection)9 IContext (org.talend.core.model.process.IContext)9