IDEMPIERE-4798 Add Event Before Parse Status Line (#697)

This commit is contained in:
Carlos Ruiz 2021-05-26 11:21:27 +02:00 committed by GitHub
parent 9a21b84055
commit 590d03ae3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -28,13 +28,16 @@ import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.base.event.EventManager;
import org.adempiere.base.event.EventProperty;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.idempiere.cache.ImmutablePOSupport;
import org.idempiere.cache.ImmutablePOCache;
import org.idempiere.cache.ImmutablePOSupport;
import org.osgi.service.event.Event;
/**
* Status Line Model
@ -47,13 +50,17 @@ public class MStatusLine extends X_AD_StatusLine implements ImmutablePOSupport
/**
*
*/
private static final long serialVersionUID = -2804602992872075936L;
private static final long serialVersionUID = -1542116796861052734L;
/** Logging */
private static CLogger s_log = CLogger.getCLogger(MStatusLine.class);
/** Status Line Cache */
private static ImmutablePOCache<String, MStatusLine> s_cache = new ImmutablePOCache<String, MStatusLine>(Table_Name, 10);
private static CCache<String, MStatusLine[]> s_cachew = new CCache<String, MStatusLine[]>(Table_Name, Table_Name+"|MStatusLine[]", 10);
public static final String BEFORE_PARSE_STATUS_LINE = "idempiere/statusLine/beforeParse";
public static final String EVENT_WINDOWNO = "event.windowno";
/**
* Standard Constructor
* @param ctx context
@ -211,6 +218,10 @@ public class MStatusLine extends X_AD_StatusLine implements ImmutablePOSupport
}
public String parseLine(int windowNo) {
Event event = EventManager.newEvent(BEFORE_PARSE_STATUS_LINE,
new EventProperty(EventManager.EVENT_DATA, this), new EventProperty(EVENT_WINDOWNO, windowNo));
EventManager.getInstance().sendEvent(event);
String sql = getSQLStatement();
if (sql.indexOf("@") >= 0) {