From 70c79da7bebe597de1d82bc4db8a4a238ea9e3af Mon Sep 17 00:00:00 2001 From: trifonnt Date: Sun, 19 Apr 2009 07:49:47 +0000 Subject: [PATCH] FR: [2772451] Stabilization of Replication https://sourceforge.net/tracker/?func=detail&aid=2772451&group_id=176962&atid=879335 --- base/.classpath | 1 + .../adempiere/model/ExportModelValidator.java | 238 ++++++ base/src/org/adempiere/process/Export.java | 408 ++++++++++ .../process/ExportFormatGenerator.java | 329 ++++++++ .../process/rpl/IExportProcessor.java | 46 ++ .../process/rpl/exp/ExportHelper.java | 598 ++++++++++++++ .../process/rpl/exp/HDDExportProcessor.java | 119 +++ .../process/rpl/exp/MultiplePublisher.java | 61 ++ .../process/rpl/exp/TopicExportProcessor.java | 209 +++++ .../model/I_AD_ReplicationStrategy.java | 2 +- .../model/I_EXP_Format.java | 2 +- .../model/I_EXP_FormatLine.java | 4 +- .../model/I_EXP_Processor.java | 4 +- .../model/I_EXP_ProcessorParameter.java | 4 +- .../model/I_EXP_Processor_Type.java | 2 +- .../model/I_IMP_Processor.java | 4 +- .../model/I_IMP_ProcessorLog.java | 4 +- .../model/I_IMP_ProcessorParameter.java | 4 +- .../model/I_IMP_Processor_Type.java | 2 +- base/src/org/compiere/model/MEXPFormat.java | 215 +++++ .../org/compiere/model/MEXPFormatLine.java | 106 +++ .../src/org/compiere/model/MEXPProcessor.java | 101 +++ .../model/MEXPProcessorParameter.java | 59 ++ .../org/compiere/model/MEXPProcessorType.java | 59 ++ .../src/org/compiere/model/MIMPProcessor.java | 220 +++++ .../org/compiere/model/MIMPProcessorLog.java | 82 ++ .../compiere/model/MReplicationStrategy.java | 35 +- .../org/compiere/model/X_AD_Replication.java | 54 +- .../model/X_AD_ReplicationDocument.java | 10 +- .../model/X_AD_ReplicationStrategy.java | 55 +- .../compiere/model/X_AD_ReplicationTable.java | 11 +- .../compiere/model/X_AD_Replication_Log.java | 86 +- .../model/X_EXP_Format.java | 2 +- .../model/X_EXP_FormatLine.java | 10 +- .../model/X_EXP_Processor.java | 10 +- .../model/X_EXP_ProcessorParameter.java | 10 +- .../model/X_EXP_Processor_Type.java | 2 +- .../model/X_IMP_Processor.java | 10 +- .../model/X_IMP_ProcessorLog.java | 10 +- .../model/X_IMP_ProcessorParameter.java | 10 +- .../model/X_IMP_Processor_Type.java | 2 +- .../oracle/449_StabilizeReplication.sql | 174 ++++ .../oracle/450_ReplicationExampleData.sql | 407 ++++++++++ .../postgresql/449_StabilizeReplication.sql | 170 ++++ .../postgresql/450_ReplicationExampleData.sql | 405 ++++++++++ .../server/rpl/IImportProcessor.java | 57 ++ .../org/adempiere/server/rpl/XMLHelper.java | 140 ++++ .../server/rpl/imp/FileImportProcessor.java | 89 ++ .../server/rpl/imp/ImportHelper.java | 761 ++++++++++++++++++ .../server/rpl/imp/ModelImporter.java | 154 ++++ .../server/rpl/imp/TopicImportProcessor.java | 130 +++ .../server/rpl/imp/TopicListener.java | 318 ++++++++ .../org/compiere/server/AdempiereServer.java | 3 + .../compiere/server/AdempiereServerMgr.java | 14 +- .../compiere/server/ReplicationProcessor.java | 181 +++++ 55 files changed, 6030 insertions(+), 173 deletions(-) create mode 100644 base/src/org/adempiere/model/ExportModelValidator.java create mode 100644 base/src/org/adempiere/process/Export.java create mode 100644 base/src/org/adempiere/process/ExportFormatGenerator.java create mode 100644 base/src/org/adempiere/process/rpl/IExportProcessor.java create mode 100644 base/src/org/adempiere/process/rpl/exp/ExportHelper.java create mode 100644 base/src/org/adempiere/process/rpl/exp/HDDExportProcessor.java create mode 100644 base/src/org/adempiere/process/rpl/exp/MultiplePublisher.java create mode 100644 base/src/org/adempiere/process/rpl/exp/TopicExportProcessor.java rename base/src/org/{eevolution => compiere}/model/I_EXP_Format.java (99%) rename base/src/org/{eevolution => compiere}/model/I_EXP_FormatLine.java (98%) rename base/src/org/{eevolution => compiere}/model/I_EXP_Processor.java (97%) rename base/src/org/{eevolution => compiere}/model/I_EXP_ProcessorParameter.java (97%) rename base/src/org/{eevolution => compiere}/model/I_EXP_Processor_Type.java (99%) rename base/src/org/{eevolution => compiere}/model/I_IMP_Processor.java (98%) rename base/src/org/{eevolution => compiere}/model/I_IMP_ProcessorLog.java (97%) rename base/src/org/{eevolution => compiere}/model/I_IMP_ProcessorParameter.java (97%) rename base/src/org/{eevolution => compiere}/model/I_IMP_Processor_Type.java (99%) create mode 100644 base/src/org/compiere/model/MEXPFormat.java create mode 100644 base/src/org/compiere/model/MEXPFormatLine.java create mode 100644 base/src/org/compiere/model/MEXPProcessor.java create mode 100644 base/src/org/compiere/model/MEXPProcessorParameter.java create mode 100644 base/src/org/compiere/model/MEXPProcessorType.java create mode 100644 base/src/org/compiere/model/MIMPProcessor.java create mode 100644 base/src/org/compiere/model/MIMPProcessorLog.java rename base/src/org/{eevolution => compiere}/model/X_EXP_Format.java (99%) rename base/src/org/{eevolution => compiere}/model/X_EXP_FormatLine.java (96%) rename base/src/org/{eevolution => compiere}/model/X_EXP_Processor.java (93%) rename base/src/org/{eevolution => compiere}/model/X_EXP_ProcessorParameter.java (93%) rename base/src/org/{eevolution => compiere}/model/X_EXP_Processor_Type.java (99%) rename base/src/org/{eevolution => compiere}/model/X_IMP_Processor.java (95%) rename base/src/org/{eevolution => compiere}/model/X_IMP_ProcessorLog.java (93%) rename base/src/org/{eevolution => compiere}/model/X_IMP_ProcessorParameter.java (93%) rename base/src/org/{eevolution => compiere}/model/X_IMP_Processor_Type.java (99%) create mode 100644 migration/353a-trunk/oracle/449_StabilizeReplication.sql create mode 100644 migration/353a-trunk/oracle/450_ReplicationExampleData.sql create mode 100644 migration/353a-trunk/postgresql/449_StabilizeReplication.sql create mode 100644 migration/353a-trunk/postgresql/450_ReplicationExampleData.sql create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/IImportProcessor.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/XMLHelper.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/imp/FileImportProcessor.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/imp/ImportHelper.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/imp/ModelImporter.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicImportProcessor.java create mode 100644 serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java create mode 100644 serverRoot/src/main/server/org/compiere/server/ReplicationProcessor.java diff --git a/base/.classpath b/base/.classpath index e618a5af1b..73e4923954 100644 --- a/base/.classpath +++ b/base/.classpath @@ -23,5 +23,6 @@ + diff --git a/base/src/org/adempiere/model/ExportModelValidator.java b/base/src/org/adempiere/model/ExportModelValidator.java new file mode 100644 index 0000000000..ebb607752b --- /dev/null +++ b/base/src/org/adempiere/model/ExportModelValidator.java @@ -0,0 +1,238 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) * +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ + +package org.adempiere.model; + +import org.adempiere.process.rpl.exp.ExportHelper; +import org.compiere.model.MClient; +import org.compiere.model.MReplicationStrategy; +import org.compiere.model.MTable; +import org.compiere.model.ModelValidationEngine; +import org.compiere.model.ModelValidator; +import org.compiere.model.PO; +import org.compiere.model.X_AD_ReplicationDocument; +import org.compiere.model.X_AD_ReplicationTable; +import org.compiere.util.CLogger; + + +/** + * Export Validator which is responsible to create XML document. + * + * @author Trifon Trifonov + * @version $Id$ + */ +public class ExportModelValidator implements ModelValidator +{ + + /** Logger */ + private static CLogger log = CLogger.getCLogger(ExportModelValidator.class); + + /** Client */ + private int m_AD_Client_ID = -1; + + /** Organization */ + private int m_AD_Org_ID = -1; + + /** Role */ + private int m_AD_Role_ID = -1; + + /** User */ + private int m_AD_User_ID = -1; + + /** Replication Strategy **/ + private int m_AD_ReplicationStrategy_ID = -1; + + /** Export Helper */ + ExportHelper expHelper = null; + + /** + * Constructor. + * The class is instantiated when logging in and client is selected/known + */ + public ExportModelValidator () + { + super (); + } + + /** + * Initialize Validation + * @param engine validation engine + * @param client client + */ + public void initialize (ModelValidationEngine engine, MClient client) + { + m_AD_Client_ID = client.getAD_Client_ID(); + log.info(client.toString()); + + MReplicationStrategy rplStrategy = null; + + m_AD_ReplicationStrategy_ID = client.getAD_ReplicationStrategy_ID(); + log.info("client.getAD_ReplicationStrategy_ID() = " + m_AD_ReplicationStrategy_ID); + + if (m_AD_ReplicationStrategy_ID > 0) { + rplStrategy = new MReplicationStrategy(client.getCtx(), m_AD_ReplicationStrategy_ID, null); + expHelper = new ExportHelper(client, rplStrategy); + } + // Add Tables + // We want to be informed when records in Replication tables are created/updated/deleted! + //engine.addModelChange(MBPartner.Table_Name, this); + //engine.addModelChange(MOrder.Table_Name, this); + //engine.addModelChange(MOrderLine.Table_Name, this); + if (rplStrategy != null) { + + for (X_AD_ReplicationTable rplTable : rplStrategy.getReplicationTables()) { + if (X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(rplTable.getReplicationType()) + || X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(rplTable.getReplicationType())) + { + MTable table = MTable.get (client.getCtx(), rplTable.getAD_Table_ID()); + engine.addModelChange(table.getTableName(), this); + } + } + } + // Add Documents + // We want to be informed when Replication documents are created/updated/deleted! + if (rplStrategy != null) { + for (X_AD_ReplicationDocument rplDocument : rplStrategy.getReplicationDocuments()) { + if (X_AD_ReplicationDocument.REPLICATIONTYPE_Merge.equals(rplDocument.getReplicationType()) + || X_AD_ReplicationDocument.REPLICATIONTYPE_Reference.equals(rplDocument.getReplicationType())) + { + //MDocType docType = MDocType.get(client.getCtx(), rplDocuments[i].getC_DocType_ID()); + MTable table = MTable.get (client.getCtx(), rplDocument.getAD_Table_ID()); + engine.addDocValidate(table.getTableName(), this); + } + } + } + + } + + /** + * Model Change of a monitored Table. + * Called after PO.beforeSave/PO.beforeDelete + * @param po persistent object + * @param type TYPE_ + * @return error message or null + * @exception Exception if the recipient wishes the change to be not accept. + */ + public String modelChange (PO po, int type) throws Exception + { + //String Mode = "Table"; + log.info("po.get_TableName() = " + po.get_TableName()); + if (expHelper != null) { + if ( type == TYPE_AFTER_CHANGE + || type == TYPE_AFTER_NEW + || type == TYPE_BEFORE_DELETE) // After Change or After New + { + expHelper.exportRecord( po, + MReplicationStrategy.REPLICATION_TABLE, + MReplicationStrategy.getReplicationTable(po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()).getReplicationType(), + type); + } + } + + return null; + } + + /** + * Validate Document. + * Called as first step of DocAction.prepareIt + * when you called addDocValidate for the table. + * @param po persistent object + * @param type see TIMING_ constants + * @return error message or null + * @throws Exception + */ + public String docValidate (PO po, int type) + { + log.info("po.get_TableName() = " + po.get_TableName()); + String result = null; + if (expHelper != null) { + try { + if ( type == TIMING_AFTER_COMPLETE + || type == TIMING_AFTER_CLOSE + || type == TIMING_AFTER_REVERSECORRECT + || type == TIMING_AFTER_VOID + || type == TIMING_AFTER_VOID + || type == TIMING_AFTER_PREPARE + ) + { + expHelper.exportRecord( po, + MReplicationStrategy.REPLICATION_DOCUMENT , + MReplicationStrategy.getReplicationDocument(po.getCtx(), m_AD_ReplicationStrategy_ID, po.get_Table_ID()).getReplicationType(), + type); + + } + } catch (Exception e) { + e.printStackTrace(); + result = e.toString(); + } + } + return result; + } + + /** + * User Login. + * Called when preferences are set + * @param AD_Org_ID org + * @param AD_Role_ID role + * @param AD_User_ID user + * @return error message or null + */ + public String login (int AD_Org_ID, int AD_Role_ID, int AD_User_ID) + { + m_AD_Org_ID = AD_Org_ID; + m_AD_Role_ID = AD_Role_ID; + m_AD_User_ID = AD_User_ID; + + log.info("AD_Org_ID =" + m_AD_Org_ID); + log.info("AD_Role_ID =" + m_AD_Role_ID); + log.info("AD_User_ID =" + m_AD_User_ID); + return null; + } + + + /** + * Get Client to be monitored + * @return AD_Client_ID client + */ + public int getAD_Client_ID() + { + return m_AD_Client_ID; + } + + /** + * String Representation + * @return info + */ + public String toString () + { + StringBuffer sb = new StringBuffer (ExportModelValidator.class.getName()); + return sb.toString(); + } + +} diff --git a/base/src/org/adempiere/process/Export.java b/base/src/org/adempiere/process/Export.java new file mode 100644 index 0000000000..d361d6b183 --- /dev/null +++ b/base/src/org/adempiere/process/Export.java @@ -0,0 +1,408 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.adempiere.process; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.logging.Level; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.compiere.model.MClient; +import org.compiere.model.MColumn; +import org.compiere.model.MEXPFormat; +import org.compiere.model.MEXPFormatLine; +import org.compiere.model.MTable; +import org.compiere.model.PO; +import org.compiere.model.X_EXP_FormatLine; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * + * @author Trifon Trifonov + * @version $Id: $ + */ +public class Export extends SvrProcess +{ + private static final String TOTAL_SEGMENTS = "${totalSegments}"; + + /** Client Parameter */ + protected int p_AD_Client_ID = 0; + + /** Table Parameter */ + protected int p_AD_Table_ID = 0; + + /** Record ID */ + protected int p_Record_ID = 0; + + /** XML Document */ + private Document outDocument = null; + + /** Date Time Format */ +// private SimpleDateFormat m_dateTimeFormat = null; + + /** Date Format */ +// private SimpleDateFormat m_dateFormat = null; + + /** Custom Date Format */ +// private SimpleDateFormat m_customDateFormat = null; + + /** Table ID */ + int AD_Table_ID = 0; + + /** + * Get Parameters + */ + protected void prepare () + { + + p_Record_ID = getRecord_ID(); + if (p_AD_Client_ID == 0) + p_AD_Client_ID = Env.getAD_Client_ID(getCtx()); + AD_Table_ID = getTable_ID(); + + // C_Invoice; AD_Table_ID = 318 + StringBuffer sb = new StringBuffer ("AD_Table_ID=").append(AD_Table_ID); + sb.append("; Record_ID=").append(getRecord_ID()); + // Parameter + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("AD_Table_ID")) + p_AD_Table_ID = para[i].getParameterAsInt(); + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + + // TODO - we can get Language from Business Partner +// m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Env.getLanguage(getCtx())); +// m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Env.getLanguage(getCtx())); + // + log.info(sb.toString()); + } + + // create new Document + Document createNewDocument() throws ParserConfigurationException { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + return documentBuilder.newDocument(); + + } + + /** + * Process - Generate Export Format + * @return info + */ + @SuppressWarnings("unchecked") + protected String doIt () throws Exception + { + outDocument = createNewDocument(); + + MClient client = MClient.get (getCtx(), p_AD_Client_ID); + log.info(client.toString()); + // TODO - get proper Export Format! + int EXP_Format_ID = 1000000; + + MTable table = MTable.get(getCtx(), AD_Table_ID); + log.info("Table = " + table); + PO po = table.getPO (p_Record_ID, get_TrxName()); + + if (po.get_KeyColumns().length > 1 || po.get_KeyColumns().length < 1) { + throw new Exception(Msg.getMsg (getCtx(), "ExportMultiColumnNotSupported")); + } + MEXPFormat exportFormat = new MEXPFormat(getCtx(), EXP_Format_ID, get_TrxName()); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(table.getTableName()).append(" ") + .append("WHERE ").append(po.get_KeyColumns()[0]).append("=?") + ; + + if (exportFormat.getWhereClause() != null & !"".equals(exportFormat.getWhereClause())) { + sql.append(" AND ").append(exportFormat.getWhereClause()); + } + + ResultSet rs = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); + pstmt.setInt(1, p_Record_ID); + rs = pstmt.executeQuery(); + if (rs.next()) + { + HashMap variableMap = new HashMap(); + variableMap.put(TOTAL_SEGMENTS, new Integer(1)); + + Element rootElement = outDocument.createElement(exportFormat.getValue()); + rootElement.appendChild(outDocument.createComment(exportFormat.getDescription())); + outDocument.appendChild(rootElement); + generateExportFormat(rootElement, exportFormat, rs, po, p_Record_ID, variableMap); + } + + } finally { + try { + if (rs != null) rs.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) {/*ignored*/} + rs = null; + pstmt = null; + } + +/* int C_EDIProcessorType_ID = ediProcessor.getC_EDIProcessorType_ID(); + X_C_EDIProcessorType ediProcessType = new X_C_EDIProcessorType(getCtx(), C_EDIProcessorType_ID, get_TrxName() ); + + String javaClass = ediProcessType.getJavaClass(); + try { + Class clazz = Class.forName(javaClass); + IOutbandEdiProcessor outbandProcessor = (IOutbandEdiProcessor)clazz.newInstance(); + + outbandProcessor.process(getCtx(), ediProcessor, result.toString(), "C_Invoice-"+p_Record_ID+".txt", Trx.get( get_TrxName(), false )); + } catch (Exception e) { + result = new StringBuffer( e.toString() ); + } +*/ + addLog(0, null, null, Msg.getMsg (getCtx(), "ExportProcessResult") + "\n" + outDocument.toString()); + return outDocument.toString(); + } + + + /* + * Trifon Generate Export Format process; RESULT = + * + * 101 + * + */ + private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, ResultSet rs, PO masterPO, int masterID, HashMap variableMap) throws SQLException, Exception + { + MEXPFormatLine[] formatLines = (MEXPFormatLine[]) exportFormat.getFormatLines(); + @SuppressWarnings("unused") + boolean elementHasValue = false; + + for (int i = 0; i < formatLines.length; i++) { + if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_XMLElement) ) { + // process single XML Attribute + // Create new element + Element newElement = outDocument.createElement(formatLines[i].getValue()); + + if (formatLines[i].getAD_Column_ID() == 0) { + throw new Exception(Msg.getMsg (getCtx(), "EXPColumnMandatory")); + } + MColumn column = MColumn.get(getCtx(), formatLines[i].getAD_Column_ID()); + if (column == null) { + throw new Exception(Msg.getMsg (getCtx(), "EXPColumnMandatory")); + } + if ( column.isVirtualColumn() ) { + log.info("This is Virtual Column!"); + } else { } + //log.info("["+column.getColumnName()+"]"); + + Object value = rs.getObject(column.getColumnName()); + String valueString = null; + if (value != null) { + valueString = value.toString(); + } else { + if (formatLines[i].isMandatory()) { + throw new Exception(Msg.getMsg (getCtx(), "EXPFieldMandatory")); + } + } +/* if (column.getAD_Reference_ID() == DisplayType.Date) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateFormat.format (Timestamp.valueOf (valueString)); + } + + } + } else if (column.getAD_Reference_ID() == DisplayType.DateTime) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateTimeFormat.format (Timestamp.valueOf (valueString)); + } + } + }*/ + log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); + if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { + Text newText = outDocument.createTextNode(valueString); + newElement.appendChild(newText); + rootElement.appendChild(newElement); + elementHasValue = true; + //increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable + //increaseVariable(variableMap, TOTAL_SEGMENTS); + } else { + // Empty field. + } + } else if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_XMLAttribute) ) { + // process single XML Attribute +/* // Create new element + Element newElement = outDocument.createElement(formatLines[i].getValue()); + if (hasContent) { + rootElement.appendChild(newElement); + }*/ + if (formatLines[i].getAD_Column_ID() == 0) { + throw new Exception(Msg.getMsg (getCtx(), "EXPColumnMandatory")); + } + MColumn column = MColumn.get(getCtx(), formatLines[i].getAD_Column_ID()); + if (column == null) { + throw new Exception(Msg.getMsg (getCtx(), "EXPColumnMandatory")); + } + if ( column.isVirtualColumn() ) { + log.info("This is Virtual Column!"); + } else { } + //log.info("["+column.getColumnName()+"]"); + + Object value = rs.getObject(column.getColumnName()); + String valueString = null; + if (value != null) { + valueString = value.toString(); + } else { + if (formatLines[i].isMandatory()) { + throw new Exception(Msg.getMsg (getCtx(), "EXPFieldMandatory")); + } + } +/* if (column.getAD_Reference_ID() == DisplayType.Date) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateFormat.format (Timestamp.valueOf (valueString)); + } + + } + } else if (column.getAD_Reference_ID() == DisplayType.DateTime) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateTimeFormat.format (Timestamp.valueOf (valueString)); + } + } + }*/ + log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); + if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { + rootElement.setAttribute(formatLines[i].getValue(), valueString); + elementHasValue = true; + //increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable + //increaseVariable(variableMap, TOTAL_SEGMENTS); + } else { + // Empty field. + } + } else if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_EmbeddedEXPFormat) ) { + // process Embedded Export Format + + int embeddedFormat_ID = formatLines[i].getEXP_EmbeddedFormat_ID(); + MEXPFormat embeddedFormat = new MEXPFormat(getCtx(), embeddedFormat_ID, get_TrxName()); + + MTable tableEmbedded = MTable.get(getCtx(), embeddedFormat.getAD_Table_ID()); + log.info("Table Embedded = " + tableEmbedded); + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(tableEmbedded.getTableName()).append(" ") + .append("WHERE ").append(masterPO.get_KeyColumns()[0]).append("=?") + //+ "WHERE " + po.get_WhereClause(false) + ; + if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) { + sql.append(" AND ").append(embeddedFormat.getWhereClause()); + } + ResultSet rsEmbedded = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), get_TrxName()); + pstmt.setInt(1, masterID); + rsEmbedded = pstmt.executeQuery(); + while (rsEmbedded.next()) + { + //System.out.println("Trifon - tableEmbedded.getTableName()_ID = "+ tableEmbedded.getTableName() + "_ID"); + int embeddedID = rsEmbedded.getInt(tableEmbedded.getTableName() + "_ID"); + PO poEmbedded = tableEmbedded.getPO (embeddedID, get_TrxName()); + + Element embeddedElement = outDocument.createElement(formatLines[i].getValue()); + embeddedElement.appendChild(outDocument.createComment(formatLines[i].getDescription())); + generateExportFormat(embeddedElement, embeddedFormat, rsEmbedded, poEmbedded, embeddedID, variableMap); + rootElement.appendChild(embeddedElement); + } + + } finally { + try { + if (rsEmbedded != null) rsEmbedded.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) { } + rsEmbedded = null; + pstmt = null; + } + + } else { + throw new Exception(Msg.getMsg (getCtx(), "EXPUnknownLineType")); + } + } + } + + /** + * @param variableMap + * @param variableName + */ + @SuppressWarnings("unused") + private void increaseVariable(HashMap variableMap, String variableName) { + if (variableName != null && !"".equals(variableName) ) { + Integer var = variableMap.get(variableName); + if (var == null) { + var = new Integer(0); + } + int intValue = var.intValue(); + intValue++; + variableMap.put(variableName, new Integer(intValue)); + } + } + +} diff --git a/base/src/org/adempiere/process/ExportFormatGenerator.java b/base/src/org/adempiere/process/ExportFormatGenerator.java new file mode 100644 index 0000000000..aafbfe9a03 --- /dev/null +++ b/base/src/org/adempiere/process/ExportFormatGenerator.java @@ -0,0 +1,329 @@ +/****************************************************************************** + * Product: Adempiere ERP & CRM Smart Business Solution * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. * + * Contributor(s): Victor Perez www.e-evolution.com * + *****************************************************************************/ +package org.adempiere.process; + +import java.math.*; +import java.sql.*; +import java.util.*; +import java.util.logging.*; + +import org.compiere.model.*; +import org.compiere.util.*; +import org.compiere.process.*; + +import org.eevolution.model.*; + + + +/** + * Create a Export Format from a Window + * + * @author Victor Perez www.e-evolution.com + * @version $Id: ExportFormatGenerator.java,v 1.0 + */ +public class ExportFormatGenerator extends SvrProcess +{ + + private int p_AD_Window_ID = 0; + private boolean p_IsMandatory = false; + private boolean p_IsInsertRecord= false; + private Hashtable m_formats = new Hashtable(); + private String m_parent_table = null; + private String m_format_value = null; + private int m_level = -1; + + /** + * Prepare - e.g., get Parameters. + */ + protected void prepare() + { + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) + { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("AD_Window_ID")) + p_AD_Window_ID = para[i].getParameterAsInt(); + else if (name.equals("IsMandatory")) + { + p_IsMandatory = "Y".equals(para[i].getParameter()); + } + else if (name.equals("IsInsertRecord")) + { + p_IsInsertRecord = "Y".equals(para[i].getParameter()); + } + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + } // prepare + + /** + * Generate Export Format + * @return info + * @throws Exception + */ + protected String doIt () throws Exception + { + MWindow window = new MWindow(getCtx(),p_AD_Window_ID, get_TrxName()); + MTab[] tabs = window.getTabs(true, get_TrxName()); + + + for(MTab tab:tabs) + { + MTable table = null; + String format = null; + if(tab.isActive()) + { + if(p_IsInsertRecord&tab.isInsertRecord()) + { + table = new MTable(getCtx(), tab.getAD_Table_ID(), get_TrxName()); + format = createFormat(table); + } + else if(!p_IsInsertRecord) + { + table = new MTable(getCtx(), tab.getAD_Table_ID(), get_TrxName()); + format = createFormat(table); + }else + continue; + + if (tab.getTabLevel() > m_level) + { + m_parent_table = table.getTableName(); + m_format_value = format; + } + } + } + return "ok"; + } // doIt + + private String createFormat(MTable table) throws Exception + { + log.info("Table Name:"+table.getTableName()); + MColumn[] cols = table.getColumns(true); + String unique = null; + boolean fieldname = false; + for(MColumn col : cols) + { + if(col.isIdentifier() && col.getSeqNo() == 1) + { + unique = col.getColumnName(); + if(unique.equals("Name")) + fieldname = true; + log.info("Unique Key"+unique); + break; + } + } + + if (unique==null) + unique="Name"; + + MEXPFormat format = null; + //String formatValue = table.getTableName()+"_"+unique; + String formatValue = table.getTableName(); + log.info("Export Format Value:"+formatValue); + format = (MEXPFormat) m_formats.get(formatValue); + if (format != null) + return format.getValue(); + + String where=" value = ? "; + Query sql = new Query(getCtx(),MEXPFormat.Table_Name,where,null).setParameters(new Object[]{formatValue}); + if(sql.match()) + { + format = (MEXPFormat) sql.first(); + m_formats.put(format.getValue(), format); + return format.getValue(); + } + + format = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(getCtx(), formatValue, getAD_Client_ID(), "1", get_TrxName()); + if(format == null) + format = new MEXPFormat(getCtx(), 0 , get_TrxName()); + + format.setValue(formatValue); + format.setName(table.getName()); + format.setAD_Table_ID(table.getAD_Table_ID()); + format.setDescription(table.getDescription()); + format.setHelp(table.getHelp()); + format.setVersion("1"); + format.save(); + if (format != null) + m_formats.put(format.getValue(), format); + + int position = 10; + for(MColumn col : cols) + { + if(p_IsMandatory) + { + if(col.isMandatory()) + createFormatLine(format, table, col, position,false); + } + else + createFormatLine(format, table, col, position,false); + position++; + } + return format.getValue(); + } + + private int createFormatLine(MEXPFormat format, MTable table, MColumn col, int position,boolean force) throws Exception + { + + MEXPFormatLine format_line =null; + String formatlinevalue= col.getColumnName(); + format_line = MEXPFormatLine.getFormatLineByValue(getCtx(),formatlinevalue ,format.getEXP_Format_ID(),get_TrxName()); + if(format_line==null) + format_line = new MEXPFormatLine(getCtx(),0,get_TrxName()); + + format_line.setEXP_Format_ID(format.getEXP_Format_ID()); + format_line.setValue(formatlinevalue); + format_line.setName(col.getName()); + format_line.setDescription(col.getDescription()); + format_line.setHelp(col.getHelp()); + format_line.setPosition(position); + format_line.setIsMandatory(col.isMandatory()); + if(force||col.isIdentifier()) + { + format_line.setIsPartUniqueIndex(true); + format_line.setIsActive(true); + } + else + format_line.setIsActive(false); + MTable tabledir = null; + + if(col.getColumnName().equals(m_parent_table+"_ID")&(col.getAD_Reference_ID()==DisplayType.Search|col.getAD_Reference_ID()==DisplayType.TableDir)) + { + MEXPFormat referenceFormat = null; + referenceFormat = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(getCtx(), m_parent_table+"_Key", getAD_Client_ID(), "1", get_TrxName()); + if(referenceFormat == null) + referenceFormat = new MEXPFormat(getCtx(), 0 , get_TrxName()); + referenceFormat.setValue(m_parent_table+"_Key"); + referenceFormat.setName(m_parent_table+"_Key"); + referenceFormat.setAD_Table_ID(table.getAD_Table_ID()); + referenceFormat.setDescription(table.getDescription()); + referenceFormat.setHelp(table.getHelp()); + referenceFormat.setVersion("1"); + referenceFormat.save(); + + int AD_Column_ID=DB.getSQLValue(get_TrxName(), "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=(SELECT AD_Table_ID FROM AD_Table WHERE TableName=?) AND UPPER(ColumnName)='DOCUMENTNO'",m_parent_table); + if(AD_Column_ID>0) + { + //used if the export format is a document like invoice, etc. + createFormatLine(referenceFormat, table, new MColumn(getCtx(),AD_Column_ID,get_TrxName()), 10,true); + AD_Column_ID=0; + AD_Column_ID=DB.getSQLValue(get_TrxName(), "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=(SELECT AD_Table_ID FROM AD_Table WHERE TableName=?) AND UPPER(ColumnName)='C_DOCTYPE_ID'",m_parent_table); + if(AD_Column_ID>0) + createFormatLine(referenceFormat, table, new MColumn(getCtx(),AD_Column_ID,get_TrxName()), 20,true); + + format_line.setValue(m_parent_table+"_DocumentNo_C_DocType_Key"); + format_line.setName("Key DocumentNo_C_DocType"); + format_line.setAD_Column_ID(col.getAD_Column_ID()); + format_line.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat); + format_line.setEXP_EmbeddedFormat_ID(referenceFormat.getEXP_Format_ID()); + format_line.save(); + return format_line.getEXP_FormatLine_ID(); + }else + { + AD_Column_ID=DB.getSQLValue(get_TrxName(), "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=(SELECT AD_Table_ID FROM AD_Table WHERE TableName=?) AND UPPER(ColumnName)='NAME'",m_parent_table); + if(AD_Column_ID>0) + createFormatLine(referenceFormat, table, new MColumn(getCtx(),AD_Column_ID,get_TrxName()), 10,true); + else + { + AD_Column_ID=DB.getSQLValue(get_TrxName(), "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=(SELECT AD_Table_ID FROM AD_Table WHERE TableName=?) AND UPPER(ColumnName)='VALUE'",m_parent_table); + if(AD_Column_ID>0) + createFormatLine(referenceFormat, table, new MColumn(getCtx(),AD_Column_ID,get_TrxName()), 10,true); + else + throw new Exception("Table without name or value column"); + } + format_line.setValue(m_parent_table+"_Key"); + format_line.setName("Key "+ col.getColumnName()); + format_line.setAD_Column_ID(col.getAD_Column_ID()); + format_line.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat); + format_line.setEXP_EmbeddedFormat_ID(referenceFormat.getEXP_Format_ID()); + format_line.save(); + return format_line.getEXP_FormatLine_ID(); + } + } + + if((col.getAD_Reference_ID()==DisplayType.Table||col.getAD_Reference_ID()==DisplayType.Search)&col.getAD_Reference_Value_ID()>0) + { + int AD_Table_ID = DB.getSQLValue(get_TrxName(), "SELECT rt.AD_Table_ID FROM AD_Reference r INNER JOIN AD_Ref_Table rt ON (r.AD_Reference_ID=rt.AD_Reference_ID) WHERE r.AD_Reference_ID=?", col.getAD_Reference_Value_ID()); + if (AD_Table_ID > 0) + { + tabledir = MTable.get(getCtx(), AD_Table_ID); + format_line.setValue(col.getColumnName()+"_Reference"); + format_line.setName("Referenced "+ tabledir.getTableName()); + format_line.setAD_Column_ID(col.getAD_Column_ID()); + String format_value = createFormat(tabledir); + int embedded = ((MEXPFormat)m_formats.get(format_value)).getEXP_Format_ID(); + format_line.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat); + format_line.setEXP_EmbeddedFormat_ID(embedded); + format_line.save(); + return format_line.getEXP_FormatLine_ID(); + } + + } + + if((col.getAD_Reference_ID()==DisplayType.TableDir & col.isKey()== false) || (col.getAD_Reference_ID()==DisplayType.TableDir & col.isParent() == true)) + { + + String tableName = col.getColumnName().substring(0, col.getColumnName().lastIndexOf("_ID")); + log.info("Table Name:"+tableName); + + if(tableName==null) + log.info("Table Name: null"); + + tabledir = MTable.get(getCtx(), tableName); + if(tabledir==null) + throw new Exception ("Ilegal Table Name"); + + format_line.setValue(tabledir.getTableName()+"_Reference"); + format_line.setName("Referenced "+ tabledir.getTableName()); + + if (tabledir!=null) + { + if(m_parent_table != null) + { + if (col.isParent() && col.getColumnName().contains(m_parent_table)) + { + + int embedded = ((MEXPFormat)m_formats.get(m_format_value)).getEXP_Format_ID(); + format_line.setValue(format.getValue()+"_Embedded"); + format_line.setName("Embedded "+ format.getName()); + format_line.setEXP_EmbeddedFormat_ID(format_line.getEXP_Format_ID()); + format_line.setEXP_Format_ID(embedded); + format_line.setType(MEXPFormatLine.TYPE_EmbeddedEXPFormat); + format_line.setAD_Column_ID(col.getAD_Column_ID()); + format_line.save(); + log.info("Export Format Line:"+format_line.getName()); + return format_line.getEXP_FormatLine_ID(); + + } + } + String format_value = createFormat(tabledir); + int embedded = ((MEXPFormat)m_formats.get(format_value)).getEXP_Format_ID(); + format_line.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat); + format_line.setEXP_EmbeddedFormat_ID(embedded); + } + else + format_line.setType(MEXPFormatLine.TYPE_XMLElement); + } + + format_line.setAD_Column_ID(col.getAD_Column_ID()); + format_line.save(); + log.info("Export Format Line:"+format_line.getName()); + return format_line.getEXP_FormatLine_ID(); + + } +} // Generate Export Format diff --git a/base/src/org/adempiere/process/rpl/IExportProcessor.java b/base/src/org/adempiere/process/rpl/IExportProcessor.java new file mode 100644 index 0000000000..3953464fa6 --- /dev/null +++ b/base/src/org/adempiere/process/rpl/IExportProcessor.java @@ -0,0 +1,46 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) * +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ + +package org.adempiere.process.rpl; + +import java.util.Properties; + +import org.compiere.model.MEXPProcessor; +import org.compiere.util.Trx; +import org.w3c.dom.Document; + +/** + * @author Trifon N. Trifonov + */ +public interface IExportProcessor { + + public void process(Properties ctx, MEXPProcessor expProcessor, Document document, Trx trx) + throws Exception; + +} diff --git a/base/src/org/adempiere/process/rpl/exp/ExportHelper.java b/base/src/org/adempiere/process/rpl/exp/ExportHelper.java new file mode 100644 index 0000000000..858bd93c17 --- /dev/null +++ b/base/src/org/adempiere/process/rpl/exp/ExportHelper.java @@ -0,0 +1,598 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * - Antonio Cañaveral, e-Evolution * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.adempiere.process.rpl.exp; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.adempiere.process.rpl.IExportProcessor; +import org.compiere.model.MClient; +import org.compiere.model.MColumn; +import org.compiere.model.MReplicationStrategy; +import org.compiere.model.MTable; +import org.compiere.model.PO; +import org.compiere.model.X_EXP_FormatLine; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Language; +import org.compiere.util.Msg; +import org.compiere.util.Trx; +import org.compiere.model.MEXPFormat; +import org.compiere.model.MEXPFormatLine; +import org.compiere.model.MEXPProcessor; +import org.compiere.model.MEXPProcessorType; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Text; + +/** + * @author Trifon N. Trifonov + * @author Antonio Cañaveral, e-Evolution + *
  • [ 2195016 ] Implementation delete records messages + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195016&group_id=176962&atid=879332 + */ +public class ExportHelper { + + /** Logger */ + private static CLogger log = CLogger.getCLogger(ExportHelper.class); + + /** XML Document */ + private Document outDocument = null; + + /** Date Time Format */ + private SimpleDateFormat m_dateTimeFormat = null; + + /** Date Format */ + private SimpleDateFormat m_dateFormat = null; + + /** Custom Date Format */ + private SimpleDateFormat m_customDateFormat = null; + + /** Client */ + private int m_AD_Client_ID = -1; + + /** Replication Strategy */ + MReplicationStrategy m_rplStrategy = null; + + + public ExportHelper(MClient client, MReplicationStrategy rplStrategy) { + m_AD_Client_ID = client.getAD_Client_ID(); + m_rplStrategy = rplStrategy; + + m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(client.getCtx()))); + m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(client.getCtx()))); + } + + public ExportHelper(Properties ctx , int AD_Client_ID) { + m_AD_Client_ID = AD_Client_ID; + m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Language.getLanguage(Env.getAD_Language(ctx))); + m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Language.getLanguage(Env.getAD_Language(ctx))); + } + + /** + * Process - Generate Export Format + * @return info + */ + @SuppressWarnings("unchecked") + public String exportRecord (PO po, Integer ReplicationMode , String ReplicationType, Integer ReplicationEvent) throws Exception + { + MClient client = MClient.get (po.getCtx(), m_AD_Client_ID); + log.info("Client = " + client.toString()); + + log.info("TRIFON - po.getAD_Org_ID() = " + po.getAD_Org_ID()); + + log.info("TRIFON - po.get_TrxName() = " + po.get_TrxName()); + if (po.get_TrxName() == null || po.get_TrxName().equals("")) { + po.set_TrxName("exportRecord"); + } + + + log.info("Table = " + po.get_TableName()); + + if (po.get_KeyColumns().length < 1) { + throw new Exception(Msg.getMsg (po.getCtx(), "ExportNoneColumnKeyNotSupported"));//TODO: Create Mesagge. + } + // TODO - get proper Export Format! + String version = "3.2.0"; + //int EXP_Format_ID = 1000006; + MEXPFormat exportFormat = null; + //exportFormat = new MFormat(po.getCtx(), EXP_Format_ID, po.get_TrxName()); + exportFormat = MEXPFormat.getFormatByAD_Client_IDAD_Table_IDAndVersion(po.getCtx(), m_AD_Client_ID, po.get_Table_ID(), version, po.get_TrxName()); + log.fine("exportFormat = " + exportFormat); + if (exportFormat == null || exportFormat.getEXP_Format_ID() == 0) { + // Fall back to System Client + MClient systemClient = MClient.get (po.getCtx(), 0); + log.info(systemClient.toString()); + exportFormat = MEXPFormat.getFormatByAD_Client_IDAD_Table_IDAndVersion(po.getCtx(), 0, po.get_Table_ID(), version, po.get_TrxName()); + + if (exportFormat == null || exportFormat.getEXP_Format_ID() == 0) { + throw new Exception(Msg.getMsg(po.getCtx(), "EXPFormatNotFound")); + } + } + + outDocument = createNewDocument(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(po.get_TableName()).append(" ") + .append("WHERE ").append(po.get_KeyColumns()[0]).append("=?") + ; + + if (exportFormat.getWhereClause() != null & !"".equals(exportFormat.getWhereClause())) { + sql.append(" AND ").append(exportFormat.getWhereClause()); + } + + ResultSet rs = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), po.get_TrxName()); + pstmt.setInt(1, po.get_ID()); + rs = pstmt.executeQuery(); + if (rs.next()) + { + HashMap variableMap = new HashMap(); + //variableMap.put(TOTAL_SEGMENTS, new Integer(1)); + + Element rootElement = outDocument.createElement(exportFormat.getValue()); + if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) { + rootElement.appendChild(outDocument.createComment(exportFormat.getDescription())); + } + rootElement.setAttribute("AD_Client_Value", client.getValue()); + rootElement.setAttribute("Version", exportFormat.getVersion()); + rootElement.setAttribute("ReplicationMode", ReplicationMode.toString()); + rootElement.setAttribute("ReplicationType", ReplicationType); + rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString()); + outDocument.appendChild(rootElement); + generateExportFormat(rootElement, exportFormat, rs, po, po.get_ID(), variableMap); + } + + } finally { + try { + if (rs != null) rs.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) {/*ignored*/} + rs = null; + pstmt = null; + } + + MEXPProcessor mExportProcessor = null; + mExportProcessor = new MEXPProcessor (po.getCtx(), m_rplStrategy.getEXP_Processor_ID(), po.get_TrxName() ); + log.fine("ExportProcessor = " + mExportProcessor); + int EXP_ProcessorType_ID = 0; + EXP_ProcessorType_ID = mExportProcessor.getEXP_Processor_Type_ID(); + MEXPProcessorType expProcessor_Type = new MEXPProcessorType(po.getCtx(), EXP_ProcessorType_ID, po.get_TrxName() ); + + + String javaClass = expProcessor_Type.getJavaClass(); + try { + Class clazz = Class.forName(javaClass); + IExportProcessor exportProcessor = (IExportProcessor)clazz.newInstance(); + + exportProcessor.process(po.getCtx(), mExportProcessor, outDocument, Trx.get( po.get_TrxName(), false )); + + } catch (Exception e) { + log.severe(e.toString()); + throw e; + } + + return outDocument.toString(); + } + + + /** + * Process - Generate Export Format + * @param + * + * @return Document + */ + @SuppressWarnings("unchecked") + public Document exportRecord (MEXPFormat exportFormat, String where , Integer ReplicationMode , String ReplicationType, Integer ReplicationEvent) throws Exception + { + MClient client = MClient.get (exportFormat.getCtx(), m_AD_Client_ID); + MTable table = MTable.get(exportFormat.getCtx(), exportFormat.getAD_Table_ID()); + log.info("Table = " + table); + int[] ids = MTable.getAllIDs(table.getTableName(), where, null); + + for (int id : ids) + { + PO po = table.getPO(id, null); + log.info("Client = " + client.toString()); + + log.info("TRIFON - po.getAD_Org_ID() = " + po.getAD_Org_ID()); + + log.info("TRIFON - po.get_TrxName() = " + po.get_TrxName()); + if (po.get_TrxName() == null || po.get_TrxName().equals("")) { + po.set_TrxName("exportRecord"); + } + + if (po.get_KeyColumns().length > 1 || po.get_KeyColumns().length < 1) { + throw new Exception(Msg.getMsg (po.getCtx(), "ExportMultiColumnNotSupported")); + } + // TODO - get proper Export Format! + String version = "3.2.0"; + outDocument = createNewDocument(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(table.getTableName()).append(" ") + .append("WHERE ").append(po.get_KeyColumns()[0]).append("=?") + ; + + if (exportFormat.getWhereClause() != null & !"".equals(exportFormat.getWhereClause())) { + sql.append(" AND ").append(exportFormat.getWhereClause()); + } + + ResultSet rs = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), po.get_TrxName()); + pstmt.setInt(1, po.get_ID()); + rs = pstmt.executeQuery(); + if (rs.next()) + { + HashMap variableMap = new HashMap(); + //variableMap.put(TOTAL_SEGMENTS, new Integer(1)); + + Element rootElement = outDocument.createElement(exportFormat.getValue()); + if (exportFormat.getDescription() != null && !"".equals(exportFormat.getDescription())) { + rootElement.appendChild(outDocument.createComment(exportFormat.getDescription())); + } + rootElement.setAttribute("AD_Client_Value", client.getValue()); + rootElement.setAttribute("Version", exportFormat.getVersion()); + rootElement.setAttribute("ReplicationMode", ReplicationMode.toString()); + rootElement.setAttribute("ReplicationType", ReplicationType); + rootElement.setAttribute("ReplicationEvent", ReplicationEvent.toString()); + outDocument.appendChild(rootElement); + generateExportFormat(rootElement, exportFormat, rs, po, po.get_ID(), variableMap); + } + + } finally { + try { + if (rs != null) rs.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) {/*ignored*/} + rs = null; + pstmt = null; + } + }// finish record read + return outDocument; + } + + + /* + * Trifon Generate Export Format process; RESULT = + * + * 101 + * + */ + private void generateExportFormat(Element rootElement, MEXPFormat exportFormat, ResultSet rs, PO masterPO, int masterID, HashMap variableMap) throws SQLException, Exception + { + MEXPFormatLine[] formatLines = (MEXPFormatLine[]) exportFormat.getFormatLines(); + @SuppressWarnings("unused") + boolean elementHasValue = false; + + for (int i = 0; i < formatLines.length; i++) { + if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_XMLElement) ) { + // process single XML Attribute + // Create new element + Element newElement = outDocument.createElement(formatLines[i].getValue()); + + if (formatLines[i].getAD_Column_ID() == 0) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + MColumn column = MColumn.get(masterPO.getCtx(), formatLines[i].getAD_Column_ID()); + if (column == null) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + if ( column.isVirtualColumn() ) { + log.info("This is Virtual Column!"); + } else { } + //log.info("["+column.getColumnName()+"]"); + + Object value = rs.getObject(column.getColumnName()); + String valueString = null; + if (value != null) { + valueString = value.toString(); + } else { + // Could remove this exception and create empty XML Element when column do not have value. + if (formatLines[i].isMandatory()) { + //throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory")); + } + } + if (column.getAD_Reference_ID() == DisplayType.Date) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute" + } else { + //valueString = m_dateFormat.format (Timestamp.valueOf (valueString)); + //newElement.setAttribute("DateFormat", m_dateTimeFormat.toPattern()); // Add "DateForamt attribute + //Standard Japanese Format (default) works better (yyyy-mm-dd) + newElement.setAttribute("DateFormat", valueString); + } + + } + } else if (column.getAD_Reference_ID() == DisplayType.DateTime) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + newElement.setAttribute("DateFormat", m_customDateFormat.toPattern()); // Add "DateForamt attribute" + } else { + //valueString = m_dateTimeFormat.format (Timestamp.valueOf (valueString)); + //newElement.setAttribute("DateFormat", m_dateTimeFormat.toPattern()); // Add "DateForamt attribute + //Standard Japanese Format (default) works better (yyyy-mm-dd hh:mm:ss m.mm) + newElement.setAttribute("DateFormat", valueString); + } + } + } + log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); + if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { + Text newText = outDocument.createTextNode(valueString); + newElement.appendChild(newText); + rootElement.appendChild(newElement); + elementHasValue = true; + //increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable + //increaseVariable(variableMap, TOTAL_SEGMENTS); + } else { + // Empty field. + if (formatLines[i].isMandatory()) { + Text newText = outDocument.createTextNode(""); + newElement.appendChild(newText); + rootElement.appendChild(newElement); + elementHasValue = true; + } + } + } else if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_XMLAttribute) ) { + // process single XML Attribute + if (formatLines[i].getAD_Column_ID() == 0) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + MColumn column = MColumn.get(masterPO.getCtx(), formatLines[i].getAD_Column_ID()); + if (column == null) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + if ( column.isVirtualColumn() ) { + log.info("This is Virtual Column!"); + } else { } + //log.info("["+column.getColumnName()+"]"); + + Object value = rs.getObject(column.getColumnName()); + String valueString = null; + if (value != null) { + valueString = value.toString(); + } else { + if (formatLines[i].isMandatory()) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory")); + } + } +/* if (column.getAD_Reference_ID() == DisplayType.Date) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateFormat.format (Timestamp.valueOf (valueString)); + } + + } + } else if (column.getAD_Reference_ID() == DisplayType.DateTime) { + if (valueString != null) { + if (formatLines[i].getDateFormat() != null && !"".equals(formatLines[i].getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLines[i].getDateFormat() ); // "MM/dd/yyyy" + //Date date = m_customDateFormat.parse ( valueString ); + valueString = m_customDateFormat.format(Timestamp.valueOf (valueString)); + } else { + valueString = m_dateTimeFormat.format (Timestamp.valueOf (valueString)); + } + } + }*/ + log.info("EXP Field - column=["+column.getColumnName()+"]; value=" + value); + if (valueString != null && !"".equals(valueString) && !"null".equals(valueString)) { + rootElement.setAttribute(formatLines[i].getValue(), valueString); + elementHasValue = true; + //increaseVariable(variableMap, formatLines[i].getVariableName()); // Increase value of Variable if any Variable + //increaseVariable(variableMap, TOTAL_SEGMENTS); + } else { + // Empty field. + } + } else if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_EmbeddedEXPFormat) ) { + // process Embedded Export Format + + int embeddedFormat_ID = formatLines[i].getEXP_EmbeddedFormat_ID(); + MEXPFormat embeddedFormat = new MEXPFormat(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName()); + + MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID()); + log.info("Table Embedded = " + tableEmbedded); + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(tableEmbedded.getTableName()).append(" ") + .append("WHERE ").append(masterPO.get_KeyColumns()[0]).append("=?") + //+ "WHERE " + po.get_WhereClause(false) + ; + if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) { + sql.append(" AND ").append(embeddedFormat.getWhereClause()); + } + log.info(sql.toString()); + ResultSet rsEmbedded = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), masterPO.get_TrxName()); + pstmt.setInt(1, masterID); + rsEmbedded = pstmt.executeQuery(); + while (rsEmbedded.next()) + { + //System.out.println("Trifon - tableEmbedded.getTableName()_ID = "+ tableEmbedded.getTableName() + "_ID"); + int embeddedID = rsEmbedded.getInt(tableEmbedded.getTableName() + "_ID"); + PO poEmbedded = tableEmbedded.getPO (embeddedID, masterPO.get_TrxName()); + + Element embeddedElement = outDocument.createElement(formatLines[i].getValue()); + if (formatLines[i].getDescription() != null && !"".equals(formatLines[i].getDescription())) { + embeddedElement.appendChild(outDocument.createComment(formatLines[i].getDescription())); + } + generateExportFormat(embeddedElement, embeddedFormat, rsEmbedded, poEmbedded, embeddedID, variableMap); + rootElement.appendChild(embeddedElement); + } + + } finally { + try { + if (rsEmbedded != null) rsEmbedded.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) { } + rsEmbedded = null; + pstmt = null; + } + + } else if ( formatLines[i].getType().equals(X_EXP_FormatLine.TYPE_ReferencedEXPFormat) ) { + // process Referenced Export Format + + int embeddedFormat_ID = formatLines[i].getEXP_EmbeddedFormat_ID(); + MEXPFormat embeddedFormat = new MEXPFormat(masterPO.getCtx(), embeddedFormat_ID, masterPO.get_TrxName()); + + MTable tableEmbedded = MTable.get(masterPO.getCtx(), embeddedFormat.getAD_Table_ID()); + log.info("Table Embedded = " + tableEmbedded); + StringBuffer sql = new StringBuffer("SELECT * ") + .append("FROM ").append(tableEmbedded.getTableName()).append(" ") + .append("WHERE ").append(tableEmbedded.getTableName() + "_ID").append("=?") + //+ "WHERE " + po.get_WhereClause(false) + ; + if (embeddedFormat.getWhereClause() != null & !"".equals(embeddedFormat.getWhereClause())) { + sql.append(" AND ").append(embeddedFormat.getWhereClause()); + } + log.info(sql.toString()); + if (formatLines[i].getAD_Column_ID() == 0) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + MColumn column = MColumn.get(masterPO.getCtx(), formatLines[i].getAD_Column_ID()); + if (column == null) { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPColumnMandatory")); + } + if ( column.isVirtualColumn() ) { + log.info("This is Virtual Column!"); + } else { } + //log.info("["+column.getColumnName()+"]"); + Object value = rs.getObject(column.getColumnName()); +/* String valueString = null; + if (value != null) { + valueString = value.toString(); + } else { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPFieldMandatory")); + } +*/ + log.info(sql.toString()); + ResultSet rsEmbedded = null; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement(sql.toString(), masterPO.get_TrxName()); + pstmt.setObject(1, value); + rsEmbedded = pstmt.executeQuery(); + while (rsEmbedded.next()) + { + //System.out.println("Trifon - tableEmbedded.getTableName()_ID = "+ tableEmbedded.getTableName() + "_ID"); + int embeddedID = rsEmbedded.getInt(tableEmbedded.getTableName() + "_ID"); + PO poEmbedded = tableEmbedded.getPO (embeddedID, masterPO.get_TrxName()); + + Element embeddedElement = outDocument.createElement(formatLines[i].getValue()); + if (formatLines[i].getDescription() != null && !"".equals(formatLines[i].getDescription())) { + embeddedElement.appendChild(outDocument.createComment(formatLines[i].getDescription())); + } + generateExportFormat(embeddedElement, embeddedFormat, rsEmbedded, poEmbedded, embeddedID, variableMap); + rootElement.appendChild(embeddedElement); + } + + } finally { + try { + if (rsEmbedded != null) rsEmbedded.close(); + if (pstmt != null) pstmt.close(); + } catch (SQLException ex) { } + rsEmbedded = null; + pstmt = null; + } + + } + + else { + throw new Exception(Msg.getMsg (masterPO.getCtx(), "EXPUnknownLineType")); + } + } + } + + /** + * @param variableMap + * @param variableName + */ + @SuppressWarnings("unused") + private void increaseVariable(HashMap variableMap, String variableName) { + if (variableName != null && !"".equals(variableName) ) { + Integer var = variableMap.get(variableName); + if (var == null) { + var = new Integer(0); + } + int intValue = var.intValue(); + intValue++; + variableMap.put(variableName, new Integer(intValue)); + } + } + + /** + * Utility method which is responsible to create new XML Document + * + * @return Document + * @throws ParserConfigurationException + */ + // create new Document + Document createNewDocument() throws ParserConfigurationException + { + Document result = null; + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + + result = documentBuilder.newDocument(); + return result; + } + + +} diff --git a/base/src/org/adempiere/process/rpl/exp/HDDExportProcessor.java b/base/src/org/adempiere/process/rpl/exp/HDDExportProcessor.java new file mode 100644 index 0000000000..8cad5e8159 --- /dev/null +++ b/base/src/org/adempiere/process/rpl/exp/HDDExportProcessor.java @@ -0,0 +1,119 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) * +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ +package org.adempiere.process.rpl.exp; + +import java.io.File; +import java.io.StringWriter; +import java.io.Writer; +import java.util.Properties; + +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.adempiere.process.rpl.IExportProcessor; +import org.compiere.model.MEXPProcessor; +import org.compiere.model.X_EXP_ProcessorParameter; +import org.compiere.util.CLogger; +import org.compiere.util.Trx; +import org.w3c.dom.Document; + +/** + * @author Trifon N. Trifonov + */ +public class HDDExportProcessor implements IExportProcessor { + + /** Logger */ + protected CLogger log = CLogger.getCLogger (getClass()); + + public void process(Properties ctx, MEXPProcessor expProcessor, Document document, Trx trx) + throws Exception + { + //String host = expProcessor.getHost(); + //int port = expProcessor.getPort(); + //String account = expProcessor.getAccount(); + //String password = expProcessor.getPasswordInfo(); + String fileName = ""; + String folder = ""; + + // Read all processor parameters and set them! + X_EXP_ProcessorParameter[] processorParameters = expProcessor.getEXP_ProcessorParameters(trx.getTrxName()); + if (processorParameters != null && processorParameters.length > 0) { + for (int i = 0; i < processorParameters.length; i++) { + + // One special parameter which will be used for remote folder name. + // Or could add flag to ProcessorParameters table which will distinguish between + // connection parameters and FTP Upload parameters. + log.info("ProcesParameter Value = " + processorParameters[i].getValue()); + log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue()); + if ( processorParameters[i].getValue().equals("fileName") ) { + fileName = processorParameters[i].getParameterValue(); + } else if ( processorParameters[i].getValue().equals("folder") ) { + folder = processorParameters[i].getParameterValue(); + } + } + } + + if (fileName == null || fileName.length() == 0) { + throw new Exception("Missing EXP_ProcessorParameter with key 'fileName'!"); + } + // Save the document to the disk file + TransformerFactory tranFactory = TransformerFactory.newInstance(); + tranFactory.setAttribute("indent-number", Integer.valueOf(1)); + + Transformer aTransformer = tranFactory.newTransformer(); + aTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); + Source src = new DOMSource(document); + + // =================================== Write to String + Writer writer = new StringWriter(); + Result dest2 = new StreamResult(writer); + aTransformer.transform(src, dest2); + System.err.println(writer.toString()); + + //writer = new OutputStreamWriter(new FileOutputStream(out), "utf-8"); + // =================================== Write to Disk + try { + Result dest = new StreamResult(new File(folder + fileName)); + aTransformer.transform(src, dest); + + writer.close(); + } catch (TransformerException ex) { + ex.printStackTrace(); + throw ex; + } + + } + +} diff --git a/base/src/org/adempiere/process/rpl/exp/MultiplePublisher.java b/base/src/org/adempiere/process/rpl/exp/MultiplePublisher.java new file mode 100644 index 0000000000..8d99a3771f --- /dev/null +++ b/base/src/org/adempiere/process/rpl/exp/MultiplePublisher.java @@ -0,0 +1,61 @@ +package org.adempiere.process.rpl.exp; + +//MultiplePublisher.java + +import javax.jms.*; +import javax.naming.*; + +public class MultiplePublisher { + TopicConnection topicConnection = null; + TopicSession topicSession = null; + Topic topic = null; + TopicPublisher topicPublisher = null; + public final String topicName = "asunto"; + static int startindex = 0; + + public MultiplePublisher() { + TopicConnectionFactory topicConnectionFactory = null; + + try { + InitialContext contexto = new InitialContext(); + topicConnectionFactory = (TopicConnectionFactory) contexto.lookup("TopicDurable"); + topicConnection = topicConnectionFactory.createTopicConnection(); + topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); + topic = (Topic) contexto.lookup("asunto"); + topicPublisher = topicSession.createPublisher(topic); + } catch (Exception e) { + System.out.println("Error en constructor de MultiplePublisher"); + } + } + + public void publishMessages() { + TextMessage message = null; + int i; + final int NUMMSGS = 3; + final String MSG_TEXT = new String("Message"); + + try { + message = topicSession.createTextMessage(); + for (i = startindex; i < startindex + NUMMSGS; i++) { + message.setText(MSG_TEXT + " " + (i + 1)); + System.out.println("Publicado mensaje: " + message.getText()); + topicPublisher.publish( message ); + } + + topicPublisher.publish( topicSession.createMessage() ); + startindex = i; + } catch (Exception e) { + System.out.println("Error en metodo publishMessages() de MultiplePublisher"); + e.printStackTrace(); + } + } + + public void finish() { + if (topicConnection != null) { + try { + topicConnection.close(); + } catch (JMSException e) { + } + } + } +} diff --git a/base/src/org/adempiere/process/rpl/exp/TopicExportProcessor.java b/base/src/org/adempiere/process/rpl/exp/TopicExportProcessor.java new file mode 100644 index 0000000000..a4efe4d955 --- /dev/null +++ b/base/src/org/adempiere/process/rpl/exp/TopicExportProcessor.java @@ -0,0 +1,209 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) +* - Antonio Cañaveral, e-Evolution +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ +package org.adempiere.process.rpl.exp; + +import java.io.StringWriter; +import java.io.Writer; +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.DeliveryMode; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.adempiere.process.rpl.IExportProcessor; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.compiere.model.MEXPProcessor; +import org.compiere.model.X_EXP_ProcessorParameter; +import org.compiere.util.CLogger; +import org.compiere.util.Trx; +import org.w3c.dom.Document; + +/** + * @author Trifon N. Trifonov + * @author Antonio Cañaveral, e-Evolution + *
  • [ 2195051 ] Implementing Message Transaction + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195051&group_id=176962&atid=879335 + + */ +public class TopicExportProcessor implements IExportProcessor { + + /** Logger */ + protected CLogger log = CLogger.getCLogger (getClass()); + + /** + * + */ + public void process(Properties ctx, MEXPProcessor expProcessor, Document document, Trx trx) + throws Exception + { + String host = expProcessor.getHost(); + int port = expProcessor.getPort(); + String account = expProcessor.getAccount(); + String password = expProcessor.getPasswordInfo(); + String protocol = null; + String topicName = ""; + String clientID = null; + String timeToLiveStr = null; + int timeToLive = 10000; + boolean isDeliveryModePersistent = true; + + // Read all processor parameters and set them! + X_EXP_ProcessorParameter[] processorParameters = expProcessor.getEXP_ProcessorParameters(trx.getTrxName()); + if (processorParameters != null && processorParameters.length > 0) { + for (int i = 0; i < processorParameters.length; i++) { + log.info("ProcesParameter Value = " + processorParameters[i].getValue()); + log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue()); + if (processorParameters[i].getValue().equals("topicName")) { + topicName = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("protocol")) { + protocol = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("clientID")) { + clientID = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("timeToLive")) { + timeToLiveStr = processorParameters[i].getParameterValue(); + timeToLive = Integer.parseInt( timeToLiveStr ); + } else if (processorParameters[i].getValue().equals("isDeliveryModePersistent")) { + isDeliveryModePersistent = Boolean.parseBoolean( processorParameters[i].getParameterValue() ); + } else { + // Some other mandatory parameter here + } + } + } + + if (topicName == null || topicName.length() == 0) { + throw new Exception("Missing "+X_EXP_ProcessorParameter.Table_Name+" with key 'topicName'!"); + } + if (protocol == null || protocol.length() == 0) { + throw new Exception("Missing "+X_EXP_ProcessorParameter.Table_Name+" with key 'protocol'!"); + } + if (clientID == null || clientID.length() == 0) { + throw new Exception("Missing "+X_EXP_ProcessorParameter.Table_Name+" with key 'clientID'!"); + } + if (timeToLiveStr == null || timeToLiveStr.length() == 0) { + throw new Exception("Missing "+X_EXP_ProcessorParameter.Table_Name+" with key 'timeToLive'!"); + } + + // Construct Transformer Factory and Transformer + TransformerFactory tranFactory = TransformerFactory.newInstance(); + tranFactory.setAttribute("indent-number", Integer.valueOf(1)); + + Transformer aTransformer = tranFactory.newTransformer(); + aTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); + Source src = new DOMSource( document ); + + // =================================== Write to String + Writer writer = new StringWriter(); + Result dest2 = new StreamResult(writer); + aTransformer.transform(src, dest2); + + sendJMSMessage(host, port, writer.toString(), protocol, topicName, clientID, account, password, timeToLive, isDeliveryModePersistent); + + } + + private void sendJMSMessage(String host, int port, String msg, String protocol, String topicName + , String clientID, String userName, String password, int timeToLive + , boolean isDeliveryModePersistent) throws JMSException + { + // Create a ConnectionFactory + // network protocol (tcp, ...) set as EXP_ProcessorParameter + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(protocol + "://" + host + ":" + port); + + Connection connection = null; + Session session = null; + try { + // Create a Connection + if (userName != null && password != null) { + connection = connectionFactory.createConnection(userName, password); + } else { + connection = connectionFactory.createConnection(); + } + + // connection.setClientID( clientID ); Commented by Victor as he had issue! + connection.start(); + + // Create a Session + session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); //TODO - Trifon could be EXP_ProcessorParameter + + // Create the destination (Topic or Queue) + Destination destination = session.createTopic(topicName); + + // Create a MessageProducer from the Session to the Topic or Queue + MessageProducer producer = session.createProducer( destination ); + producer.setTimeToLive( timeToLive ); // EXP_ProcessorParameter + if ( isDeliveryModePersistent ) { + producer.setDeliveryMode( DeliveryMode.PERSISTENT ); // EXP_ProcessorParameter + } else { + producer.setDeliveryMode( DeliveryMode.NON_PERSISTENT ); // EXP_ProcessorParameter + } + + // How to send to multiple destinations. + //MessageProducer producer = session.createProducer(null); + //producer.send(someDestination, message); + //producer.send(anotherDestination, message); + + // Create a message + TextMessage message = session.createTextMessage( msg ); + + // Tell the producer to send the message + try + { + producer.send(message); + session.commit(); + log.info("JMS Message sent!"); + }catch(JMSException ex) + { + session.rollback(); + log.info("JMS Can't send the message!"); + throw ex; + } + + } finally { + // Clean up + if (session != null) { + try { session.close(); } catch (JMSException ex) { /* ignored */ } + } + if (connection != null) { + try { connection.close(); } catch (JMSException ex) { /* ignored */ } + } + } + } + +} diff --git a/base/src/org/compiere/model/I_AD_ReplicationStrategy.java b/base/src/org/compiere/model/I_AD_ReplicationStrategy.java index 7d7f0a5edb..2ce2dfd494 100644 --- a/base/src/org/compiere/model/I_AD_ReplicationStrategy.java +++ b/base/src/org/compiere/model/I_AD_ReplicationStrategy.java @@ -106,7 +106,7 @@ public interface I_AD_ReplicationStrategy /** Get Export Processor */ public int getEXP_Processor_ID(); - public org.eevolution.model.I_EXP_Processor getEXP_Processor() throws RuntimeException; + public org.compiere.model.I_EXP_Processor getEXP_Processor() throws RuntimeException; /** Column name Help */ public static final String COLUMNNAME_Help = "Help"; diff --git a/base/src/org/eevolution/model/I_EXP_Format.java b/base/src/org/compiere/model/I_EXP_Format.java similarity index 99% rename from base/src/org/eevolution/model/I_EXP_Format.java rename to base/src/org/compiere/model/I_EXP_Format.java index a9adf266d1..1c97a3ca8d 100644 --- a/base/src/org/eevolution/model/I_EXP_Format.java +++ b/base/src/org/compiere/model/I_EXP_Format.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; diff --git a/base/src/org/eevolution/model/I_EXP_FormatLine.java b/base/src/org/compiere/model/I_EXP_FormatLine.java similarity index 98% rename from base/src/org/eevolution/model/I_EXP_FormatLine.java rename to base/src/org/compiere/model/I_EXP_FormatLine.java index 5c60a8e8d4..f05b7a94b8 100644 --- a/base/src/org/eevolution/model/I_EXP_FormatLine.java +++ b/base/src/org/compiere/model/I_EXP_FormatLine.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; @@ -138,7 +138,7 @@ public interface I_EXP_FormatLine /** Get Export Format */ public int getEXP_Format_ID(); - public org.eevolution.model.I_EXP_Format getEXP_Format() throws RuntimeException; + public org.compiere.model.I_EXP_Format getEXP_Format() throws RuntimeException; /** Column name Help */ public static final String COLUMNNAME_Help = "Help"; diff --git a/base/src/org/eevolution/model/I_EXP_Processor.java b/base/src/org/compiere/model/I_EXP_Processor.java similarity index 97% rename from base/src/org/eevolution/model/I_EXP_Processor.java rename to base/src/org/compiere/model/I_EXP_Processor.java index 6c2960ad69..e81d4d3946 100644 --- a/base/src/org/eevolution/model/I_EXP_Processor.java +++ b/base/src/org/compiere/model/I_EXP_Processor.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; @@ -97,7 +97,7 @@ public interface I_EXP_Processor /** Get Export Processor Type */ public int getEXP_Processor_Type_ID(); - public org.eevolution.model.I_EXP_Processor_Type getEXP_Processor_Type() throws RuntimeException; + public org.compiere.model.I_EXP_Processor_Type getEXP_Processor_Type() throws RuntimeException; /** Column name Help */ public static final String COLUMNNAME_Help = "Help"; diff --git a/base/src/org/eevolution/model/I_EXP_ProcessorParameter.java b/base/src/org/compiere/model/I_EXP_ProcessorParameter.java similarity index 97% rename from base/src/org/eevolution/model/I_EXP_ProcessorParameter.java rename to base/src/org/compiere/model/I_EXP_ProcessorParameter.java index f470a3c17b..b2e87e142a 100644 --- a/base/src/org/eevolution/model/I_EXP_ProcessorParameter.java +++ b/base/src/org/compiere/model/I_EXP_ProcessorParameter.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; @@ -88,7 +88,7 @@ public interface I_EXP_ProcessorParameter /** Get Export Processor */ public int getEXP_Processor_ID(); - public org.eevolution.model.I_EXP_Processor getEXP_Processor() throws RuntimeException; + public org.compiere.model.I_EXP_Processor getEXP_Processor() throws RuntimeException; /** Column name Help */ public static final String COLUMNNAME_Help = "Help"; diff --git a/base/src/org/eevolution/model/I_EXP_Processor_Type.java b/base/src/org/compiere/model/I_EXP_Processor_Type.java similarity index 99% rename from base/src/org/eevolution/model/I_EXP_Processor_Type.java rename to base/src/org/compiere/model/I_EXP_Processor_Type.java index 386062c7cb..4911cd0b50 100644 --- a/base/src/org/eevolution/model/I_EXP_Processor_Type.java +++ b/base/src/org/compiere/model/I_EXP_Processor_Type.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; diff --git a/base/src/org/eevolution/model/I_IMP_Processor.java b/base/src/org/compiere/model/I_IMP_Processor.java similarity index 98% rename from base/src/org/eevolution/model/I_IMP_Processor.java rename to base/src/org/compiere/model/I_IMP_Processor.java index dac967bc23..5c8fbe1570 100644 --- a/base/src/org/eevolution/model/I_IMP_Processor.java +++ b/base/src/org/compiere/model/I_IMP_Processor.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import java.sql.Timestamp; @@ -172,7 +172,7 @@ public interface I_IMP_Processor /** Get Import Processor Type */ public int getIMP_Processor_Type_ID(); - public org.eevolution.model.I_IMP_Processor_Type getIMP_Processor_Type() throws RuntimeException; + public org.compiere.model.I_IMP_Processor_Type getIMP_Processor_Type() throws RuntimeException; /** Column name KeepLogDays */ public static final String COLUMNNAME_KeepLogDays = "KeepLogDays"; diff --git a/base/src/org/eevolution/model/I_IMP_ProcessorLog.java b/base/src/org/compiere/model/I_IMP_ProcessorLog.java similarity index 97% rename from base/src/org/eevolution/model/I_IMP_ProcessorLog.java rename to base/src/org/compiere/model/I_IMP_ProcessorLog.java index 4d7fadc53b..09a6517586 100644 --- a/base/src/org/eevolution/model/I_IMP_ProcessorLog.java +++ b/base/src/org/compiere/model/I_IMP_ProcessorLog.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; @@ -114,7 +114,7 @@ public interface I_IMP_ProcessorLog /** Get Import Processor */ public int getIMP_Processor_ID(); - public org.eevolution.model.I_IMP_Processor getIMP_Processor() throws RuntimeException; + public org.compiere.model.I_IMP_Processor getIMP_Processor() throws RuntimeException; /** Column name IsError */ public static final String COLUMNNAME_IsError = "IsError"; diff --git a/base/src/org/eevolution/model/I_IMP_ProcessorParameter.java b/base/src/org/compiere/model/I_IMP_ProcessorParameter.java similarity index 97% rename from base/src/org/eevolution/model/I_IMP_ProcessorParameter.java rename to base/src/org/compiere/model/I_IMP_ProcessorParameter.java index 9f1517e07f..88f099976c 100644 --- a/base/src/org/eevolution/model/I_IMP_ProcessorParameter.java +++ b/base/src/org/compiere/model/I_IMP_ProcessorParameter.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; @@ -101,7 +101,7 @@ public interface I_IMP_ProcessorParameter /** Get Import Processor */ public int getIMP_Processor_ID(); - public org.eevolution.model.I_IMP_Processor getIMP_Processor() throws RuntimeException; + public org.compiere.model.I_IMP_Processor getIMP_Processor() throws RuntimeException; /** Column name Name */ public static final String COLUMNNAME_Name = "Name"; diff --git a/base/src/org/eevolution/model/I_IMP_Processor_Type.java b/base/src/org/compiere/model/I_IMP_Processor_Type.java similarity index 99% rename from base/src/org/eevolution/model/I_IMP_Processor_Type.java rename to base/src/org/compiere/model/I_IMP_Processor_Type.java index 6f1a11718f..4a9254c47a 100644 --- a/base/src/org/eevolution/model/I_IMP_Processor_Type.java +++ b/base/src/org/compiere/model/I_IMP_Processor_Type.java @@ -17,7 +17,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.eevolution.model; +package org.compiere.model; import java.math.BigDecimal; import org.compiere.model.*; diff --git a/base/src/org/compiere/model/MEXPFormat.java b/base/src/org/compiere/model/MEXPFormat.java new file mode 100644 index 0000000000..8c5838333d --- /dev/null +++ b/base/src/org/compiere/model/MEXPFormat.java @@ -0,0 +1,215 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * - Antonio Cañaveral, e-Evolution + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.model.MTable; +import org.compiere.model.Query; +import org.compiere.util.CCache; +import org.compiere.util.CLogger; +import org.compiere.util.DB; + +/** + * @author Trifon N. Trifonov + * @author Antonio Cañaveral, e-Evolution + *
  • [ 2195090 ] Implementing ExportFormat cache + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195090&group_id=176962&atid=879335 + */ +public class MEXPFormat extends X_EXP_Format { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MEXPFormat.class); + + private static CCache s_cache = new CCache("MEXPFormat", 50 ); + + public MEXPFormat(Properties ctx, int EXP_Format_ID, String trxName) { + super(ctx, EXP_Format_ID, trxName); + } + + public MEXPFormat(Properties ctx, ResultSet rs, String trxName) { + super (ctx, rs, trxName); + } + + public MEXPFormatLine[] getFormatLines() { + return getFormatLinesOrderedBy(X_EXP_FormatLine.COLUMNNAME_Position); + } + + public MEXPFormatLine[] getFormatLinesOrderedBy(String orderBy) { + List resultList = new ArrayList(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(X_EXP_FormatLine.Table_Name) + .append(" WHERE ").append(X_EXP_FormatLine.COLUMNNAME_EXP_Format_ID).append("=?") + .append(" AND IsActive = ?") + .append(" ORDER BY ").append(orderBy); + PreparedStatement pstmt = null; + MEXPFormatLine exportLine = null; + try { + pstmt = DB.prepareStatement (sql.toString(), get_TrxName()); + pstmt.setInt(1, getEXP_Format_ID()); + pstmt.setString(2, "Y"); + ResultSet rs = pstmt.executeQuery (); + while ( rs.next() ) { + exportLine = new MEXPFormatLine (getCtx(), rs, get_TrxName()); + resultList.add(exportLine); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + + MEXPFormatLine[] result = (MEXPFormatLine[])resultList.toArray( new MEXPFormatLine[0]); + return result; + } + + public MEXPFormatLine[] getUniqueColumns() throws SQLException { + List resultList = new ArrayList(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(X_EXP_FormatLine.Table_Name) + .append(" WHERE ").append(X_EXP_FormatLine.COLUMNNAME_EXP_Format_ID).append("= ?") + .append(" AND IsActive = ?") + .append(" AND ").append(X_EXP_FormatLine.COLUMNNAME_IsPartUniqueIndex).append("= ?") + .append(" ORDER BY ").append(X_EXP_FormatLine.COLUMNNAME_Position); + PreparedStatement pstmt = null; + MEXPFormatLine exportLine = null; + log.info(sql.toString()); + + log.info("pstmt.setInt(1, getEXP_Format_ID() = " + getEXP_Format_ID()); + try { + pstmt = DB.prepareStatement (sql.toString(), get_TrxName()); + pstmt.setInt(1, getEXP_Format_ID()); + pstmt.setString(2, "Y"); + pstmt.setString(3, "Y"); + ResultSet rs = pstmt.executeQuery (); + while ( rs.next() ) { + exportLine = new MEXPFormatLine (getCtx(), rs, get_TrxName()); + resultList.add(exportLine); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + throw e; + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + + MEXPFormatLine[] result = (MEXPFormatLine[])resultList.toArray( new MEXPFormatLine[0]); + return result; + } + + + public static MEXPFormat getFormatByValueAD_Client_IDAndVersion(Properties ctx, String value, int AD_Client_ID, String version, String trxName) + throws SQLException + { + String key = new String(value+version); + MEXPFormat retValue=null; + if(retValue!=null) + return retValue; + + StringBuffer whereCluse = new StringBuffer(X_EXP_Format.COLUMNNAME_Value).append("=?") + .append(" AND AD_Client_ID = ?") + .append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?"); + + retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereCluse.toString(),trxName) + .setParameters(new Object[] {value,AD_Client_ID,version}).first(); + s_cache.put (key, retValue); + + return retValue; + } + + public static MEXPFormat getFormatByAD_Client_IDAD_Table_IDAndVersion(Properties ctx, int AD_Client_ID, int AD_Table_ID, String version, String trxName) throws SQLException + { + String key = new String(MTable.getTableName(ctx, AD_Table_ID)+version); + MEXPFormat retValue=null; + + retValue = (MEXPFormat)s_cache.get(key); + if(retValue!=null) + return retValue; + + StringBuffer whereCluse = new StringBuffer(" AD_Client_ID = ? ") + .append(" AND ").append(X_EXP_Format.COLUMNNAME_AD_Table_ID).append(" = ? ") + .append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?"); + + retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereCluse.toString(),trxName) + .setParameters(new Object[] {AD_Client_ID,AD_Table_ID,version}).first(); + + s_cache.put (key, retValue); + + return retValue; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer ("X_EXP_Format[ID=").append(get_ID()).append("; Value = "+getValue()+"]"); + return sb.toString(); + + } + + /** + * Before Delete + * @return true of it can be deleted + */ + protected boolean beforeDelete () + { + int[] ids =MEXPFormatLine.getAllIDs(MEXPFormatLine.Table_Name, "EXP_Format_ID="+getEXP_Format_ID(), get_TrxName()); + for (int id : ids) + { + MEXPFormatLine line = new MEXPFormatLine(getCtx(), id, get_TrxName()); + line.delete(true); + } + return true; + } // beforeDelete +} diff --git a/base/src/org/compiere/model/MEXPFormatLine.java b/base/src/org/compiere/model/MEXPFormatLine.java new file mode 100644 index 0000000000..0d6bd48e55 --- /dev/null +++ b/base/src/org/compiere/model/MEXPFormatLine.java @@ -0,0 +1,106 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.util.CLogger; +import org.compiere.util.DB; + +/** + * @author Trifon N. Trifonov + */ +public class MEXPFormatLine extends X_EXP_FormatLine { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (X_EXP_FormatLine.class); + + + + public MEXPFormatLine(Properties ctx, int C_EDIFormat_Line_ID, String trxName) { + super(ctx, C_EDIFormat_Line_ID, trxName); + } + + public MEXPFormatLine (Properties ctx, ResultSet rs, String trxName) { + super (ctx, rs, trxName); + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer ("X_EXP_FormatLine[ID=").append(get_ID()).append("; Value="+getValue()+"; Type="+getType()+"]"); + return sb.toString(); + } + + public static MEXPFormatLine getFormatLineByValue(Properties ctx, String value, int EXP_Format_ID, String trxName) + throws SQLException + { + MEXPFormatLine result = null; + + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(X_EXP_FormatLine.Table_Name) + .append(" WHERE ").append(X_EXP_Format.COLUMNNAME_Value).append("=?") + //.append(" AND IsActive = ?") + //.append(" AND AD_Client_ID = ?") + .append(" AND ").append(X_EXP_Format.COLUMNNAME_EXP_Format_ID).append(" = ?") + ; + PreparedStatement pstmt = null; + try { + pstmt = DB.prepareStatement (sql.toString(), trxName); + pstmt.setString(1, value); + pstmt.setInt(2, EXP_Format_ID); + ResultSet rs = pstmt.executeQuery (); + if ( rs.next() ) { + result = new MEXPFormatLine (ctx, rs, trxName); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + throw e; + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + + return result; + } +} diff --git a/base/src/org/compiere/model/MEXPProcessor.java b/base/src/org/compiere/model/MEXPProcessor.java new file mode 100644 index 0000000000..0ee0d78b1d --- /dev/null +++ b/base/src/org/compiere/model/MEXPProcessor.java @@ -0,0 +1,101 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.util.CLogger; +import org.compiere.util.DB; + +/** + * @author Trifon N. Trifonov + */ +public class MEXPProcessor extends X_EXP_Processor { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class); + + + public MEXPProcessor(Properties ctx, int EXP_Processor_ID, String trxName) { + super(ctx, EXP_Processor_ID, trxName); + } + + public MEXPProcessor(Properties ctx, ResultSet rs, String trxName) { + super (ctx, rs, trxName); + } + + public X_EXP_ProcessorParameter[] getEXP_ProcessorParameters(String trxName) { + List resultList = new ArrayList(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(X_EXP_ProcessorParameter.Table_Name) + .append(" WHERE ").append(X_EXP_ProcessorParameter.COLUMNNAME_EXP_Processor_ID).append("=?") // # 1 + .append(" AND IsActive = ?") // # 2 + //.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_) + ; + PreparedStatement pstmt = null; + X_EXP_ProcessorParameter processorParameter = null; + try { + pstmt = DB.prepareStatement (sql.toString(), trxName); + pstmt.setInt(1, getEXP_Processor_ID()); + pstmt.setString(2, "Y"); + ResultSet rs = pstmt.executeQuery (); + while ( rs.next() ) { + processorParameter = new X_EXP_ProcessorParameter (getCtx(), rs, trxName); + resultList.add(processorParameter); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]); + return result; + } + + +} diff --git a/base/src/org/compiere/model/MEXPProcessorParameter.java b/base/src/org/compiere/model/MEXPProcessorParameter.java new file mode 100644 index 0000000000..5f203ea456 --- /dev/null +++ b/base/src/org/compiere/model/MEXPProcessorParameter.java @@ -0,0 +1,59 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.util.CLogger; + +/** + * @author Trifon N. Trifonov + */ +public class MEXPProcessorParameter extends X_EXP_ProcessorParameter { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MEXPProcessorParameter.class); + + + public MEXPProcessorParameter(Properties ctx, int EXP_ProcessorParameter_ID, String trxName) { + super(ctx, EXP_ProcessorParameter_ID, trxName); + } + + public MEXPProcessorParameter(Properties ctx, ResultSet rs, String trxName) { + super (ctx, rs, trxName); + } + +} diff --git a/base/src/org/compiere/model/MEXPProcessorType.java b/base/src/org/compiere/model/MEXPProcessorType.java new file mode 100644 index 0000000000..0c69a75665 --- /dev/null +++ b/base/src/org/compiere/model/MEXPProcessorType.java @@ -0,0 +1,59 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - e-Evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + +import org.compiere.util.CLogger; + +/** + * @author Trifon N. Trifonov + */ +public class MEXPProcessorType extends X_EXP_Processor_Type { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MEXPProcessorType.class); + + + public MEXPProcessorType(Properties ctx, int EXP_Processor_Type_ID, String trxName) { + super(ctx, EXP_Processor_Type_ID, trxName); + } + + public MEXPProcessorType(Properties ctx, ResultSet rs, String trxName) { + super (ctx, rs, trxName); + } + +} diff --git a/base/src/org/compiere/model/MIMPProcessor.java b/base/src/org/compiere/model/MIMPProcessor.java new file mode 100644 index 0000000000..4509db20aa --- /dev/null +++ b/base/src/org/compiere/model/MIMPProcessor.java @@ -0,0 +1,220 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.compiere.model; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.util.CLogger; +import org.compiere.util.DB; + +/** + * @author Trifon Trifonov + */ +public class MIMPProcessor + extends X_IMP_Processor + implements AdempiereProcessor +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger (MIMPProcessor.class); + + public MIMPProcessor(Properties ctx, + int EXP_ReplicationProcessor_ID, String trxName) + { + super(ctx, EXP_ReplicationProcessor_ID, trxName); + if (EXP_ReplicationProcessor_ID == 0) + { + //setValue (/*client.getName() + " - " +*/ "Default Import Processor"); + setName (/*client.getName() + " - " +*/ "Default Import Processor"); + setFrequencyType (FREQUENCYTYPE_Hour); + setFrequency (1); + setKeepLogDays (7); + } + } + + public MIMPProcessor(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + /** + * + */ + public Timestamp getDateNextRun (boolean requery) + { + if (requery) + load(get_TrxName()); + return getDateNextRun(); + } + + + /** + * Get Logs + * @return logs + */ + public AdempiereProcessorLog[] getLogs () + { + ArrayList list = new ArrayList(); + String sql = "SELECT * " + + "FROM " + X_IMP_ProcessorLog.Table_Name + " " + + "WHERE " + X_IMP_Processor.COLUMNNAME_IMP_Processor_ID + "=? " // # 1 + + "ORDER BY Created DESC"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, get_TrxName()); + pstmt.setInt (1, getIMP_Processor_ID()); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add (new MIMPProcessorLog (getCtx(), rs, get_TrxName())); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + log.log(Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + MIMPProcessorLog[] retValue = new MIMPProcessorLog[list.size ()]; + list.toArray (retValue); + return retValue; + } // getLogs + + /** + * Delete old Request Log + * @return number of records + */ + public int deleteLog() + { + if (getKeepLogDays() < 1) + return 0; + String sql = "DELETE " + X_IMP_ProcessorLog.Table_Name + " " + + "WHERE "+X_IMP_ProcessorLog.COLUMNNAME_IMP_Processor_ID+"=" + getIMP_Processor_ID() + + " AND (Created+" + getKeepLogDays() + ") < SysDate"; + int no = DB.executeUpdate(sql, get_TrxName()); + return no; + } + + public String getServerID() { + return "ReplicationProcessor" + get_ID(); + } + + public X_IMP_ProcessorParameter[] getIMP_ProcessorParameters(String trxName) { + List resultList = new ArrayList(); + + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(X_IMP_ProcessorParameter.Table_Name) + .append(" WHERE ").append(X_IMP_ProcessorParameter.COLUMNNAME_IMP_Processor_ID).append("=?") // # 1 + .append(" AND IsActive = ?") // # 2 + //.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_) + ; + PreparedStatement pstmt = null; + X_IMP_ProcessorParameter processorParameter = null; + try { + pstmt = DB.prepareStatement (sql.toString(), trxName); + pstmt.setInt(1, getIMP_Processor_ID()); + pstmt.setString(2, "Y"); + ResultSet rs = pstmt.executeQuery (); + while ( rs.next() ) { + processorParameter = new X_IMP_ProcessorParameter (getCtx(), rs, trxName); + resultList.add(processorParameter); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + X_IMP_ProcessorParameter[] result = (X_IMP_ProcessorParameter[])resultList.toArray( new X_IMP_ProcessorParameter[0]); + return result; + } + + public static MIMPProcessor[] getActive(Properties ctx) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM "+X_IMP_Processor.Table_Name+" WHERE IsActive='Y'"; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, null); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add (new MIMPProcessor (ctx, rs, null)); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + s_log.log (Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + + MIMPProcessor[] retValue = new MIMPProcessor[list.size()]; + list.toArray(retValue); + return retValue; + } // getActive + +} diff --git a/base/src/org/compiere/model/MIMPProcessorLog.java b/base/src/org/compiere/model/MIMPProcessorLog.java new file mode 100644 index 0000000000..531f441191 --- /dev/null +++ b/base/src/org/compiere/model/MIMPProcessorLog.java @@ -0,0 +1,82 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.compiere.model; + +import java.sql.ResultSet; +import java.util.Properties; + + +/** + * @author Trifon Trifonov + */ +public class MIMPProcessorLog + extends X_IMP_ProcessorLog + implements AdempiereProcessorLog +{ + + /** + * serialVersionUID + */ + private static final long serialVersionUID = 1L; + + /** + * + * @param ctx + * @param EXP_ReplicationProcessorLog_ID + * @param trxName + */ + public MIMPProcessorLog(Properties ctx, int IMP_ProcessorLog_ID, String trxName) { + super(ctx, IMP_ProcessorLog_ID, trxName); + } + + /** + * + * @param ctx + * @param rs + * @param trxName + */ + public MIMPProcessorLog(Properties ctx, ResultSet rs, String trxName) + { + super(ctx, rs, trxName); + } + + /** + * + * @param parent + * @param summary + */ + public MIMPProcessorLog (MIMPProcessor parent, String summary) + { + this (parent.getCtx(), 0, parent.get_TrxName()); + setClientOrg(parent); + setIMP_Processor_ID(parent.getIMP_Processor_ID()); + setSummary(summary); + } + +} diff --git a/base/src/org/compiere/model/MReplicationStrategy.java b/base/src/org/compiere/model/MReplicationStrategy.java index e69debf506..0b96cff010 100644 --- a/base/src/org/compiere/model/MReplicationStrategy.java +++ b/base/src/org/compiere/model/MReplicationStrategy.java @@ -56,10 +56,11 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy { */ public Collection getReplicationTables() { String whereClause = new StringBuffer(X_AD_ReplicationTable.COLUMNNAME_AD_ReplicationStrategy_ID)+"=?"; // #1 - return new Query(getCtx(),X_AD_ReplicationTable.Table_Name,whereClause,get_TrxName()) - .setParameters(new Object[]{getAD_ReplicationStrategy_ID()}) - .setApplyAccessFilter(true) - .list(); + return new Query(getCtx(), X_AD_ReplicationTable.Table_Name, whereClause, get_TrxName()) + .setParameters(new Object[]{getAD_ReplicationStrategy_ID()}) + .setApplyAccessFilter(false) + .list() + ; } /** @@ -68,9 +69,10 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy { public Collection getReplicationDocuments() { String whereClause = "AD_ReplicationStrategy_ID=?"; // #1 return new Query(getCtx(),X_AD_ReplicationDocument.Table_Name,whereClause,get_TrxName()) - .setParameters(new Object[]{getAD_ReplicationStrategy_ID()}) - .setApplyAccessFilter(true) - .list(); + .setParameters(new Object[]{getAD_ReplicationStrategy_ID()}) + .setApplyAccessFilter(false) + .list() + ; } /** @@ -81,10 +83,11 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy { public static X_AD_ReplicationTable getReplicationTable(Properties ctx ,int AD_ReplicationStrategy_ID, int AD_Table_ID) { String whereClause = "AD_ReplicationStrategy_ID=? AND AD_Table_ID=?"; - return new Query(ctx,X_AD_ReplicationTable.Table_Name,whereClause, null) - .setApplyAccessFilter(true) - .setParameters(new Object[]{AD_ReplicationStrategy_ID,AD_Table_ID}) - .first(); + return new Query(ctx, X_AD_ReplicationTable.Table_Name, whereClause, null) + .setApplyAccessFilter(false) + .setParameters(new Object[]{AD_ReplicationStrategy_ID, AD_Table_ID}) + .first() + ; } /** @@ -95,11 +98,11 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy { public static X_AD_ReplicationDocument getReplicationDocument(Properties ctx ,int AD_ReplicationStrategy_ID , int AD_Table_ID) { String whereClause = "AD_ReplicationStrategy_ID=? AND AD_Table_ID=?"; - new Query(ctx ,X_AD_ReplicationDocument.Table_Name,whereClause, null) - .setApplyAccessFilter(true) - .setParameters(new Object[]{AD_ReplicationStrategy_ID,AD_Table_ID}) - .first(); - return null; + return new Query(ctx, X_AD_ReplicationDocument.Table_Name, whereClause, null) + .setApplyAccessFilter(true) + .setParameters(new Object[]{AD_ReplicationStrategy_ID, AD_Table_ID}) + .first() + ; } } diff --git a/base/src/org/compiere/model/X_AD_Replication.java b/base/src/org/compiere/model/X_AD_Replication.java index c8f6395625..a2ab3de07a 100644 --- a/base/src/org/compiere/model/X_AD_Replication.java +++ b/base/src/org/compiere/model/X_AD_Replication.java @@ -1,14 +1,14 @@ /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * + * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * + * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * @@ -35,7 +35,7 @@ public class X_AD_Replication extends PO implements I_AD_Replication, I_Persiste /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 20081221L; /** Standard Constructor */ public X_AD_Replication (Properties ctx, int AD_Replication_ID, String trxName) @@ -43,8 +43,8 @@ public class X_AD_Replication extends PO implements I_AD_Replication, I_Persiste super (ctx, AD_Replication_ID, trxName); /** if (AD_Replication_ID == 0) { - setAD_Replication_ID (0); setAD_ReplicationStrategy_ID (0); + setAD_Replication_ID (0); setHostAddress (null); setHostPort (0); // 80 @@ -84,28 +84,6 @@ public class X_AD_Replication extends PO implements I_AD_Replication, I_Persiste return sb.toString(); } - /** Set Replication. - @param AD_Replication_ID - Data Replication Target - */ - public void setAD_Replication_ID (int AD_Replication_ID) - { - if (AD_Replication_ID < 1) - throw new IllegalArgumentException ("AD_Replication_ID is mandatory."); - set_ValueNoCheck (COLUMNNAME_AD_Replication_ID, Integer.valueOf(AD_Replication_ID)); - } - - /** Get Replication. - @return Data Replication Target - */ - public int getAD_Replication_ID () - { - Integer ii = (Integer)get_Value(COLUMNNAME_AD_Replication_ID); - if (ii == null) - return 0; - return ii.intValue(); - } - public I_AD_ReplicationStrategy getAD_ReplicationStrategy() throws RuntimeException { Class clazz = MTable.getClass(I_AD_ReplicationStrategy.Table_Name); @@ -144,6 +122,28 @@ public class X_AD_Replication extends PO implements I_AD_Replication, I_Persiste return ii.intValue(); } + /** Set Replication. + @param AD_Replication_ID + Data Replication Target + */ + public void setAD_Replication_ID (int AD_Replication_ID) + { + if (AD_Replication_ID < 1) + throw new IllegalArgumentException ("AD_Replication_ID is mandatory."); + set_ValueNoCheck (COLUMNNAME_AD_Replication_ID, Integer.valueOf(AD_Replication_ID)); + } + + /** Get Replication. + @return Data Replication Target + */ + public int getAD_Replication_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_Replication_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Date last run. @param DateLastRun Date the process was last run. diff --git a/base/src/org/compiere/model/X_AD_ReplicationDocument.java b/base/src/org/compiere/model/X_AD_ReplicationDocument.java index 21df973734..1a8fbd6981 100644 --- a/base/src/org/compiere/model/X_AD_ReplicationDocument.java +++ b/base/src/org/compiere/model/X_AD_ReplicationDocument.java @@ -1,14 +1,14 @@ /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * + * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * + * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * @@ -31,7 +31,7 @@ public class X_AD_ReplicationDocument extends PO implements I_AD_ReplicationDocu /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 20081221L; /** Standard Constructor */ public X_AD_ReplicationDocument (Properties ctx, int AD_ReplicationDocument_ID, String trxName) @@ -224,7 +224,7 @@ public class X_AD_ReplicationDocument extends PO implements I_AD_ReplicationDocu public void setReplicationType (String ReplicationType) { if (ReplicationType == null) throw new IllegalArgumentException ("ReplicationType is mandatory"); - if (ReplicationType.equals("L") || ReplicationType.equals("M") || ReplicationType.equals("R")); else throw new IllegalArgumentException ("ReplicationType Invalid value - " + ReplicationType + " - Reference_ID=126 - L - M - R"); set_Value (COLUMNNAME_ReplicationType, ReplicationType); + set_Value (COLUMNNAME_ReplicationType, ReplicationType); } /** Get Replication Type. diff --git a/base/src/org/compiere/model/X_AD_ReplicationStrategy.java b/base/src/org/compiere/model/X_AD_ReplicationStrategy.java index 976b62bb06..565939c5b5 100644 --- a/base/src/org/compiere/model/X_AD_ReplicationStrategy.java +++ b/base/src/org/compiere/model/X_AD_ReplicationStrategy.java @@ -1,14 +1,14 @@ /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * + * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * + * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * @@ -32,7 +32,7 @@ public class X_AD_ReplicationStrategy extends PO implements I_AD_ReplicationStra /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 20081221L; /** Standard Constructor */ public X_AD_ReplicationStrategy (Properties ctx, int AD_ReplicationStrategy_ID, String trxName) @@ -114,33 +114,14 @@ public class X_AD_ReplicationStrategy extends PO implements I_AD_ReplicationStra return (String)get_Value(COLUMNNAME_Description); } - /** EntityType AD_Reference_ID=389 */ - public static final int ENTITYTYPE_AD_Reference_ID=389; - /** Set Entity Type. - @param EntityType - Dictionary Entity Type; Determines ownership and synchronization - */ - public void setEntityType (String EntityType) - { - set_Value (COLUMNNAME_EntityType, EntityType); - } - - /** Get Entity Type. - @return Dictionary Entity Type; Determines ownership and synchronization - */ - public String getEntityType () - { - return (String)get_Value(COLUMNNAME_EntityType); - } - - public org.eevolution.model.I_EXP_Processor getEXP_Processor() throws RuntimeException + public org.compiere.model.I_EXP_Processor getEXP_Processor() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_EXP_Processor.Table_Name); - org.eevolution.model.I_EXP_Processor result = null; + Class clazz = MTable.getClass(org.compiere.model.I_EXP_Processor.Table_Name); + org.compiere.model.I_EXP_Processor result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_EXP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_ID()), get_TrxName()}); + result = (org.compiere.model.I_EXP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); @@ -169,6 +150,26 @@ public class X_AD_ReplicationStrategy extends PO implements I_AD_ReplicationStra return ii.intValue(); } + /** EntityType AD_Reference_ID=389 */ + public static final int ENTITYTYPE_AD_Reference_ID=389; + /** Set Entity Type. + @param EntityType + Dictionary Entity Type; Determines ownership and synchronization + */ + public void setEntityType (String EntityType) + { + + set_Value (COLUMNNAME_EntityType, EntityType); + } + + /** Get Entity Type. + @return Dictionary Entity Type; Determines ownership and synchronization + */ + public String getEntityType () + { + return (String)get_Value(COLUMNNAME_EntityType); + } + /** Set Comment/Help. @param Help Comment or Hint diff --git a/base/src/org/compiere/model/X_AD_ReplicationTable.java b/base/src/org/compiere/model/X_AD_ReplicationTable.java index 0f7c258511..3a1b9e83a7 100644 --- a/base/src/org/compiere/model/X_AD_ReplicationTable.java +++ b/base/src/org/compiere/model/X_AD_ReplicationTable.java @@ -1,14 +1,14 @@ /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * + * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * + * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * @@ -32,7 +32,7 @@ public class X_AD_ReplicationTable extends PO implements I_AD_ReplicationTable, /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 20081221L; /** Standard Constructor */ public X_AD_ReplicationTable (Properties ctx, int AD_ReplicationTable_ID, String trxName) @@ -191,6 +191,7 @@ public class X_AD_ReplicationTable extends PO implements I_AD_ReplicationTable, */ public void setEntityType (String EntityType) { + set_Value (COLUMNNAME_EntityType, EntityType); } @@ -217,7 +218,7 @@ public class X_AD_ReplicationTable extends PO implements I_AD_ReplicationTable, public void setReplicationType (String ReplicationType) { if (ReplicationType == null) throw new IllegalArgumentException ("ReplicationType is mandatory"); - if (ReplicationType.equals("L") || ReplicationType.equals("M") || ReplicationType.equals("R")); else throw new IllegalArgumentException ("ReplicationType Invalid value - " + ReplicationType + " - Reference_ID=126 - L - M - R"); set_Value (COLUMNNAME_ReplicationType, ReplicationType); + set_Value (COLUMNNAME_ReplicationType, ReplicationType); } /** Get Replication Type. diff --git a/base/src/org/compiere/model/X_AD_Replication_Log.java b/base/src/org/compiere/model/X_AD_Replication_Log.java index 26417eb39a..b32505b8bf 100644 --- a/base/src/org/compiere/model/X_AD_Replication_Log.java +++ b/base/src/org/compiere/model/X_AD_Replication_Log.java @@ -1,14 +1,14 @@ /****************************************************************************** * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved. * - * This program is free software; you can redistribute it and/or modify it * + * This program is free software, you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied * * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * + * with this program, if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * For the text or an alternative of this public license, you may reach us * * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * @@ -32,7 +32,7 @@ public class X_AD_Replication_Log extends PO implements I_AD_Replication_Log, I_ /** * */ - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 20081221L; /** Standard Constructor */ public X_AD_Replication_Log (Properties ctx, int AD_Replication_Log_ID, String trxName) @@ -75,6 +75,45 @@ public class X_AD_Replication_Log extends PO implements I_AD_Replication_Log, I_ return sb.toString(); } + public I_AD_ReplicationTable getAD_ReplicationTable() throws RuntimeException + { + Class clazz = MTable.getClass(I_AD_ReplicationTable.Table_Name); + I_AD_ReplicationTable result = null; + try { + Constructor constructor = null; + constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); + result = (I_AD_ReplicationTable)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_ReplicationTable_ID()), get_TrxName()}); + } catch (Exception e) { + log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); + log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); + throw new RuntimeException( e ); + } + return result; + } + + /** Set Replication Table. + @param AD_ReplicationTable_ID + Data Replication Strategy Table Info + */ + public void setAD_ReplicationTable_ID (int AD_ReplicationTable_ID) + { + if (AD_ReplicationTable_ID < 1) + set_Value (COLUMNNAME_AD_ReplicationTable_ID, null); + else + set_Value (COLUMNNAME_AD_ReplicationTable_ID, Integer.valueOf(AD_ReplicationTable_ID)); + } + + /** Get Replication Table. + @return Data Replication Strategy Table Info + */ + public int getAD_ReplicationTable_ID () + { + Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReplicationTable_ID); + if (ii == null) + return 0; + return ii.intValue(); + } + /** Set Replication Log. @param AD_Replication_Log_ID Data Replication Log Details @@ -143,45 +182,6 @@ public class X_AD_Replication_Log extends PO implements I_AD_Replication_Log, I_ return new KeyNamePair(get_ID(), String.valueOf(getAD_Replication_Run_ID())); } - public I_AD_ReplicationTable getAD_ReplicationTable() throws RuntimeException - { - Class clazz = MTable.getClass(I_AD_ReplicationTable.Table_Name); - I_AD_ReplicationTable result = null; - try { - Constructor constructor = null; - constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (I_AD_ReplicationTable)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_ReplicationTable_ID()), get_TrxName()}); - } catch (Exception e) { - log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); - log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); - throw new RuntimeException( e ); - } - return result; - } - - /** Set Replication Table. - @param AD_ReplicationTable_ID - Data Replication Strategy Table Info - */ - public void setAD_ReplicationTable_ID (int AD_ReplicationTable_ID) - { - if (AD_ReplicationTable_ID < 1) - set_Value (COLUMNNAME_AD_ReplicationTable_ID, null); - else - set_Value (COLUMNNAME_AD_ReplicationTable_ID, Integer.valueOf(AD_ReplicationTable_ID)); - } - - /** Get Replication Table. - @return Data Replication Strategy Table Info - */ - public int getAD_ReplicationTable_ID () - { - Integer ii = (Integer)get_Value(COLUMNNAME_AD_ReplicationTable_ID); - if (ii == null) - return 0; - return ii.intValue(); - } - /** Set Replicated. @param IsReplicated The data is successfully replicated diff --git a/base/src/org/eevolution/model/X_EXP_Format.java b/base/src/org/compiere/model/X_EXP_Format.java similarity index 99% rename from base/src/org/eevolution/model/X_EXP_Format.java rename to base/src/org/compiere/model/X_EXP_Format.java index 84c23caf33..c1fc686f0b 100644 --- a/base/src/org/eevolution/model/X_EXP_Format.java +++ b/base/src/org/compiere/model/X_EXP_Format.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; diff --git a/base/src/org/eevolution/model/X_EXP_FormatLine.java b/base/src/org/compiere/model/X_EXP_FormatLine.java similarity index 96% rename from base/src/org/eevolution/model/X_EXP_FormatLine.java rename to base/src/org/compiere/model/X_EXP_FormatLine.java index 6fb27ed8ff..48a64deed2 100644 --- a/base/src/org/eevolution/model/X_EXP_FormatLine.java +++ b/base/src/org/compiere/model/X_EXP_FormatLine.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -207,14 +207,14 @@ public class X_EXP_FormatLine extends PO implements I_EXP_FormatLine, I_Persiste return ii.intValue(); } - public org.eevolution.model.I_EXP_Format getEXP_Format() throws RuntimeException + public org.compiere.model.I_EXP_Format getEXP_Format() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_EXP_Format.Table_Name); - org.eevolution.model.I_EXP_Format result = null; + Class clazz = MTable.getClass(org.compiere.model.I_EXP_Format.Table_Name); + org.compiere.model.I_EXP_Format result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_EXP_Format)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Format_ID()), get_TrxName()}); + result = (org.compiere.model.I_EXP_Format)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Format_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_EXP_Processor.java b/base/src/org/compiere/model/X_EXP_Processor.java similarity index 93% rename from base/src/org/eevolution/model/X_EXP_Processor.java rename to base/src/org/compiere/model/X_EXP_Processor.java index 47b1d1fdcc..06d72f0848 100644 --- a/base/src/org/eevolution/model/X_EXP_Processor.java +++ b/base/src/org/compiere/model/X_EXP_Processor.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -125,14 +125,14 @@ public class X_EXP_Processor extends PO implements I_EXP_Processor, I_Persistent return ii.intValue(); } - public org.eevolution.model.I_EXP_Processor_Type getEXP_Processor_Type() throws RuntimeException + public org.compiere.model.I_EXP_Processor_Type getEXP_Processor_Type() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_EXP_Processor_Type.Table_Name); - org.eevolution.model.I_EXP_Processor_Type result = null; + Class clazz = MTable.getClass(org.compiere.model.I_EXP_Processor_Type.Table_Name); + org.compiere.model.I_EXP_Processor_Type result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_EXP_Processor_Type)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_Type_ID()), get_TrxName()}); + result = (org.compiere.model.I_EXP_Processor_Type)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_Type_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_EXP_ProcessorParameter.java b/base/src/org/compiere/model/X_EXP_ProcessorParameter.java similarity index 93% rename from base/src/org/eevolution/model/X_EXP_ProcessorParameter.java rename to base/src/org/compiere/model/X_EXP_ProcessorParameter.java index 48ee8628bc..ee2dd0bc57 100644 --- a/base/src/org/eevolution/model/X_EXP_ProcessorParameter.java +++ b/base/src/org/compiere/model/X_EXP_ProcessorParameter.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -111,14 +111,14 @@ public class X_EXP_ProcessorParameter extends PO implements I_EXP_ProcessorParam return ii.intValue(); } - public org.eevolution.model.I_EXP_Processor getEXP_Processor() throws RuntimeException + public org.compiere.model.I_EXP_Processor getEXP_Processor() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_EXP_Processor.Table_Name); - org.eevolution.model.I_EXP_Processor result = null; + Class clazz = MTable.getClass(org.compiere.model.I_EXP_Processor.Table_Name); + org.compiere.model.I_EXP_Processor result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_EXP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_ID()), get_TrxName()}); + result = (org.compiere.model.I_EXP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getEXP_Processor_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_EXP_Processor_Type.java b/base/src/org/compiere/model/X_EXP_Processor_Type.java similarity index 99% rename from base/src/org/eevolution/model/X_EXP_Processor_Type.java rename to base/src/org/compiere/model/X_EXP_Processor_Type.java index 7e4ec4f6d5..c134374f68 100644 --- a/base/src/org/eevolution/model/X_EXP_Processor_Type.java +++ b/base/src/org/compiere/model/X_EXP_Processor_Type.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.sql.ResultSet; import java.util.Properties; diff --git a/base/src/org/eevolution/model/X_IMP_Processor.java b/base/src/org/compiere/model/X_IMP_Processor.java similarity index 95% rename from base/src/org/eevolution/model/X_IMP_Processor.java rename to base/src/org/compiere/model/X_IMP_Processor.java index 0e795d8dc0..fdf38df159 100644 --- a/base/src/org/eevolution/model/X_IMP_Processor.java +++ b/base/src/org/compiere/model/X_IMP_Processor.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -244,14 +244,14 @@ public class X_IMP_Processor extends PO implements I_IMP_Processor, I_Persistent return ii.intValue(); } - public org.eevolution.model.I_IMP_Processor_Type getIMP_Processor_Type() throws RuntimeException + public org.compiere.model.I_IMP_Processor_Type getIMP_Processor_Type() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_IMP_Processor_Type.Table_Name); - org.eevolution.model.I_IMP_Processor_Type result = null; + Class clazz = MTable.getClass(org.compiere.model.I_IMP_Processor_Type.Table_Name); + org.compiere.model.I_IMP_Processor_Type result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_IMP_Processor_Type)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_Type_ID()), get_TrxName()}); + result = (org.compiere.model.I_IMP_Processor_Type)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_Type_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_IMP_ProcessorLog.java b/base/src/org/compiere/model/X_IMP_ProcessorLog.java similarity index 93% rename from base/src/org/eevolution/model/X_IMP_ProcessorLog.java rename to base/src/org/compiere/model/X_IMP_ProcessorLog.java index 196df3f955..c5472f6de4 100644 --- a/base/src/org/eevolution/model/X_IMP_ProcessorLog.java +++ b/base/src/org/compiere/model/X_IMP_ProcessorLog.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -145,14 +145,14 @@ public class X_IMP_ProcessorLog extends PO implements I_IMP_ProcessorLog, I_Pers return ii.intValue(); } - public org.eevolution.model.I_IMP_Processor getIMP_Processor() throws RuntimeException + public org.compiere.model.I_IMP_Processor getIMP_Processor() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_IMP_Processor.Table_Name); - org.eevolution.model.I_IMP_Processor result = null; + Class clazz = MTable.getClass(org.compiere.model.I_IMP_Processor.Table_Name); + org.compiere.model.I_IMP_Processor result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_IMP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_ID()), get_TrxName()}); + result = (org.compiere.model.I_IMP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_IMP_ProcessorParameter.java b/base/src/org/compiere/model/X_IMP_ProcessorParameter.java similarity index 93% rename from base/src/org/eevolution/model/X_IMP_ProcessorParameter.java rename to base/src/org/compiere/model/X_IMP_ProcessorParameter.java index 97210317c3..466dc1ac7e 100644 --- a/base/src/org/eevolution/model/X_IMP_ProcessorParameter.java +++ b/base/src/org/compiere/model/X_IMP_ProcessorParameter.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.lang.reflect.Constructor; import java.sql.ResultSet; @@ -128,14 +128,14 @@ public class X_IMP_ProcessorParameter extends PO implements I_IMP_ProcessorParam return ii.intValue(); } - public org.eevolution.model.I_IMP_Processor getIMP_Processor() throws RuntimeException + public org.compiere.model.I_IMP_Processor getIMP_Processor() throws RuntimeException { - Class clazz = MTable.getClass(org.eevolution.model.I_IMP_Processor.Table_Name); - org.eevolution.model.I_IMP_Processor result = null; + Class clazz = MTable.getClass(org.compiere.model.I_IMP_Processor.Table_Name); + org.compiere.model.I_IMP_Processor result = null; try { Constructor constructor = null; constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class}); - result = (org.eevolution.model.I_IMP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_ID()), get_TrxName()}); + result = (org.compiere.model.I_IMP_Processor)constructor.newInstance(new Object[] {getCtx(), new Integer(getIMP_Processor_ID()), get_TrxName()}); } catch (Exception e) { log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e); log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz); diff --git a/base/src/org/eevolution/model/X_IMP_Processor_Type.java b/base/src/org/compiere/model/X_IMP_Processor_Type.java similarity index 99% rename from base/src/org/eevolution/model/X_IMP_Processor_Type.java rename to base/src/org/compiere/model/X_IMP_Processor_Type.java index 6b7f72bbe8..cc3cb5f4e1 100644 --- a/base/src/org/eevolution/model/X_IMP_Processor_Type.java +++ b/base/src/org/compiere/model/X_IMP_Processor_Type.java @@ -15,7 +15,7 @@ * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ /** Generated Model - DO NOT CHANGE */ -package org.eevolution.model; +package org.compiere.model; import java.sql.ResultSet; import java.util.Properties; diff --git a/migration/353a-trunk/oracle/449_StabilizeReplication.sql b/migration/353a-trunk/oracle/449_StabilizeReplication.sql new file mode 100644 index 0000000000..311e35e5ea --- /dev/null +++ b/migration/353a-trunk/oracle/449_StabilizeReplication.sql @@ -0,0 +1,174 @@ +--- EXP_FormatLine +ALTER TABLE EXP_FormatLine +MODIFY AD_Column_ID NULL; + + +--- Table: AD_Org +ALTER TABLE AD_Org +ADD AD_ReplicationStrategy_ID NUMBER(10,0); + +ALTER TABLE AD_Org +ADD CONSTRAINT AD_Org__AD_Repli_AD_Replica FOREIGN KEY(AD_ReplicationStrategy_ID) REFERENCES AD_ReplicationStrategy(AD_ReplicationStrategy_ID); + + +--- Table: AD_ReplicationStrategy +ALTER TABLE AD_ReplicationStrategy +ADD Value NVARCHAR2(40); + +UPDATE AD_ReplicationStrategy + Set Value = nextidfunc( (SELECT AD_Sequence_ID FROM AD_Sequence WHERE AD_Client_ID = 0 AND Name = 'AD_ReplicationStrategy'), 'N') +WHERE AD_ReplicationStrategy.Value IS NULL + AND AD_ReplicationStrategy.AD_Client_ID IN (0, 11); + +ALTER TABLE AD_ReplicationStrategy + ADD Constraint AD_ReplicationStrategy_Value UNIQUE(AD_Client_ID, Value); + + +--- Table: AD_ReplicationTable +ALTER TABLE AD_ReplicationTable +ADD Description NVARCHAR2(255); + + + +-- Apr 18, 2009 11:38:16 PM EEST +-- Replication stabilization +UPDATE AD_EntityType SET ModelPackage='org.compiere.model',Updated=TO_DATE('2009-04-18 23:38:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_EntityType_ID=50003 +; + +-- Apr 18, 2009 11:43:34 PM EEST +-- Replication stabilization +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,CreatedBy,Updated,Help,IsParent,AD_Client_ID,AD_Org_ID,Description,Name,IsActive,FieldLength,IsSelectionColumn,AD_Reference_ID,Created,IsUpdateable,IsKey,AD_Element_ID,UpdatedBy,IsEncrypted,IsAlwaysUpdateable,ColumnName) VALUES (57227,155,'A',0,'N','N','N',10,0,TO_DATE('2009-04-18 23:43:26','YYYY-MM-DD HH24:MI:SS'),'The Data Replication Strategy determines what and how tables are replicated ','N',0,0,'Data Replication Strategy','Replication Strategy','Y',10,'N',10,TO_DATE('2009-04-18 23:43:26','YYYY-MM-DD HH24:MI:SS'),'Y','N',2133,0,'N','N','AD_ReplicationStrategy_ID') +; + +-- Apr 18, 2009 11:43:34 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57227 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Apr 18, 2009 11:43:36 PM EEST +-- Replication stabilization +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,CreatedBy,Updated,Help,IsParent,AD_Client_ID,AD_Org_ID,Description,Name,IsActive,FieldLength,IsSelectionColumn,AD_Reference_ID,Created,IsUpdateable,IsKey,AD_Element_ID,UpdatedBy,IsEncrypted,IsAlwaysUpdateable,ColumnName) VALUES (57228,602,'A',0,'N','N','N',10,0,TO_DATE('2009-04-18 23:43:35','YYYY-MM-DD HH24:MI:SS'),'A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','N',0,0,'Search key for the record in the format required - must be unique','Search Key','Y',40,'N',10,TO_DATE('2009-04-18 23:43:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',620,0,'N','N','Value') +; + +-- Apr 18, 2009 11:43:36 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57228 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Apr 18, 2009 11:43:37 PM EEST +-- Replication stabilization +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,CreatedBy,Updated,Help,IsParent,AD_Client_ID,AD_Org_ID,Description,Name,IsActive,FieldLength,IsSelectionColumn,AD_Reference_ID,Created,IsUpdateable,IsKey,AD_Element_ID,UpdatedBy,IsEncrypted,IsAlwaysUpdateable,ColumnName) VALUES (57229,601,'A',0,'N','N','N',10,0,TO_DATE('2009-04-18 23:43:36','YYYY-MM-DD HH24:MI:SS'),'A description is limited to 255 characters.','N',0,0,'Optional short description of the record','Description','Y',255,'N',10,TO_DATE('2009-04-18 23:43:36','YYYY-MM-DD HH24:MI:SS'),'Y','N',275,0,'N','N','Description') +; + +-- Apr 18, 2009 11:43:37 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57229 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + + +-- Apr 19, 2009 1:08:16 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Data Replication Strategy','Y',TO_DATE('2009-04-19 01:08:10','YYYY-MM-DD HH24:MI:SS'),0,'Replication Strategy','Y','N','N',57227,'N',10,'Y',143,56981,0,TO_DATE('2009-04-19 01:08:10','YYYY-MM-DD HH24:MI:SS'),'N','The Data Replication Strategy determines what and how tables are replicated ','EE05') +; + +-- Apr 19, 2009 1:08:16 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56981 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Apr 19, 2009 1:08:18 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Search key for the record in the format required - must be unique','Y',TO_DATE('2009-04-19 01:08:18','YYYY-MM-DD HH24:MI:SS'),0,'Search Key','Y','N','N',57228,'N',10,'Y',524,56982,0,TO_DATE('2009-04-19 01:08:18','YYYY-MM-DD HH24:MI:SS'),'N','A search key allows you a fast method of finding a particular record. If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','EE05') +; + +-- Apr 19, 2009 1:08:19 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56982 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Apr 19, 2009 1:08:19 AM EEST +-- Replication stabilization +UPDATE AD_Field SET DisplayLength=20, Name='Search Key', IsDisplayed='Y', SeqNo=35, IsReadOnly='N', EntityType='EE05',Updated=TO_DATE('2009-04-19 01:08:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=56982 +; + +-- Apr 19, 2009 1:08:20 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Optional short description of the record','Y',TO_DATE('2009-04-19 01:08:19','YYYY-MM-DD HH24:MI:SS'),0,'Description','Y','N','N',57229,'N',20,'Y',525,56983,0,TO_DATE('2009-04-19 01:08:19','YYYY-MM-DD HH24:MI:SS'),'N','A description is limited to 255 characters.','EE05') +; + +-- Apr 19, 2009 1:08:20 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56983 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=7516 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=7517 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=7518 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=56982 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=54569 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=7524 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=7525 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=7527 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=7523 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=7522 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=7528 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=56983 +; + +-- Apr 19, 2009 9:50:46 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET DisplayLength=60,Updated=TO_DATE('2009-04-19 09:50:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56983 +; + + + + diff --git a/migration/353a-trunk/oracle/450_ReplicationExampleData.sql b/migration/353a-trunk/oracle/450_ReplicationExampleData.sql new file mode 100644 index 0000000000..ce4f7b2023 --- /dev/null +++ b/migration/353a-trunk/oracle/450_ReplicationExampleData.sql @@ -0,0 +1,407 @@ +-- Apr 19, 2009 8:25:02 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50000,0,0,'Y',TO_DATE('2009-04-19 08:24:57','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:24:57','YYYY-MM-DD HH24:MI:SS'),100,'Client_Value','Client Value',112,'3.2.0') +; + +-- Apr 19, 2009 8:25:07 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50000,50000,0,'Y',TO_DATE('2009-04-19 08:25:04','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:04','YYYY-MM-DD HH24:MI:SS'),'AD_Client_Value','AD_Client_Value',10,'Y',0,100,100,'N','E',4773) +; + +-- Apr 19, 2009 8:25:09 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50001,0,0,'Y',TO_DATE('2009-04-19 08:25:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:08','YYYY-MM-DD HH24:MI:SS'),100,'Org_Value','Organization',155,'3.2.0') +; + +-- Apr 19, 2009 8:25:09 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50001,50001,0,'Y',TO_DATE('2009-04-19 08:25:09','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:09','YYYY-MM-DD HH24:MI:SS'),'Value','Value',10,'Y',0,100,100,'N','E',2045) +; + +-- Apr 19, 2009 8:25:10 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50001,50002,0,'Y',TO_DATE('2009-04-19 08:25:10','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:10','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',20,'Y',0,100,100,'N','R',527,50000) +; + +-- Apr 19, 2009 8:25:11 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50002,0,0,'Y',TO_DATE('2009-04-19 08:25:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:11','YYYY-MM-DD HH24:MI:SS'),100,'User_Name','User',114,'3.2.0') +; + +-- Apr 19, 2009 8:25:12 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50002,50003,0,'Y',TO_DATE('2009-04-19 08:25:12','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:12','YYYY-MM-DD HH24:MI:SS'),'Name','Name',20,'Y',0,100,100,'Y','E',213) +; + +-- Apr 19, 2009 8:25:13 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50002,50004,0,'Y',TO_DATE('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client key',30,'Y',0,100,100,'Y','R',422,50000) +; + +-- Apr 19, 2009 8:25:14 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50003,0,0,'Y',TO_DATE('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),100,'C_BP_Group-Key','Business Partner Group',394,'3.2.0') +; + +-- Apr 19, 2009 8:25:15 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50003,50005,0,'Y',TO_DATE('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),'Value','Value',10,'Y',0,100,100,'Y','E',4969) +; + +-- Apr 19, 2009 8:25:16 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50003,50006,0,'Y',TO_DATE('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client key',30,'Y',0,100,100,'Y','R',4962,50000) +; + +-- Apr 19, 2009 8:25:17 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50004,0,0,'Y',TO_DATE('2009-04-19 08:25:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:16','YYYY-MM-DD HH24:MI:SS'),100,'C_Order-Key','Order key',259,'3.2.0') +; + +-- Apr 19, 2009 8:25:18 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50007,0,'Y',TO_DATE('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),'DocumentNo','Document number',10,'Y',0,100,100,'N','E',2169) +; + +-- Apr 19, 2009 8:25:19 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50008,0,'Y',TO_DATE('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),'C_DocType_ID','Document Type',20,'Y',0,100,100,'Y','E',2172) +; + +-- Apr 19, 2009 8:25:20 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50009,0,'Y',TO_DATE('2009-04-19 08:25:19','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:19','YYYY-MM-DD HH24:MI:SS'),'C_BPartner_ID','Business Partner',30,'Y',0,100,100,'Y','E',2762) +; + +-- Apr 19, 2009 8:25:21 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50005,0,0,'Y',TO_DATE('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),100,'C_Order','Order',259,'3.2.0') +; + +-- Apr 19, 2009 8:25:22 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50010,0,'Y',TO_DATE('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'N',0,100,100,'Y','R',2162,50000) +; + +-- Apr 19, 2009 8:25:23 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50011,0,'Y',TO_DATE('2009-04-19 08:25:22','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:22','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2163,50001) +; + +-- Apr 19, 2009 8:25:24 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50012,0,'Y',TO_DATE('2009-04-19 08:25:23','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:23','YYYY-MM-DD HH24:MI:SS'),'DocumentNo','Document number',30,'Y',0,100,100,'Y','E',2169) +; + +-- Apr 19, 2009 8:25:25 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50005,50013,0,'Y',TO_DATE('2009-04-19 08:25:24','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:24','YYYY-MM-DD HH24:MI:SS'),'Created','Date Created',40,'N',0,100,100,'Y','E',2165,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:26 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50005,50014,0,'Y',TO_DATE('2009-04-19 08:25:25','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:25','YYYY-MM-DD HH24:MI:SS'),'Updated','Date Updated',50,'N',0,100,100,'Y','E',2167,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:27 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50015,0,'Y',TO_DATE('2009-04-19 08:25:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:26','YYYY-MM-DD HH24:MI:SS'),'CreatedBy','Created By',60,'N',0,100,100,'Y','R',2166,50002) +; + +-- Apr 19, 2009 8:25:28 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50016,0,'Y',TO_DATE('2009-04-19 08:25:27','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:27','YYYY-MM-DD HH24:MI:SS'),'UpdatedBy','Updated By',70,'N',0,100,100,'Y','R',2168,50002) +; + +-- Apr 19, 2009 8:25:29 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50017,0,'Y',TO_DATE('2009-04-19 08:25:28','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:28','YYYY-MM-DD HH24:MI:SS'),'GrandTotal','Grand Total',80,'N',0,100,100,'N','E',2201) +; + +-- Apr 19, 2009 8:25:30 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type) VALUES (50005,50018,0,'Y',TO_DATE('2009-04-19 08:25:29','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:29','YYYY-MM-DD HH24:MI:SS'),'C_OrderLine','Order Line',90,'N',0,100,100,'N','M') +; + +-- Apr 19, 2009 8:25:30 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50019,0,'Y',TO_DATE('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),'C_DocType_ID','Document Type',100,'Y',0,100,100,'Y','E',2172) +; + +-- Apr 19, 2009 8:25:31 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50020,0,'Y',TO_DATE('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),'C_BPartner_ID','Business Partner',110,'Y',0,100,100,'Y','E',2762) +; + +-- Apr 19, 2009 8:25:32 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50006,0,0,'Y',TO_DATE('2009-04-19 08:25:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:31','YYYY-MM-DD HH24:MI:SS'),100,'C_OrderLine','Order Line',260,'3.2.0') +; + +-- Apr 19, 2009 8:25:33 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50021,0,'Y',TO_DATE('2009-04-19 08:25:32','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:32','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'N',0,100,100,'Y','R',2206,50000) +; + +-- Apr 19, 2009 8:25:34 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50022,0,'Y',TO_DATE('2009-04-19 08:25:33','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:33','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2207,50001) +; + +-- Apr 19, 2009 8:25:35 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50023,0,'Y',TO_DATE('2009-04-19 08:25:34','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:34','YYYY-MM-DD HH24:MI:SS'),'M_Product_ID','Product',30,'N',0,100,100,'N','E',2221) +; + +-- Apr 19, 2009 8:25:35 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50024,0,'Y',TO_DATE('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),'PriceEntered','Price Entered',40,'N',0,100,100,'N','E',12875) +; + +-- Apr 19, 2009 8:25:36 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50025,0,'Y',TO_DATE('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),'C_Order_ID','Order',50,'Y',0,100,100,'N','R',2213,50004) +; + +-- Apr 19, 2009 8:25:37 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50026,0,'Y',TO_DATE('2009-04-19 08:25:36','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:36','YYYY-MM-DD HH24:MI:SS'),'Line','Line number',60,'Y',0,100,100,'Y','E',2214) +; + +-- Apr 19, 2009 8:25:38 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50007,0,0,'Y',TO_DATE('2009-04-19 08:25:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:37','YYYY-MM-DD HH24:MI:SS'),100,'C_BPartner','Business Partner',291,'3.2.0') +; + +-- Apr 19, 2009 8:25:39 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50027,0,'Y',TO_DATE('2009-04-19 08:25:38','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:38','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'Y',0,100,100,'Y','R',2894,50000) +; + +-- Apr 19, 2009 8:25:40 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50028,0,'Y',TO_DATE('2009-04-19 08:25:39','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:39','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2895,50001) +; + +-- Apr 19, 2009 8:25:41 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50029,0,'Y',TO_DATE('2009-04-19 08:25:40','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:40','YYYY-MM-DD HH24:MI:SS'),'Value','Business Partner Key',30,'Y',0,100,100,'Y','E',2901) +; + +-- Apr 19, 2009 8:25:42 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50030,0,'Y',TO_DATE('2009-04-19 08:25:41','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:41','YYYY-MM-DD HH24:MI:SS'),'Name','Business Partner Name',40,'N',0,100,100,'Y','E',2902) +; + +-- Apr 19, 2009 8:25:43 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50031,0,'Y',TO_DATE('2009-04-19 08:25:42','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:42','YYYY-MM-DD HH24:MI:SS'),'DUNS','DUNS',50,'N',0,100,100,'N','E',2906) +; + +-- Apr 19, 2009 8:25:44 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50032,0,'Y',TO_DATE('2009-04-19 08:25:43','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:43','YYYY-MM-DD HH24:MI:SS'),'C_BP_Group_ID','BP Group',52,'N',0,100,100,'Y','R',4940,50003) +; + +-- Apr 19, 2009 8:25:44 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50007,50033,0,'Y',TO_DATE('2009-04-19 08:25:44','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:44','YYYY-MM-DD HH24:MI:SS'),'Created','Created',60,'N',0,100,100,'N','E',2897,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:45 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50034,0,'Y',TO_DATE('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),'CreatedBy','Created By',70,'N',0,100,100,'N','R',2898,50002) +; + +-- Apr 19, 2009 8:25:46 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50007,50035,0,'Y',TO_DATE('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),'Updated','Updated',80,'N',0,100,100,'N','E',2899,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:47 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50036,0,'Y',TO_DATE('2009-04-19 08:25:46','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:46','YYYY-MM-DD HH24:MI:SS'),'UpdatedBy','Updated By',90,'N',0,100,100,'N','R',2900,50002) +; + +-- Apr 19, 2009 8:25:48 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50008,11,0,'Y',TO_DATE('2009-04-19 08:25:47','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:47','YYYY-MM-DD HH24:MI:SS'),100,'GardenWorld-C_BPartner','Business Partner',291,'3.2.0.1') +; + +-- Apr 19, 2009 8:25:49 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50037,11,'Y',TO_DATE('2009-04-19 08:25:48','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:48','YYYY-MM-DD HH24:MI:SS'),'client','Client ID',10,'Y',0,100,100,'Y','R',2894) +; + +-- Apr 19, 2009 8:25:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50038,11,'Y',TO_DATE('2009-04-19 08:25:49','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:49','YYYY-MM-DD HH24:MI:SS'),'Value','Search key',20,'Y',0,100,100,'Y','E',2901) +; + +-- Apr 19, 2009 8:25:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50039,11,'Y',TO_DATE('2009-04-19 08:25:50','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:50','YYYY-MM-DD HH24:MI:SS'),'name','Name',30,'N',0,100,100,'N','E',2902) +; + +-- Apr 19, 2009 8:25:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50040,11,'N',TO_DATE('2009-04-19 08:25:51','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:51','YYYY-MM-DD HH24:MI:SS'),'language','Language',40,'N',0,100,100,'N','E',2914) +; + +-- Apr 19, 2009 8:25:52 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50009,11,0,'Y',TO_DATE('2009-04-19 08:25:52','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2009-04-19 08:25:52','YYYY-MM-DD HH24:MI:SS'),100,'clientPartners','All BPartners for Client/Tenant',112,'3.2.0') +; + +-- Apr 19, 2009 8:25:53 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50009,50041,11,'Y',TO_DATE('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),'value','Value',10,'Y',0,100,100,'N','E',4773) +; + +-- Apr 19, 2009 8:25:54 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,EXP_EmbeddedFormat_ID) VALUES (50009,50042,11,'Y',TO_DATE('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),'bPartner','Business partner',20,'N',0,100,100,'N','M',50008) +; + + + + +-- Apr 19, 2009 8:30:29 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor_Type (AD_Client_ID,Created,Description,Help,EXP_Processor_Type_ID,AD_Org_ID,IsActive,CreatedBy,Updated,UpdatedBy,Value,Name,JavaClass) VALUES (11,TO_DATE('2009-04-19 08:30:26','YYYY-MM-DD HH24:MI:SS'),'Adempiere HDD Export Processor Type','HDD Export Processor Type',50000,0,'Y',100,TO_DATE('2009-04-19 08:30:26','YYYY-MM-DD HH24:MI:SS'),100,'HDD Export Processor Type','HDD Export Processor Type','org.adempiere.process.rpl.exp.HDDExportProcessor') +; + +-- Apr 19, 2009 8:30:31 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor_Type (AD_Client_ID,Created,Description,Help,EXP_Processor_Type_ID,AD_Org_ID,IsActive,CreatedBy,Updated,UpdatedBy,Value,Name,JavaClass) VALUES (11,TO_DATE('2009-04-19 08:30:30','YYYY-MM-DD HH24:MI:SS'),'Adempiere JMS Topic Export Processor Type','JMS Topic Export Processor Type',50001,0,'Y',100,TO_DATE('2009-04-19 08:30:30','YYYY-MM-DD HH24:MI:SS'),100,'JMS Topic Export Processor Type','Human Readable name for - JMS Topic Export Processor Type','org.adempiere.process.rpl.exp.TopicExportProcessor') +; + + + + +-- Apr 19, 2009 8:32:43 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor (EXP_Processor_Type_ID,AD_Org_ID,Created,EXP_Processor_ID,AD_Client_ID,IsActive,CreatedBy,Updated,Name,Description,Account,UpdatedBy,Value,Help,Host,PasswordInfo) VALUES (50000,0,TO_DATE('2009-04-19 08:32:40','YYYY-MM-DD HH24:MI:SS'),50000,11,'Y',100,TO_DATE('2009-04-19 08:32:40','YYYY-MM-DD HH24:MI:SS'),'HDD Export Processor','HDD Export Processor Description','exampleAccount',100,'HDD Export Processor','HDD Export Processor Help','www.example.com','examplePassword') +; + +-- Apr 19, 2009 8:32:47 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:44','YYYY-MM-DD HH24:MI:SS'),100,50000,50000,11,TO_DATE('2009-04-19 08:32:44','YYYY-MM-DD HH24:MI:SS'),100,'Name of file under which xml will be exported','Export Processor Parameter Description','example-export.xml','fileName','Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:48 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:47','YYYY-MM-DD HH24:MI:SS'),100,50001,50000,11,TO_DATE('2009-04-19 08:32:47','YYYY-MM-DD HH24:MI:SS'),100,'Name of folder where file will be exported','Export Processor Parameter Description','C:/temp/','folder','Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:49 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor (EXP_Processor_Type_ID,AD_Org_ID,Created,EXP_Processor_ID,AD_Client_ID,IsActive,CreatedBy,Updated,Name,Description,Account,UpdatedBy,Value,Help,Host,Port,PasswordInfo) VALUES (50001,0,TO_DATE('2009-04-19 08:32:48','YYYY-MM-DD HH24:MI:SS'),50001,11,'Y',100,TO_DATE('2009-04-19 08:32:48','YYYY-MM-DD HH24:MI:SS'),'Human Readable name for - JMS Topic Export Processor','JMS Topic Export Processor Description','exampleAccount',100,'JMS Topic Export Processor','JMS Topic Export Processor Help','www.example.com',61616,'examplePassword') +; + +-- Apr 19, 2009 8:32:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:49','YYYY-MM-DD HH24:MI:SS'),100,50002,50001,11,TO_DATE('2009-04-19 08:32:49','YYYY-MM-DD HH24:MI:SS'),100,'Name of JMS Topic where xml will be exported','Export Processor Parameter Description','ExampleTopic','topicName','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,50003,50001,11,TO_DATE('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,'ClientID which will be set in JMS connection','Export Processor Parameter Description','ExampleClientID','clientID','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,50004,50001,11,TO_DATE('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,'protocol which will be used for JMS connection','Export Processor Parameter Description','tcp','protocol','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:52 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:51','YYYY-MM-DD HH24:MI:SS'),100,50005,50001,11,TO_DATE('2009-04-19 08:32:51','YYYY-MM-DD HH24:MI:SS'),100,'Time to Live for the JMS Message','Export Processor Parameter Description','10000','timeToLive','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:53 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_DATE('2009-04-19 08:32:52','YYYY-MM-DD HH24:MI:SS'),100,50006,50001,11,TO_DATE('2009-04-19 08:32:52','YYYY-MM-DD HH24:MI:SS'),100,'Is JMS Delivery Mode Persistent','Export Processor Parameter Description','true','isDeliveryModePersistent','JMS Topic Export Processor Parameter Help') +; + + + + +-- Apr 19, 2009 8:35:00 AM EEST +-- Replication stabilization +UPDATE EXP_FormatLine SET IsActive='Y', Name='Order Line', Position=90, IsPartUniqueIndex='N', IsMandatory='N', Type='M', EXP_EmbeddedFormat_ID=50006,Updated=TO_DATE('2009-04-19 08:35:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE EXP_FormatLine_ID=50018 +; + + + +-- Apr 19, 2009 9:09:35 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor_Type (IMP_Processor_Type_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Value,Description,Help,JavaClass,CreatedBy,Updated,UpdatedBy,Name) VALUES (50000,11,0,'Y',TO_DATE('2009-04-19 09:09:32','YYYY-MM-DD HH24:MI:SS'),'HDD Import Processor Type','Adempiere HDD Import Processor Type','HDD Import Processor Type','org.adempiere.server.rpl.imp.FileImportProcessor',100,TO_DATE('2009-04-19 09:09:32','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor Type') +; + +-- Apr 19, 2009 9:09:37 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor_Type (IMP_Processor_Type_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Value,Description,Help,JavaClass,CreatedBy,Updated,UpdatedBy,Name) VALUES (50001,11,0,'Y',TO_DATE('2009-04-19 09:09:36','YYYY-MM-DD HH24:MI:SS'),'JMS Topic Import Processor Type','Adempiere JMS Topic Import Processor Type','JMS Topic Import Processor Type','org.adempiere.server.rpl.imp.TopicImportProcessor',100,TO_DATE('2009-04-19 09:09:36','YYYY-MM-DD HH24:MI:SS'),100,'Human Readable name for - JMS Topic Import Processor Type') +; + + + +-- Apr 19, 2009 9:12:14 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor (IMP_Processor_ID,AD_Org_ID,IMP_Processor_Type_ID,AD_Client_ID,IsActive,Updated,UpdatedBy,Name,Description,Created,CreatedBy,Value,Help,Frequency,Processing,Host,FrequencyType,KeepLogDays,Account,PasswordInfo) VALUES (50000,0,50000,11,'Y',TO_DATE('2009-04-19 09:12:09','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor','HDD Import Processor Description',TO_DATE('2009-04-19 09:12:09','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor','HDD Import Processor Help',10,'N','www.example.com','M',7,'exampleAccount','examplePassword') +; + +-- Apr 19, 2009 9:12:17 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50000,11,'Y',TO_DATE('2009-04-19 09:12:15','YYYY-MM-DD HH24:MI:SS'),50000,0,100,TO_DATE('2009-04-19 09:12:15','YYYY-MM-DD HH24:MI:SS'),100,'fileName','Name of file from where xml will be imported','Import Processor Parameter Description','HDD Import Processor Parameter Help','C_Order') +; + +-- Apr 19, 2009 9:12:19 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor (IMP_Processor_ID,AD_Org_ID,IMP_Processor_Type_ID,AD_Client_ID,IsActive,Updated,UpdatedBy,Name,Description,Created,CreatedBy,Value,Help,Frequency,Processing,Host,Port,FrequencyType,KeepLogDays,Account,PasswordInfo) VALUES (50001,0,50001,11,'Y',TO_DATE('2009-04-19 09:12:18','YYYY-MM-DD HH24:MI:SS'),100,'Human Readable name for - JMS Topic Import Processor','JMS Topic Import Processor Description',TO_DATE('2009-04-19 09:12:18','YYYY-MM-DD HH24:MI:SS'),100,'JMS Topic Import Processor','JMS Topic Import Processor Help',10,'N','www.example.com',61616,'M',7,'exampleAccount','examplePassword') +; + +-- Apr 19, 2009 9:12:19 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_DATE('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),50001,0,100,TO_DATE('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),100,'topicName','Name of JMS Topic from where xml will be Imported','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','ExampleTopic') +; + +-- Apr 19, 2009 9:12:20 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_DATE('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),50002,0,100,TO_DATE('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),100,'protocol','protocol which will be used for JMS connection','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','tcp') +; + +-- Apr 19, 2009 9:12:21 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_DATE('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),50003,0,100,TO_DATE('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),100,'isDurableSubscription','Durable Subscription','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','true') +; + +-- Apr 19, 2009 9:12:22 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_DATE('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),50004,0,100,TO_DATE('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),100,'subscriptionName','Subscription Name','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','exampleSubName') +; + +-- Apr 19, 2009 9:12:23 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_DATE('2009-04-19 09:12:22','YYYY-MM-DD HH24:MI:SS'),50005,0,100,TO_DATE('2009-04-19 09:12:22','YYYY-MM-DD HH24:MI:SS'),100,'clientID','JMS Connection Client ID','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','ImpClientID') +; + + + +-- Apr 19, 2009 9:14:59 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationStrategy (Created,AD_Client_ID,AD_Org_ID,AD_ReplicationStrategy_ID,CreatedBy,Description,Updated,UpdatedBy,EntityType,Help,IsActive,Name,Value,EXP_Processor_ID) VALUES (TO_DATE('2009-04-19 09:14:55','YYYY-MM-DD HH24:MI:SS'),11,0,50000,100,'Example POS Replication Strategy - Description',TO_DATE('2009-04-19 09:14:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Example POS Replication Strategy - Help','Y','Example POS Replication Strategy','Example POS',50001) +; + +-- Apr 19, 2009 9:15:03 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationTable (UpdatedBy,AD_Org_ID,Updated,AD_Client_ID,AD_ReplicationTable_ID,Created,CreatedBy,EntityType,IsActive,ReplicationType,AD_ReplicationStrategy_ID,AD_Table_ID,Description) VALUES (100,0,TO_DATE('2009-04-19 09:15:00','YYYY-MM-DD HH24:MI:SS'),11,50000,TO_DATE('2009-04-19 09:15:00','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','R',50000,291,'Business Partner - Example') +; + +-- Apr 19, 2009 9:15:06 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationDocument (Updated,AD_ReplicationDocument_ID,AD_ReplicationStrategy_ID,AD_Org_ID,IsActive,AD_Client_ID,Created,C_DocType_ID,CreatedBy,UpdatedBy,Description,ReplicationType,AD_Table_ID) VALUES (TO_DATE('2009-04-19 09:15:03','YYYY-MM-DD HH24:MI:SS'),50000,50000,0,'Y',11,TO_DATE('2009-04-19 09:15:03','YYYY-MM-DD HH24:MI:SS'),132,100,100,'Standard Order - Example','R',259) +; + + + diff --git a/migration/353a-trunk/postgresql/449_StabilizeReplication.sql b/migration/353a-trunk/postgresql/449_StabilizeReplication.sql new file mode 100644 index 0000000000..581a142e8f --- /dev/null +++ b/migration/353a-trunk/postgresql/449_StabilizeReplication.sql @@ -0,0 +1,170 @@ +--- EXP_FormatLine +ALTER TABLE EXP_FormatLine +ALTER COLUMN AD_Column_ID DROP NOT NULL; +commit; + + +--- Table: AD_Org +ALTER TABLE AD_Org +ADD column AD_ReplicationStrategy_ID NUMERIC; +commit; + +ALTER TABLE AD_Org +ADD CONSTRAINT AD_Org__AD_Repli_AD_Replica FOREIGN KEY(AD_ReplicationStrategy_ID) REFERENCES AD_ReplicationStrategy(AD_ReplicationStrategy_ID); +commit; + + +--- Table: AD_ReplicationStrategy +ALTER TABLE AD_ReplicationStrategy +ADD COLUMN Value VARCHAR(40); +commit; + +UPDATE AD_ReplicationStrategy + Set Value = nextidfunc( (SELECT AD_Sequence_ID FROM AD_Sequence WHERE AD_Client_ID = 0 AND Name = 'AD_ReplicationStrategy')::integer, 'N'::varchar) +WHERE AD_ReplicationStrategy.Value IS NULL + AND AD_ReplicationStrategy.AD_Client_ID IN (0, 11); +commit; + +ALTER TABLE AD_ReplicationStrategy + ADD Constraint AD_ReplicationStrategy_Value UNIQUE(AD_Client_ID, Value); +commit; + + +--- Table: AD_ReplicationTable +ALTER TABLE AD_ReplicationTable +ADD COLUMN Description VARCHAR(255); +commit; + + + +-- Apr 18, 2009 11:38:16 PM EEST +-- Replication stabilization +UPDATE AD_EntityType SET ModelPackage='org.compiere.model',Updated=TO_TIMESTAMP('2009-04-18 23:38:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_EntityType_ID=50003 +; + +-- Apr 18, 2009 11:43:35 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57227 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Apr 18, 2009 11:43:36 PM EEST +-- Replication stabilization +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,CreatedBy,Updated,Help,IsParent,AD_Client_ID,AD_Org_ID,Description,Name,IsActive,FieldLength,IsSelectionColumn,AD_Reference_ID,Created,IsUpdateable,IsKey,AD_Element_ID,UpdatedBy,IsEncrypted,IsAlwaysUpdateable,ColumnName) VALUES (57228,602,'A',0,'N','N','N',10,0,TO_TIMESTAMP('2009-04-18 23:43:35','YYYY-MM-DD HH24:MI:SS'),'A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','N',0,0,'Search key for the record in the format required - must be unique','Search Key','Y',40,'N',10,TO_TIMESTAMP('2009-04-18 23:43:35','YYYY-MM-DD HH24:MI:SS'),'Y','N',620,0,'N','N','Value') +; + +-- Apr 18, 2009 11:43:36 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57228 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + +-- Apr 18, 2009 11:43:37 PM EEST +-- Replication stabilization +INSERT INTO AD_Column (AD_Column_ID,AD_Table_ID,EntityType,Version,IsMandatory,IsTranslated,IsIdentifier,SeqNo,CreatedBy,Updated,Help,IsParent,AD_Client_ID,AD_Org_ID,Description,Name,IsActive,FieldLength,IsSelectionColumn,AD_Reference_ID,Created,IsUpdateable,IsKey,AD_Element_ID,UpdatedBy,IsEncrypted,IsAlwaysUpdateable,ColumnName) VALUES (57229,601,'A',0,'N','N','N',10,0,TO_TIMESTAMP('2009-04-18 23:43:36','YYYY-MM-DD HH24:MI:SS'),'A description is limited to 255 characters.','N',0,0,'Optional short description of the record','Description','Y',255,'N',10,TO_TIMESTAMP('2009-04-18 23:43:36','YYYY-MM-DD HH24:MI:SS'),'Y','N',275,0,'N','N','Description') +; + +-- Apr 18, 2009 11:43:37 PM EEST +-- Replication stabilization +INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=57229 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID) +; + + + +-- Apr 19, 2009 1:08:16 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Data Replication Strategy','Y',TO_TIMESTAMP('2009-04-19 01:08:10','YYYY-MM-DD HH24:MI:SS'),0,'Replication Strategy','Y','N','N',57227,'N',10,'Y',143,56981,0,TO_TIMESTAMP('2009-04-19 01:08:10','YYYY-MM-DD HH24:MI:SS'),'N','The Data Replication Strategy determines what and how tables are replicated ','EE05') +; + +-- Apr 19, 2009 1:08:16 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56981 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Apr 19, 2009 1:08:18 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Search key for the record in the format required - must be unique','Y',TO_TIMESTAMP('2009-04-19 01:08:18','YYYY-MM-DD HH24:MI:SS'),0,'Search Key','Y','N','N',57228,'N',10,'Y',524,56982,0,TO_TIMESTAMP('2009-04-19 01:08:18','YYYY-MM-DD HH24:MI:SS'),'N','A search key allows you a fast method of finding a particular record. +If you leave the search key empty, the system automatically creates a numeric number. The document sequence used for this fallback number is defined in the "Maintain Sequence" window with the name "DocumentNo_", where TableName is the actual name of the table (e.g. C_Order).','EE05') +; + +-- Apr 19, 2009 1:08:19 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56982 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + +-- Apr 19, 2009 1:08:20 AM EEST +-- Replication stabilization +INSERT INTO AD_Field (IsEncrypted,UpdatedBy,AD_Org_ID,Description,IsActive,Created,AD_Client_ID,Name,IsDisplayed,IsSameLine,IsHeading,AD_Column_ID,IsFieldOnly,SeqNo,IsCentrallyMaintained,AD_Tab_ID,AD_Field_ID,CreatedBy,Updated,IsReadOnly,Help,EntityType) VALUES ('N',0,0,'Optional short description of the record','Y',TO_TIMESTAMP('2009-04-19 01:08:19','YYYY-MM-DD HH24:MI:SS'),0,'Description','Y','N','N',57229,'N',20,'Y',525,56983,0,TO_TIMESTAMP('2009-04-19 01:08:19','YYYY-MM-DD HH24:MI:SS'),'N','A description is limited to 255 characters.','EE05') +; + +-- Apr 19, 2009 1:08:20 AM EEST +-- Replication stabilization +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Name,Help, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Name,t.Help, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=56983 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID) +; + + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=7516 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=7517 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=7518 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=56982 +; + +-- Apr 19, 2009 9:45:34 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=54569 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=7524 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=10,IsDisplayed='Y' WHERE AD_Field_ID=7525 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=20,IsDisplayed='Y' WHERE AD_Field_ID=7527 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=30,IsDisplayed='Y' WHERE AD_Field_ID=7523 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=40,IsDisplayed='Y' WHERE AD_Field_ID=7522 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=50,IsDisplayed='Y' WHERE AD_Field_ID=7528 +; + +-- Apr 19, 2009 9:46:51 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET SeqNo=60,IsDisplayed='Y' WHERE AD_Field_ID=56983 +; + +-- Apr 19, 2009 9:50:46 AM EEST +-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator +UPDATE AD_Field SET DisplayLength=60,Updated=TO_TIMESTAMP('2009-04-19 09:50:46','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=56983 +; + + diff --git a/migration/353a-trunk/postgresql/450_ReplicationExampleData.sql b/migration/353a-trunk/postgresql/450_ReplicationExampleData.sql new file mode 100644 index 0000000000..65b5a879bc --- /dev/null +++ b/migration/353a-trunk/postgresql/450_ReplicationExampleData.sql @@ -0,0 +1,405 @@ +-- Apr 19, 2009 8:25:02 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50000,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:24:57','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:24:57','YYYY-MM-DD HH24:MI:SS'),100,'Client_Value','Client Value',112,'3.2.0') +; + +-- Apr 19, 2009 8:25:07 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50000,50000,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:04','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:04','YYYY-MM-DD HH24:MI:SS'),'AD_Client_Value','AD_Client_Value',10,'Y',0,100,100,'N','E',4773) +; + +-- Apr 19, 2009 8:25:09 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50001,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:08','YYYY-MM-DD HH24:MI:SS'),100,'Org_Value','Organization',155,'3.2.0') +; + +-- Apr 19, 2009 8:25:09 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50001,50001,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:09','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:09','YYYY-MM-DD HH24:MI:SS'),'Value','Value',10,'Y',0,100,100,'N','E',2045) +; + +-- Apr 19, 2009 8:25:10 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50001,50002,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:10','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:10','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',20,'Y',0,100,100,'N','R',527,50000) +; + +-- Apr 19, 2009 8:25:11 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50002,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:11','YYYY-MM-DD HH24:MI:SS'),100,'User_Name','User',114,'3.2.0') +; + +-- Apr 19, 2009 8:25:12 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50002,50003,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:12','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:12','YYYY-MM-DD HH24:MI:SS'),'Name','Name',20,'Y',0,100,100,'Y','E',213) +; + +-- Apr 19, 2009 8:25:13 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50002,50004,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client key',30,'Y',0,100,100,'Y','R',422,50000) +; + +-- Apr 19, 2009 8:25:14 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50003,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:13','YYYY-MM-DD HH24:MI:SS'),100,'C_BP_Group-Key','Business Partner Group',394,'3.2.0') +; + +-- Apr 19, 2009 8:25:15 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50003,50005,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),'Value','Value',10,'Y',0,100,100,'Y','E',4969) +; + +-- Apr 19, 2009 8:25:16 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50003,50006,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:15','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client key',30,'Y',0,100,100,'Y','R',4962,50000) +; + +-- Apr 19, 2009 8:25:17 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50004,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:16','YYYY-MM-DD HH24:MI:SS'),100,'C_Order-Key','Order key',259,'3.2.0') +; + +-- Apr 19, 2009 8:25:18 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50007,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),'DocumentNo','Document number',10,'Y',0,100,100,'N','E',2169) +; + +-- Apr 19, 2009 8:25:19 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50008,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:18','YYYY-MM-DD HH24:MI:SS'),'C_DocType_ID','Document Type',20,'Y',0,100,100,'Y','E',2172) +; + +-- Apr 19, 2009 8:25:20 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50004,50009,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:19','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:19','YYYY-MM-DD HH24:MI:SS'),'C_BPartner_ID','Business Partner',30,'Y',0,100,100,'Y','E',2762) +; + +-- Apr 19, 2009 8:25:21 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50005,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),100,'C_Order','Order',259,'3.2.0') +; + +-- Apr 19, 2009 8:25:22 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50010,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:21','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'N',0,100,100,'Y','R',2162,50000) +; + +-- Apr 19, 2009 8:25:23 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50011,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:22','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:22','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2163,50001) +; + +-- Apr 19, 2009 8:25:24 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50012,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:23','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:23','YYYY-MM-DD HH24:MI:SS'),'DocumentNo','Document number',30,'Y',0,100,100,'Y','E',2169) +; + +-- Apr 19, 2009 8:25:25 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50005,50013,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:24','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:24','YYYY-MM-DD HH24:MI:SS'),'Created','Date Created',40,'N',0,100,100,'Y','E',2165,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:26 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50005,50014,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:25','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:25','YYYY-MM-DD HH24:MI:SS'),'Updated','Date Updated',50,'N',0,100,100,'Y','E',2167,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:27 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50015,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:26','YYYY-MM-DD HH24:MI:SS'),'CreatedBy','Created By',60,'N',0,100,100,'Y','R',2166,50002) +; + +-- Apr 19, 2009 8:25:28 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50005,50016,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:27','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:27','YYYY-MM-DD HH24:MI:SS'),'UpdatedBy','Updated By',70,'N',0,100,100,'Y','R',2168,50002) +; + +-- Apr 19, 2009 8:25:29 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50017,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:28','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:28','YYYY-MM-DD HH24:MI:SS'),'GrandTotal','Grand Total',80,'N',0,100,100,'N','E',2201) +; + +-- Apr 19, 2009 8:25:30 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type) VALUES (50005,50018,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:29','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:29','YYYY-MM-DD HH24:MI:SS'),'C_OrderLine','Order Line',90,'N',0,100,100,'N','M') +; + +-- Apr 19, 2009 8:25:30 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50019,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),'C_DocType_ID','Document Type',100,'Y',0,100,100,'Y','E',2172) +; + +-- Apr 19, 2009 8:25:31 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50005,50020,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:30','YYYY-MM-DD HH24:MI:SS'),'C_BPartner_ID','Business Partner',110,'Y',0,100,100,'Y','E',2762) +; + +-- Apr 19, 2009 8:25:32 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50006,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:31','YYYY-MM-DD HH24:MI:SS'),100,'C_OrderLine','Order Line',260,'3.2.0') +; + +-- Apr 19, 2009 8:25:33 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50021,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:32','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:32','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'N',0,100,100,'Y','R',2206,50000) +; + +-- Apr 19, 2009 8:25:34 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50022,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:33','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:33','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2207,50001) +; + +-- Apr 19, 2009 8:25:35 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50023,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:34','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:34','YYYY-MM-DD HH24:MI:SS'),'M_Product_ID','Product',30,'N',0,100,100,'N','E',2221) +; + +-- Apr 19, 2009 8:25:35 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50024,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),'PriceEntered','Price Entered',40,'N',0,100,100,'N','E',12875) +; + +-- Apr 19, 2009 8:25:36 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50006,50025,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:35','YYYY-MM-DD HH24:MI:SS'),'C_Order_ID','Order',50,'Y',0,100,100,'N','R',2213,50004) +; + +-- Apr 19, 2009 8:25:37 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50006,50026,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:36','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:36','YYYY-MM-DD HH24:MI:SS'),'Line','Line number',60,'Y',0,100,100,'Y','E',2214) +; + +-- Apr 19, 2009 8:25:38 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50007,0,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:37','YYYY-MM-DD HH24:MI:SS'),100,'C_BPartner','Business Partner',291,'3.2.0') +; + +-- Apr 19, 2009 8:25:39 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50027,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:38','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:38','YYYY-MM-DD HH24:MI:SS'),'AD_Client_ID','Client',10,'Y',0,100,100,'Y','R',2894,50000) +; + +-- Apr 19, 2009 8:25:40 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50028,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:39','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:39','YYYY-MM-DD HH24:MI:SS'),'AD_Org_ID','Organization',20,'N',0,100,100,'Y','R',2895,50001) +; + +-- Apr 19, 2009 8:25:41 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50029,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:40','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:40','YYYY-MM-DD HH24:MI:SS'),'Value','Business Partner Key',30,'Y',0,100,100,'Y','E',2901) +; + +-- Apr 19, 2009 8:25:42 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50030,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:41','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:41','YYYY-MM-DD HH24:MI:SS'),'Name','Business Partner Name',40,'N',0,100,100,'Y','E',2902) +; + +-- Apr 19, 2009 8:25:43 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50007,50031,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:42','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:42','YYYY-MM-DD HH24:MI:SS'),'DUNS','DUNS',50,'N',0,100,100,'N','E',2906) +; + +-- Apr 19, 2009 8:25:44 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50032,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:43','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:43','YYYY-MM-DD HH24:MI:SS'),'C_BP_Group_ID','BP Group',52,'N',0,100,100,'Y','R',4940,50003) +; + +-- Apr 19, 2009 8:25:45 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50007,50033,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:44','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:44','YYYY-MM-DD HH24:MI:SS'),'Created','Created',60,'N',0,100,100,'N','E',2897,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:45 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50034,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),'CreatedBy','Created By',70,'N',0,100,100,'N','R',2898,50002) +; + +-- Apr 19, 2009 8:25:46 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,DateFormat) VALUES (50007,50035,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:45','YYYY-MM-DD HH24:MI:SS'),'Updated','Updated',80,'N',0,100,100,'N','E',2899,'MM/dd/yyyy hh:mm:ss') +; + +-- Apr 19, 2009 8:25:47 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID,EXP_EmbeddedFormat_ID) VALUES (50007,50036,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:46','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:46','YYYY-MM-DD HH24:MI:SS'),'UpdatedBy','Updated By',90,'N',0,100,100,'N','R',2900,50002) +; + +-- Apr 19, 2009 8:25:48 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50008,11,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:47','YYYY-MM-DD HH24:MI:SS'),100,'GardenWorld-C_BPartner','Business Partner',291,'3.2.0.1') +; + +-- Apr 19, 2009 8:25:49 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50037,11,'Y',TO_TIMESTAMP('2009-04-19 08:25:48','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:48','YYYY-MM-DD HH24:MI:SS'),'client','Client ID',10,'Y',0,100,100,'Y','R',2894) +; + +-- Apr 19, 2009 8:25:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50038,11,'Y',TO_TIMESTAMP('2009-04-19 08:25:49','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:49','YYYY-MM-DD HH24:MI:SS'),'Value','Search key',20,'Y',0,100,100,'Y','E',2901) +; + +-- Apr 19, 2009 8:25:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50039,11,'Y',TO_TIMESTAMP('2009-04-19 08:25:50','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:50','YYYY-MM-DD HH24:MI:SS'),'name','Name',30,'N',0,100,100,'N','E',2902) +; + +-- Apr 19, 2009 8:25:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50008,50040,11,'N',TO_TIMESTAMP('2009-04-19 08:25:51','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:51','YYYY-MM-DD HH24:MI:SS'),'language','Language',40,'N',0,100,100,'N','E',2914) +; + +-- Apr 19, 2009 8:25:52 AM EEST +-- Replication stabilization +INSERT INTO EXP_Format (Processing,EXP_Format_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Value,Name,AD_Table_ID,Version) VALUES ('N',50009,11,0,'Y',TO_TIMESTAMP('2009-04-19 08:25:52','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2009-04-19 08:25:52','YYYY-MM-DD HH24:MI:SS'),100,'clientPartners','All BPartners for Client/Tenant',112,'3.2.0') +; + +-- Apr 19, 2009 8:25:53 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,AD_Column_ID) VALUES (50009,50041,11,'Y',TO_TIMESTAMP('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),'value','Value',10,'Y',0,100,100,'N','E',4773) +; + +-- Apr 19, 2009 8:25:54 AM EEST +-- Replication stabilization +INSERT INTO EXP_FormatLine (EXP_Format_ID,EXP_FormatLine_ID,AD_Client_ID,IsActive,Created,Updated,Value,Name,Position,IsPartUniqueIndex,AD_Org_ID,CreatedBy,UpdatedBy,IsMandatory,Type,EXP_EmbeddedFormat_ID) VALUES (50009,50042,11,'Y',TO_TIMESTAMP('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2009-04-19 08:25:53','YYYY-MM-DD HH24:MI:SS'),'bPartner','Business partner',20,'N',0,100,100,'N','M',50008) +; + + + +-- Apr 19, 2009 8:30:29 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor_Type (AD_Client_ID,Created,Description,Help,EXP_Processor_Type_ID,AD_Org_ID,IsActive,CreatedBy,Updated,UpdatedBy,Value,Name,JavaClass) VALUES (11,TO_TIMESTAMP('2009-04-19 08:30:26','YYYY-MM-DD HH24:MI:SS'),'Adempiere HDD Export Processor Type','HDD Export Processor Type',50000,0,'Y',100,TO_TIMESTAMP('2009-04-19 08:30:26','YYYY-MM-DD HH24:MI:SS'),100,'HDD Export Processor Type','HDD Export Processor Type','org.adempiere.process.rpl.exp.HDDExportProcessor') +; + +-- Apr 19, 2009 8:30:31 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor_Type (AD_Client_ID,Created,Description,Help,EXP_Processor_Type_ID,AD_Org_ID,IsActive,CreatedBy,Updated,UpdatedBy,Value,Name,JavaClass) VALUES (11,TO_TIMESTAMP('2009-04-19 08:30:30','YYYY-MM-DD HH24:MI:SS'),'Adempiere JMS Topic Export Processor Type','JMS Topic Export Processor Type',50001,0,'Y',100,TO_TIMESTAMP('2009-04-19 08:30:30','YYYY-MM-DD HH24:MI:SS'),100,'JMS Topic Export Processor Type','Human Readable name for - JMS Topic Export Processor Type','org.adempiere.process.rpl.exp.TopicExportProcessor') +; + + + +-- Apr 19, 2009 8:32:43 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor (EXP_Processor_Type_ID,AD_Org_ID,Created,EXP_Processor_ID,AD_Client_ID,IsActive,CreatedBy,Updated,Name,Description,Account,UpdatedBy,Value,Help,Host,PasswordInfo) VALUES (50000,0,TO_TIMESTAMP('2009-04-19 08:32:40','YYYY-MM-DD HH24:MI:SS'),50000,11,'Y',100,TO_TIMESTAMP('2009-04-19 08:32:40','YYYY-MM-DD HH24:MI:SS'),'HDD Export Processor','HDD Export Processor Description','exampleAccount',100,'HDD Export Processor','HDD Export Processor Help','www.example.com','examplePassword') +; + +-- Apr 19, 2009 8:32:47 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:44','YYYY-MM-DD HH24:MI:SS'),100,50000,50000,11,TO_TIMESTAMP('2009-04-19 08:32:44','YYYY-MM-DD HH24:MI:SS'),100,'Name of file under which xml will be exported','Export Processor Parameter Description','example-export.xml','fileName','Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:48 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:47','YYYY-MM-DD HH24:MI:SS'),100,50001,50000,11,TO_TIMESTAMP('2009-04-19 08:32:47','YYYY-MM-DD HH24:MI:SS'),100,'Name of folder where file will be exported','Export Processor Parameter Description','C:/temp/','folder','Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:49 AM EEST +-- Replication stabilization +INSERT INTO EXP_Processor (EXP_Processor_Type_ID,AD_Org_ID,Created,EXP_Processor_ID,AD_Client_ID,IsActive,CreatedBy,Updated,Name,Description,Account,UpdatedBy,Value,Help,Host,Port,PasswordInfo) VALUES (50001,0,TO_TIMESTAMP('2009-04-19 08:32:48','YYYY-MM-DD HH24:MI:SS'),50001,11,'Y',100,TO_TIMESTAMP('2009-04-19 08:32:48','YYYY-MM-DD HH24:MI:SS'),'Human Readable name for - JMS Topic Export Processor','JMS Topic Export Processor Description','exampleAccount',100,'JMS Topic Export Processor','JMS Topic Export Processor Help','www.example.com',61616,'examplePassword') +; + +-- Apr 19, 2009 8:32:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:49','YYYY-MM-DD HH24:MI:SS'),100,50002,50001,11,TO_TIMESTAMP('2009-04-19 08:32:49','YYYY-MM-DD HH24:MI:SS'),100,'Name of JMS Topic where xml will be exported','Export Processor Parameter Description','ExampleTopic','topicName','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:50 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,50003,50001,11,TO_TIMESTAMP('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,'ClientID which will be set in JMS connection','Export Processor Parameter Description','ExampleClientID','clientID','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:51 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,50004,50001,11,TO_TIMESTAMP('2009-04-19 08:32:50','YYYY-MM-DD HH24:MI:SS'),100,'protocol which will be used for JMS connection','Export Processor Parameter Description','tcp','protocol','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:52 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:51','YYYY-MM-DD HH24:MI:SS'),100,50005,50001,11,TO_TIMESTAMP('2009-04-19 08:32:51','YYYY-MM-DD HH24:MI:SS'),100,'Time to Live for the JMS Message','Export Processor Parameter Description','10000','timeToLive','JMS Topic Export Processor Parameter Help') +; + +-- Apr 19, 2009 8:32:53 AM EEST +-- Replication stabilization +INSERT INTO EXP_ProcessorParameter (AD_Org_ID,IsActive,Created,CreatedBy,EXP_ProcessorParameter_ID,EXP_Processor_ID,AD_Client_ID,Updated,UpdatedBy,Name,Description,ParameterValue,Value,Help) VALUES (0,'Y',TO_TIMESTAMP('2009-04-19 08:32:52','YYYY-MM-DD HH24:MI:SS'),100,50006,50001,11,TO_TIMESTAMP('2009-04-19 08:32:52','YYYY-MM-DD HH24:MI:SS'),100,'Is JMS Delivery Mode Persistent','Export Processor Parameter Description','true','isDeliveryModePersistent','JMS Topic Export Processor Parameter Help') +; + + + + +-- Apr 19, 2009 8:35:00 AM EEST +-- Replication stabilization +UPDATE EXP_FormatLine SET IsActive='Y', Name='Order Line', Position=90, IsPartUniqueIndex='N', IsMandatory='N', Type='M', EXP_EmbeddedFormat_ID=50006,Updated=TO_TIMESTAMP('2009-04-19 08:35:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE EXP_FormatLine_ID=50018 +; + + + +-- Apr 19, 2009 9:09:35 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor_Type (IMP_Processor_Type_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Value,Description,Help,JavaClass,CreatedBy,Updated,UpdatedBy,Name) VALUES (50000,11,0,'Y',TO_TIMESTAMP('2009-04-19 09:09:32','YYYY-MM-DD HH24:MI:SS'),'HDD Import Processor Type','Adempiere HDD Import Processor Type','HDD Import Processor Type','org.adempiere.server.rpl.imp.FileImportProcessor',100,TO_TIMESTAMP('2009-04-19 09:09:32','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor Type') +; + +-- Apr 19, 2009 9:09:37 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor_Type (IMP_Processor_Type_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,Value,Description,Help,JavaClass,CreatedBy,Updated,UpdatedBy,Name) VALUES (50001,11,0,'Y',TO_TIMESTAMP('2009-04-19 09:09:36','YYYY-MM-DD HH24:MI:SS'),'JMS Topic Import Processor Type','Adempiere JMS Topic Import Processor Type','JMS Topic Import Processor Type','org.adempiere.server.rpl.imp.TopicImportProcessor',100,TO_TIMESTAMP('2009-04-19 09:09:36','YYYY-MM-DD HH24:MI:SS'),100,'Human Readable name for - JMS Topic Import Processor Type') +; + + + +-- Apr 19, 2009 9:12:14 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor (IMP_Processor_ID,AD_Org_ID,IMP_Processor_Type_ID,AD_Client_ID,IsActive,Updated,UpdatedBy,Name,Description,Created,CreatedBy,Value,Help,Frequency,Processing,Host,FrequencyType,KeepLogDays,Account,PasswordInfo) VALUES (50000,0,50000,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:09','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor','HDD Import Processor Description',TO_TIMESTAMP('2009-04-19 09:12:09','YYYY-MM-DD HH24:MI:SS'),100,'HDD Import Processor','HDD Import Processor Help',10,'N','www.example.com','M',7,'exampleAccount','examplePassword') +; + +-- Apr 19, 2009 9:12:17 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50000,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:15','YYYY-MM-DD HH24:MI:SS'),50000,0,100,TO_TIMESTAMP('2009-04-19 09:12:15','YYYY-MM-DD HH24:MI:SS'),100,'fileName','Name of file from where xml will be imported','Import Processor Parameter Description','HDD Import Processor Parameter Help','C_Order') +; + +-- Apr 19, 2009 9:12:19 AM EEST +-- Replication stabilization +INSERT INTO IMP_Processor (IMP_Processor_ID,AD_Org_ID,IMP_Processor_Type_ID,AD_Client_ID,IsActive,Updated,UpdatedBy,Name,Description,Created,CreatedBy,Value,Help,Frequency,Processing,Host,Port,FrequencyType,KeepLogDays,Account,PasswordInfo) VALUES (50001,0,50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:18','YYYY-MM-DD HH24:MI:SS'),100,'Human Readable name for - JMS Topic Import Processor','JMS Topic Import Processor Description',TO_TIMESTAMP('2009-04-19 09:12:18','YYYY-MM-DD HH24:MI:SS'),100,'JMS Topic Import Processor','JMS Topic Import Processor Help',10,'N','www.example.com',61616,'M',7,'exampleAccount','examplePassword') +; + +-- Apr 19, 2009 9:12:19 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),50001,0,100,TO_TIMESTAMP('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),100,'topicName','Name of JMS Topic from where xml will be Imported','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','ExampleTopic') +; + +-- Apr 19, 2009 9:12:20 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),50002,0,100,TO_TIMESTAMP('2009-04-19 09:12:19','YYYY-MM-DD HH24:MI:SS'),100,'protocol','protocol which will be used for JMS connection','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','tcp') +; + +-- Apr 19, 2009 9:12:21 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),50003,0,100,TO_TIMESTAMP('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),100,'isDurableSubscription','Durable Subscription','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','true') +; + +-- Apr 19, 2009 9:12:22 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),50004,0,100,TO_TIMESTAMP('2009-04-19 09:12:21','YYYY-MM-DD HH24:MI:SS'),100,'subscriptionName','Subscription Name','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','exampleSubName') +; + +-- Apr 19, 2009 9:12:23 AM EEST +-- Replication stabilization +INSERT INTO IMP_ProcessorParameter (IMP_Processor_ID,AD_Client_ID,IsActive,Created,IMP_ProcessorParameter_ID,AD_Org_ID,CreatedBy,Updated,UpdatedBy,Value,Name,Description,Help,ParameterValue) VALUES (50001,11,'Y',TO_TIMESTAMP('2009-04-19 09:12:22','YYYY-MM-DD HH24:MI:SS'),50005,0,100,TO_TIMESTAMP('2009-04-19 09:12:22','YYYY-MM-DD HH24:MI:SS'),100,'clientID','JMS Connection Client ID','Import Processor Parameter Description','JMS Topic Import Processor Parameter Help','ImpClientID') +; + + + +-- Apr 19, 2009 9:14:59 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationStrategy (Created,AD_Client_ID,AD_Org_ID,AD_ReplicationStrategy_ID,CreatedBy,Description,Updated,UpdatedBy,EntityType,Help,IsActive,Name,Value,EXP_Processor_ID) VALUES (TO_TIMESTAMP('2009-04-19 09:14:55','YYYY-MM-DD HH24:MI:SS'),11,0,50000,100,'Example POS Replication Strategy - Description',TO_TIMESTAMP('2009-04-19 09:14:55','YYYY-MM-DD HH24:MI:SS'),100,'D','Example POS Replication Strategy - Help','Y','Example POS Replication Strategy','Example POS',50001) +; + +-- Apr 19, 2009 9:15:03 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationTable (UpdatedBy,AD_Org_ID,Updated,AD_Client_ID,AD_ReplicationTable_ID,Created,CreatedBy,EntityType,IsActive,ReplicationType,AD_ReplicationStrategy_ID,AD_Table_ID,Description) VALUES (100,0,TO_TIMESTAMP('2009-04-19 09:15:00','YYYY-MM-DD HH24:MI:SS'),11,50000,TO_TIMESTAMP('2009-04-19 09:15:00','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','R',50000,291,'Business Partner - Example') +; + +-- Apr 19, 2009 9:15:06 AM EEST +-- Replication stabilization +INSERT INTO AD_ReplicationDocument (Updated,AD_ReplicationDocument_ID,AD_ReplicationStrategy_ID,AD_Org_ID,IsActive,AD_Client_ID,Created,C_DocType_ID,CreatedBy,UpdatedBy,Description,ReplicationType,AD_Table_ID) VALUES (TO_TIMESTAMP('2009-04-19 09:15:03','YYYY-MM-DD HH24:MI:SS'),50000,50000,0,'Y',11,TO_TIMESTAMP('2009-04-19 09:15:03','YYYY-MM-DD HH24:MI:SS'),132,100,100,'Standard Order - Example','R',259) +; + + + diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/IImportProcessor.java b/serverRoot/src/main/server/org/adempiere/server/rpl/IImportProcessor.java new file mode 100644 index 0000000000..7afc009a6f --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/IImportProcessor.java @@ -0,0 +1,57 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) * +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ +package org.adempiere.server.rpl; + +import java.util.Properties; + +import org.compiere.server.ReplicationProcessor; + +/** + * Interface for Import processor + * @author Trifon Trifonov + * + */ +public interface IImportProcessor { + + /** + * @param ctx + * @param expProcessor + * @param trxName + * @return void + * @throws Exception + */ + public void process(Properties ctx, ReplicationProcessor replicationProcessor, String trxName) throws Exception; + + /** + * + * @throws Exception + */ + public void stop() throws Exception; + +} diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/XMLHelper.java b/serverRoot/src/main/server/org/adempiere/server/rpl/XMLHelper.java new file mode 100644 index 0000000000..fc894d6dd0 --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/XMLHelper.java @@ -0,0 +1,140 @@ +/********************************************************************** +* This file is part of Adempiere ERP Bazaar * +* http://www.adempiere.org * +* * +* Copyright (C) Trifon Trifonov. * +* Copyright (C) Contributors * +* * +* This program is free software; you can redistribute it and/or * +* modify it under the terms of the GNU General Public License * +* as published by the Free Software Foundation; either version 2 * +* of the License, or (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the Free Software * +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * +* MA 02110-1301, USA. * +* * +* Contributors: * +* - Trifon Trifonov (trifonnt@users.sourceforge.net) * +* * +* Sponsors: * +* - E-evolution (http://www.e-evolution.com) * +***********************************************************************/ +package org.adempiere.server.rpl; + +import java.io.File; +import java.io.IOException; +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Utility class which helps with XML processing. + * + * @author Trifon Trifonov + * @version $Id$ + */ +public class XMLHelper { + + private static XPath xPath = XPathFactory.newInstance().newXPath(); + + public static Element getElement(String xPathExpression, Node node) + throws XPathExpressionException { + return (Element) xPath.evaluate(xPathExpression, node, + XPathConstants.NODE); + } + + public static Node getNode(String xPathExpression, Node node) + throws XPathExpressionException { + return (Node) xPath + .evaluate(xPathExpression, node, XPathConstants.NODE); + } + + public static NodeList getNodeList(String xPathExpression, Node node) + throws XPathExpressionException { + return (NodeList) xPath.evaluate(xPathExpression, node, + XPathConstants.NODESET); + } + + public static Double getNumber(String xPathExpression, Node node) + throws XPathExpressionException { + return (Double) xPath.evaluate(xPathExpression, node, + XPathConstants.NUMBER); + } + + public static String getString(String xPathExpression, Node node) + throws XPathExpressionException { + return (String) xPath.evaluate(xPathExpression, node, + XPathConstants.STRING); + } + + public static Boolean getBoolean(String xPathExpression, Node node) + throws XPathExpressionException { + return (Boolean) xPath.evaluate(xPathExpression, node, + XPathConstants.BOOLEAN); + } + + + + public static Document createDocumentFromFile(String pathToXmlFile) + throws ParserConfigurationException, SAXException, IOException { + // path to file is global + String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; + String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; + // String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + // validate against XML Schema in dbsql2xml.xsd + // documentBuilderFactory.setNamespaceAware(true); + + //INFO change validation to true. Someday when xsd file is complete... + documentBuilderFactory.setValidating(false); + documentBuilderFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); + // documentBuilderFactory.setAttribute(JAXP_SCHEMA_SOURCE, new File(pathToXsdFile)); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document document = documentBuilder.parse(new File(pathToXmlFile)); + + return document; + } + + public static Document createDocumentFromString(String str) + throws ParserConfigurationException, SAXException, IOException { + // path to file is global +// String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; +// String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; + // String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + // validate against XML Schema in dbsql2xml.xsd + // documentBuilderFactory.setNamespaceAware(true); + + //INFO change validation to true. Someday when xsd file is complete... + documentBuilderFactory.setValidating(false); +// documentBuilderFactory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); + // documentBuilderFactory.setAttribute(JAXP_SCHEMA_SOURCE, new File(pathToXsdFile)); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + Document document = documentBuilder.parse( new InputSource(new StringReader( str ) ) ); + + return document; + } + +} diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/FileImportProcessor.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/FileImportProcessor.java new file mode 100644 index 0000000000..e19b204275 --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/FileImportProcessor.java @@ -0,0 +1,89 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.adempiere.server.rpl.imp; + +import java.util.Properties; + +import org.adempiere.server.rpl.IImportProcessor; +import org.adempiere.server.rpl.XMLHelper; +import org.compiere.model.MIMPProcessor; +import org.compiere.model.X_IMP_ProcessorParameter; +import org.compiere.server.ReplicationProcessor; +import org.compiere.util.CLogger; +import org.w3c.dom.Document; + +/** + * + * @author Trifon N. Trifonov + * @version $Id:$ + */ +public class FileImportProcessor implements IImportProcessor { + + /** Logger */ + protected CLogger log = CLogger.getCLogger (FileImportProcessor.class); + + public void process(Properties ctx, ReplicationProcessor replicationProcessor, String trxName) + throws Exception { + + MIMPProcessor impProcessor = replicationProcessor.getMImportProcessor(); + + X_IMP_ProcessorParameter[] processorParameters = impProcessor.getIMP_ProcessorParameters(trxName); + + String fileName = null; + if (processorParameters != null && processorParameters.length > 0) { + for (int i = 0; i < processorParameters.length; i++) { + log.info("ProcesParameter Value = " + processorParameters[i].getValue()); + log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue()); + if (processorParameters[i].getValue().equals("fileName")) { + fileName = processorParameters[i].getParameterValue(); + } else { + // Some other mandatory parameter here + } + } + } + + if (fileName == null || fileName.length() == 0) { + throw new Exception("Missing IMP_ProcessorParameter with key 'fileName'!"); + } + + Document documentToBeImported = XMLHelper.createDocumentFromFile(fileName); + StringBuffer result = new StringBuffer(); + + ImportHelper impHelper = new ImportHelper( ctx ); + impHelper.importXMLDocument(result, documentToBeImported, trxName ); + +// addLog(0, null, null, Msg.getMsg(ctx, "ImportModelProcessResult") + "\n" + result.toString()); + } + + public void stop() throws Exception { + // do nothing! + + } + +} diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ImportHelper.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ImportHelper.java new file mode 100644 index 0000000000..15ff9682d3 --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ImportHelper.java @@ -0,0 +1,761 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.adempiere.server.rpl.imp; + +import java.math.BigDecimal; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Properties; +import java.util.logging.Level; + +import javax.xml.xpath.XPathExpressionException; + +import org.adempiere.process.rpl.exp.ExportHelper; +import org.adempiere.server.rpl.XMLHelper; +import org.compiere.model.MClient; +import org.compiere.model.MColumn; +import org.compiere.model.MInOut; +import org.compiere.model.MReplicationStrategy; +import org.compiere.model.MTable; +import org.compiere.model.ModelValidator; +import org.compiere.model.PO; +import org.compiere.model.POInfo; +import org.compiere.model.X_AD_Client; +import org.compiere.model.X_AD_ReplicationTable; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.compiere.model.MEXPFormat; +import org.compiere.model.MEXPFormatLine; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +/** + * @author Trifon N. Trifonov +* @author Antonio Cañaveral, e-Evolution + *
  • [ 2195016 ] Implementation delete records messages + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2195016&group_id=176962&atid=879332 + *
  • Otras Modificaciones Posteriores + */ +public class ImportHelper { + + /** Instance Logger */ + private CLogger log = CLogger.getCLogger(ImportHelper.class); + + /** Static Logger */ + private static CLogger s_log = CLogger.getCLogger(ImportHelper.class); + + /** Date Time Format */ + private SimpleDateFormat m_dateTimeFormat = null; + + /** Date Format */ + private SimpleDateFormat m_dateFormat = null; + + /** Custom Date Format */ + private SimpleDateFormat m_customDateFormat = null; + + /** Context */ + private Properties ctx = null; + + public ImportHelper(Properties ctx) { + this.ctx = ctx; + // Construct DateFromat and DateTimeFormat + m_dateTimeFormat = DisplayType.getDateFormat(DisplayType.DateTime, Env.getLanguage(ctx)); + m_dateFormat = DisplayType.getDateFormat(DisplayType.Date, Env.getLanguage(ctx)); + } + + /** + * @param ctx + * @param result + * @param documentToBeImported + * @param trxName + * @throws Exception + * @throws SQLException + * @throws XPathExpressionException + */ + public void importXMLDocument(StringBuffer result, Document documentToBeImported, String trxName) + throws Exception, SQLException, XPathExpressionException + { + //Element rootNode = importedDocument.getFirstChild(); + Element rootElement = documentToBeImported.getDocumentElement(); + //NodeList nl = rootElement.getChildNodes(); + // iterate over all address nodes and find the one that has the correct addressee + //for (int i = 0; i < nl.getLength(); i++) { /* */ } + + // Find which Export format to Load... + String AD_Client_Value = null; + //AD_Client_Value = XMLHelper.getString("@AD_Client_Value", rootNode); + AD_Client_Value = rootElement.getAttribute("AD_Client_Value"); + log.info("AD_Client_Value = " + AD_Client_Value); + if (AD_Client_Value == null || "".equals(AD_Client_Value)) { + throw new Exception(Msg.getMsg(ctx, "XMLClientValueMandatory")); + } + String version = null; + version = rootElement.getAttribute("Version"); + log.info("Version = " + version); + if (version == null || "".equals(version)) { + throw new Exception(Msg.getMsg(ctx, "XMLVersionAttributeMandatory")); + } + ///Getting Attributes. + + ; + + int ReplicationMode = new Integer(rootElement.getAttribute("ReplicationMode")); + String ReplicationType = rootElement.getAttribute("ReplicationType"); + int ReplicationEvent = new Integer(rootElement.getAttribute("ReplicationEvent")); + + MClient client = null; + client = getAD_ClientByValue(ctx, AD_Client_Value, trxName); + if (client == null) { + throw new Exception(Msg.getMsg(ctx, "XMLClientNotFound")); + } + log.info(client.toString()); + + String EXP_Format_Value = null; + EXP_Format_Value = rootElement.getNodeName(); + log.info("EXP_Format_Value = " + EXP_Format_Value); + + MEXPFormat expFormat = null; + expFormat = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(ctx, EXP_Format_Value, client.getAD_Client_ID(), version, trxName); + if (expFormat == null || expFormat.getEXP_Format_ID() == 0) { + // Fall back to SYSTEM Client. + // Try to search Export format defined for SYSTEM Client!!! + MClient systemClient = null; + systemClient = MClient.get(ctx, 0); + if (systemClient == null) { + throw new Exception(Msg.getMsg(ctx, "XMLClientNotFound")); + } + log.info(systemClient.toString()); + expFormat = MEXPFormat.getFormatByValueAD_Client_IDAndVersion(ctx, EXP_Format_Value, systemClient.getAD_Client_ID(), version, trxName); + } + if (expFormat == null || expFormat.getEXP_Format_ID() == 0) { + throw new Exception(Msg.getMsg(ctx, "EXPFormatNotFound")); + } + log.info("expFormat = " + expFormat.toString()); + + PO po = importElement(ctx, result, rootElement, expFormat, trxName); + // Here must invoke other method else we get cycle... + boolean resultSave=false; + if(ReplicationEvent == ModelValidator.TYPE_BEFORE_DELETE || + ReplicationEvent == ModelValidator.TYPE_BEFORE_DELETE_REPLICATION || + ReplicationEvent == ModelValidator.TYPE_DELETE) + resultSave=po.delete(true); + else + { + //TODO: Create a Replication Type "BROADCAST" now we are using MERGE + if(ReplicationType.equals(X_AD_ReplicationTable.REPLICATIONTYPE_Merge)) + { + resultSave = po.saveReplica(true); + MReplicationStrategy rplStrategy = new MReplicationStrategy(client.getCtx(), client.getAD_ReplicationStrategy_ID(), null); + ExportHelper expHelper = new ExportHelper(client, rplStrategy); + expHelper.exportRecord( po, MReplicationStrategy.REPLICATION_TABLE,X_AD_ReplicationTable.REPLICATIONTYPE_Reference,ModelValidator.TYPE_AFTER_CHANGE); + } + else + resultSave = po.saveReplica(true); + } + + result.append("ResultSave=").append(resultSave).append("; "); + /*if (resultSave) + { + if(ReplicationMode == MReplicationStrategy.REPLICATION_DOCUMENT && + ReplicationType == X_AD_ReplicationDocument.REPLICATIONTYPE_Merge) + { + String status = po.get_ValueAsString("DocStatus"); + String action = po.get_ValueAsString("DocAction"); + DocAction m_document; + m_document=(DocAction) po; + DocumentEngine engine = new DocumentEngine (m_document, status); + engine.processIt (action); + } + // Success in save + } else { + // Failed in save + throw new Exception(Msg.getMsg(ctx, "EXPFormatFailedSave")); + }*/ + } + + /** + * @param result + * @param rootElement + * @param expFormat + * @throws Exception + * @throws XPathExpressionException + */ + @SuppressWarnings("unchecked") + private PO importElement(Properties ctx, StringBuffer result, Element rootElement, + MEXPFormat expFormat, String trxName) throws Exception, XPathExpressionException + { + // get AD_Table ID from export Format. + int AD_Table_ID = expFormat.getAD_Table_ID(); + + // Load appropriate Model class... + MTable table = MTable.get(ctx, AD_Table_ID); + log.info("Table = " + table); + + int record_ID = 0; + String whereClause=""; + // Find Record_ID by ???Value??? In fact by Columns set as Part Of Unique Index in Export Format! + if(table.getKeyColumns().length == 1) + { + record_ID = getID(ctx, expFormat, rootElement, rootElement.getNodeName(), trxName); + log.info("record_ID = " + record_ID); + }else + { + whereClause = getID(ctx, expFormat, rootElement, rootElement.getNodeName(),trxName,true); + log.info("WHERE = " + whereClause); + } + PO po=null; + if(record_ID>0) + po = table.getPO(record_ID, trxName); + else if(whereClause.length()>0) + po=table.getPO(whereClause, trxName); + else + po = table.getPO(record_ID, trxName); + + if(po==null) + throw new Exception(Msg.getMsg(ctx, "Can't Load PO Object")); + + log.info("PO.toString() = " + po.toString()); + + if (po.get_KeyColumns().length < 1) { + throw new Exception(Msg.getMsg(ctx, "EDIMultiColumnNotSupported")); + } + + StringBuffer orderBy = new StringBuffer(MEXPFormatLine.COLUMNNAME_IsMandatory).append(" DESC ") + .append(", ").append(MEXPFormatLine.COLUMNNAME_Position) + ; + MEXPFormatLine[] formatLines = expFormat.getFormatLinesOrderedBy(orderBy.toString()); + if (formatLines == null || formatLines.length < 1) { + throw new Exception(Msg.getMsg(ctx, "EXPFormatNoLines")); + } + Object value = null; + // Iterate all Export Format Lines (even this marked as part of unique index) + // and set value of column! + for (int i = 0; i < formatLines.length; i++) { + log.info("=================== Beginnig of Format Line ==============================="); + log.info("formatLines["+i+"]=[" + formatLines[i].toString() + "]"); + + if (MEXPFormatLine.TYPE_XMLElement.equals(formatLines[i].getType())) { + // XML Element + value = XMLHelper.getString(formatLines[i].getValue(), rootElement); + log.info("value=[" + value + "]"); + + } else if (MEXPFormatLine.TYPE_ReferencedEXPFormat.equals(formatLines[i].getType())) { + // Referenced Export Format +/* + + 0 + + SYSTEM + + + ... + */ + + MEXPFormat referencedExpFormat = new MEXPFormat(ctx, formatLines[i].getEXP_EmbeddedFormat_ID(), trxName); + log.info("referencedExpFormat = " + referencedExpFormat); + + int refRecord_ID = 0; + // Find Record_ID by ???Value??? In fact by Columns set as Part Of Unique Index in Export Format! + String xPath = null; + //xPath = ""+rootElement.getNodeName() + "/" + formatLines[i].getValue() + ""; // Do not work + xPath = "" + formatLines[i].getValue() + ""; // + + log.info("SEARCH FOR XML Element = " + xPath); + Element referencedNode = XMLHelper.getElement(xPath, rootElement); + + //NodeList nodeList = XMLHelper.getNodeList(xPath, rootElement); + //referencedNode = (Element)nodeList.item(0); + + log.info("referencedNode = " + referencedNode); + if(referencedNode!=null) + { + refRecord_ID = getID(ctx, referencedExpFormat, referencedNode, formatLines[i].getValue(), trxName); + log.info("refRecord_ID = " + refRecord_ID); + value = new Integer(refRecord_ID); + } + else + { + log.info("NULL VALUE FOR " + xPath.toString()); + value=null; + } + log.info("value=[" + value + "]"); + } else if (MEXPFormatLine.TYPE_EmbeddedEXPFormat.equals(formatLines[i].getType())) { + boolean resSave = false; + if (po.get_ID() == 0) { + resSave = po.saveReplica(true); + result.append("ResultSave-MasterPO=").append(resSave).append("; "); + log.info("ResultSave-MasterPO = " + resSave); + } else { + resSave = true; + } + if (resSave) { + // Success in save + } else { + throw new Exception("Failed to save Master PO"); + } + // Embedded Export Format +/* + GardenWorls + ... + ... <-- MUST save Master Record here! Else we can't set orderLine.setC_Order_ID(..) + ... + ... + */ + MEXPFormat referencedExpFormat = new MEXPFormat(ctx, formatLines[i].getEXP_EmbeddedFormat_ID(), trxName); + log.info("embeddedExpFormat = " + referencedExpFormat); + + NodeList nodeList = XMLHelper.getNodeList("/"+rootElement.getNodeName() + "/" + formatLines[i].getValue(), rootElement); + for (int j = 0; j < nodeList.getLength(); j++) { + Element referencedElement = (Element)nodeList.item(j); + log.info("EmbeddedEXPFormat - referencedElement.getNodeName = " + referencedElement.getNodeName()); + + PO embeddedPo = null; + // Import embedded PO + log.info("=== BEGIN RECURSION CALL ==="); + embeddedPo = importElement(ctx, result, referencedElement, referencedExpFormat, trxName); + log.info("embeddedPo = " + embeddedPo); + + //embeddedPo.set_CustomColumn(po.get_KeyColumns()[0], po.get_ID()); + //log.info("embeddedPo.set"+po.get_KeyColumns()[0]+" = [" + po.get_ID()+"]"); + + boolean rSave = embeddedPo.saveReplica(true); + result.append("ResultSave-EmbeddedPO=").append(rSave).append("; "); + } + + } else if (MEXPFormatLine.TYPE_XMLAttribute.equals(formatLines[i].getType())) { + // XML Attribute + value = XMLHelper.getString("@" + formatLines[i].getValue(), rootElement); + log.info("value=[" + value + "]"); + } else { + // Export Format Line is not one of two possible values...ERROR + throw new Exception(Msg.getMsg(ctx, "EXPFormatLineNonValidType")); + } + if (value == null) { + + } else { +/* if (column.getColumnName().equals("AD_Client_ID")) { + //Env.setContext(Env.getCtx(), "#AD_Client_ID", value.toString()); + } + if (column.getColumnName().equals("AD_Org_ID")) { + //Env.setContext(Env.getCtx(), "#AD_Org_ID", value.toString()); + } */ + if ( MEXPFormatLine.TYPE_EmbeddedEXPFormat.equals(formatLines[i].getType()) ) { + // do nothing + } else { + MColumn column = MColumn.get(ctx, formatLines[i].getAD_Column_ID()); + log.info("column=[" + column + "]"); + + // Clazz + Class clazz = DisplayType.getClass(column.getAD_Reference_ID(), true); + // Handle Posted + if (column.getColumnName().equalsIgnoreCase("Posted") + || column.getColumnName().equalsIgnoreCase("Processed") + || column.getColumnName().equalsIgnoreCase("Processing")) + { + clazz = Boolean.class; + } else if (column.getColumnName().equalsIgnoreCase("Record_ID")) + { + clazz = Integer.class; + } else if (column.getColumnName().equalsIgnoreCase("AD_Language") + || column.getColumnName().equalsIgnoreCase("EntityType")) + { + clazz = String.class; + } + log.info("clazz = " + clazz.getName()); + // Handle Date and Time + value = handleDateTime(value, column, formatLines[i]); + + log.info("formatLinesType = " + formatLines[i].getType()); + if (MEXPFormatLine.TYPE_EmbeddedEXPFormat.equals( formatLines[i].getType() ) ) { + // DO NOTHING + throw new Exception("We can't be here!!!"); + } else { + if (column.getAD_Reference_ID() == DisplayType.DateTime + || column.getAD_Reference_ID() == DisplayType.Date + ) + { + // + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + log.info("Set value of column ["+column.getColumnName()+"]=["+value+"]"); + } else if (column.getAD_Reference_ID() == DisplayType.ID + || column.getAD_Reference_ID() == DisplayType.Integer + || column.getAD_Reference_ID() == DisplayType.Search + || column.getAD_Reference_ID() == DisplayType.TableDir + || column.getAD_Reference_ID() == DisplayType.Table + ) + { + // + if (! Util.isEmpty(value.toString())) + { + int intValue = Integer.parseInt(value.toString()); + value = new Integer( intValue ); + }else + value=null; + log.info("Abut to set int value of column ["+column.getColumnName()+"]=["+value+"]"); + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + log.info("Set int value of column ["+column.getColumnName()+"]=["+value+"]"); + } else if (column.getAD_Reference_ID() == DisplayType.Amount + || column.getAD_Reference_ID() == DisplayType.Number + || column.getAD_Reference_ID() == DisplayType.CostPrice + || column.getAD_Reference_ID() == DisplayType.Quantity + ) + { + // + if (! Util.isEmpty(value.toString())) + { + double doubleValue = Double.parseDouble(value.toString()); + value = new BigDecimal(doubleValue); + }else + value=null; + //value = new Double( doubleValue ); + log.info("About to set BigDecimal value of column ["+column.getColumnName()+"]=["+value+"]"); + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + log.info("Set BigDecimal value of column ["+column.getColumnName()+"]=["+value+"]"); + } + else if(column.getAD_Reference_ID() == DisplayType.YesNo) + { + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + } + else { + // + try { + log.info("About to set value of column ["+column.getColumnName()+"]=["+value+"]"); + if(clazz == Boolean.class) + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + else + po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), clazz.cast(value)); + log.info("Set value of column ["+column.getColumnName()+"]=["+value+"]"); + } catch (ClassCastException ex) { + ex.printStackTrace(); + throw new Exception(ex); + } + + //po.set_ValueOfColumn(formatLines[i].getAD_Column_ID(), value); + } + result.append(column.getColumnName()).append("=").append(value).append("; "); + } + } + } + + } + + return po; + } + + public static MClient getAD_ClientByValue(Properties ctx, String value, String trxName) + throws SQLException + { + MClient result = null; + + StringBuffer sql = new StringBuffer("SELECT AD_Client_ID ") + .append(" FROM ").append(X_AD_Client.Table_Name) + .append(" WHERE ").append(X_AD_Client.COLUMNNAME_Value).append(" = ?") + // .append(" AND IsActive = ?") + ; + //s_log.info(sql.toString()); + s_log.info("Client_Value =[" + value + "]"); + + PreparedStatement pstmt = null; + try { + pstmt = DB.prepareStatement(sql.toString(), trxName); + pstmt.setString(1, value); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) { + int AD_Client_ID = rs.getInt(1); + s_log.info("AD_Client_ID = " + AD_Client_ID); + result = new MClient(ctx, AD_Client_ID, trxName); + } + rs.close(); + pstmt.close(); + pstmt = null; + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + throw e; + } finally { + try { + if (pstmt != null) + pstmt.close(); + pstmt = null; + } catch (Exception e) { + pstmt = null; + } + } + + return result; + } + + + private PreparedStatement getIDValues(Properties ctx, MEXPFormat expFormat, Element rootElement, String rootNodeName, String trxName) throws Exception { + if (expFormat == null || rootElement == null || rootNodeName == null) { + throw new IllegalArgumentException("expFormat, rootNode and RootnodeName can't be null!"); + } + log.info("expFormat = " + expFormat); + log.info("rootNode.getNodeName() = " + rootElement.getNodeName()); + log.info("rootNodeName = " + rootNodeName); + if (rootElement.getParentNode() != null) { + log.info("rootNode.ParentName = " + rootElement.getParentNode().getNodeName()); + } + + // get AD_Table ID from export Format. + int AD_Table_ID = expFormat.getAD_Table_ID(); + + // Load appropriate Model class... + MTable table = MTable.get(ctx, AD_Table_ID); + log.info("Table = " + table); + + //Select * FROM table.getTableName() WHERE Value or ANY IDENTIFIER column + StringBuffer sql = new StringBuffer("SELECT * ") + .append(" FROM ").append(table.getTableName()) + .append(" WHERE ") + ; + // Get list with all Unique columns! + MEXPFormatLine[] uniqueFormatLines = expFormat.getUniqueColumns(); + if (uniqueFormatLines == null || uniqueFormatLines.length < 1) { + throw new Exception(Msg.getMsg(ctx, "EXPFormatLineNoUniqueColumns")); + } + Object[] values = new Object[uniqueFormatLines.length]; + for (int i = 0; i < uniqueFormatLines.length; i++) { + log.info("--- iterate unique column with index = ["+i+"]"); + MColumn column = MColumn.get(ctx, uniqueFormatLines[i].getAD_Column_ID()); + log.info("column = ["+column+"]"); + String valuecol=column.getColumnName(); + if(column.getAD_Reference_ID() == DisplayType.Amount + || column.getAD_Reference_ID() == DisplayType.Number + || column.getAD_Reference_ID() == DisplayType.CostPrice + || column.getAD_Reference_ID() == DisplayType.Quantity) + { + valuecol="Round("+valuecol+",2)"; + } + + if (MEXPFormatLine.TYPE_XMLElement.equals(uniqueFormatLines[i].getType())) { + // XML Element + //values[i] = XMLHelper.getString("/"+rootElement.getNodeName() + "/" + uniqueFormatLines[i].getValue(), rootElement); + String xPath = null; + //xPath = "/"+rootNodeName + "/" + uniqueFormatLines[i].getValue(); -- works + //xPath = "/"+ uniqueFormatLines[i].getValue(); // do not work + xPath = ""+ uniqueFormatLines[i].getValue(); + + values[i] = XMLHelper.getString(xPath, rootElement); + //log.info("xml PATH =" + rootElement.getNodeName() + "." + xPath ); + log.info("values[" + i + "]=" + values[i]); + + } else if (MEXPFormatLine.TYPE_ReferencedEXPFormat.equals(uniqueFormatLines[i].getType())) { + // Referenced Export Format + log.info("referencedExpFormat.EXP_EmbeddedFormat_ID = " + uniqueFormatLines[i].getEXP_EmbeddedFormat_ID()); + MEXPFormat referencedExpFormat = new MEXPFormat(ctx, uniqueFormatLines[i].getEXP_EmbeddedFormat_ID(), trxName); + log.info("referencedExpFormat = " + referencedExpFormat); + /* + + + 0 + + SYSTEM + + + ... + + */ + int record_ID = 0; + // Find Record_ID by ???Value??? In fact by Columns set as Part Of Unique Index in Export Format! + Element referencedNode = ((Element) rootElement.getElementsByTagName(uniqueFormatLines[i].getValue()).item(0)); + log.info("referencedNode = " + referencedNode); + + record_ID = getID(ctx, referencedExpFormat, referencedNode, uniqueFormatLines[i].getValue(), trxName); + log.info("record_ID = " + record_ID); + + values[i] = new Integer(record_ID); + } else { + // Export Format Line is not one of two possible values...ERROR + throw new Exception(Msg.getMsg(ctx, "EXPFormatLineNonValidType")); + } + if (i == 0) { + sql.append(" ").append(valuecol).append(" = ? "); + } else { + sql.append(" AND ").append(valuecol).append(" = ? "); + } + + } + log.info("sql = " + sql.toString()); + + PreparedStatement pstmt = null; + try { + pstmt = DB.prepareStatement (sql.toString(), trxName); + for (int i = 0; i < uniqueFormatLines.length; i++) { + MColumn col = MColumn.get(ctx, uniqueFormatLines[i].getAD_Column_ID()); + + if (col.getAD_Reference_ID() == DisplayType.DateTime + || col.getAD_Reference_ID() == DisplayType.Date) + { + + Timestamp value = (Timestamp)handleDateTime(values[i], col , uniqueFormatLines[i]); + pstmt.setTimestamp(i+1, value); + } + else if(col.getAD_Reference_ID() == DisplayType.String) + { + String value = (String)values[i]; + pstmt.setString(i+1, value); + } + else if(col.getAD_Reference_ID() == DisplayType.Amount + || col.getAD_Reference_ID() == DisplayType.Number + || col.getAD_Reference_ID() == DisplayType.CostPrice + || col.getAD_Reference_ID() == DisplayType.Quantity) + { + BigDecimal value = new BigDecimal((String)values[i]); + pstmt.setBigDecimal(i+1, value.setScale(2, BigDecimal.ROUND_HALF_UP)); + } + else + { + pstmt.setObject(i+1, values[i]); + log.info("pstmt.setObject["+(i+1)+"] = [" + values[i]+"]"); + } + + } + + return pstmt; + + } catch (SQLException e) { + s_log.log(Level.SEVERE, sql.toString(), e); + throw e; + } + } + + + public int getID(Properties ctx, MEXPFormat expFormat, Element rootElement, String rootNodeName, String trxName) throws Exception { + int result = 0; + + PreparedStatement pstmt = getIDValues(ctx,expFormat,rootElement,rootNodeName,trxName); + try + { + ResultSet rs = pstmt.executeQuery(); + if ( rs.next() ) { + result = rs.getInt(1); + } + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + throw e; + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + log.info("result = " + result); + return result; + } + + public String getID(Properties ctx, MEXPFormat expFormat, Element rootElement,String rootNodeName, String trxName,boolean multikey) throws Exception + { + String result=""; + PreparedStatement pstmt = getIDValues(ctx,expFormat,rootElement,rootNodeName,trxName); + try + { + + int AD_Table_ID = expFormat.getAD_Table_ID(); + MTable table = MTable.get(ctx, AD_Table_ID); + String columns[]=table.getKeyColumns(); + + log.warning("Multiple columns ID. Table = "+ table.getTableName() +" Columns="+ columns); + + ResultSet rs = pstmt.executeQuery(); + if ( rs.next() ) + { + for(String column : columns) + { + result += " AND " + column + " = "+ rs.getInt(rs.findColumn(column)); + } + } + if(result.length()>0) + result = result.substring(4); + + rs.close (); + pstmt.close (); + pstmt = null; + } catch (SQLException e) { + throw e; + } finally { + try { + if (pstmt != null) pstmt.close (); + pstmt = null; + } catch (Exception e) { pstmt = null; } + } + + return result; + } + + private Object handleDateTime(Object value, MColumn column, MEXPFormatLine formatLine) throws ParseException { + String valueString = null; + valueString = value.toString(); // We are sure that value is not null + Object result = value; + + if (column.getAD_Reference_ID() == DisplayType.Date) { + if (valueString != null) { + if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy"; MM/dd/yyyy hh:mm:ss + result = new Timestamp(m_customDateFormat.parse(valueString).getTime()); + log.info("Custom Date Format; Parsed value = " + result.toString()); + } else { + //result = new Timestamp(m_dateFormat.parse(valueString).getTime()); + //log.info("Custom Date Format; Parsed value = " + result.toString()); + //NOW Using Standard Japanese Format yyyy-mm-dd hh:mi:ss.mil so don't care about formats.... + if(valueString==null||valueString.length()<=0) + result=null; + else + result = Timestamp.valueOf(valueString); + } + } + } else if (column.getAD_Reference_ID() == DisplayType.DateTime) { + if (valueString != null) { + if (formatLine.getDateFormat() != null && !"".equals(formatLine.getDateFormat())) { + m_customDateFormat = new SimpleDateFormat( formatLine.getDateFormat() ); // "MM/dd/yyyy" + result = new Timestamp(m_customDateFormat.parse(valueString).getTime()); + log.info("Custom Date Format; Parsed value = " + result.toString()); + } else { + //result = new Timestamp(m_dateTimeFormat.parse(valueString).getTime()); + //log.info("Custom Date Format; Parsed value = " + result.toString()); + //NOW Using Standard Japanese Format yyyy-mm-dd hh:mi:ss.mil so don't care about formats.... + result = Timestamp.valueOf(valueString); + } + + } + + } + return result; + } + +} diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ModelImporter.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ModelImporter.java new file mode 100644 index 0000000000..aba442b57d --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/ModelImporter.java @@ -0,0 +1,154 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.adempiere.server.rpl.imp; + +import java.util.logging.Level; + +import org.adempiere.server.rpl.XMLHelper; +import org.compiere.Adempiere; +import org.compiere.process.ProcessInfo; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; +import org.compiere.util.CLogMgt; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.w3c.dom.Document; + +/** + * + * @author Trifon N. Trifonov + * @author victor.perez@e-evolution.com + * FB [1963487 ] Is necessary new process to export and import with an Export + * @see http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1963487&group_id=176962 + * @version $Id:$ + */ +public class ModelImporter extends SvrProcess { + + /** Client Parameter */ + protected int p_AD_Client_ID = 0; + + /** Document Type Parameter */ + protected int p_C_DocType_ID = 0; + + /** Record ID */ + protected int p_Record_ID = 0; + /** EXP_Format_ID */ + protected int p_EXP_Format_ID = 0; + /** File Name **/ + protected String p_FileName = ""; + + /** Table ID */ + int AD_Table_ID = 0; + + + /** + * Get Parameters + */ + protected void prepare() { + + p_Record_ID = getRecord_ID(); + if (p_AD_Client_ID == 0) + p_AD_Client_ID = Env.getAD_Client_ID(getCtx()); + AD_Table_ID = getTable_ID(); + + StringBuffer sb = new StringBuffer("AD_Table_ID=").append(AD_Table_ID); + sb.append("; Record_ID=").append(getRecord_ID()); + // Parameter + ProcessInfoParameter[] para = getParameter(); + for (int i = 0; i < para.length; i++) { + String name = para[i].getParameterName(); + if (para[i].getParameter() == null) + ; + else if (name.equals("EXP_Format_ID")) + p_EXP_Format_ID = para[i].getParameterAsInt(); + else if (name.equals("FileName")) + p_FileName = (String)para[i].getParameter(); + else + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + + if(p_EXP_Format_ID == 0) + p_EXP_Format_ID = p_Record_ID; + if(p_FileName == null) + { + // Load XML file and parse it + String fileNameOr = org.compiere.util.Ini.findAdempiereHome() + + System.getProperty("file.separator") + + "data" + + System.getProperty("file.separator") + + "ExportFile.xml"; + p_FileName = fileNameOr; + } + + log.info(sb.toString()); + } + + /** + * Process + * + * @return info + */ + protected String doIt() throws Exception + { + StringBuffer result = new StringBuffer(""); + + // Load XML file and parse it + /*String fileNameOr = org.compiere.util.Ini.findAdempiereHome() + + System.getProperty("file.separator") + + "data" + + System.getProperty("file.separator"); + + String pathToXmlFile = fileNameOr+"XmlExport-test.xml"; + Document documentToBeImported = XMLHelper.createDocumentFromFile(pathToXmlFile);*/ + Document documentToBeImported = XMLHelper.createDocumentFromFile(p_FileName); + + ImportHelper impHelper = new ImportHelper(getCtx()); + impHelper.importXMLDocument(result, documentToBeImported, get_TrxName()); + + addLog(0, null, null, Msg.getMsg(getCtx(), "ImportModelProcessResult") + "\n" + result.toString()); + return result.toString(); + } + + public static void main(String[] args) + { + CLogMgt.setLoggerLevel(Level.INFO, null); + CLogMgt.setLevel(Level.INFO); + + Adempiere.startupEnvironment(false); + ProcessInfo pi = new ProcessInfo("Test Import Model", 1000000); + pi.setAD_Client_ID(11); + pi.setAD_User_ID(100); + + ModelImporter modelImporter = new ModelImporter(); + modelImporter.startProcess(Env.getCtx(), pi, null); + + System.out.println("Process=" + pi.getTitle() + " Error="+pi.isError() + " Summary=" + pi.getSummary()); + } + +} \ No newline at end of file diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicImportProcessor.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicImportProcessor.java new file mode 100644 index 0000000000..df68dfe2b8 --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicImportProcessor.java @@ -0,0 +1,130 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.adempiere.server.rpl.imp; + +import java.util.Properties; + +import org.adempiere.server.rpl.IImportProcessor; +import org.compiere.model.MIMPProcessor; +import org.compiere.model.X_IMP_ProcessorParameter; +import org.compiere.server.ReplicationProcessor; +import org.compiere.util.CLogger; + +/** + * Aim of this class is to import records from JMS Server. + * + * @author Trifon N. Trifonov + * @version $Id:$ + */ +public class TopicImportProcessor implements IImportProcessor { + + /** Logger */ + protected CLogger log = CLogger.getCLogger (TopicImportProcessor.class); + + /** + * Topic Listener + */ + private TopicListener topicListener = null; + + + public void process(Properties ctx, ReplicationProcessor replicationProcessor, String trxName) + throws Exception { + + log.info("replicationProcessor = " + replicationProcessor); + log.info("replicationProcessor.getMImportProcessor() = " + replicationProcessor.getMImportProcessor()); + + MIMPProcessor impProcessor = replicationProcessor.getMImportProcessor(); + + X_IMP_ProcessorParameter[] processorParameters = impProcessor.getIMP_ProcessorParameters(trxName); + + String host = impProcessor.getHost(); + int port = impProcessor.getPort(); + String account = impProcessor.getAccount(); + String password = impProcessor.getPasswordInfo(); + + // mandatory parameters! + String topicName = null; + String protocol = null; + boolean isDurableSubscription = true; + String subscriptionName = null; + String options = null; + String clientID = null; + + if (processorParameters != null && processorParameters.length > 0) { + for (int i = 0; i < processorParameters.length; i++) { + log.info("ProcesParameter Value = " + processorParameters[i].getValue()); + log.info("ProcesParameter ParameterValue = " + processorParameters[i].getParameterValue()); + if (processorParameters[i].getValue().equals("topicName")) { + topicName = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("protocol")) { + protocol = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("isDurableSubscription")) { + isDurableSubscription = Boolean.parseBoolean( processorParameters[i].getParameterValue() ); + } else if (processorParameters[i].getValue().equals("subscriptionName")) { + subscriptionName = processorParameters[i].getParameterValue(); + } else if (processorParameters[i].getValue().equals("clientID")) { + clientID = processorParameters[i].getParameterValue(); + } else { + // Some other mandatory parameter here + } + } + } + + if (topicName == null || topicName.length() == 0) { + throw new Exception("Missing "+X_IMP_ProcessorParameter.Table_Name+" with key 'topicName'!"); + } + if (protocol == null || protocol.length() == 0) { + throw new Exception("Missing "+X_IMP_ProcessorParameter.Table_Name+" with key 'protocol'!"); + } + if (isDurableSubscription && subscriptionName == null || subscriptionName.length() == 0) { + throw new Exception("Missing "+X_IMP_ProcessorParameter.Table_Name+" with key 'subscriptionName'!"); + } + if (clientID == null || clientID.length() == 0) { + throw new Exception("Missing "+X_IMP_ProcessorParameter.Table_Name+" with key 'clientID'!"); + } + + topicListener = new TopicListener(ctx, replicationProcessor, protocol, host, port + , isDurableSubscription, subscriptionName, topicName, clientID + , account, password, options, trxName); + + topicListener.run(); + log.info("Started topicListener = " + topicListener); + } + + public void stop() throws Exception { + + if ( topicListener != null ) { + topicListener.stop(); + log.info("Stoped topicListener." ); + } + + } + + +} diff --git a/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java new file mode 100644 index 0000000000..2ab1e01253 --- /dev/null +++ b/serverRoot/src/main/server/org/adempiere/server/rpl/imp/TopicListener.java @@ -0,0 +1,318 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * - Antonio Cañaveral (antonio.canaveral@e-evolution.com) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ + +package org.adempiere.server.rpl.imp; + +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageListener; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.jms.Topic; + +import org.adempiere.server.rpl.XMLHelper; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.compiere.server.ReplicationProcessor; +import org.compiere.util.CLogger; +import org.compiere.model.MIMPProcessorLog; +import org.w3c.dom.Document; + +/** + * Listen for JMS Messages + * @author Trifon N. Trifonov + * @author Antonio Cañaveral, e-Evolution + *
  • [ 2194986 ] Already connected ClientID issue. + *
  • http://sourceforge.net/tracker/index.php?func=detail&aid=2194986&group_id=176962&atid=879332 + */ +public class TopicListener implements MessageListener { + + /** + * Connection to JMS Server + */ + private Connection conn; + + /** + * JMS Session + */ + private Session session; + + /** + * JMS Topic + */ + private Topic topic; + +// private String url="tcp://localhost:61616?jms.dispatchAsync=true&jms.useAsyncSend=true&jms.optimizeAcknowledge=true&jms.disableTimeStampsByDefault=true&jms.optimizedMessageDispatch=true&wireFormat.cacheEnabled=false&wireFormat.tightEncodingEnabled=false"; + private String url="tcp://localhost:61616"; + + /** + * host where JMS server is running + */ + private String host = "localhost"; + + /** + * port of JMS Server + */ + private int port = 61616; + + /** + * Network protocol + */ + private String protocol = "tcp"; + + /** + * Context + */ + private Properties ctx = null; + + /** + * Transaction name + */ + private String trxName = null; + + /** + * Topic Name + */ + private String topicName = null; + + /** + * Replication processor + */ + private ReplicationProcessor replicationProcessor = null; + + /** Logger */ + protected CLogger log = CLogger.getCLogger (TopicListener.class); + + /** + * Is Durable Subscription + */ + private boolean isDurableSubscription = false; + + /** + * Subscription Name + */ + private String subscriptionName = null; + + /** + * JMS Connection ClientID + */ + private String clientID = null; + + /** + * String User Name + */ + private String userName = null; + + /** + * Password + */ + private String password = null; + + + /** + * + */ + public TopicListener(Properties ctx, ReplicationProcessor replicationProcessor, String protocol, String host, int port + , boolean isDurableSubscription, String subscriptionName, String topicName + , String clientID, String userName, String password + , String options, String trxName) { + if ( host != null && !host.equals("") ) { + this.host = host; + } + + if ( port > 0 ) { + this.port = port; + } + + if ( protocol != null && !protocol.equals("") ) { + this.protocol = protocol; + } + + this.topicName = topicName; + + String uri=this.protocol + "://" + this.host + ":" + this.port; + + if(options!=null && options.length()>0) + { + if(!options.contains("?")) + uri+="?"+options; + } + this.setUrl(uri); + + this.ctx = ctx; + + this.trxName = trxName; + + this.replicationProcessor = replicationProcessor; + + this.isDurableSubscription = isDurableSubscription; + + this.subscriptionName = subscriptionName; + + this.clientID = clientID; + + this.userName = userName; + + this.password = password; + + } + + public void run() throws JMSException { + ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory( url ); + log.finest("ActiveMQConnectionFactory = " + factory); + + if (userName !=null && password != null) { + conn = factory.createConnection(userName, password); + } else { + conn = factory.createConnection(); + } + + log.finest("conn = " + conn ); + + if(conn.getClientID()==null) + { + try + { + conn.setClientID( clientID ); + } + catch (Exception e) + { + log.info("Connection with clientID '" + clientID +"' already exists"); + return; + } + }else + { + if(conn.getClientID().equals(clientID)) + { + log.warning("Connection with clientID '" + clientID + + "' already exists"); + return; + }else + conn.setClientID( clientID ); + } + + + session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); // TODO - could be parameter + log.finest("session = " + session ); + + log.finest("topicName = " + topicName ); + log.finest("subscriptionName = " + subscriptionName); + + topic = session.createTopic( topicName ); + log.finest("topic = " + topic ); + + MessageConsumer consumer = null; + if (isDurableSubscription) { + // http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.pmc.express.doc/tasks/tjn0012_.html + // The subscriptionName assigned to a durable subscription must be unique within a given client ID. + consumer = session.createDurableSubscriber( topic, subscriptionName ); + } else { + consumer = session.createConsumer( topic ); + } + + log.finest("consumer = " + consumer ); + + consumer.setMessageListener( this ); + + conn.start(); + log.finest("Waiting for JMS messages..."); + + MIMPProcessorLog pLog = new MIMPProcessorLog(replicationProcessor.getMImportProcessor(), "Connected to JMS Server. Waiting for messages!"); + StringBuffer logReference = new StringBuffer("topicName = ").append(topicName) + .append(", subscriptionName = ").append( subscriptionName ) + ; + pLog.setReference( logReference.toString() ); + boolean resultSave = pLog.save(); + log.finest("Result Save = " + resultSave); + + } + + /** + * + */ + public void onMessage(Message message) { + if ( message instanceof TextMessage ) { + + try { + TextMessage txtMessage = (TextMessage) message; + + String text = txtMessage.getText(); + //log.finest("Received message: \n" + text ); + + Document documentToBeImported = XMLHelper.createDocumentFromString( text ); + StringBuffer result = new StringBuffer(); + + ImportHelper impHelper = new ImportHelper( ctx ); + + impHelper.importXMLDocument(result, documentToBeImported, trxName ); + + + MIMPProcessorLog pLog = new MIMPProcessorLog(replicationProcessor.getMImportProcessor(), "Imported Document!"); + //pLog.setReference("topicName = " + topicName ); + if (text.length() > 2000 ) { + pLog.setTextMsg( text.substring(0, 1999) ); + } else { + pLog.setTextMsg( text); + } + + boolean resultSave = pLog.save(); + log.finest("Result Save = " + resultSave); + + session.commit(); + + } catch (Exception e) { + replicationProcessor.setProcessRunning(false); + try { + session.rollback(); + } catch (JMSException e1) { + e1.printStackTrace(); + } + e.printStackTrace(); + } + + } else { + log.finest("Received NO TEXT Message: " ); + // Received non text message!!! + } + } + + public void setUrl(String url) { + this.url = url; + } + + public void stop() throws JMSException { + // Close JMS Connection + log.finest("Closing JMS Connection!"); + conn.close(); + } +} diff --git a/serverRoot/src/main/server/org/compiere/server/AdempiereServer.java b/serverRoot/src/main/server/org/compiere/server/AdempiereServer.java index 2a92ba63c4..125d7cc1ab 100644 --- a/serverRoot/src/main/server/org/compiere/server/AdempiereServer.java +++ b/serverRoot/src/main/server/org/compiere/server/AdempiereServer.java @@ -26,6 +26,7 @@ import org.compiere.model.AdempiereProcessorLog; import org.compiere.model.MAcctProcessor; import org.compiere.model.MAlertProcessor; import org.compiere.model.MClient; +import org.compiere.model.MIMPProcessor; import org.compiere.model.MLdapProcessor; import org.compiere.model.MRequestProcessor; import org.compiere.model.MScheduler; @@ -63,6 +64,8 @@ public abstract class AdempiereServer extends Thread return new Scheduler ((MScheduler)model); if (model instanceof MLdapProcessor) return new LdapProcessor((MLdapProcessor)model); + if (model instanceof MIMPProcessor) // @Trifon + return new ReplicationProcessor((MIMPProcessor)model); // throw new IllegalArgumentException("Unknown Processor"); } // create diff --git a/serverRoot/src/main/server/org/compiere/server/AdempiereServerMgr.java b/serverRoot/src/main/server/org/compiere/server/AdempiereServerMgr.java index d9a7145022..c3925e0bf9 100644 --- a/serverRoot/src/main/server/org/compiere/server/AdempiereServerMgr.java +++ b/serverRoot/src/main/server/org/compiere/server/AdempiereServerMgr.java @@ -24,6 +24,7 @@ import java.util.logging.Level; import org.compiere.Adempiere; import org.compiere.model.MAcctProcessor; import org.compiere.model.MAlertProcessor; +import org.compiere.model.MIMPProcessor; import org.compiere.model.MLdapProcessor; import org.compiere.model.MRequestProcessor; import org.compiere.model.MScheduler; @@ -163,7 +164,18 @@ public class AdempiereServerMgr server.start(); server.setPriority(Thread.NORM_PRIORITY-1); m_servers.add(server); - } + } + // ImportProcessor - @Trifon + MIMPProcessor[] importModels = MIMPProcessor.getActive(m_ctx); + for (int i = 0; i < importModels.length; i++) + { + MIMPProcessor lp = importModels[i]; + AdempiereServer server = AdempiereServer.create(lp); + server.start(); + server.setPriority(Thread.NORM_PRIORITY-1); + m_servers.add(server); + } + log.fine("#" + noServers); return startAll(); } // startEnvironment diff --git a/serverRoot/src/main/server/org/compiere/server/ReplicationProcessor.java b/serverRoot/src/main/server/org/compiere/server/ReplicationProcessor.java new file mode 100644 index 0000000000..cc691d5cc2 --- /dev/null +++ b/serverRoot/src/main/server/org/compiere/server/ReplicationProcessor.java @@ -0,0 +1,181 @@ +/********************************************************************** + * This file is part of Adempiere ERP Bazaar * + * http://www.adempiere.org * + * * + * Copyright (C) Trifon Trifonov. * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Trifon Trifonov (trifonnt@users.sourceforge.net) * + * * + * Sponsors: * + * - E-evolution (http://www.e-evolution.com/) * + **********************************************************************/ +package org.compiere.server; + +import java.sql.Timestamp; + +import org.adempiere.server.rpl.IImportProcessor; +import org.compiere.model.AdempiereProcessor; +import org.compiere.model.MClient; +import org.compiere.model.X_IMP_Processor_Type; +import org.compiere.util.TimeUtil; +import org.compiere.server.AdempiereServer; +import org.compiere.model.MIMPProcessor; +import org.compiere.model.MIMPProcessorLog; + +/** + * + * @author Trifon N. Trifonov + * + */ +public class ReplicationProcessor extends AdempiereServer { + + /** Last Summary */ + private StringBuffer m_summary = new StringBuffer(); + + /** Client info */ + private MClient m_client = null; + + private MIMPProcessor mImportProcessor = null; + + /** + * flag showing if process is working! + */ + private boolean isProcessRunning = false; + + + /*protected ReplicationProcessor(MIMPProcessor model, int initialNap) { + super (model, initialNap); + mImportProcessor = model; + m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID()); + }*/ + + /*protected ReplicationProcessor(MIMPProcessor model) { + super (model, 30); + mImportProcessor = model; + m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID()); + }*/ + + protected ReplicationProcessor(AdempiereProcessor model, int initialNap) { + super (model, initialNap); + mImportProcessor = (MIMPProcessor)model; + m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID()); +} + protected ReplicationProcessor(AdempiereProcessor model) { + super (model, 30); + mImportProcessor =(MIMPProcessor)model; + m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID()); + } + + @SuppressWarnings("unchecked") + @Override + protected void doWork() { + if (isProcessRunning) { + // process is already started successfully! + + } else { + // process is not started! + + m_summary = new StringBuffer(); + String trxName = mImportProcessor.get_TrxName(); + if ( trxName == null || "".equals(trxName) ) { +// trxName = "ImportProcessor-" + System.currentTimeMillis(); + } + log.fine("trxName = " + trxName); + log.fine("ImportProcessor = " + mImportProcessor); + + int IMP_ProcessorType_ID = 0; + IMP_ProcessorType_ID = mImportProcessor.getIMP_Processor_Type_ID(); + X_IMP_Processor_Type impProcessor_Type = new X_IMP_Processor_Type(mImportProcessor.getCtx(), IMP_ProcessorType_ID, trxName ); + log.fine("impProcessor_Type = " + impProcessor_Type); // TODO --- REMOVE + + String javaClass = impProcessor_Type.getJavaClass(); + IImportProcessor importProcessor = null; + try { + Class clazz = Class.forName(javaClass); + importProcessor = (IImportProcessor)clazz.newInstance(); + + importProcessor.process(mImportProcessor.getCtx(), this, trxName ); + + } catch (Exception e) { + isProcessRunning = false; + log.fine("ReplicationProcessor caught an exception !!!" ); + e.printStackTrace(); + + log.severe( e.getMessage() ); + + MIMPProcessorLog pLog = new MIMPProcessorLog(mImportProcessor, e.getMessage() ); + pLog.setReference("#" + String.valueOf(p_runCount) + " - " + TimeUtil.formatElapsed(new Timestamp(p_startWork))); + boolean resultSave = pLog.save(); + + try { + importProcessor.stop(); + } catch (Exception e1) { + e1.printStackTrace(); + MIMPProcessorLog pLog2 = new MIMPProcessorLog(mImportProcessor, e1.getMessage() ); + + boolean resultSave2 = pLog2.save(); + } + } + + // + int no = mImportProcessor.deleteLog(); + m_summary.append("Logs Records deleted=").append(no).append("; "); + // + MIMPProcessorLog pLog = new MIMPProcessorLog(mImportProcessor, m_summary.toString()); + pLog.setReference("#" + String.valueOf(p_runCount) + " - " + TimeUtil.formatElapsed(new Timestamp(p_startWork))); + boolean resultSave = pLog.save(); + } + } + + @Override + public String getServerInfo() + { + return "#" + p_runCount + " - Last=" + m_summary.toString(); + } + + /** + * @return the isProcessRunning + */ + public boolean isProcessRunning() { + return isProcessRunning; + } + + /** + * @param isProcessRunning the isProcessRunning to set + */ + public void setProcessRunning(boolean isProcessRunning) { + this.isProcessRunning = isProcessRunning; + } + + /** + * @return the mImportProcessor + */ + public MIMPProcessor getMImportProcessor() { + return mImportProcessor; + } + + /** + * @param importProcessor the mImportProcessor to set + */ + public void setMImportProcessor(MIMPProcessor importProcessor) { + mImportProcessor = importProcessor; + } + +}