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();
}
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();
}
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);
}
}
}
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();
}
}
}
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();
}
}
Aggregations