Search in sources :

Example 16 with MetadataColumn

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;
        }
    };
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) AddPushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButtonForExtendedTable) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)

Example 17 with 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();
        }
    };
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) RemovePushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.RemovePushButtonForExtendedTable) MetadataEmfPasteCommand(org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand) Command(org.eclipse.gef.commands.Command) ArrayList(java.util.ArrayList) List(java.util.List)

Example 18 with MetadataColumn

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));
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)

Example 19 with 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;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable)

Example 20 with MetadataColumn

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);
        }
    }
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) IModel(org.talend.designer.hl7.model.IModel) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.builder.connection.MetadataTable) ArrayList(java.util.ArrayList) List(java.util.List) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Map(java.util.Map)

Aggregations

MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)59 ArrayList (java.util.ArrayList)27 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)22 List (java.util.List)13 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 MetadataEmfTableEditor (org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)10 IModel (org.talend.designer.hl7.model.IModel)9 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)8 Command (org.eclipse.gef.commands.Command)7 EList (org.eclipse.emf.common.util.EList)6 HashMap (java.util.HashMap)5 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)5 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)5 ExtendedTableResetDBTypesCommand (org.talend.core.ui.metadata.extended.command.ExtendedTableResetDBTypesCommand)5 MetadataEmfExportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfExportXmlCommand)5 MetadataEmfImportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfImportXmlCommand)5 MetadataEmfPasteCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand)5 HL7MultiSchemaUI (org.talend.designer.hl7.ui.HL7MultiSchemaUI)5 Iterator (java.util.Iterator)4 Map (java.util.Map)4