use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.
the class MapperMain method initIOConnections.
public void initIOConnections(IODataComponentContainer ioDataContainer) {
List<IODataComponent> inputsData = ioDataContainer.getInputs();
List<IODataComponent> ouputsData = ioDataContainer.getOuputs();
ioInputConnections = new ArrayList<IOConnection>(inputsData.size());
for (IODataComponent iData : inputsData) {
ioInputConnections.add(new IOConnection(iData));
}
ioOutputConnections = new ArrayList<IOConnection>(ouputsData.size());
for (IODataComponent oData : ouputsData) {
ioOutputConnections.add(new IOConnection(oData));
}
}
use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.
the class MapperMain method createModelFromExternalData.
public void createModelFromExternalData(IODataComponentContainer ioDataContainer, List<IMetadataTable> outputMetadataTables, ExternalMapperData externalData, boolean checkProblems) {
List<IODataComponent> inputsData = ioDataContainer.getInputs();
List<IODataComponent> ouputsData = ioDataContainer.getOuputs();
ArrayList<IOConnection> inputs = new ArrayList<IOConnection>(inputsData.size());
for (IODataComponent iData : inputsData) {
inputs.add(new IOConnection(iData));
}
ArrayList<IOConnection> outputs = new ArrayList<IOConnection>(ouputsData.size());
for (IODataComponent oData : ouputsData) {
outputs.add(new IOConnection(oData));
}
createModelFromExternalData(inputs, outputs, outputMetadataTables, externalData, false);
}
use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.
the class InsertNewColumnCommand method createInputMetadataColumn.
private void createInputMetadataColumn(String sourceTreeName, String targetTreeName, TreeNode sourceNode, String targetNodeName, int index) {
String sourceNodeName = sourceNode.getName();
IMetadataTable metadataTarget = null;
List<IODataComponent> inputs = manager.getMapperComponent().getIODataComponents().getInputs();
for (IODataComponent incoming : inputs) {
if (targetTreeName != null && targetTreeName.equals(incoming.getConnection().getName())) {
metadataTarget = incoming.getTable();
}
}
if (metadataTarget != null) {
IMetadataColumn columnSource = null;
if (sourceTreeName != null) {
columnSource = getSourceColumn(sourceTreeName, sourceNodeName);
}
creatMeatadataColumn(columnSource, targetNodeName, sourceNode, metadataTarget, index);
}
}
use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.
the class ExternalNodeChangeCommand method undo.
@Override
public void undo() {
for (Connection connection : (List<Connection>) node.getIncomingConnections()) {
if (connection.getLineStyle().equals(EConnectionType.FLOW_MAIN) || connection.getLineStyle().equals(EConnectionType.FLOW_REF) || connection.getLineStyle().equals(EConnectionType.TABLE) || connection.getLineStyle().equals(EConnectionType.TABLE_REF)) {
IODataComponent currentIO = inAndOut.getDataComponent(connection);
if (currentIO.hasChanged()) {
// IMetadataTable metadata = inAndOut.getTable(connection);
INode sourceNode = currentIO.getSource();
sourceNode.metadataOutputChanged(currentIO, currentIO.getName());
// IMetadataTable oldMetadata = connection.getMetadataTable().clone();
// currentIO.setTable(oldMetadata);
// connection.getMetadataTable().setListColumns(metadata.getListColumns());
IMetadataTable oldMetadata = currentIO.getConnMetadataTable();
// currentIO.setTable(oldMetadata);
connection.getMetadataTable().setListColumns(oldMetadata.getListColumns());
if (metadataInputWasRepository.get(connection) != null) {
connection.getSource().setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.REPOSITORY);
}
}
}
}
metadataInputWasRepository.clear();
node.setExternalData(oldExternalData);
node.setMetadataList(oldMetaDataList);
for (Connection connection : connectionsToDelete.keySet()) {
connection.reconnect();
Node prevNode = (Node) connection.getSource();
INodeConnector nodeConnectorSource, nodeConnectorTarget;
nodeConnectorSource = prevNode.getConnectorFromType(connection.getLineStyle());
nodeConnectorSource.setCurLinkNbOutput(nodeConnectorSource.getCurLinkNbOutput() + 1);
Node nextNode = (Node) connection.getTarget();
nodeConnectorTarget = nextNode.getConnectorFromType(connection.getLineStyle());
nodeConnectorTarget.setCurLinkNbInput(nodeConnectorTarget.getCurLinkNbInput() + 1);
if (connectionsToDelete.get(connection) != null) {
inAndOut.getOuputs().add(connectionsToDelete.get(connection));
}
}
for (ChangeMetadataCommand cmd : metadataOutputChanges) {
cmd.undo();
}
((Process) node.getProcess()).checkProcess();
if (!isMetaLanguage) {
refreshCodeView();
}
}
use of org.talend.core.model.components.IODataComponent in project tdi-studio-se by Talend.
the class ExternalNodeChangeCommand method propagateInput.
private void propagateInput() {
for (Connection connection : (List<Connection>) node.getIncomingConnections()) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
IODataComponent currentIO = inAndOut.getDataComponent(connection);
currentIO.setColumnOption(IMetadataColumn.OPTIONS_NONE);
if (currentIO.hasChanged()) {
IMetadataTable metadata = inAndOut.getTable(connection);
INode sourceNode = currentIO.getSource();
sourceNode.metadataOutputChanged(currentIO, currentIO.getName());
// It's better to clone, because will change that, if apply, bug 13325
// IMetadataTable oldMetadata = connection.getMetadataTable().clone();
IMetadataTable newMetadata = metadata.clone();
currentIO.setTable(newMetadata);
String schemaType = (String) connection.getSource().getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
if (schemaType != null) {
// if there is a SCHEMA_TYPE, then switch it to BUILT_IN if REPOSITORY is set.
if (schemaType.equals(EmfComponent.REPOSITORY)) {
connection.getSource().setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.BUILTIN);
metadataInputWasRepository.put(connection, Boolean.TRUE);
}
}
// for bug 9849
List<IMetadataColumn> listColumns = connection.getMetadataTable().getListColumns();
// before is empty
boolean empty = listColumns.isEmpty();
List<IMetadataColumn> newListColumns = newMetadata.getListColumns();
List<ColumnNameChanged> columnNameChangeds = new ArrayList<ColumnNameChanged>();
int size = listColumns.size();
int newSize = newListColumns.size();
if (newSize < size) {
size = newSize;
}
for (int i = 0; i < size; i++) {
IMetadataColumn metadataColumn = listColumns.get(i);
IMetadataColumn newMetadataColumn = newListColumns.get(i);
if (metadataColumn != null && newMetadataColumn != null) {
String oldId = metadataColumn.getId();
String oldLabel = metadataColumn.getLabel();
String newLabel = newMetadataColumn.getLabel();
String newId = newMetadataColumn.getId();
if (oldId != null && oldLabel != null && newId != null && oldId.equals(newId) && !oldLabel.equals(newLabel)) {
columnNameChangeds.add(new ColumnNameChanged(oldLabel, newLabel));
}
}
}
connection.getMetadataTable().setListColumns(newListColumns);
// some pig component have FLOW_MAIN && PIGCOMBINE two connector type
if (connection.getConnectorName() != null && connection.getConnectorName().equals("PIGCOMBINE")) {
IMetadataTable table = sourceNode.getMetadataFromConnector(EConnectionType.FLOW_MAIN.getName());
if (table != null) {
table.setListColumns(newListColumns);
}
}
ColumnListController.updateColumnList(sourceNode, columnNameChangeds, false);
if (empty) {
// trace init
connection.initTraceParamters();
}
}
}
}
}
Aggregations