/* * use to synchronize column list for output connections. */ private void syncOutputNodeColumnsList(List<ColumnNameChanged> columnNameChanged) { if (outputdataContainer == null) { return; } for (IConnection conn : node.getOutgoingConnections()) { INode targetNode = conn.getTarget(); EConnectionType connStyle = conn.getLineStyle(); if (EConnectionType.FLOW_MAIN.equals(connStyle) || EConnectionType.FLOW_MERGE.equals(connStyle) || EConnectionType.FLOW_REF.equals(connStyle)) { ColumnListController.updateColumnList(targetNode, columnNameChanged); // fix for TDI-23202 // reset value in order to call "firePropertyChange(RETURNS_CHANGED, null, null)" IElementParameter defaultMap = targetNode.getElementParameter(EParameterName.DEFAULT_MAP.getName()); if (defaultMap != null) { if ("tFlowToIterate".equals(targetNode.getComponent().getName())) { // update target properties incase any old columns are removed IElementParameter elementParameter = targetNode.getElementParameter("MAP"); if (elementParameter != null) { Object value = elementParameter.getValue(); if (value instanceof List) { for (Object obj : (List) value) { if (obj instanceof Map) { Object object = ((Map) obj).get("VALUE"); if (newOutputMetadata != null && !newOutputMetadata.getListColumns().isEmpty()) { boolean found = false; for (IMetadataColumn column : newOutputMetadata.getListColumns()) { if (column.getLabel().equals(object)) { found = true; } } if (!found) { ((Map) obj) .put("VALUE", newOutputMetadata.getListColumns().get(0).getLabel()); } } else { ((Map) obj).put("VALUE", ""); } } } } } } targetNode.setPropertyValue(EParameterName.DEFAULT_MAP.getName(), defaultMap.getValue()); } } } }
public void init( INode node, IElementParameter schemaParam, IMetadataTable currentOutputMetadata, IMetadataTable newOutputMetadata) { this.node = node; this.schemaParam = schemaParam; if (schemaParam == null) { if (newOutputMetadata.getAttachedConnector() != null) { currentConnector = newOutputMetadata.getAttachedConnector(); } else { if (node.isELTComponent()) { currentConnector = EConnectionType.TABLE.getName(); } else { currentConnector = EConnectionType.FLOW_MAIN.getName(); } } for (IElementParameter param : node.getElementParameters()) { if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) && param.getContext().equals(currentConnector)) { this.schemaParam = param; } } } else { currentConnector = this.schemaParam.getContext(); } this.inputNode = null; this.currentInputMetadata = null; this.newInputMetadata = null; oldInputMetadata = null; this.currentOutputMetadata = currentOutputMetadata; if (this.currentOutputMetadata == null) { this.currentOutputMetadata = node.getMetadataFromConnector(currentConnector); } if (currentOutputMetadata == null && newOutputMetadata != null) { currentOutputMetadata = newOutputMetadata.clone(true); } oldOutputMetadata = this.currentOutputMetadata.clone(true); this.newOutputMetadata = newOutputMetadata.clone(true); this.newOutputMetadata.setReadOnly(this.currentOutputMetadata.isReadOnly()); initializeContainer(); setLabel(Messages.getString("ChangeMetadataCommand.changeMetadataValues")); // $NON-NLS-1$ }
public ChangeMetadataCommand( INode node, IElementParameter schemaParam, INode inputNode, IMetadataTable currentInputMetadata, IMetadataTable newInputMetadata, IMetadataTable currentOutputMetadata, IMetadataTable newOutputMetadata) { this.node = node; this.inputNode = inputNode; this.schemaParam = schemaParam; if (schemaParam == null) { currentConnector = EConnectionType.FLOW_MAIN.getName(); for (IElementParameter param : node.getElementParameters()) { if ((param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA)) && param.getContext().equals(currentConnector)) { this.schemaParam = param; } } } else { currentConnector = this.schemaParam.getContext(); } this.currentInputMetadata = currentInputMetadata; if (currentInputMetadata != null) { oldInputMetadata = currentInputMetadata.clone(); } else { oldInputMetadata = null; } this.newInputMetadata = newInputMetadata; this.currentOutputMetadata = currentOutputMetadata; if (this.currentOutputMetadata == null) { this.currentOutputMetadata = node.getMetadataFromConnector(currentConnector); } oldOutputMetadata = this.currentOutputMetadata.clone(); this.newOutputMetadata = newOutputMetadata; initializeContainer(); setLabel(Messages.getString("ChangeMetadataCommand.changeMetadataValues")); // $NON-NLS-1$ }