use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class DesignerCoreService method getProcessFromItemByExtendion.
public IProcess getProcessFromItemByExtendion(Item item, boolean loadScreenshots) {
IProcess process = null;
List<IProcessConvertService> processConvertServices = ProcessConvertManager.getInstance().extractAllConvertServices();
for (IProcessConvertService service : processConvertServices) {
process = service.getProcessFromItem(item, loadScreenshots);
if (process != null) {
break;
}
}
return process;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class JobLaunchConfigurationDelegate method findProcessFromRepository.
/**
* DOC bqian Comment method "findProcessFromRepository".
*
* @param jobName
* @return
*/
private IProcess2 findProcessFromRepository(String jobId, String version) {
try {
ItemCacheManager.clearCache();
ProcessItem processItem = ItemCacheManager.getProcessItem(jobId, version);
if (processItem != null) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService service = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
IProcess process = service.getProcessFromItem(processItem);
if (process instanceof IProcess2) {
return (IProcess2) process;
}
}
// keep old code for now, but it should never be called.
ProcessEditorInput fileEditorInput = new ProcessEditorInput(processItem, true, true, true);
IProcess2 process = fileEditorInput.getLoadedProcess();
return process;
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return null;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class JobletContainer method refreshJobletConnections.
private void refreshJobletConnections() {
Iterator<IConnection> inIterator = inputs.iterator();
while (inIterator.hasNext()) {
IConnection conn = inIterator.next();
if (isCollapsed()) {
((Connection) conn).reconnect(conn.getSource(), this.node, conn.getLineStyle());
} else {
out: for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
IElementParameter elePa = this.node.getElementParameter(connNode.getJoblet_unique_name());
if (elePa != null) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
IElementParameter elechild = null;
String uniqueName = null;
boolean isTri = service.isTriggerNode(connNode);
if (service != null && isTri) {
elechild = elePa.getChildParameters().get("COMPONENT_LIST");
uniqueName = conn.getMetaName();
} else {
elechild = elePa.getChildParameters().get("CONNECTION");
uniqueName = conn.getUniqueName();
}
if (elechild != null && elechild.getValue().equals(uniqueName)) {
List<? extends INodeConnector> connList = new JobletUtil().createConnectors(connNode, this.getProcess());
// modify///////////////////////////////////////////////////////////////////////////////////////////////////////
List<INodeConnector> inodeConnList = new ArrayList<INodeConnector>();
inodeConnList.addAll(connList);
inodeConnList.addAll(connNode.getListConnector());
connNode.setListConnector(inodeConnList);
// connNode.getListConnector().addAll(connList);
IMetadataTable iTable = this.node.getMetadataTable(connNode.getUniqueName());
if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
// connNode.getMetadataList().add(iTable);
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewTarget(connNode);
reConnectCommand.execute();
break;
} else if (getFlowInput(inputs).size() == 1 && !isTri && new JobletUtil().isJobletInput(connNode, this.getProcess())) {
for (IConnection flowConn : getFlowInput(inputs)) {
if (!flowConn.getUniqueName().equals(conn.getUniqueName())) {
continue out;
}
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewTarget(connNode);
reConnectCommand.execute();
break;
}
}
}
}
}
Iterator<IConnection> outIterator = outputs.iterator();
while (outIterator.hasNext()) {
IConnection conn = outIterator.next();
if (isCollapsed()) {
((Connection) conn).reconnect(this.node, conn.getTarget(), conn.getLineStyle());
} else {
for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
if (conn.getConnectorName().equals(connNode.getJoblet_unique_name())) {
List<? extends INodeConnector> connList = new JobletUtil().createConnectors(connNode, this.getProcess());
List<INodeConnector> inodeConnList = new ArrayList<INodeConnector>();
inodeConnList.addAll(connList);
inodeConnList.addAll(connNode.getListConnector());
connNode.setListConnector(inodeConnList);
// connNode.setListConnector(connList);
IMetadataTable iTable = this.node.getMetadataTable(connNode.getUniqueName());
if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
// connNode.getMetadataList().add(iTable);
}
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
reConnectCommand.setNewSource(connNode);
reConnectCommand.execute();
// return;
}
}
}
}
if (!isCollapsed()) {
for (NodeContainer nodeContainer : this.nodeContainers) {
Node connNode = nodeContainer.getNode();
IProcess jobletProcess = this.getNode().getComponent().getProcess();
List<? extends INode> jobletNodes = jobletProcess.getGraphicalNodes();
for (INode n : jobletNodes) {
if (connNode.getJoblet_unique_name().equals(n.getUniqueName())) {
connNode.setDummy(n.isDummy());
// connNode.setActivate(n.isActivate());
}
}
}
}
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class SqlMemoController method refreshConnectionCommand.
private Command refreshConnectionCommand() {
// open sql builder in repository mode, just use query object, no need for connection information
ConnectionParameters connParameters = new ConnectionParameters();
String queryId = (String) elem.getPropertyValue(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName());
Query query = MetadataToolHelper.getQueryFromRepository(queryId);
DatabaseConnectionItem item = findRepositoryItem(queryId);
if (item != null) {
connParameters.setRepositoryName(item.getProperty().getLabel());
connParameters.setRepositoryId(item.getProperty().getId());
}
connParameters.setQueryObject(query);
connParameters.setQuery(query.getValue());
TextUtil.setDialogTitle(TextUtil.SQL_BUILDER_TITLE_REP);
String processName = null;
if (elem instanceof IProcess) {
processName = ((IProcess) elem).getName();
} else if (elem instanceof INode) {
processName = ((INode) elem).getProcess().getName();
} else if (elem instanceof IConnection) {
processName = ((IConnection) elem).getSource().getProcess().getName();
}
connParameters.setNodeReadOnly(false);
connParameters.setFromRepository(true);
ISQLBuilderService sqlBuilderService = (ISQLBuilderService) GlobalServiceRegister.getDefault().getService(ISQLBuilderService.class);
Dialog sqlBuilder = sqlBuilderService.openSQLBuilderDialog(composite.getShell(), processName, connParameters);
String sql = null;
if (Window.OK == sqlBuilder.open()) {
sql = connParameters.getQuery();
}
if (sql != null && !queryText.isDisposed()) {
queryText.setText(sql);
String propertyName = (String) openSQLEditorButton.getData(PARAMETER_NAME);
return new PropertyChangeCommand(elem, propertyName, sql);
}
return null;
}
use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.
the class SapSchemaTypeController method copySchemaFromChildJob.
/**
* DOC hcw Comment method "copySchemaFromChildJob".
*
* @param runJobNode
* @param item
*/
private void copySchemaFromChildJob(Node runJobNode, final Item item) {
// 0004322: tRunJob can import the tBufferOutput schema from the son job
if (runJobNode != null && item instanceof ProcessItem) {
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
IProcess process = service.getProcessFromProcessItem((ProcessItem) item);
List<? extends INode> graphicalNodes = process.getGraphicalNodes();
for (INode node : graphicalNodes) {
if ((node != null) && node.getComponent().getName().equals("tBufferOutput")) {
//$NON-NLS-1$
List<IMetadataTable> list = node.getMetadataList();
if (list.size() > 0) {
List<IMetadataTable> metadata = runJobNode.getMetadataList();
if (metadata.size() == 0) {
metadata.add(list.get(0).clone());
} else {
IMetadataTable table = metadata.get(0);
// clear schema of tRunJob, so we will replace with schema of tBufferOutput
table.getListColumns().clear();
List<IMetadataColumn> columns = list.get(0).getListColumns();
for (IMetadataColumn col : columns) {
table.getListColumns().add(col.clone());
}
}
// skip other tBufferOutput component
break;
}
}
}
}
}
Aggregations