IDEMPIERE-4639 simplify calls using saveCrossTenantSafeEx when possible (#2073)
* IDEMPIERE-4639 simplify calls using saveCrossTenantSafeEx when possible * - integrate patch from Heng Sin
This commit is contained in:
parent
e83bb49935
commit
ef9ecb3490
|
@ -229,12 +229,7 @@ public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
|
||||||
ri.setAD_Role_ID(AD_Role_ID);
|
ri.setAD_Role_ID(AD_Role_ID);
|
||||||
ri.setAD_Window_ID(AD_Window_ID);
|
ri.setAD_Window_ID(AD_Window_ID);
|
||||||
ri.setAD_Tab_ID(AD_Tab_ID);
|
ri.setAD_Tab_ID(AD_Tab_ID);
|
||||||
try {
|
ri.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
ri.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ( ric.getAD_Role_ID() != AD_Role_ID
|
if ( ric.getAD_Role_ID() != AD_Role_ID
|
||||||
|| ric.getAD_Window_ID() != AD_Window_ID
|
|| ric.getAD_Window_ID() != AD_Window_ID
|
||||||
|
@ -243,12 +238,7 @@ public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
|
||||||
ri.setAD_Role_ID(AD_Role_ID);
|
ri.setAD_Role_ID(AD_Role_ID);
|
||||||
ri.setAD_Window_ID(AD_Window_ID);
|
ri.setAD_Window_ID(AD_Window_ID);
|
||||||
ri.setAD_Tab_ID(AD_Tab_ID);
|
ri.setAD_Tab_ID(AD_Tab_ID);
|
||||||
try {
|
ri.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
ri.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
DB.executeUpdateEx("UPDATE AD_RecentItem SET Updated=getDate() WHERE AD_RecentItem_ID=?", new Object[] {ric.getAD_RecentItem_ID()}, null);
|
DB.executeUpdateEx("UPDATE AD_RecentItem SET Updated=getDate() WHERE AD_RecentItem_ID=?", new Object[] {ric.getAD_RecentItem_ID()}, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,12 +117,7 @@ public class MShippingTransaction extends X_M_ShippingTransaction
|
||||||
msg.append(getErrorMessage());
|
msg.append(getErrorMessage());
|
||||||
msg.append("\nAction: " + getAction());
|
msg.append("\nAction: " + getAction());
|
||||||
history.setTextMsg(msg.toString());
|
history.setTextMsg(msg.toString());
|
||||||
try {
|
history.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
history.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
setProcessed(processed);
|
setProcessed(processed);
|
||||||
return processed;
|
return processed;
|
||||||
|
|
|
@ -76,12 +76,7 @@ public class MSystem extends X_AD_System
|
||||||
//
|
//
|
||||||
if (!Ini.isClient() && system.setInfo())
|
if (!Ini.isClient() && system.setInfo())
|
||||||
{
|
{
|
||||||
try {
|
system.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
system.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s_system.put(0, new MSystem(Env.getCtx(), system));
|
s_system.put(0, new MSystem(Env.getCtx(), system));
|
||||||
return system;
|
return system;
|
||||||
|
|
|
@ -2592,11 +2592,14 @@ public abstract class PO
|
||||||
* @see #saveEx(String)
|
* @see #saveEx(String)
|
||||||
*/
|
*/
|
||||||
public void saveCrossTenantSafeEx() {
|
public void saveCrossTenantSafeEx() {
|
||||||
|
boolean crossTenantSet = isSafeCrossTenant.get();
|
||||||
try {
|
try {
|
||||||
PO.setCrossTenantSafe();
|
if (!crossTenantSet)
|
||||||
|
PO.setCrossTenantSafe();
|
||||||
saveEx();
|
saveEx();
|
||||||
} finally {
|
} finally {
|
||||||
PO.clearCrossTenantSafe();
|
if (!crossTenantSet)
|
||||||
|
PO.clearCrossTenantSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2751,11 +2754,14 @@ public abstract class PO
|
||||||
* @see #saveEx(String)
|
* @see #saveEx(String)
|
||||||
*/
|
*/
|
||||||
public void saveCrossTenantSafeEx(String trxName) {
|
public void saveCrossTenantSafeEx(String trxName) {
|
||||||
|
boolean crossTenantSet = isSafeCrossTenant.get();
|
||||||
try {
|
try {
|
||||||
PO.setCrossTenantSafe();
|
if (!crossTenantSet)
|
||||||
|
PO.setCrossTenantSafe();
|
||||||
saveEx(trxName);
|
saveEx(trxName);
|
||||||
} finally {
|
} finally {
|
||||||
PO.clearCrossTenantSafe();
|
if (!crossTenantSet)
|
||||||
|
PO.clearCrossTenantSafe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ import javax.print.attribute.DocAttributeSet;
|
||||||
import org.adempiere.base.Core;
|
import org.adempiere.base.Core;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.print.ArchiveEngine;
|
import org.compiere.print.ArchiveEngine;
|
||||||
import org.compiere.print.CPaper;
|
import org.compiere.print.CPaper;
|
||||||
|
@ -1671,13 +1670,8 @@ public class LayoutEngine implements Pageable, Printable, Doc
|
||||||
if (item.is_Immutable())
|
if (item.is_Immutable())
|
||||||
item = new MPrintFormatItem(item);
|
item = new MPrintFormatItem(item);
|
||||||
item.setIsSuppressNull(true); // display size will be set to 0 in TableElement
|
item.setIsSuppressNull(true); // display size will be set to 0 in TableElement
|
||||||
try {
|
//this can be tenant or system print format
|
||||||
//this can be tenant or system print format
|
item.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
item.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset(MPrintFormat.Table_Name, format.get_ID());
|
CacheMgt.get().reset(MPrintFormat.Table_Name, format.get_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.MMFARegisteredDevice;
|
import org.compiere.model.MMFARegisteredDevice;
|
||||||
import org.compiere.model.MProcessPara;
|
import org.compiere.model.MProcessPara;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
|
@ -89,12 +88,7 @@ public class MFARevokeDevice extends SvrProcess {
|
||||||
.list();
|
.list();
|
||||||
for (MMFARegisteredDevice rd : rds) {
|
for (MMFARegisteredDevice rd : rds) {
|
||||||
rd.setIsActive(false);
|
rd.setIsActive(false);
|
||||||
try {
|
rd.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
rd.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "@OK@";
|
return "@OK@";
|
||||||
|
|
|
@ -32,7 +32,6 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.model.MMFARegistration;
|
import org.compiere.model.MMFARegistration;
|
||||||
import org.compiere.model.MProcessPara;
|
import org.compiere.model.MProcessPara;
|
||||||
import org.compiere.model.PO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDEMPIERE-4782
|
* IDEMPIERE-4782
|
||||||
|
@ -69,12 +68,7 @@ public class MFAUnregister extends SvrProcess {
|
||||||
MMFARegistration reg = new MMFARegistration(getCtx(), p_MFA_Registration_ID, get_TrxName());
|
MMFARegistration reg = new MMFARegistration(getCtx(), p_MFA_Registration_ID, get_TrxName());
|
||||||
reg.setIsActive(false);
|
reg.setIsActive(false);
|
||||||
reg.setMFAUnregisteredAt(new Timestamp(System.currentTimeMillis()));
|
reg.setMFAUnregisteredAt(new Timestamp(System.currentTimeMillis()));
|
||||||
try {
|
reg.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
reg.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "@OK@";
|
return "@OK@";
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,12 +217,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable
|
||||||
setEndWaitTime(new Timestamp(limitMS + System.currentTimeMillis()));
|
setEndWaitTime(new Timestamp(limitMS + System.currentTimeMillis()));
|
||||||
// Responsible
|
// Responsible
|
||||||
setResponsible(process);
|
setResponsible(process);
|
||||||
try {
|
saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
m_audit = new MWFEventAudit(this);
|
m_audit = new MWFEventAudit(this);
|
||||||
m_audit.setAD_Org_ID(getAD_Org_ID());//Add by Hideaki Hagiwara
|
m_audit.setAD_Org_ID(getAD_Org_ID());//Add by Hideaki Hagiwara
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.compiere.model.MMFAMethod;
|
||||||
import org.compiere.model.MMFARegistration;
|
import org.compiere.model.MMFARegistration;
|
||||||
import org.compiere.model.MMailText;
|
import org.compiere.model.MMailText;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.EMail;
|
import org.compiere.util.EMail;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -274,12 +273,7 @@ public class EMailMechanism implements IMFAMechanism {
|
||||||
* @param reg
|
* @param reg
|
||||||
*/
|
*/
|
||||||
private void saveRegistration(MMFARegistration reg) {
|
private void saveRegistration(MMFARegistration reg) {
|
||||||
try {
|
reg.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
reg.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ import org.compiere.model.MMFAMethod;
|
||||||
import org.compiere.model.MMFARegistration;
|
import org.compiere.model.MMFARegistration;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
|
@ -249,12 +248,7 @@ public class TOTPMechanism implements IMFAMechanism {
|
||||||
* @param reg
|
* @param reg
|
||||||
*/
|
*/
|
||||||
private void saveRegistration(MMFARegistration reg) {
|
private void saveRegistration(MMFARegistration reg) {
|
||||||
try {
|
reg.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
reg.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.adempiere.webui.window.Dialog;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.MTreeFavoriteNode;
|
import org.compiere.model.MTreeFavoriteNode;
|
||||||
import org.compiere.model.MTreeNode;
|
import org.compiere.model.MTreeNode;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -407,13 +406,8 @@ public class ADTreeFavoriteOnDropListener implements EventListener<Event>
|
||||||
{
|
{
|
||||||
favNode.setParent_ID(parentTNode.getNode_ID());
|
favNode.setParent_ID(parentTNode.getNode_ID());
|
||||||
favNode.setSeqNo(seqNo);
|
favNode.setSeqNo(seqNo);
|
||||||
try {
|
//For service users, needs to persist data in system tenant
|
||||||
//For service users, needs to persist data in system tenant
|
favNode.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
favNode.save();
|
|
||||||
}finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // updateTFNParentAndSeqNo
|
} // updateTFNParentAndSeqNo
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ import org.compiere.model.MMFARegisteredDevice;
|
||||||
import org.compiere.model.MMFARegistration;
|
import org.compiere.model.MMFARegistration;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.SystemProperties;
|
import org.compiere.model.SystemProperties;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -393,12 +392,7 @@ public class ValidateMFAPanel extends Window implements EventListener<Event> {
|
||||||
long daysExpire = MSysConfig.getIntValue(MSysConfig.MFA_REGISTERED_DEVICE_EXPIRATION_DAYS, 30, Env.getAD_Client_ID(m_ctx));
|
long daysExpire = MSysConfig.getIntValue(MSysConfig.MFA_REGISTERED_DEVICE_EXPIRATION_DAYS, 30, Env.getAD_Client_ID(m_ctx));
|
||||||
rd.setExpiration(new Timestamp(System.currentTimeMillis() + (daysExpire * 86400000L)));
|
rd.setExpiration(new Timestamp(System.currentTimeMillis() + (daysExpire * 86400000L)));
|
||||||
// TODO: rd.setHelp -> add information about the browser, device and IP address (fingerprint)
|
// TODO: rd.setHelp -> add information about the browser, device and IP address (fingerprint)
|
||||||
try {
|
rd.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
rd.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Env.setContext(m_ctx, Env.MFA_Registration_ID, registrationId);
|
Env.setContext(m_ctx, Env.MFA_Registration_ID, registrationId);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.adempiere.webui.util.ZKUpdateUtil;
|
||||||
import org.compiere.model.MField;
|
import org.compiere.model.MField;
|
||||||
import org.compiere.model.MFieldSuggestion;
|
import org.compiere.model.MFieldSuggestion;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
@ -174,12 +173,7 @@ public class WFieldSuggestion extends Window implements EventListener<Event> {
|
||||||
suggestion.setIsApproved(false);
|
suggestion.setIsApproved(false);
|
||||||
suggestion.setIsUpdateBaseLanguage(false);
|
suggestion.setIsUpdateBaseLanguage(false);
|
||||||
suggestion.setProcessed(false);
|
suggestion.setProcessed(false);
|
||||||
try {
|
suggestion.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
suggestion.saveEx();
|
|
||||||
}finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
Dialog.info(0, Msg.getMsg(Env.getCtx(),"Your suggestions have been submitted for review"));
|
Dialog.info(0, Msg.getMsg(Env.getCtx(),"Your suggestions have been submitted for review"));
|
||||||
this.detach();
|
this.detach();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ import org.compiere.model.MPayment;
|
||||||
import org.compiere.model.MPaymentProcessor;
|
import org.compiere.model.MPaymentProcessor;
|
||||||
import org.compiere.model.MProduct;
|
import org.compiere.model.MProduct;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.SystemIDs;
|
import org.compiere.model.SystemIDs;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -312,12 +311,7 @@ public class PaymentFormTest extends AbstractTestCase {
|
||||||
try {
|
try {
|
||||||
payProcessorClass = mpp.getPayProcessorClass();
|
payProcessorClass = mpp.getPayProcessorClass();
|
||||||
mpp.setPayProcessorClass("org.compiere.model.PP_Dummy");
|
mpp.setPayProcessorClass("org.compiere.model.PP_Dummy");
|
||||||
try {
|
mpp.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
mpp.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
boolean ok = form.saveChangesInTrx(getTrxName());
|
boolean ok = form.saveChangesInTrx(getTrxName());
|
||||||
assertTrue(ok, "Save failed: " + form.getProcessMessage());
|
assertTrue(ok, "Save failed: " + form.getProcessMessage());
|
||||||
assertNotNull(form.getPayment(), "Payment not created");
|
assertNotNull(form.getPayment(), "Payment not created");
|
||||||
|
@ -325,12 +319,7 @@ public class PaymentFormTest extends AbstractTestCase {
|
||||||
assertEquals(order.getGrandTotal().setScale(2, RoundingMode.HALF_EVEN), form.getPayment().getPayAmt().setScale(2, RoundingMode.HALF_EVEN), "Wrong Payment Document Amount");
|
assertEquals(order.getGrandTotal().setScale(2, RoundingMode.HALF_EVEN), form.getPayment().getPayAmt().setScale(2, RoundingMode.HALF_EVEN), "Wrong Payment Document Amount");
|
||||||
} finally {
|
} finally {
|
||||||
mpp.setPayProcessorClass(payProcessorClass);
|
mpp.setPayProcessorClass(payProcessorClass);
|
||||||
try {
|
mpp.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
mpp.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.compiere.model.MBankStatement;
|
||||||
import org.compiere.model.MBankStatementLine;
|
import org.compiere.model.MBankStatementLine;
|
||||||
import org.compiere.model.MPayment;
|
import org.compiere.model.MPayment;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.model.Query;
|
import org.compiere.model.Query;
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
|
@ -99,12 +98,7 @@ public class BankStatementTest extends AbstractTestCase {
|
||||||
MSysConfig sysConfig = query.setOrderBy("AD_Client_ID Desc").setParameters(MSysConfig.ALLOW_REVERSAL_OF_RECONCILED_PAYMENT, getAD_Client_ID()).first();
|
MSysConfig sysConfig = query.setOrderBy("AD_Client_ID Desc").setParameters(MSysConfig.ALLOW_REVERSAL_OF_RECONCILED_PAYMENT, getAD_Client_ID()).first();
|
||||||
if (!sysConfig.getValue().equals("Y")) {
|
if (!sysConfig.getValue().equals("Y")) {
|
||||||
sysConfig.setValue("Y");
|
sysConfig.setValue("Y");
|
||||||
try {
|
sysConfig.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
sysConfig.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset();
|
CacheMgt.get().reset();
|
||||||
} else {
|
} else {
|
||||||
sysConfig = null;
|
sysConfig = null;
|
||||||
|
@ -165,12 +159,7 @@ public class BankStatementTest extends AbstractTestCase {
|
||||||
} finally {
|
} finally {
|
||||||
if (sysConfig != null) {
|
if (sysConfig != null) {
|
||||||
sysConfig.setValue("N");
|
sysConfig.setValue("N");
|
||||||
try {
|
sysConfig.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
sysConfig.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,12 +173,7 @@ public class BankStatementTest extends AbstractTestCase {
|
||||||
MSysConfig sysConfig = query.setOrderBy("AD_Client_ID Desc").setParameters(MSysConfig.ALLOW_REVERSAL_OF_RECONCILED_PAYMENT, getAD_Client_ID()).first();
|
MSysConfig sysConfig = query.setOrderBy("AD_Client_ID Desc").setParameters(MSysConfig.ALLOW_REVERSAL_OF_RECONCILED_PAYMENT, getAD_Client_ID()).first();
|
||||||
if (!sysConfig.getValue().equals("N")) {
|
if (!sysConfig.getValue().equals("N")) {
|
||||||
sysConfig.setValue("N");
|
sysConfig.setValue("N");
|
||||||
try {
|
sysConfig.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
sysConfig.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset();
|
CacheMgt.get().reset();
|
||||||
} else {
|
} else {
|
||||||
sysConfig = null;
|
sysConfig = null;
|
||||||
|
@ -249,12 +233,7 @@ public class BankStatementTest extends AbstractTestCase {
|
||||||
} finally {
|
} finally {
|
||||||
if (sysConfig != null) {
|
if (sysConfig != null) {
|
||||||
sysConfig.setValue("Y");
|
sysConfig.setValue("Y");
|
||||||
try {
|
sysConfig.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
sysConfig.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.compiere.model.MClientInfo;
|
||||||
import org.compiere.model.MOrgInfo;
|
import org.compiere.model.MOrgInfo;
|
||||||
import org.compiere.model.MSchedule;
|
import org.compiere.model.MSchedule;
|
||||||
import org.compiere.model.MScheduler;
|
import org.compiere.model.MScheduler;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.CacheMgt;
|
import org.compiere.util.CacheMgt;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
|
@ -69,12 +68,7 @@ public class MSchedulerTest extends AbstractTestCase {
|
||||||
schedule.setScheduleType(MSchedule.SCHEDULETYPE_CronSchedulingPattern);
|
schedule.setScheduleType(MSchedule.SCHEDULETYPE_CronSchedulingPattern);
|
||||||
schedule.setIsSystemSchedule(false);
|
schedule.setIsSystemSchedule(false);
|
||||||
schedule.setCronPattern("0 17 * * *");
|
schedule.setCronPattern("0 17 * * *");
|
||||||
try {
|
schedule.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
schedule.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
//get jvm timezone
|
//get jvm timezone
|
||||||
//this test assume jvm and db server is using the same default time zone
|
//this test assume jvm and db server is using the same default time zone
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.math.RoundingMode;
|
||||||
|
|
||||||
import org.compiere.model.MUOM;
|
import org.compiere.model.MUOM;
|
||||||
import org.compiere.model.MUOMConversion;
|
import org.compiere.model.MUOMConversion;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.CacheMgt;
|
import org.compiere.util.CacheMgt;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -61,12 +60,7 @@ public class MUOMConversionTest extends AbstractTestCase {
|
||||||
conv1.setC_UOM_To_ID(DictionaryIDs.C_UOM.HOUR.id);
|
conv1.setC_UOM_To_ID(DictionaryIDs.C_UOM.HOUR.id);
|
||||||
conv1.setMultiplyRate(new BigDecimal("1.15"));
|
conv1.setMultiplyRate(new BigDecimal("1.15"));
|
||||||
conv1.setDivideRate(BigDecimal.ZERO);
|
conv1.setDivideRate(BigDecimal.ZERO);
|
||||||
try {
|
conv1.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
conv1.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
MUOMConversion conv2 = null;
|
MUOMConversion conv2 = null;
|
||||||
MUOMConversion conv3 = null;
|
MUOMConversion conv3 = null;
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MStyle;
|
import org.compiere.model.MStyle;
|
||||||
import org.compiere.model.MStyleLine;
|
import org.compiere.model.MStyleLine;
|
||||||
import org.compiere.model.MTest;
|
import org.compiere.model.MTest;
|
||||||
import org.compiere.model.PO;
|
|
||||||
import org.compiere.util.CacheMgt;
|
import org.compiere.util.CacheMgt;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
|
@ -62,12 +61,7 @@ public class ModelForeignKeyTest extends AbstractTestCase {
|
||||||
// set model cascade on Test.Record_ID
|
// set model cascade on Test.Record_ID
|
||||||
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
||||||
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelCascade);
|
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelCascade);
|
||||||
try {
|
col_test_record_id.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
col_test_record_id.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
|
|
||||||
MTest test1 = new MTest(ctx, 0, trxName);
|
MTest test1 = new MTest(ctx, 0, trxName);
|
||||||
test1.setName("Test 1");
|
test1.setName("Test 1");
|
||||||
|
@ -93,12 +87,7 @@ public class ModelForeignKeyTest extends AbstractTestCase {
|
||||||
// set model cascade on Test.Record_ID
|
// set model cascade on Test.Record_ID
|
||||||
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
||||||
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelSetNull);
|
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelSetNull);
|
||||||
try {
|
col_test_record_id.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
col_test_record_id.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset();
|
CacheMgt.get().reset();
|
||||||
|
|
||||||
MTest test1 = new MTest(ctx, 0, trxName);
|
MTest test1 = new MTest(ctx, 0, trxName);
|
||||||
|
@ -125,12 +114,7 @@ public class ModelForeignKeyTest extends AbstractTestCase {
|
||||||
// set model cascade on Test.Record_ID
|
// set model cascade on Test.Record_ID
|
||||||
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
MColumn col_test_record_id = new MColumn(ctx, MColumn.getColumn_ID(MTest.Table_Name, MTest.COLUMNNAME_Record_ID), trxName);
|
||||||
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelNoAction_ForbidDeletion);
|
col_test_record_id.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelNoAction_ForbidDeletion);
|
||||||
try {
|
col_test_record_id.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
col_test_record_id.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset();
|
CacheMgt.get().reset();
|
||||||
|
|
||||||
MTest test1 = new MTest(ctx, 0, trxName);
|
MTest test1 = new MTest(ctx, 0, trxName);
|
||||||
|
@ -184,12 +168,7 @@ public class ModelForeignKeyTest extends AbstractTestCase {
|
||||||
// set model cascade on Test.Record_ID
|
// set model cascade on Test.Record_ID
|
||||||
MColumn col_styleline_style = new MColumn(ctx, MColumn.getColumn_ID(MStyleLine.Table_Name, MStyleLine.COLUMNNAME_AD_Style_ID), trxName);
|
MColumn col_styleline_style = new MColumn(ctx, MColumn.getColumn_ID(MStyleLine.Table_Name, MStyleLine.COLUMNNAME_AD_Style_ID), trxName);
|
||||||
col_styleline_style.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelCascade);
|
col_styleline_style.setFKConstraintType(MColumn.FKCONSTRAINTTYPE_ModelCascade);
|
||||||
try {
|
col_styleline_style.saveCrossTenantSafeEx();
|
||||||
PO.setCrossTenantSafe();
|
|
||||||
col_styleline_style.saveEx();
|
|
||||||
} finally {
|
|
||||||
PO.clearCrossTenantSafe();
|
|
||||||
}
|
|
||||||
CacheMgt.get().reset();
|
CacheMgt.get().reset();
|
||||||
|
|
||||||
MStyle style = new MStyle(ctx, 0, trxName);
|
MStyle style = new MStyle(ctx, 0, trxName);
|
||||||
|
|
Loading…
Reference in New Issue