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
This commit is contained in:
vpj-cd 2010-06-06 17:27:50 +00:00
parent dba57464a6
commit 2078c0abf6
3 changed files with 34 additions and 9 deletions

View File

@ -163,6 +163,11 @@ public class ImportHelper {
log.info("expFormat = " + expFormat.toString()); log.info("expFormat = " + expFormat.toString());
PO po = importElement(ctx, result, rootElement, expFormat, ReplicationType, trxName); PO po = importElement(ctx, result, rootElement, expFormat, ReplicationType, trxName);
if(po.is_Changed())
{
log.info("Object not changed = " + po.toString());
return;
}
if(po != null) if(po != null)
{ {
@ -191,10 +196,8 @@ public class ImportHelper {
else if(X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(ReplicationType) else if(X_AD_ReplicationTable.REPLICATIONTYPE_Merge.equals(ReplicationType)
|| X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType)) || X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType))
{ {
if(po.is_Changed())
{
po.saveReplica(true); po.saveReplica(true);
}
} }
/*else if (X_AD_ReplicationTable.REPLICATIONTYPE_Reference.equals(ReplicationType)) /*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()); Env.setContext(po.getCtx(), "#AD_Client_ID", po.getAD_Client_ID());
DocAction document = (DocAction)po; 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(); po.saveEx();
} }
} }
@ -599,7 +607,7 @@ public class ImportHelper {
log.info("referencedNode = " + referencedNode); log.info("referencedNode = " + referencedNode);
if (referencedNode == null) 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); record_ID = getID(ctx, referencedExpFormat, referencedNode, uniqueFormatLine.getValue(), trxName);

View File

@ -33,6 +33,7 @@ package org.compiere.model;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import org.compiere.util.CCache; import org.compiere.util.CCache;
@ -61,8 +62,8 @@ public class MEXPFormat extends X_EXP_Format {
private static CCache<String,MEXPFormat> s_cache = new CCache<String,MEXPFormat>(MEXPFormat.Table_Name, 50 ); private static CCache<String,MEXPFormat> s_cache = new CCache<String,MEXPFormat>(MEXPFormat.Table_Name, 50 );
private static CCache<Integer,MEXPFormat> exp_format_by_id_cache = new CCache<Integer,MEXPFormat>(MEXPFormat.Table_Name, 50); private static CCache<Integer,MEXPFormat> exp_format_by_id_cache = new CCache<Integer,MEXPFormat>(MEXPFormat.Table_Name, 50);
private Collection<MEXPFormatLine> m_lines = null; private List<MEXPFormatLine> m_lines = null;
private Collection<MEXPFormatLine> m_lines_unique = null; private List<MEXPFormatLine> m_lines_unique = null;
public MEXPFormat(Properties ctx, int EXP_Format_ID, String trxName) 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); super (ctx, rs, trxName);
} }
public Collection<MEXPFormatLine> getFormatLines() { public List<MEXPFormatLine> getFormatLines() {
return getFormatLinesOrderedBy(X_EXP_FormatLine.COLUMNNAME_Position); return getFormatLinesOrderedBy(X_EXP_FormatLine.COLUMNNAME_Position);
} }
public Collection<MEXPFormatLine> getFormatLinesOrderedBy(String orderBy) public List<MEXPFormatLine> getFormatLinesOrderedBy(String orderBy)
{ {
if(m_lines != null) if(m_lines != null)
{ {

View File

@ -51,6 +51,17 @@ public class MEXPProcessor extends X_EXP_Processor {
/** Static Logger */ /** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MEXPProcessor.class); 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) { public MEXPProcessor(Properties ctx, int EXP_Processor_ID, String trxName) {
super(ctx, EXP_Processor_ID, 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) { public X_EXP_ProcessorParameter[] getEXP_ProcessorParameters(String trxName) {
if(parameters != null)
return parameters;
List<X_EXP_ProcessorParameter> resultList = new ArrayList<X_EXP_ProcessorParameter>(); List<X_EXP_ProcessorParameter> resultList = new ArrayList<X_EXP_ProcessorParameter>();
StringBuffer sql = new StringBuffer("SELECT * ") StringBuffer sql = new StringBuffer("SELECT * ")
@ -92,6 +107,7 @@ public class MEXPProcessor extends X_EXP_Processor {
} catch (Exception e) { pstmt = null; } } catch (Exception e) { pstmt = null; }
} }
X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]); X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]);
parameters = result;
return result; return result;
} }