use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class PostgresGenerationManager method initExpression.
@Override
protected String initExpression(DbMapComponent component, ExternalDbMapEntry dbMapEntry) {
String expression = super.initExpression(component, dbMapEntry);
// String expression = dbMapEntry.getExpression();
if (expression != null) {
List<? extends IConnection> inputConnections = component.getIncomingConnections();
ExternalDbMapData data = (ExternalDbMapData) component.getExternalData();
if (inputConnections == null) {
return expression;
}
for (ExternalDbMapTable input : data.getInputTables()) {
ExternalDbMapTable inputTable = input;
IConnection connection = null;
for (IConnection iconn : inputConnections) {
if (iconn.getName().equals(input.getTableName())) {
connection = iconn;
break;
}
}
if (connection == null) {
return expression;
}
INode source = connection.getSource();
String schemaStr = "";
String tableNameStr = "";
if (source != null) {
if (isELTDBMap(source)) {
tableNameStr = connection.getName();
} else {
IElementParameter schema = source.getElementParameter("ELT_SCHEMA_NAME");
IElementParameter tableName = source.getElementParameter("ELT_TABLE_NAME");
if (schema != null && schema.getValue() != null) {
schemaStr = TalendTextUtils.removeQuotes(schema.getValue().toString());
}
if (tableName != null && tableName.getValue() != null) {
tableNameStr = TalendTextUtils.removeQuotes(tableName.getValue().toString());
}
}
}
for (IMetadataColumn co : connection.getMetadataTable().getListColumns()) {
String columnLabel = co.getOriginalDbColumnName();
if (columnLabel == null || "".equals(columnLabel)) {
columnLabel = co.getLabel();
}
String[] patternSubs = getPattenSubs(schemaStr, tableNameStr, columnLabel);
MapExpressionParser parser = new MapExpressionParser(patternSubs[0]);
expression = parser.replaceLocation(expression, patternSubs[0], patternSubs[1]);
if (inputTable.getAlias() != null && !"".equals(inputTable.getAlias())) {
patternSubs = getPattenSubs("", inputTable.getAlias(), columnLabel);
parser = new MapExpressionParser(patternSubs[0]);
expression = parser.replaceLocation(expression, patternSubs[0], patternSubs[1]);
}
}
}
}
List<IMetadataTable> metadataList = component.getMetadataList();
if (metadataList != null) {
for (IMetadataTable table : metadataList) {
String tableName = table.getLabel();
for (IMetadataColumn column : table.getListColumns()) {
String columnLabel = column.getOriginalDbColumnName();
if (columnLabel == null || "".equals(columnLabel)) {
columnLabel = column.getLabel();
}
String[] patternSubs = getPattenSubs("", tableName, columnLabel);
MapExpressionParser parser = new MapExpressionParser(patternSubs[0]);
expression = parser.replaceLocation(expression, patternSubs[0], patternSubs[1]);
}
}
}
return expression;
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class HL7OutputLinkUI method createCombo.
/*
* (non-Javadoc)
*
* @see org.talend.designer.hl7.ui.HL7UI#createCombo(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void createCombo(Composite mainComposite) {
metaTableViewer = new ComboViewer(mainComposite, SWT.NONE | SWT.READ_ONLY);
metaTableViewer.setContentProvider(new ArrayContentProvider());
metaTableViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof IConnection) {
return ((IConnection) element).getUniqueName();
}
return super.getText(element);
}
});
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(externalNode, IConnectionCategory.FLOW);
metaTableViewer.setInput(incomingConnections);
final Combo combo = metaTableViewer.getCombo();
combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
combo.select(0);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (hl7Manager != null) {
((HL7OutputManager) hl7Manager).setCurrentSchema(combo.getText());
}
IStructuredSelection selection = (IStructuredSelection) metaTableViewer.getSelection();
Object obj = selection.getFirstElement();
xmlViewer.refresh();
xmlViewer.expandAll();
schemaViewer.setInput(((IConnection) obj).getMetadataTable().getListColumns());
initlinkers();
}
});
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class HL7OutputUI method initSchemaTable.
protected void initSchemaTable() {
if (externalNode.isHL7Output()) {
// !externalNode.istWriteXMLField() && !externalNode.istMDMOutput()) {
IMetadataTable metadataTable = null;
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(externalNode, IConnectionCategory.FLOW);
if (incomingConnections.size() <= 0) {
metadataTable = this.externalNode.getMetadataList().get(0);
} else {
metadataTable = incomingConnections.get(0).getMetadataTable();
}
if (metadataTable != null) {
List<IMetadataColumn> columnList = metadataTable.getListColumns();
schemaViewer.setInput(columnList);
} else {
schemaViewer.setInput(new ArrayList<IMetadataColumn>());
}
} else {
IConnection inConn = null;
for (IConnection conn : externalNode.getIncomingConnections()) {
if ((conn.getLineStyle().equals(EConnectionType.FLOW_MAIN)) || (conn.getLineStyle().equals(EConnectionType.FLOW_REF))) {
inConn = conn;
break;
}
}
if (inConn != null) {
List<IMetadataColumn> columnList = inConn.getMetadataTable().getListColumns();
schemaViewer.setInput(columnList);
} else {
schemaViewer.setInput(new ArrayList<IMetadataColumn>());
}
}
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ParallelExecutionAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
boolean hasFlowConnection = false;
for (IConnection connection : node.getOutgoingConnections()) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
hasFlowConnection = true;
break;
}
}
if (hasFlowConnection) {
MessageDialog.openError(getWorkbenchPart().getSite().getShell(), Messages.getString(//$NON-NLS-1$
"ParallelExecutionAction.gotLink"), //$NON-NLS-1$
Messages.getString("ParallelExecutionAction.noOutputLink"));
return;
}
IElementParameter enableParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE.getName());
if (enableParallelizeParameter != null) {
parallelEnable = (Boolean) enableParallelizeParameter.getValue();
}
IElementParameter numberParallelizeParameter = node.getElementParameter(EParameterName.PARALLELIZE_NUMBER.getName());
if (numberParallelizeParameter != null) {
numberParallel = (String) numberParallelizeParameter.getValue();
}
Dialog dialog = new ParallelDialog(getWorkbenchPart().getSite().getShell());
if (dialog.open() == Dialog.OK) {
Command command = new PropertyChangeCommand(node, EParameterName.PARALLELIZE.getName(), parallelEnable);
execute(command);
}
}
use of org.talend.core.model.process.IConnection in project tdi-studio-se by Talend.
the class ModifyMergeOrderAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
super.run();
MergeOrderDialog dialog = new MergeOrderDialog(this.getWorkbenchPart().getSite().getShell(), mergeComponent);
if (dialog.open() == MergeOrderDialog.OK) {
for (IConnection connection : mergeComponent.getIncomingConnections()) {
if (connection.getSource().isStart() && (connection.getSource().getOutgoingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0 || connection.getSource().getOutgoingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0)) {
//$NON-NLS-1$
MessageDialog.openError(//$NON-NLS-1$
new Shell(), //$NON-NLS-1$
Messages.getString("ModifyMergeOrderAction.ERROE"), //$NON-NLS-1$
Messages.getString("ModifyMergeOrderAction.ConnectionModifyError"));
return;
}
if (connection.getSource().getIncomingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0 || connection.getSource().getIncomingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0) {
//$NON-NLS-1$
MessageDialog.openError(//$NON-NLS-1$
new Shell(), //$NON-NLS-1$
Messages.getString("ModifyMergeOrderAction.ERROE"), //$NON-NLS-1$
Messages.getString("ModifyMergeOrderAction.ConnectionModifyError"));
return;
}
}
ChangeMergeOrderCommand cmd = new ChangeMergeOrderCommand(mergeComponent, dialog.getConnectionList());
execute(cmd);
}
}
Aggregations