use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.
the class TableEntriesManager method renameEntryName.
/**
* DOC amaumont Comment method "renameEntryName".
*
* @param dataMapTableEntry
* @param newColumnName
* @param newColumnName
*/
public void renameEntryName(ITableEntry dataMapTableEntry, String previousColumnName, String newColumnName) {
TableEntryLocation tableEntryLocationKey = new TableEntryLocation(dataMapTableEntry.getParentName(), previousColumnName);
// TableEntriesManager.buildLocation(dataMapTableEntry);
ITableEntry entry = tableEntries.get(tableEntryLocationKey);
if (entry != dataMapTableEntry) {
//$NON-NLS-1$
throw new IllegalStateException(Messages.getString("TableEntriesManager.exceptionMessage.tableEntriesNotSame"));
}
tableEntries.remove(tableEntryLocationKey);
tableEntryLocationKey.columnName = newColumnName;
tableEntries.put(tableEntryLocationKey, dataMapTableEntry);
// update matching column
IMetadataColumn metadataColumn = null;
InputTable inputTable = isPhysicalTable(dataMapTableEntry.getParent());
if (inputTable != null) {
metadataColumn = getColumnFromDbTable(inputTable.getName(), dataMapTableEntry.getName());
removeMetadataColumnFromDbTable(inputTable.getTableName(), dataMapTableEntry.getName());
addMetadataColumnFromDbTable(inputTable.getTableName(), newColumnName, metadataColumn);
}
dataMapTableEntry.setName(newColumnName);
}
use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.
the class TableEntriesManager method addInternal.
/**
* DOC amaumont Comment method "add".
*
* @param dataMapTableEntry
*/
private void addInternal(ITableEntry dataMapTableEntry) {
tableEntries.put(TableEntryLocation.getNewInstance(dataMapTableEntry), dataMapTableEntry);
IDataMapTable dataMapTable = dataMapTableEntry.getParent();
InputTable inputTable = isPhysicalTable(dataMapTable);
if (inputTable != null) {
IMetadataColumn metadataColumn = ((InputColumnTableEntry) dataMapTableEntry).getMetadataColumn();
addMetadataColumnFromDbTable(inputTable.getTableName(), metadataColumn.getLabel(), metadataColumn);
}
}
use of org.talend.core.model.metadata.IMetadataColumn 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.metadata.IMetadataColumn in project tdi-studio-se by Talend.
the class HL7OutputUI method initLinker.
private void initLinker(TreeItem node, TableItem[] tableItems) {
HL7TreeNode treeNode = (HL7TreeNode) node.getData();
IMetadataColumn column = null;
if (treeNode != null) {
column = treeNode.getColumn();
}
if (column != null) {
if (this.gethl7Manager().getHl7Component().isHL7Output() && treeNode.getChildren().size() <= 0) {
for (TableItem tableItem : tableItems) {
IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
if (mColumn.getLabel().equals(column.getLabel())) {
linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
break;
}
}
}
for (TableItem tableItem : tableItems) {
IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
if (mColumn.getLabel().equals(column.getLabel())) {
linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
break;
}
}
}
TreeItem[] children = node.getItems();
for (TreeItem element : children) {
initLinker(element, tableItems);
}
}
use of org.talend.core.model.metadata.IMetadataColumn in project tdi-studio-se by Talend.
the class OracleGenerationManagerTest method createMetadataTable.
private IMetadataTable createMetadataTable(String... columnLabels) {
IMetadataTable metadataTable = new MetadataTable();
// will be error, strange
// List<IMetadataColumn> columns = mock(List.class);
List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
if (columnLabels != null) {
for (String columnlabel : columnLabels) {
columns.add(createColumn(columnlabel));
}
}
// when(metadataTable.getListColumns()).thenReturn(columns);
metadataTable.setListColumns(columns);
return metadataTable;
}
Aggregations