details:   /erp/devel/pi/rev/3343f4e0708a
changeset: 7287:3343f4e0708a
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri May 07 14:30:46 2010 +0200
summary:   [pref] Log warning in case of conflict in StartPage preference

details:   /erp/devel/pi/rev/d7872862fa41
changeset: 7288:d7872862fa41
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri May 07 14:36:33 2010 +0200
summary:   [pref] Deprecated Utility.getPropertyValue method

diffstat:

 src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java |  2 ++
 src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java             |  2 ++
 src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java      |  2 ++
 src/org/openbravo/erpCommon/security/Menu.java                         |  4 
++++
 src/org/openbravo/erpCommon/utility/Utility.java                       |  6 
++++++
 5 files changed, 16 insertions(+), 0 deletions(-)

diffs (93 lines):

diff -r 8406828b4a78 -r d7872862fa41 
src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java
--- a/src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java    
Fri May 07 13:54:44 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/InvoicePaymentMonitor.java    
Fri May 07 14:36:33 2010 +0200
@@ -80,11 +80,13 @@
       pageErrorPopUp(response);
   }
 
+  @SuppressWarnings("deprecation")
   private OBError process(VariablesSecureApp vars, String strKey) throws 
ServletException {
     OBError myError = null;
     try {
       Invoice invoice = OBDal.getInstance().get(Invoice.class, strKey);
       // Extra check for PaymentMonitor-disabling switch, to build correct 
message for users
+      // Use Utility.getPropertyValue for backward compatibility
       if (Utility.getPropertyValue("PaymentMonitor", vars.getClient(), 
invoice.getOrganization()
           .getId()) == null
           && invoice.isProcessed())
diff -r 8406828b4a78 -r d7872862fa41 
src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java
--- a/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java        Fri May 
07 13:54:44 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/PaymentMonitor.java        Fri May 
07 14:36:33 2010 +0200
@@ -32,9 +32,11 @@
    * Users of this method should check for existence of the PaymentMonitor 
property (disabling it)
    * to be able to provide the user with a relevant message.
    */
+  @SuppressWarnings("deprecation")
   public static void updateInvoice(Invoice invoice) {
     // Check for PaymentMonitor-disabling switch.
     try {
+      // Use Utility.getPropertyValue for backward compatibility
       if (Utility.getPropertyValue("PaymentMonitor", 
invoice.getClient().getId(), invoice
           .getOrganization().getId()) != null)
         return;
diff -r 8406828b4a78 -r d7872862fa41 
src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java
--- a/src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java Fri May 
07 13:54:44 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/PaymentMonitorProcess.java Fri May 
07 14:36:33 2010 +0200
@@ -18,11 +18,13 @@
 
   private ProcessLogger logger;
 
+  @SuppressWarnings("deprecation")
   public void doExecute(ProcessBundle bundle) throws Exception {
 
     logger = bundle.getLogger();
     // Extra check for PaymentMonitor-disabling switch, to build correct 
message for users
     try {
+      // Use Utility.getPropertyValue for backward compatibility
       if (Utility.getPropertyValue("PaymentMonitor", 
bundle.getContext().getClient(), bundle
           .getContext().getOrganization()) != null) {
         logger
diff -r 8406828b4a78 -r d7872862fa41 
src/org/openbravo/erpCommon/security/Menu.java
--- a/src/org/openbravo/erpCommon/security/Menu.java    Fri May 07 13:54:44 
2010 +0200
+++ b/src/org/openbravo/erpCommon/security/Menu.java    Fri May 07 14:36:33 
2010 +0200
@@ -38,6 +38,7 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.businessUtility.Preferences;
+import org.openbravo.erpCommon.utility.PropertyConflictException;
 import org.openbravo.erpCommon.utility.PropertyException;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.datamodel.Table;
@@ -73,6 +74,9 @@
           response.sendRedirect(".." + startPage);
           return;
         }
+      } catch (PropertyConflictException e) {
+        // ignore show normal page
+        log4j.warn("Conflict getting StartPage preference. Showing normal 
page.");
       } catch (PropertyException e) {
         // ignore show normal page
       }
diff -r 8406828b4a78 -r d7872862fa41 
src/org/openbravo/erpCommon/utility/Utility.java
--- a/src/org/openbravo/erpCommon/utility/Utility.java  Fri May 07 13:54:44 
2010 +0200
+++ b/src/org/openbravo/erpCommon/utility/Utility.java  Fri May 07 14:36:33 
2010 +0200
@@ -68,6 +68,7 @@
 import org.openbravo.data.FieldProvider;
 import org.openbravo.data.Sqlc;
 import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.erpCommon.reference.PInstanceProcessData;
 import org.openbravo.model.ad.ui.Window;
 import org.openbravo.service.db.CallStoredProcedure;
@@ -2507,6 +2508,11 @@
    * Gets the configuration property value if there is an extension module 
implementing the given
    * property.
    * 
+   * @deprecated Use Preferences instead
+   * @see Preferences#getPreferenceValue(String, boolean, 
org.openbravo.model.ad.system.Client,
+   *      org.openbravo.model.common.enterprise.Organization, 
org.openbravo.model.ad.access.User,
+   *      org.openbravo.model.ad.access.Role, Window) 
Preferences.getPreferenceValue
+   * 
    * @param strProperty
    *          String with the name of the property
    * @param strClientId

------------------------------------------------------------------------------

_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to