use of org.talend.core.model.process.TalendProblem in project tdi-studio-se by Talend.
the class JobErrorsChecker method checkRoutinesCompilationError.
private static void checkRoutinesCompilationError() throws ProcessorException {
Set<String> dependentRoutines = LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(LastGenerationInfo.getInstance().getLastMainJob().getJobId(), LastGenerationInfo.getInstance().getLastMainJob().getJobVersion());
// from Problems
List<Problem> errors = Problems.getProblemList().getProblemsBySeverity(ProblemStatus.ERROR);
for (Problem p : errors) {
if (p instanceof TalendProblem) {
TalendProblem talendProblem = (TalendProblem) p;
if (talendProblem.getType() == ProblemType.ROUTINE && dependentRoutines.contains(talendProblem.getJavaUnitName())) {
int line = talendProblem.getLineNumber();
String errorMessage = talendProblem.getDescription();
throw new ProcessorException(Messages.getString("JobErrorsChecker_routines_compile_errors", talendProblem.getJavaUnitName()) + //$NON-NLS-1$
'\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + //$NON-NLS-1$
'\n' + Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + //$NON-NLS-1$
errorMessage);
}
} else {
// for now not to check components errors when building jobs in studio/commandline
// throw new ProcessorException(Messages.getString("JobErrorsChecker_jobDesign_errors", p.getType().getTypeName(), //$NON-NLS-1$
// p.getJobInfo().getJobName(), p.getComponentName(), p.getDescription()));
}
}
// if can't find the routines problem, try to check the file directly(mainly for commandline)
try {
final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
IProxyRepositoryFactory factory = CorePlugin.getDefault().getProxyRepositoryFactory();
List<IRepositoryViewObject> routinesObjects = factory.getAll(ERepositoryObjectType.ROUTINES, false);
if (routinesObjects != null) {
for (IRepositoryViewObject obj : routinesObjects) {
Property property = obj.getProperty();
if (!dependentRoutines.contains(property.getLabel())) {
continue;
}
Item routinesitem = property.getItem();
IFile routinesFile = synchronizer.getFile(routinesitem);
IMarker[] markers = routinesFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ONE);
for (IMarker marker : markers) {
Integer lineNr = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
String message = (String) marker.getAttribute(IMarker.MESSAGE);
Integer severity = (Integer) marker.getAttribute(IMarker.SEVERITY);
Integer start = (Integer) marker.getAttribute(IMarker.CHAR_START);
Integer end = (Integer) marker.getAttribute(IMarker.CHAR_END);
if (lineNr != null && message != null && severity != null && start != null && end != null) {
switch(severity) {
case IMarker.SEVERITY_ERROR:
throw new ProcessorException(//$NON-NLS-1$
Messages.getString("JobErrorsChecker_routines_compile_errors", property.getLabel()) + '\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + lineNr + //$NON-NLS-1$
'\n' + Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + //$NON-NLS-1$
message);
default:
break;
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
} catch (SystemException e) {
ExceptionHandler.process(e);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.process.TalendProblem in project tdi-studio-se by Talend.
the class Problems method add.
public static void add(ProblemStatus status, IMarker marker, Item item, String markerErrorMessage, Integer lineN, String uniName, Integer charStart, Integer charEnd, ProblemType type) {
Problem problem = new TalendProblem(status, item, marker, markerErrorMessage, lineN, uniName, charStart, charEnd, type);
add(problem);
}
use of org.talend.core.model.process.TalendProblem in project tdi-studio-se by Talend.
the class Problems method add.
public static void add(ProblemStatus status, IMarker marker, String javaUnitName, String markerErrorMessage, Integer lineN, String uniName, Integer charStart, Integer charEnd, ProblemType type, String version) {
Problem problem = new TalendProblem(status, javaUnitName, marker, markerErrorMessage, lineN, uniName, charStart, charEnd, type, version);
add(problem);
// addErrorMark();
}
use of org.talend.core.model.process.TalendProblem 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.TalendProblem 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