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 JavaProcessor method getExportJarsStr.
protected String getExportJarsStr() {
final String rootWorkingDir = getRootWorkingDir(true);
final String classPathSeparator = extractClassPathSeparator();
String jarName = JavaResourcesHelper.getJobFolderName(process.getName(), process.getVersion());
String exportJar = rootWorkingDir + jarName + FileExtensions.JAR_FILE_SUFFIX;
Set<JobInfo> infos = getBuildChildrenJobs();
for (JobInfo jobInfo : infos) {
String childJarName = JavaResourcesHelper.getJobFolderName(jobInfo.getJobName(), jobInfo.getJobVersion());
exportJar += classPathSeparator + rootWorkingDir + 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 addXmlMapping.
protected void addXmlMapping(ExportFileResource resource, boolean needSource) {
try {
boolean hasDynamicMetadata = false;
if (resource.getItem() instanceof ProcessItem) {
List<JobInfo> list = new ArrayList<JobInfo>();
hasDynamicMetadata = LastGenerationInfo.getInstance().isUseDynamic(resource.getItem().getProperty().getId(), resource.getItem().getProperty().getVersion());
}
if (hasDynamicMetadata) {
needMappingInSystemRoutine = true;
if (needSource) {
IRunProcessService service = CorePlugin.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
// for db mapping xml
IFolder xmlMappingFolder = talendProcessJavaProject.getResourcesFolder().getFolder(JavaUtils.JAVA_XML_MAPPING);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
coreService.synchronizeMapptingXML();
coreService.syncLog4jSettings();
}
List<URL> xmlMappingFileUrls = new ArrayList<URL>();
if (xmlMappingFolder.exists()) {
for (IResource fileResource : xmlMappingFolder.members()) {
if (XmlUtil.isXMLFile(fileResource.getName())) {
xmlMappingFileUrls.add(fileResource.getLocationURI().toURL());
}
}
resource.addResources(JOB_SOURCE_FOLDER_NAME + PATH_SEPARATOR + JavaUtils.JAVA_XML_MAPPING, xmlMappingFileUrls);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.process.JobInfo in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getChildrenJobAndContextName.
protected void getChildrenJobAndContextName(ExportFileResource[] allResources, String rootName, List<JobInfo> list, ProcessItem process, String projectName, List<ProcessItem> processedJob, List<URL> allJobScripts, ExportFileResource resource, Map<ExportChoice, Object> exportChoice, String... selectedJobVersion) {
if (processedJob.contains(process)) {
// prevent circle
return;
}
processedJob.add(process);
ProjectManager projectManager = ProjectManager.getInstance();
Project project = projectManager.getProject(process);
String childProjectName = projectName;
if (project != null) {
// hywang modify for 7932
childProjectName = project.getTechnicalLabel().toLowerCase();
}
allJobScripts.addAll(getJobScripts(childProjectName, process.getProperty().getLabel(), process.getProperty().getVersion(), isOptionChoosed(ExportChoice.needJobScript)));
addContextScripts(process, process.getProperty().getLabel(), process.getProperty().getVersion(), resource, isOptionChoosed(ExportChoice.needContext));
addJobItem(allResources, process, isOptionChoosed(ExportChoice.needJobItem), resource);
addDependencies(allResources, process, isOptionChoosed(ExportChoice.needDependencies) && isOptionChoosed(ExportChoice.needJobItem), resource);
addSourceCode(allResources, process, isOptionChoosed(ExportChoice.needSourceCode), resource);
addDependenciesSourceCode(allResources, resource, isOptionChoosed(ExportChoice.needSourceCode));
Set<JobInfo> subjobInfos = ProcessorUtilities.getChildrenJobInfo(process);
for (JobInfo subjobInfo : subjobInfos) {
if (list.contains(subjobInfo)) {
continue;
}
list.add(subjobInfo);
getChildrenJobAndContextName(allResources, rootName, list, subjobInfo.getProcessItem(), projectName, processedJob, allJobScripts, resource, exportChoice);
}
}
Aggregations