/** * create ProcessDescription and set it. * * <p>WARNING ::field FieldSeparator, RowSeparator, EscapeChar and TextEnclosure are surround by * double quote. * * @return processDescription */ private ProcessDescription getProcessDescription( SalesforceSchemaConnection originalValueConnection) { ProcessDescription processDescription = ShadowProcessHelper.getProcessDescription(originalValueConnection); SalesforceSchemaBean bean = new SalesforceSchemaBean(); bean.setWebServerUrl(originalValueConnection.getWebServiceUrl()); bean.setUserName(originalValueConnection.getUserName()); bean.setPassword( originalValueConnection.getValue(originalValueConnection.getPassword(), false)); bean.setModuleName(originalValueConnection.getModuleName()); bean.setQueryCondition(originalValueConnection.getQueryCondition()); // add for feature 7507 bean.setBatchSize(originalValueConnection.getBatchSize()); bean.setUseProxy(originalValueConnection.isUseProxy()); bean.setUesHttp(originalValueConnection.isUseHttpProxy()); bean.setProxyHost(originalValueConnection.getProxyHost()); bean.setProxyPort(originalValueConnection.getProxyPort()); bean.setProxyUsername(originalValueConnection.getProxyUsername()); bean.setProxyPassword( originalValueConnection.getValue(originalValueConnection.getProxyPassword(), false)); processDescription.setSalesforceSchemaBean(bean); List<IMetadataTable> tableSchema = new ArrayList<IMetadataTable>(); IMetadataTable tableGet = getMetadatasForSalesforce( bean.getWebServerUrl(), bean.getUserName(), bean.getPassword(), String.valueOf(bean.getTimeOut()), bean.getModuleName(), bean.getBatchSize(), bean.isUseProxy(), bean.isUesHttp(), bean.getProxyHost(), bean.getProxyPort(), bean.getProxyUsername(), bean.getProxyPassword(), false); IMetadataTable table = new org.talend.core.model.metadata.MetadataTable(); List<IMetadataColumn> schema = new ArrayList<IMetadataColumn>(); for (IMetadataColumn column : tableGet.getListColumns()) { schema.add(column.clone()); } table.setTableName("tSalesforceInput"); // $NON-NLS-1$ table.setListColumns(schema); tableSchema.add(table); processDescription.setSchema(tableSchema); processDescription.setEncoding(TalendQuoteUtils.addQuotes("ISO-8859-15")); // $NON-NLS-1$ return processDescription; }
@Override public void undo() { propagateDatas(false); if (currentInputMetadata != null) { if (!currentInputMetadata.sameMetadataAs(oldInputMetadata, IMetadataColumn.OPTIONS_NONE)) { currentInputMetadata.setListColumns(oldInputMetadata.getListColumns()); if (inputWasRepository) { inputNode.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.REPOSITORY); } } } if (!currentOutputMetadata.sameMetadataAs(oldOutputMetadata, IMetadataColumn.OPTIONS_NONE)) { List<IMetadataColumn> currentColumns = new ArrayList<IMetadataColumn>(oldOutputMetadata.getListColumns()); currentOutputMetadata.setListColumns(currentColumns); MetadataToolHelper.copyTable(oldOutputMetadata, currentOutputMetadata); } for (INodeConnector connector : node.getListConnector()) { if ((!connector.getName().equals(currentConnector)) && connector.getBaseSchema().equals(currentConnector)) { MetadataToolHelper.copyTable( oldOutputMetadata, node.getMetadataFromConnector(connector.getName())); } } if (outputWasRepository) { node.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(), EmfComponent.REPOSITORY); } for (ChangeMetadataCommand cmd : propagatedChange) { cmd.undo(); } List<ColumnNameChanged> columnNameChanged = MetadataToolHelper.getColumnNameChanged(oldOutputMetadata, newOutputMetadata); ColumnListController.updateColumnList(node, columnNameChanged, true); // newOutputMetadata.setListColumns(new // ArrayList<IMetadataColumn>(oldOutputMetadata.getListColumns())); if (!internal) { updateColumnList(newOutputMetadata, oldOutputMetadata); ((Process) node.getProcess()).checkProcess(); } refreshMetadataChanged(); }