use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkInputLoopTablesProblem.
private void checkInputLoopTablesProblem(OutputXmlTree outputTree, InputXmlTree mainInputTree) {
if (mainInputTree == null) {
return;
}
if (mainInputTree.isMultiLoops()) {
if (!XmlMapUtil.hasDocument(outputTree)) {
if (outputTree.getInputLoopNodesTables().isEmpty() || outputTree.getInputLoopNodesTables().get(0).getInputloopnodes().isEmpty()) {
String message = outputTree.getName() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
} else {
List<TreeNode> loopNodes = new ArrayList<TreeNode>();
XmlMapUtil.getChildLoops(loopNodes, outputTree.getNodes());
if (!loopNodes.isEmpty()) {
for (TreeNode node : loopNodes) {
InputLoopNodesTable inutLoopTable = ((OutputTreeNode) node).getInputLoopNodesTable();
if (inutLoopTable == null || inutLoopTable.getInputloopnodes().isEmpty()) {
String message = node.getXpath() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
}
}
}
}
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ProblemsManager method addLookupProblem.
private void addLookupProblem(IColumnEntry entity) {
List<Problem> problems = entity.getProblems();
if (problems == null) {
problems = new ArrayList<Problem>();
entity.setProblems(problems);
}
// incase other entities already have this problem in list.
boolean exist = false;
for (Problem problem : problems) {
if (problem.equals(lookupProblem)) {
exist = true;
}
}
if (!exist) {
problems.add(lookupProblem);
}
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class JavaCodeProblemsChecker method processDetailedProblems.
/**
* DOC amaumont Comment method "processDetailedProblems".
*
* @param list
* @return
*/
private ArrayList<Problem> processDetailedProblems(List<DetailedProblem> list) {
ArrayList<Problem> problems = null;
if (list != null) {
problems = new ArrayList<Problem>();
for (DetailedProblem problemWithLine : list) {
Problem talendProblem = new Problem();
talendProblem.setDescription(//$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"JavaCodeProblemsChecker.processDetailError", new Object[] { problemWithLine.getSource(), problemWithLine.getJdtProblem().getMessage() }));
talendProblem.setStatus(Problem.ProblemStatus.ERROR);
talendProblem.setKey(problemWithLine.getKey());
problems.add(talendProblem);
}
}
return problems;
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ProblemsManager method checkProblemsForTableEntry.
public void checkProblemsForTableEntry(ITableEntry tableEntry, boolean forceRefreshData) {
// if (forceRefreshData) {
// mapperManager.getComponent().refreshMapperConnectorData();
// checkProblems();
// }
List<Problem> problems = new ArrayList<Problem>(0);
String expression = tableEntry.getExpression();
if (tableEntry instanceof InputColumnTableEntry) {
InputColumnTableEntry inputEntry = (InputColumnTableEntry) tableEntry;
IDbOperatorManager operatorsManager = mapperManager.getCurrentLanguage().getOperatorsManager();
IDbOperator dbOperator = operatorsManager.getOperatorFromValue(inputEntry.getOperator());
boolean operatorIsSet = dbOperator != null;
boolean expressionIsSet = expression != null && expression.trim().length() > 0;
Problem problem = null;
String errorMessage = null;
String key = null;
if (!operatorIsSet && expressionIsSet) {
errorMessage = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ProblemsManager.operatorNotSet", new Object[] { inputEntry.getName() });
key = KEY_OPERATOR_EMPTY;
problem = new Problem(null, errorMessage, ProblemStatus.ERROR);
problem.setKey(key);
problems.add(problem);
}
if (operatorIsSet && !expressionIsSet && !dbOperator.isMonoOperand()) {
errorMessage = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ProblemsManager.inputExpressionEmpty", new Object[] { inputEntry.getParentName(), inputEntry.getName() });
key = KEY_INPUT_EXPRESSION_EMPTY;
problem = new Problem(null, errorMessage, ProblemStatus.ERROR);
problem.setKey(key);
problems.add(problem);
}
Problem warningProblem = null;
if (inputEntry.isUnmatchingEntry()) {
InputTable inputTable = (InputTable) inputEntry.getParent();
String message = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ProblemsManager.entryDoesntMatch", new Object[] { inputEntry.getParentName(), inputEntry.getName(), inputTable.getTableName() });
warningProblem = new Problem(null, message, ProblemStatus.WARNING);
warningProblem.setKey(KEY_NO_MATCHING);
problems.add(warningProblem);
}
} else if (tableEntry instanceof OutputColumnTableEntry) {
String errorMessage = null;
Problem problem = null;
if (expression == null || EMPTY_STRING.equals(expression.trim())) {
errorMessage = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ProblemsManager.outputExpressionEmpty", new Object[] { tableEntry.getParentName(), tableEntry.getName() });
}
if (errorMessage != null) {
problem = new Problem(null, errorMessage, ProblemStatus.ERROR);
problem.setKey(KEY_OUTPUT_EXPRESSION_EMPTY);
problems.add(problem);
}
}
tableEntry.setProblems(problems.size() > 0 ? problems : null);
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class JobErrorsChecker method getErrors.
public static List<IContainerEntry> getErrors() {
List<IContainerEntry> input = new ArrayList<IContainerEntry>();
try {
Item item = null;
IProxyRepositoryFactory proxyRepositoryFactory = CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
Set<String> jobIds = new HashSet<String>();
for (JobInfo jobInfo : LastGenerationInfo.getInstance().getLastGeneratedjobs()) {
// TDI-28198:get right process item no matter the job open or close
List<IRepositoryViewObject> allVersions = proxyRepositoryFactory.getAllVersion(jobInfo.getJobId());
for (IRepositoryViewObject repositoryObject2 : allVersions) {
Property property2 = repositoryObject2.getProperty();
if (jobInfo.getJobVersion().equals(property2.getVersion())) {
item = property2.getItem();
break;
}
}
if (item == null) {
continue;
}
// get source file
IFile sourceFile = synchronizer.getFile(item);
if (sourceFile == null) {
continue;
}
jobIds.add(item.getProperty().getId());
// Property property = process.getProperty();
Problems.addJobRoutineFile(sourceFile, ProblemType.JOB, item, true);
}
if (!CommonsPlugin.isHeadless()) {
List<IRepositoryViewObject> routinesObjects = proxyRepositoryFactory.getAll(ERepositoryObjectType.ROUTINES, false);
Set<String> dependentRoutines = LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(LastGenerationInfo.getInstance().getLastMainJob().getJobId(), LastGenerationInfo.getInstance().getLastMainJob().getJobVersion());
if (routinesObjects != null) {
for (IRepositoryViewObject obj : routinesObjects) {
Property property = obj.getProperty();
if (dependentRoutines.contains(property.getLabel())) {
Item routinesitem = property.getItem();
IFile routineFile = synchronizer.getFile(routinesitem);
Problems.addJobRoutineFile(routineFile, ProblemType.ROUTINE, routinesitem, true);
} else {
Problems.clearAllComliationError(property.getLabel());
}
}
}
}
Problems.refreshProblemTreeView();
// collect error
List<Problem> errors = Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
ErrorDetailTreeBuilder builder = new ErrorDetailTreeBuilder();
input.addAll(builder.createTreeInput(errors, jobIds));
} catch (Exception e) {
ExceptionHandler.process(e);
}
return input;
}
Aggregations