From 590d03ae3b8a0d83360c64601ccb37f1ff43adea Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 26 May 2021 11:21:27 +0200 Subject: [PATCH] IDEMPIERE-4798 Add Event Before Parse Status Line (#697) --- .../src/org/compiere/model/MStatusLine.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MStatusLine.java b/org.adempiere.base/src/org/compiere/model/MStatusLine.java index c59c4d2910..bc01fc62f5 100644 --- a/org.adempiere.base/src/org/compiere/model/MStatusLine.java +++ b/org.adempiere.base/src/org/compiere/model/MStatusLine.java @@ -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 s_cache = new ImmutablePOCache(Table_Name, 10); private static CCache s_cachew = new CCache(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) {