use of org.talend.designer.mapper.external.connection.IOConnection in project tdi-studio-se by Talend.
the class ExternalDataConverter method prepareOutputTables.
private ArrayList<OutputTable> prepareOutputTables(List<IOConnection> outputConnections, List<IMetadataTable> outputMetadataTables, ExternalMapperData externalData) {
Map<String, List<ExternalMapperTable>> nameToOutpuPersistentTable = new HashMap<String, List<ExternalMapperTable>>();
if (externalData != null) {
for (ExternalMapperTable persistentTable : externalData.getOutputTables()) {
String key = persistentTable.getName();
if (persistentTable.getIsJoinTableOf() != null) {
key = persistentTable.getIsJoinTableOf();
}
List<ExternalMapperTable> list = nameToOutpuPersistentTable.get(key);
if (list != null) {
list.add(persistentTable);
} else {
list = new ArrayList<ExternalMapperTable>();
list.add(persistentTable);
nameToOutpuPersistentTable.put(key, list);
}
}
}
Map<String, IOConnection> nameMetadataToOutpuConn = new HashMap<String, IOConnection>();
if (outputConnections != null) {
for (IOConnection connection : outputConnections) {
if (connection.getConnectionType().equals(EConnectionType.FLOW_MAIN) || connection.getConnectionType().equals(EConnectionType.FLOW_REF) || connection.getConnectionType().equals(EConnectionType.FLOW_MERGE)) {
nameMetadataToOutpuConn.put(connection.getTable().getTableName(), connection);
}
}
}
ArrayList<OutputTable> outputDataMapTables = new ArrayList<OutputTable>();
for (IMetadataTable table : outputMetadataTables) {
IOConnection connection = nameMetadataToOutpuConn.get(table.getTableName());
if (connection != null) {
List<ExternalMapperTable> persistentTables = nameToOutpuPersistentTable.get(connection.getName());
creatOutputTables(outputDataMapTables, persistentTables, connection.getTable(), connection, connection.getName());
} else {
List<ExternalMapperTable> persistentTables = nameToOutpuPersistentTable.get(table.getTableName());
creatOutputTables(outputDataMapTables, persistentTables, table, null, table.getTableName());
}
}
return outputDataMapTables;
}
use of org.talend.designer.mapper.external.connection.IOConnection 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.designer.mapper.external.connection.IOConnection in project tdi-studio-se by Talend.
the class OutputTable method hasReadOnlyMetadataColumns.
/*
* (non-Javadoc)
*
* @see org.talend.designer.mapper.model.table.AbstractInOutTable#hasReadOnlyMetadataColumns()
*/
@Override
public boolean hasReadOnlyMetadataColumns() {
boolean hasReadOnlyMetadataColumns = false;
IOConnection connection = getConnection();
if (connection != null) {
INode target = connection.getTarget();
if (target != null) {
hasReadOnlyMetadataColumns = connection.isReadOnly() || target.isReadOnly() || connection.getTable().isReadOnly();
if (!hasReadOnlyMetadataColumns) {
for (IElementParameter param : target.getElementParameters()) {
if (param.getFieldType() == EParameterFieldType.SCHEMA_TYPE) {
if (param.isReadOnly()) {
hasReadOnlyMetadataColumns = true;
break;
}
}
}
}
}
}
return hasReadOnlyMetadataColumns;
}
Aggregations