use of org.talend.designer.core.IDesignerCoreService in project tdi-studio-se by Talend.
the class DataSourceConfig method getSubProcessNodesFromTRunjob.
private static List<? extends INode> getSubProcessNodesFromTRunjob(INode tRunJobNode) {
//$NON-NLS-1$
String processId = (String) tRunJobNode.getElementParameter("PROCESS:PROCESS_TYPE_PROCESS").getValue();
if (processId != null && !"".equals(processId)) {
//$NON-NLS-1$
ProcessItem processItem = ItemCacheManager.getProcessItem(processId);
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
if (processItem != null && service != null) {
return service.getProcessFromItem(processItem).getGeneratingNodes();
}
}
return null;
}
use of org.talend.designer.core.IDesignerCoreService in project tesb-studio-se by Talend.
the class AssignJobAction method changeOldJob.
public void changeOldJob() {
String operationName = repositoryNode.getObject().getLabel();
String portName = repositoryNode.getParent().getObject().getLabel();
ServiceItem serviceItem = (ServiceItem) repositoryNode.getParent().getParent().getObject().getProperty().getItem();
List<ServicePort> listPort = ((ServiceConnection) serviceItem.getConnection()).getServicePort();
String oldJobID = null;
for (ServicePort port : listPort) {
if (port.getName().equals(portName)) {
List<ServiceOperation> listOperation = port.getServiceOperation();
for (ServiceOperation operation : listOperation) {
if (operation.getLabel().equals(operationName)) {
oldJobID = operation.getReferenceJobId();
break;
}
}
break;
}
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
if (oldJobID != null) {
IRepositoryViewObject object = factory.getLastVersion(oldJobID);
Item item = object.getProperty().getItem();
ProcessItem processItem = (ProcessItem) item;
//
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess2 process = null;
IEditorReference[] reference = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
List<IProcess2> processes = RepositoryPlugin.getDefault().getDesignerCoreService().getOpenedProcess(reference);
for (IProcess2 processOpen : processes) {
if (processOpen.getProperty().getItem() == processItem) {
process = processOpen;
break;
}
}
if (process == null) {
IProcess proc = service.getProcessFromProcessItem(processItem);
if (proc instanceof IProcess2) {
process = (IProcess2) proc;
}
}
if (process != null) {
List<? extends INode> nodelist = process.getGraphicalNodes();
for (INode node : nodelist) {
if (node.getComponent().getName().equals("tESBProviderRequest")) {
repositoryChangeToBuildIn(repositoryNode, node);
}
}
processItem.setProcess(process.saveXmlFile());
factory.save(processItem);
}
}
} catch (PersistenceException | IOException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.designer.core.IDesignerCoreService 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.designer.core.IDesignerCoreService in project tdi-studio-se by Talend.
the class VisibleComponentSettingsMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
Project currentProject = ProjectManager.getInstance().getCurrentProject();
List<ComponentSetting> componentsSettings = (List<ComponentSetting>) currentProject.getEmfProject().getComponentsSettings();
boolean modified = false;
if (processType != null) {
EList nodes = processType.getNode();
for (Object node : nodes) {
NodeType nodeType = (NodeType) node;
for (ComponentSetting setting : componentsSettings) {
if (setting.getName().equals(nodeType.getComponentName())) {
if (setting.isHidden()) {
setting.setHidden(false);
modified = true;
}
}
}
}
}
if (modified) {
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
try {
prf.saveProject(currentProject);
} catch (Exception ex) {
ExceptionHandler.process(ex);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.designer.core.IDesignerCoreService 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;
}
Aggregations