Search in sources :

Example 6 with JobInfo

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);
    }
}
Also used : JobEditorInput(org.talend.core.ui.editor.JobEditorInput) ProcessItem(org.talend.core.model.properties.ProcessItem) JobInfo(org.talend.core.model.process.JobInfo) IProcess2(org.talend.core.model.process.IProcess2) CoreException(org.eclipse.core.runtime.CoreException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 7 with JobInfo

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;
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) CoreException(org.eclipse.core.runtime.CoreException) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) Item(org.talend.core.model.properties.Item) JobInfo(org.talend.core.model.process.JobInfo) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TalendProblem(org.talend.core.model.process.TalendProblem) Problem(org.talend.core.model.process.Problem) IContainerEntry(org.talend.core.model.process.IContainerEntry) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) HashSet(java.util.HashSet)

Example 8 with JobInfo

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;
}
Also used : JobInfo(org.talend.core.model.process.JobInfo)

Example 9 with JobInfo

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;
}
Also used : JobInfo(org.talend.core.model.process.JobInfo) ArrayList(java.util.ArrayList)

Example 10 with JobInfo

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;
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) ProcessItem(org.talend.core.model.properties.ProcessItem) ExportFileResource(org.talend.repository.documentation.ExportFileResource) JobInfo(org.talend.core.model.process.JobInfo) JobResource(org.talend.core.model.repository.job.JobResource) ArrayList(java.util.ArrayList) JobResourceManager(org.talend.core.model.repository.job.JobResourceManager)

Aggregations

JobInfo (org.talend.core.model.process.JobInfo)16 ProcessItem (org.talend.core.model.properties.ProcessItem)8 PersistenceException (org.talend.commons.exception.PersistenceException)7 ArrayList (java.util.ArrayList)6 CoreException (org.eclipse.core.runtime.CoreException)6 ProcessorException (org.talend.designer.runprocess.ProcessorException)4 HashSet (java.util.HashSet)3 IFile (org.eclipse.core.resources.IFile)3 Property (org.talend.core.model.properties.Property)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 JobResourceManager (org.talend.core.model.repository.job.JobResourceManager)3 File (java.io.File)2 IOException (java.io.IOException)2 IResource (org.eclipse.core.resources.IResource)2 SystemException (org.talend.commons.exception.SystemException)2 Item (org.talend.core.model.properties.Item)2 JobResource (org.talend.core.model.repository.job.JobResource)2 ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)2 ITalendSynchronizer (org.talend.designer.codegen.ITalendSynchronizer)2 ExportFileResource (org.talend.repository.documentation.ExportFileResource)2