use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ProblemsManager method checkProblemsForTableEntry.
public boolean checkProblemsForTableEntry(ITableEntry tableEntry, boolean forceRefreshData, boolean checkLookupProblem) {
if (!mapperManager.isCheckSyntaxEnabled()) {
return false;
}
if (forceRefreshData) {
mapperManager.getAbstractMapComponent().restoreMapperModelFromInternalData();
checkProblems();
}
String expression = tableEntry.getExpression();
List<Problem> problems = null;
if (expression == null || EMPTY_STRING.equals(expression.trim())) {
problems = null;
} else {
// System.out.println("check=" + expression);
if (codeLanguage == ECodeLanguage.PERL) {
problems = codeChecker.checkProblemsForExpression(expression);
} else if (codeLanguage == ECodeLanguage.JAVA) {
PROBLEM_KEY_FIELD problemKeyField = JavaGenerationManager.PROBLEM_KEY_FIELD.METADATA_COLUMN;
String entryName = tableEntry.getName();
if (tableEntry instanceof FilterTableEntry || tableEntry instanceof ExpressionFilterEntry) {
problemKeyField = JavaGenerationManager.PROBLEM_KEY_FIELD.FILTER;
entryName = null;
}
problems = checkJavaProblemsForEntry(problemKeyField, tableEntry.getParent().getName(), entryName, forceRefreshData);
}
if (problems != null) {
for (Iterator iter = problems.iterator(); iter.hasNext(); ) {
Problem problem = (Problem) iter.next();
ProblemStatus status = problem.getStatus();
if (status != ProblemStatus.ERROR) {
iter.remove();
}
}
} else {
problems = null;
}
}
if (problems != null) {
if (problems.size() == 0) {
tableEntry.setProblems(null);
} else {
hasProblems = true;
tableEntry.setProblems(problems);
}
} else {
tableEntry.setProblems(problems);
}
// check problem for M/R process , only needed if modify lookup expressions
if (checkLookupProblem) {
checkLookupExpressionProblem();
}
// no need to update again
TableViewerCreator tableViewerCreator = mapperManager.retrieveTableViewerCreator(tableEntry);
DataMapTableView retrieveDataMapTableView = mapperManager.retrieveDataMapTableView(tableEntry);
mapperManager.getUiManager().applyActivatedCellEditors(tableViewerCreator);
return problems != null;
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ProblemList method getMarkerCounts.
public int[] getMarkerCounts() {
int errors = 0;
int warnings = 0;
int infos = 0;
for (Problem problem : problemList) {
if (problem.getStatus().equals(ProblemStatus.ERROR)) {
errors++;
} else if (problem.getStatus().equals(ProblemStatus.WARNING)) {
warnings++;
} else if (problem.getStatus().equals(ProblemStatus.INFO)) {
infos++;
}
}
return new int[] { errors, warnings, infos };
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class Problems method removeProblemsByProcess.
/**
*
* DOC hcyi Comment method "removeProblemsByProcess".
*
* @param process
* @param isDeleted
*/
public static void removeProblemsByProcess(IProcess process, boolean isDeleted) {
for (Iterator<Problem> iter = problemList.getProblemList().iterator(); iter.hasNext(); ) {
Problem problem = iter.next();
if (problem == null) {
continue;
}
if (problem.getJobInfo() != null && (problem.getJobInfo().getJobId().equals(process.getId()) && problem.getJobInfo().getJobVersion().equals(process.getVersion()))) {
iter.remove();
}
// if not open editor then run job , will not fill the JobInfo .
if (problem.getJobInfo() == null && problem instanceof TalendProblem) {
TalendProblem talendProblem = (TalendProblem) problem;
String jobName = talendProblem.getJavaUnitName();
if (jobName != null && jobName.equals(process.getName()) && talendProblem.getVersion().equals(process.getVersion())) {
iter.remove();
}
}
}
refreshProblemTreeView();
}
use of org.talend.core.model.process.Problem in project tdi-studio-se by Talend.
the class ErrorDetailTreeBuilder method createTreeInput.
/**
* DOC chuang Comment method "createTreeInput".
*
* @param errors
* @param jobNames
* @return
*/
public List<JobErrorEntry> createTreeInput(List<Problem> errors, Set<String> jobIds) {
for (Problem error : errors) {
if (error instanceof TalendProblem) {
TalendProblem talendProblem = (TalendProblem) error;
if (talendProblem != null && talendProblem.getJobInfo() != null) {
if (talendProblem.getType() == ProblemType.ROUTINE) {
JobErrorEntry routineEntry = getJobEntry(ROUTINE_ERROR);
routineEntry.addItem(talendProblem.getJavaUnitName(), talendProblem);
} else {
String jobId = talendProblem.getJobInfo().getJobId();
if (!jobIds.contains(jobId)) {
continue;
}
String componentName = GENERAL_ERROR;
JobErrorEntry jobEntry = getJobEntry(talendProblem.getJavaUnitName());
jobEntry.addItem(componentName, talendProblem);
}
}
} else {
if (error != null && error.getJobInfo() != null) {
String jobId = error.getJobInfo().getJobId();
if (!jobIds.contains(jobId)) {
continue;
}
String componentName = error.getNodeName();
JobErrorEntry jobEntry = getJobEntry(error.getJobInfo().getJobName());
jobEntry.addItem(componentName, error);
}
}
}
return new ArrayList<JobErrorEntry>(jobs.values());
}
Aggregations