use of org.talend.designer.mapper.language.generation.JavaGenerationManager.PROBLEM_KEY_FIELD 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;
}
Aggregations