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);
}
}
Aggregations