Skip to content

Commit

Permalink
IDEMPIERE-5996 - Added the functionality of resetting cache after cre… (
Browse files Browse the repository at this point in the history
idempiere#2186)

* IDEMPIERE-5996 - Added the functionality of resetting cache after creating a record access restriction

* Update MRecordAccess.java

---------

Co-authored-by: Carlos Ruiz <[email protected]>
  • Loading branch information
d-ruiz and CarlosRuiz-globalqss authored Jan 14, 2024
1 parent 2f0aab2 commit cb68340
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions org.adempiere.base/src/org/compiere/model/MRecordAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import java.util.Properties;
import java.util.logging.Level;

import org.compiere.Adempiere;
import org.compiere.util.CacheMgt;
import org.compiere.util.DB;
import org.compiere.util.Msg;

Expand All @@ -33,20 +35,20 @@
public class MRecordAccess extends X_AD_Record_Access
{
/**
* generated serial id
*
*/
private static final long serialVersionUID = -5115765616266528435L;
private static final long serialVersionUID = -3608241027957009608L;

/**
* UUID based Constructor
* @param ctx Context
* @param AD_Record_Access_UU UUID key
* @param trxName Transaction
*/
public MRecordAccess(Properties ctx, String AD_Record_Access_UU, String trxName) {
super(ctx, AD_Record_Access_UU, trxName);
}

/**
* UUID based Constructor
* @param ctx Context
* @param AD_Record_Access_UU UUID key
* @param trxName Transaction
*/
public MRecordAccess(Properties ctx, String AD_Record_Access_UU, String trxName) {
super(ctx, AD_Record_Access_UU, trxName);
}

/**
* @param ctx context
* @param ignored ignored
Expand Down Expand Up @@ -287,5 +289,21 @@ public String getTableName (Properties ctx)
}
return m_tableName;
} // getTableName

/**
* After Save
* @param newRecord new
* @param success success
* @return success
*/
@Override
protected boolean afterSave(boolean newRecord, boolean success) {
if (!success)
return success;

Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(MRole.Table_Name, getAD_Role_ID()));

return success;
} // afterSave

} // MRecordAccess

0 comments on commit cb68340

Please sign in to comment.