IDEMPIERE-5996 - Added the functionality of resetting cache after cre… (#2186)

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

* Update MRecordAccess.java

---------

Co-authored-by: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
Diego Ruiz 2024-01-14 15:07:01 +01:00 committed by Carlos Ruiz
parent 63823f3a40
commit 735a735fbb
1 changed files with 30 additions and 12 deletions

View File

@ -21,6 +21,8 @@ import java.sql.ResultSet;
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;
@ -33,20 +35,20 @@ import org.compiere.util.Msg;
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
@ -287,5 +289,21 @@ public class MRecordAccess extends X_AD_Record_Access
}
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