Search in sources :

Example 16 with ColumnNameChanged

use of org.talend.core.model.metadata.ColumnNameChanged in project tdi-studio-se by Talend.

the class ScdComponent method metadataInputChanged.

@Override
public void metadataInputChanged(IODataComponent dataComponent, String connectionToApply) {
    List<ColumnNameChanged> columnNameList = dataComponent.getColumnNameChanged();
    if (columnNameList != null && columnNameList.size() > 0) {
        return;
    }
    // when delete columns,synchronization filed type
    IMetadataTable metadataTable = dataComponent.getTable();
    List<IMetadataColumn> listColumns = metadataTable.getListColumns();
    List<String> listNames = new ArrayList<String>();
    for (IMetadataColumn meta : listColumns) {
        listNames.add(meta.getLabel());
    }
    List<? extends IElementParameter> list = this.getElementParameters();
    // update sorcekeys
    IElementParameter param = getElementParameter(ScdParameterConstants.SOURCE_KEYS_PARAM_NAME);
    List<Map<String, String>> sorcevalues = (List<Map<String, String>>) param.getValue();
    updateFileds(listNames, list, sorcevalues, param, null);
    // update zero filed type
    IElementParameter useL0 = getElementParameter(ScdParameterConstants.USE_L0);
    if (useL0 != null && useL0.getValue().equals(Boolean.TRUE)) {
        IElementParameter l0FieldsParam = getElementParameter(ScdParameterConstants.L0_FIELDS_PARAM_NAME);
        List<Map<String, String>> values = (List<Map<String, String>>) l0FieldsParam.getValue();
        updateFileds(listNames, list, values, l0FieldsParam, useL0);
    }
    // update one filed type
    IElementParameter useL1 = getElementParameter(ScdParameterConstants.USE_L1);
    if (useL1 != null && useL1.getValue().equals(Boolean.TRUE)) {
        IElementParameter l1FieldsParam = getElementParameter(ScdParameterConstants.L1_FIELDS_PARAM_NAME);
        List<Map<String, String>> values = (List<Map<String, String>>) l1FieldsParam.getValue();
        updateFileds(listNames, list, values, l1FieldsParam, useL1);
    }
    // update two filed type
    IElementParameter useL2 = getElementParameter(ScdParameterConstants.USE_L2);
    if (useL2 != null && useL2.getValue().equals(Boolean.TRUE)) {
        IElementParameter l2FieldsParam = getElementParameter(ScdParameterConstants.L2_FIELDS_PARAM_NAME);
        List<Map<String, String>> values = (List<Map<String, String>>) l2FieldsParam.getValue();
        updateFileds(listNames, list, values, l2FieldsParam, useL2);
    }
    // update three filed type
    IElementParameter useL3 = getElementParameter(ScdParameterConstants.USE_L3);
    if (useL3 != null && useL3.getValue().equals(Boolean.TRUE)) {
        IElementParameter l3FieldsParam = getElementParameter(ScdParameterConstants.L3_FIELDS_PARAM_NAME);
        List<Map<String, String>> values = (List<Map<String, String>>) l3FieldsParam.getValue();
        updateFileds(listNames, list, values, l3FieldsParam, useL3);
    }
}
Also used : ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ColumnNameChanged(org.talend.core.model.metadata.ColumnNameChanged) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map)

Aggregations

ColumnNameChanged (org.talend.core.model.metadata.ColumnNameChanged)16 ArrayList (java.util.ArrayList)13 List (java.util.List)8 Map (java.util.Map)7 HashMap (java.util.HashMap)5 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)5 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)4 IElementParameter (org.talend.core.model.process.IElementParameter)4 INode (org.talend.core.model.process.INode)4 ColumnNameChangedExt (org.talend.core.model.metadata.ColumnNameChangedExt)3 IConnection (org.talend.core.model.process.IConnection)3 INodeConnector (org.talend.core.model.process.INodeConnector)3 Node (org.talend.designer.core.ui.editor.nodes.Node)3 IODataComponent (org.talend.core.model.components.IODataComponent)2 Process (org.talend.designer.core.ui.editor.process.Process)2 JSONObject (org.talend.utils.json.JSONObject)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 EList (org.eclipse.emf.common.util.EList)1 Point (org.eclipse.swt.graphics.Point)1