use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.
the class OpenExistVersionProcessWizard method openAnotherVersion.
protected void openAnotherVersion(final RepositoryNode node, final boolean readonly) {
try {
if (node.getObject() != null) {
final Item item = node.getObject().getProperty().getItem();
final IWorkbenchPage page = getActivePage();
final RepositoryEditorInput fileEditorInput = getEditorInput(item, readonly, page);
if (fileEditorInput != null) {
IEditorPart editorPart = page.findEditor(fileEditorInput);
if (editorPart == null) {
fileEditorInput.setRepositoryNode(node);
if (item instanceof ProcessItem) {
page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, readonly);
} else if (item instanceof BusinessProcessItem) {
CorePlugin.getDefault().getDiagramModelService().openBusinessDiagramEditor(page, fileEditorInput);
} else {
ECodeLanguage lang = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLanguage();
//$NON-NLS-1$ //$NON-NLS-2$
String talendEditorID = "org.talend.designer.core.ui.editor.StandAloneTalend" + lang.getCaseName() + "Editor";
page.openEditor(fileEditorInput, talendEditorID);
}
} else {
page.activate(editorPart);
}
} else {
// TDI-19014:open another version of jobScript
if (item instanceof JobScriptItem) {
IProject fsProject = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
openXtextEditor(node, fsProject, readonly);
}
}
}
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.
the class JavaProcessUtil method getChildrenModules.
static List<ModuleNeeded> getChildrenModules(final INode node, Set<ProcessItem> searchItems, boolean forMR) {
List<ModuleNeeded> modulesNeeded = new ArrayList<ModuleNeeded>();
if (node.getComponent().getName().equals("tRunJob")) {
//$NON-NLS-1$
//$NON-NLS-1$
IElementParameter processIdparam = node.getElementParameter("PROCESS_TYPE_PROCESS");
IElementParameter processVersionParam = node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
ProcessItem processItem = null;
if (processVersionParam != null) {
processItem = ItemCacheManager.getProcessItem((String) processIdparam.getValue(), (String) processVersionParam.getValue());
} else {
processItem = ItemCacheManager.getProcessItem((String) processIdparam.getValue());
}
//$NON-NLS-1$
String context = (String) node.getElementParameter("PROCESS_TYPE_CONTEXT").getValue();
if (processItem != null && !searchItems.contains(processItem)) {
boolean seperated = //$NON-NLS-1$
getBooleanParamValue(node, "USE_INDEPENDENT_PROCESS") || //$NON-NLS-1$
getBooleanParamValue(node, "USE_DYNAMIC_JOB");
if (!seperated) {
// avoid dead loop of method call
searchItems.add(processItem);
JobInfo subJobInfo = new JobInfo(processItem, context);
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess child = service.getProcessFromItem(subJobInfo.getProcessItem());
getNeededModules(child, true, searchItems, modulesNeeded, forMR);
}
}
}
return modulesNeeded;
}
use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.
the class AbstractPublishJobAction method exportJobForOSGI.
private void exportJobForOSGI(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
File tmpJob = null;
final ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
try {
tmpJob = File.createTempFile("job", ".jar", null);
jobScriptsManager = JobScriptsManagerFactory.createManagerInstance(JobScriptsManagerFactory.getDefaultExportChoiceMap(), processItem.getProcess().getDefaultContext(), JobScriptsManager.LAUNCHER_ALL, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES, JobExportType.OSGI);
// generate
jobScriptsManager.setDestinationPath(tmpJob.getAbsolutePath());
JobExportAction action = new JobExportAction(Collections.singletonList(node), jobVersion, bundleVersion, jobScriptsManager, System.getProperty("java.io.tmpdir"));
action.run(monitor);
if (!action.isBuildSuccessful()) {
return;
}
monitor.beginTask("Deploy to Artifact Repository....", IProgressMonitor.UNKNOWN);
FeaturesModel featuresModel = getFeatureModel(tmpJob);
// [TESB-12036] add talend-data-mapper feature
NodeType tHMapNode = EmfModelUtils.getComponentByName(processItem, THMAP_COMPONENT_NAME);
if (tHMapNode != null) {
featuresModel.addFeature(new FeatureModel(FeaturesModel.TALEND_DATA_MAPPER_FEATURE_NAME));
}
processModules(featuresModel, ((JobJavaScriptOSGIForESBManager) jobScriptsManager).getExcludedModuleNeededs());
process(processItem, featuresModel, monitor);
} catch (IOException e) {
throw new InvocationTargetException(e);
} finally {
if (tmpJob != null && tmpJob.exists()) {
tmpJob.delete();
}
}
}
use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.
the class AbstractPublishJobAction method exportJobForPOJO.
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
File tmpJob = null;
try {
tmpJob = File.createTempFile("item", ".zip", null);
// jobScriptsManager.setDestinationPath(tmpJob.getAbsolutePath());
// JobExportAction action = new JobExportAction(Collections.singletonList(node), jobVersion,
// jobScriptsManager, null,
// "job");
// action.run(monitor);
// if (!action.isBuildSuccessful()) {
// return;
// }
// TDI-32861, because for publish job, so means, must be binaries
exportChoiceMap.put(ExportChoice.binaries, true);
exportChoiceMap.put(ExportChoice.includeLibs, true);
exportChoiceMap.put(ExportChoice.addStatistics, true);
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
String contextName = (String) exportChoiceMap.get(ExportChoice.contextName);
if (contextName == null) {
contextName = processItem.getProcess().getDefaultContext();
}
BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(), processItem, jobVersion, contextName, exportChoiceMap, exportType, monitor);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
boolean hasError = service.checkExportProcess(new StructuredSelection(node), true);
if (hasError) {
return;
}
}
monitor.beginTask("Deploy to Artifact Repository....", IProgressMonitor.UNKNOWN);
FeaturesModel featuresModel = getFeatureModel(tmpJob);
process(processItem, featuresModel, monitor);
} catch (InterruptedException e) {
throw e;
} catch (Exception e) {
throw new InvocationTargetException(e);
} finally {
if (tmpJob != null && tmpJob.exists()) {
tmpJob.delete();
}
}
}
use of org.talend.core.model.properties.ProcessItem in project tdi-studio-se by Talend.
the class JobLaunchShortcut method launch.
/**
* bqian Comment method "launch".
*
* @param object
* @param mode
*/
private void launch(Item item, String mode) {
if (item instanceof ProcessItem) {
ILaunchConfiguration config = findLaunchConfiguration((ProcessItem) item, mode);
if (config != null) {
IPreferenceStore debugUiStore = DebugUITools.getPreferenceStore();
// boolean oldBuildBeforeLaunch = debugUiStore.getBoolean(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH);
try {
if (!Problems.buildWholeProject) {
// don't build auto, because will be in one Job, so can't set back the old value
debugUiStore.setValue(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH, false);
// FIXME, only for standard job, same as Problems.computeCompilationUnit
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(item);
if (itemType == null || !ERepositoryObjectType.PROCESS.equals(itemType)) {
try {
config.getFile().getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
DebugUITools.launch(config, mode);
} finally {
// debugUiStore.setValue(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH, oldBuildBeforeLaunch);
}
}
}
}
Aggregations