use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class SpagicJavaDeployManager method getProperties.
public List<URL> getProperties(ProcessItem processItem, String contextName) {
List<URL> list = new ArrayList<URL>();
Properties p = new Properties();
FileOutputStream out = null;
String projectName = getCorrespondingProjectName(processItem);
String jobName = processItem.getProperty().getLabel();
String jobFolderName = JavaResourcesHelper.getJobFolderName(escapeFileNameSpace(processItem), processItem.getProperty().getVersion());
try {
// List<SpagoBiServer> listServerSapgo = null;
// listServerSapgo = SpagicServerHelper.parse(new SpagicPreferencePage().getPreferenceStore().getString(
// SpagoBiServer.SPAGOBI_SERVER));
// if (listServerSapgo != null && !listServerSapgo.isEmpty()) {
// Iterator<SpagoBiServer> iterator = listServerSapgo.iterator();
// while (iterator.hasNext()) {
// SpagoBiServer spagoBiServer = iterator.next();
// }
// }
IPath path = getSrcRootLocation();
//$NON-NLS-1$
File file = new File(getTmpFolder() + PATH_SEPARATOR + "spagic.properties");
//$NON-NLS-1$
path = path.append(projectName).append(jobFolderName).append(jobName + ".java");
BufferedReader buff = new BufferedReader(new FileReader(path.toPortableString()));
int nbLine = 0;
while (buff.readLine() != null) {
nbLine++;
}
out = new FileOutputStream(file);
PrintStream ps = new PrintStream(out);
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess process = service.getProcessFromProcessItem(processItem);
List<IContextParameter> ctxParams = process.getContextManager().getContext(contextName).getContextParameterList();
for (IContextParameter ctxParam : ctxParams) {
p.put(ctxParam.getName(), ctxParam.getValue());
}
p.put("JobClassName", //$NON-NLS-1$
getCorrespondingProjectName(null) + //$NON-NLS-1$
"." + JavaResourcesHelper.getJobFolderName(processItem.getProperty().getLabel(), processItem.getProperty().getVersion()) + "." + //$NON-NLS-1$
processItem.getProperty().getLabel());
//$NON-NLS-1$
p.put("talendJobClassDescription", HTMLDocUtils.checkString(processItem.getProperty().getDescription()));
//$NON-NLS-1$
p.put("rowNumber", Integer.toString(nbLine));
//$NON-NLS-1$ //$NON-NLS-2$
p.put("host", "localhost");
p.list(ps);
ps.flush();
list.add(file.toURI().toURL());
} catch (Exception e) {
ExceptionHandler.process(e);
} finally {
if (out != null) {
try {
out.close();
} catch (Exception e) {
}
}
}
return list;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class MapperUI method openNewOutputCreationDialog.
public String openNewOutputCreationDialog() {
final IProcess process = mapperManager.getMapperComponent().getProcess();
//$NON-NLS-1$
String outputName = process.generateUniqueConnectionName("out");
InputDialog id = new InputDialog(mapperShell, "Add a output", "New Output :", outputName, new IInputValidator() {
@Override
public String isValid(String newText) {
if (!process.checkValidConnectionName(newText)) {
return "Output is invalid.";
}
return null;
}
});
int response = id.open();
if (response == InputDialog.OK) {
return id.getValue();
}
return null;
}
use of org.talend.core.model.process.IProcess 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.process.IProcess in project tdi-studio-se by Talend.
the class ProcessConvertServiceImpl method getProcessFromItem.
@Override
public IProcess getProcessFromItem(Item item, boolean loadScreenshots) {
if (ProcessItemImpl.class == item.getClass()) {
Process process = null;
process = new Process(item.getProperty());
process.loadXmlFile(loadScreenshots);
return process;
}
return null;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class DesignerCoreService method getCurrentProcess.
// ends.
/*
* (non-Javadoc)
*
* @see org.talend.designer.core.IDesignerCoreService#getCurrentProcess()
*/
@Override
public IProcess getCurrentProcess() {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (!(editor instanceof AbstractMultiPageTalendEditor)) {
return null;
}
IProcess process = ((AbstractMultiPageTalendEditor) editor).getProcess();
return process;
}
Aggregations