From 2078c0abf66d6e0e441533dc44e0aedb0498c1e2 Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Sun, 6 Jun 2010 17:27:50 +0000 Subject: [PATCH] 1.- Enable Cache in Replication Processor 2.- Add logic when a replication msg is receipt the check if the Object was change, if it change then is save 2.- Apply ABP change Collection for List interface kind regards Victor Perez www.e-evolution.com Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3012113 --- .../process/rpl/imp/ImportHelper.java | 18 +++++++++++++----- base/src/org/compiere/model/MEXPFormat.java | 9 +++++---- base/src/org/compiere/model/MEXPProcessor.java | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/base/src/org/adempiere/process/rpl/imp/ImportHelper.java b/base/src/org/adempiere/process/rpl/imp/ImportHelper.java index 85d26db350..9d9b2100cb 100755 --- a/base/src/org/adempiere/process/rpl/imp/ImportHelper.java +++ b/base/src/org/adempiere/process/rpl/imp/ImportHelper.java @@ -163,6 +163,11 @@ public class ImportHelper { log.info("expFormat = " + expFormat.toString()); PO po = importElement(ctx, result, rootElement, expFormat, ReplicationType, trxName); + if(po.is_Changed()) + { + log.info("Object not changed = " + po.toString()); + return; + } if(po != null) { @@ -191,10 +196,8 @@ public class ImportHelper { else if(X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(ReplicationType) || X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType)) { - if(po.is_Changed()) - { + po.saveReplica(true); - } } /*else if (X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType)) { @@ -217,7 +220,12 @@ public class ImportHelper { { Env.setContext(po.getCtx(), "#AD_Client_ID", po.getAD_Client_ID()); DocAction document = (DocAction)po; - document.processIt(document.getDocAction()); + po.set_CustomColumn("DocAction",DocAction.ACTION_Complete); + po.set_CustomColumn("DocStatus", DocAction.STATUS_Drafted); + if(!document.processIt(document.getDocAction())) + { + log.info("PO.toString() = can not " + po.get_Value("DocAction")); + } po.saveEx(); } } @@ -599,7 +607,7 @@ public class ImportHelper { log.info("referencedNode = " + referencedNode); if (referencedNode == null) { - throw new IllegalArgumentException("referencedNode can't be null!"); + throw new IllegalArgumentException("referencedNode can't be found!"); } record_ID = getID(ctx, referencedExpFormat, referencedNode, uniqueFormatLine.getValue(), trxName); diff --git a/base/src/org/compiere/model/MEXPFormat.java b/base/src/org/compiere/model/MEXPFormat.java index 02d38c7960..aa0e3b2d1d 100644 --- a/base/src/org/compiere/model/MEXPFormat.java +++ b/base/src/org/compiere/model/MEXPFormat.java @@ -33,6 +33,7 @@ package org.compiere.model; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Collection; +import java.util.List; import java.util.Properties; import org.compiere.util.CCache; @@ -61,8 +62,8 @@ public class MEXPFormat extends X_EXP_Format { private static CCache s_cache = new CCache(MEXPFormat.Table_Name, 50 ); private static CCache exp_format_by_id_cache = new CCache(MEXPFormat.Table_Name, 50); - private Collection m_lines = null; - private Collection m_lines_unique = null; + private List m_lines = null; + private List m_lines_unique = null; public MEXPFormat(Properties ctx, int EXP_Format_ID, String trxName) { @@ -73,11 +74,11 @@ public class MEXPFormat extends X_EXP_Format { super (ctx, rs, trxName); } - public Collection getFormatLines() { + public List getFormatLines() { return getFormatLinesOrderedBy(X_EXP_FormatLine.COLUMNNAME_Position); } - public Collection getFormatLinesOrderedBy(String orderBy) + public List getFormatLinesOrderedBy(String orderBy) { if(m_lines != null) { diff --git a/base/src/org/compiere/model/MEXPProcessor.java b/base/src/org/compiere/model/MEXPProcessor.java index 7e5175848a..f1aea22235 100644 --- a/base/src/org/compiere/model/MEXPProcessor.java +++ b/base/src/org/compiere/model/MEXPProcessor.java @@ -51,6 +51,17 @@ public class MEXPProcessor extends X_EXP_Processor { /** Static Logger */ private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class); + private static MEXPProcessor processor= null; + private X_EXP_ProcessorParameter[] parameters = null; + + public static MEXPProcessor get(Properties ctx, int EXP_Processor_ID, String trxName) + { + if(processor == null) + { + processor = new MEXPProcessor(ctx, EXP_Processor_ID, trxName); + } + return processor; + } public MEXPProcessor(Properties ctx, int EXP_Processor_ID, String trxName) { super(ctx, EXP_Processor_ID, trxName); @@ -61,6 +72,10 @@ public class MEXPProcessor extends X_EXP_Processor { } public X_EXP_ProcessorParameter[] getEXP_ProcessorParameters(String trxName) { + + if(parameters != null) + return parameters; + List resultList = new ArrayList(); StringBuffer sql = new StringBuffer("SELECT * ") @@ -92,6 +107,7 @@ public class MEXPProcessor extends X_EXP_Processor { } catch (Exception e) { pstmt = null; } } X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]); + parameters = result; return result; }