use of org.talend.core.model.process.JobInfo in project tdi-studio-se by Talend.
the class AbstractTalendEditor method setInput.
// ------------------------------------------------------------------------
// Overridden from EditorPart
@Override
protected void setInput(final IEditorInput input) {
super.setInput(input);
try {
if (input instanceof JobEditorInput) {
// process = ((JobEditorInput) input).getLoadedProcess();
projectName = CorePlugin.getDefault().getProxyRepositoryFactory().getProject(((RepositoryEditorInput) input).getItem()).getLabel();
}
} catch (Exception e) {
MessageBoxExceptionHandler.process(e);
return;
}
IProcess2 process = getProcess();
if (process != null && process.getProperty().getItem() instanceof ProcessItem) {
currentJobResource.setJobInfo(new JobInfo((ProcessItem) process.getProperty().getItem(), process.getProperty(), process.getContextManager().getDefaultContext().getName()));
currentJobResource.setProjectName(projectName);
JobResourceManager.getInstance().addProtection(this);
}
}
use of org.talend.core.model.process.JobInfo 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;
}
use of org.talend.core.model.process.JobInfo in project tdi-studio-se by Talend.
the class MavenJavaProcessor method getExportJarsStr.
@Override
protected String getExportJarsStr() {
if (isOldBuildJob()) {
return super.getExportJarsStr();
}
// use the maven way for jar
final String libPrefixPath = getRootWorkingDir(true);
final String classPathSeparator = extractClassPathSeparator();
// Test-0.1
String jarName = JavaResourcesHelper.getJobJarName(process.getName(), process.getVersion());
String exportJar = libPrefixPath + jarName + FileExtensions.JAR_FILE_SUFFIX;
Set<JobInfo> infos = getBuildChildrenJobs();
for (JobInfo jobInfo : infos) {
if (jobInfo.isTestContainer()) {
continue;
}
String childJarName = JavaResourcesHelper.getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion());
exportJar += classPathSeparator + libPrefixPath + childJarName + FileExtensions.JAR_FILE_SUFFIX;
}
return exportJar;
}
use of org.talend.core.model.process.JobInfo in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getRelatedJobFolderNames.
protected List<String> getRelatedJobFolderNames(ProcessItem process, Set<String> jobNameVersionChecked) {
List<String> jobFolderNames = new ArrayList<String>();
String projectName = getCorrespondingProjectName(process);
String jobName = process.getProperty().getLabel();
String jobVersion = process.getProperty().getVersion();
//$NON-NLS-1$ //$NON-NLS-2$
String id = projectName + ":" + jobName + "_" + jobVersion;
if (jobNameVersionChecked.contains(id)) {
// no need to add more to the list, just return the empty list
return jobFolderNames;
}
jobNameVersionChecked.add(id);
String jobFolderName = JavaResourcesHelper.getJobFolderName(jobName, jobVersion);
//$NON-NLS-1$
jobFolderNames.add(projectName + ":" + jobFolderName);
Set<JobInfo> subjobInfos = ProcessorUtilities.getChildrenJobInfo(process);
for (JobInfo subjobInfo : subjobInfos) {
jobFolderNames.addAll(getRelatedJobFolderNames(subjobInfo.getProcessItem(), jobNameVersionChecked));
}
return jobFolderNames;
}
use of org.talend.core.model.process.JobInfo in project tdi-studio-se by Talend.
the class JobExportAction method generatedCodes.
/**
* DOC ggu Comment method "generatedCodes".
*
* @param version
* @param monitor
* @param processes
*/
protected boolean generatedCodes(String version, IProgressMonitor monitor, List<ExportFileResource> processes) {
String projectName = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLabel();
List<JobResource> jobResources = new ArrayList<JobResource>();
for (ExportFileResource process : processes) {
ProcessItem processItem = (ProcessItem) process.getItem();
JobInfo jobInfo = new JobInfo(processItem, processItem.getProcess().getDefaultContext(), version);
jobResources.add(new JobResource(projectName, jobInfo));
Set<JobInfo> jobInfos = ProcessorUtilities.getChildrenJobInfo(processItem);
for (JobInfo subjobInfo : jobInfos) {
jobResources.add(new JobResource(projectName, subjobInfo));
}
}
JobResourceManager reManager = JobResourceManager.getInstance();
for (JobResource r : jobResources) {
if (reManager.isProtected(r)) {
try {
ProcessorUtilities.generateCode(r.getJobInfo().getJobId(), r.getJobInfo().getContextName(), r.getJobInfo().getJobVersion(), false, false, monitor);
} catch (ProcessorException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
}
}
return true;
}
Aggregations