use of org.talend.designer.core.IDesignerCoreService in project tdi-studio-se by Talend.
the class DataSourceConfig method getDatasourceAliasFrom.
@Deprecated
private static String getDatasourceAliasFrom(INode node) {
if (!node.isActivate()) {
return null;
}
//$NON-NLS-1$
IElementParameter isSpecifyAlias = node.getElementParameter("SPECIFY_DATASOURCE_ALIAS");
if (isSpecifyAlias == null || Boolean.FALSE.equals(isSpecifyAlias.getValue())) {
return null;
}
//$NON-NLS-1$
IElementParameter aliasParam = node.getElementParameter("DATASOURCE_ALIAS");
if (aliasParam == null) {
return null;
}
IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
boolean evaluate = designerCoreService.evaluate(isSpecifyAlias.getShowIf(), node.getElementParameters());
if (!evaluate) {
return null;
}
String result = aliasParam.getValue() == null ? null : aliasParam.getValue().toString();
return TalendQuoteUtils.removeQuotes(result.trim());
}
use of org.talend.designer.core.IDesignerCoreService in project tdi-studio-se by Talend.
the class JobScriptsManager method getCommandByTalendJob.
protected String getCommandByTalendJob(String targetPlatform, ProcessItem processItem, String context, boolean needContext, int statisticPort, int tracePort, String... codeOptions) {
String[] cmd = new String[] {};
try {
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess currentProcess = service.getProcessFromProcessItem(processItem);
cmd = ProcessorUtilities.getCommandLine(true, targetPlatform, true, currentProcess, processItem.getProperty(), context, needContext, statisticPort, tracePort, codeOptions);
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
return ProcessorUtilities.generateCmdByTalendJob(cmd);
}
use of org.talend.designer.core.IDesignerCoreService in project tdi-studio-se by Talend.
the class DataSourceConfig method getDatasourceAliasesFrom.
// TESB-17238:Include sub jobs datasource alias
private static void getDatasourceAliasesFrom(INode node, Collection<String> ds) {
if (!node.isActivate()) {
return;
}
if (TRUN_JOB.equals(node.getComponent().getName())) {
List<? extends INode> subNodes = getSubProcessNodesFromTRunjob(node);
if (subNodes != null) {
for (INode n : subNodes) {
getDatasourceAliasesFrom(n, ds);
}
}
}
//$NON-NLS-1$
IElementParameter isSpecifyAlias = node.getElementParameter("SPECIFY_DATASOURCE_ALIAS");
if (isSpecifyAlias == null || Boolean.FALSE.equals(isSpecifyAlias.getValue())) {
return;
}
//$NON-NLS-1$
IElementParameter aliasParam = node.getElementParameter("DATASOURCE_ALIAS");
if (aliasParam == null) {
return;
}
IDesignerCoreService designerCoreService = CorePlugin.getDefault().getDesignerCoreService();
boolean evaluate = designerCoreService.evaluate(isSpecifyAlias.getShowIf(), node.getElementParameters());
if (!evaluate) {
return;
}
String result = aliasParam.getValue() == null ? null : aliasParam.getValue().toString();
ds.add(TalendQuoteUtils.removeQuotes(result.trim()));
}
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);
}
}
Aggregations