use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdi-studio-se by Talend.
the class JSONFileMetadataEmfToolbarEditor method createAddPushButton.
@Override
protected AddPushButton createAddPushButton() {
return new AddPushButtonForExtendedTable(this.toolbar, getExtendedTableViewer()) {
@Override
protected Object getObjectToAdd() {
MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
if (tableEditorModel.getMetadataTable() == null) {
tableEditorModel.setMetadataTable(ConnectionFactory.eINSTANCE.createMetadataTable());
}
MetadataColumn metadatacolumn = tableEditorModel.createNewMetadataColumn(dbmsId);
return metadatacolumn;
}
};
}
use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdi-studio-se by Talend.
the class JSONFileMetadataEmfToolbarEditor method createRemovePushButton.
@Override
protected RemovePushButton createRemovePushButton() {
return new RemovePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected void beforeCommandExecution() {
List beanList = this.getExtendedTableViewer().getExtendedTableModel().getBeansList();
for (int index : this.getExtendedTableViewer().getTable().getSelectionIndices()) {
MetadataColumn column = (MetadataColumn) beanList.get(index);
needUpdateInRelationMap.add(column);
}
}
@Override
protected void afterCommandExecution(Command executedCommand) {
linker.getBackgroundRefresher().refreshBackground();
}
};
}
use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdi-studio-se by Talend.
the class JSONTree2SchemaDragAndDropHandler method addColumn.
private void addColumn(String label, FOXTreeNode node, EList columnList) {
if (StringUtils.isEmpty(label)) {
return;
}
MetadataEmfTableEditor editor = new MetadataEmfTableEditor();
String columnName = label;
if (columnName.contains(":")) {
//$NON-NLS-1$
//$NON-NLS-1$
columnName = columnName.split(":")[1];
}
//$NON-NLS-1$
columnName = columnName.replaceAll("[^a-zA-Z0-9]", "_");
String dataType = node.getDataType();
MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
metadataColumn.setLabel(editor.getNextGeneratedColumnName(columnName, columnList));
metadataColumn.setOriginalField(label);
metadataColumn.setTalendType(dataType);
columnList.add(metadataColumn);
node.setColumn(ConvertionHelper.convertToIMetaDataColumn(metadataColumn));
}
use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdi-studio-se by Talend.
the class HL7MultiSchemaUI method getCurrentTable.
private MetadataTable getCurrentTable(String key, List<MetadataColumn> beans) {
MetadataTable currentTable = null;
if (beans != null) {
MetadataColumn[] array = new MetadataColumn[beans.size()];
int i = 0;
for (MetadataColumn column : beans) {
MetadataColumn newColumn = copyColumn(column);
array[i] = newColumn;
i++;
}
currentTable = buildCurrentTable(array, key);
}
return currentTable;
}
use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdi-studio-se by Talend.
the class HL7MultiSchemaUI method updateCurrentMetadataTable.
private void updateCurrentMetadataTable() {
IStructuredSelection selection = (IStructuredSelection) metaTableViewer.getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
Map m = hl7Manager.getSchemaRelationMap();
List<MetadataColumn> beans = (List<MetadataColumn>) m.get(key);
MetadataTable currentTable = getCurrentTable(key, beans);
if (currentTable != null) {
metadataEditor.setMetadataTable(currentTable);
hl7SchemaEditorView.setExtendedTableModel(metadataEditor);
} else {
currentTable = ConnectionFactory.eINSTANCE.createMetadataTable();
metadataEditor.setMetadataTable(currentTable);
}
}
}
Aggregations