You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2007/10/18 00:08:43 UTC
svn commit: r585729 - in /ofbiz/trunk:
applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
Author: doogie
Date: Wed Oct 17 15:08:42 2007
New Revision: 585729
URL: http://svn.apache.org/viewvc?rev=585729&view=rev
Log:
Java 1.5 markup for UtilProperties(fixes InvoiceServices too).
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=585729&r1=585728&r2=585729&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Wed Oct 17 15:08:42 2007
@@ -2307,7 +2307,7 @@
// added (paymentApplicationId == null)
if (amountApplied.compareTo(paymentApplyAvailable) > 0) {
errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentLessRequested",
- UtilMisc.toMap("paymentId",paymentId,
+ UtilMisc.<String, Object>toMap("paymentId",paymentId,
"paymentApplyAvailable",paymentApplyAvailable,
"amountApplied",amountApplied,"isoCode",payment.getString("currencyUomId")),locale));
}
@@ -2352,7 +2352,7 @@
// added (paymentApplicationId == null)
if (amountApplied.compareTo(toPaymentApplyAvailable) > 0) {
errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentLessRequested",
- UtilMisc.toMap("paymentId",toPaymentId,
+ UtilMisc.<String, Object>toMap("paymentId",toPaymentId,
"paymentApplyAvailable",toPaymentApplyAvailable,
"amountApplied",amountApplied,"isoCode",payment.getString("currencyUomId")),locale));
}
@@ -2451,7 +2451,7 @@
// added (paymentApplicationId == null)
else if (amountApplied.compareTo(invoiceApplyAvailable) > 0) {
errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceLessRequested",
- UtilMisc.toMap("invoiceId",invoiceId,
+ UtilMisc.<String, Object>toMap("invoiceId",invoiceId,
"invoiceApplyAvailable",invoiceApplyAvailable,
"amountApplied",amountApplied,"isoCode",invoice.getString("currencyUomId")),locale));
}
@@ -2497,7 +2497,7 @@
errorMessageList.add("Invoice(" + invoiceId + ") item(" + invoiceItemSeqId + ") has " + invoiceItemApplyAvailable + " to apply but " + amountApplied + " is requested\n");
String uomId = invoice.getString("currencyUomId");
errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceItemLessRequested",
- UtilMisc.toMap("invoiceId",invoiceId, "invoiceItemSeqId", invoiceItemSeqId,
+ UtilMisc.<String, Object>toMap("invoiceId",invoiceId, "invoiceItemSeqId", invoiceItemSeqId,
"invoiceItemApplyAvailable",invoiceItemApplyAvailable,
"amountApplied",amountApplied,"isoCode",uomId),locale));
}
@@ -2558,7 +2558,7 @@
// application record is changed
newPaymentApplyAvailable = paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(decimals, rounding);
if (newPaymentApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.toMap("paymentId",paymentId,"paymentApplyAvailable",paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")),"amountApplied",amountApplied),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",paymentId,"paymentApplyAvailable",paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")),"amountApplied",amountApplied),locale));
}
if (invoiceId != null) {
@@ -2570,33 +2570,33 @@
if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") == null) {
newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(decimals, rounding);
if (invoiceApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale));
}
} else if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") != null) {
// check if the item number changed from a real Item number to a null value
newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(decimals, rounding);
if (invoiceApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale));
}
} else if (invoiceItemSeqId != null && paymentApplication.get("invoiceItemSeqId") == null) {
// check if the item number changed from a null value to
// a real Item number
newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.subtract(amountApplied).setScale(decimals, rounding);
if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
}
} else if (invoiceItemSeqId.equals(paymentApplication.getString("invoiceItemSeqId"))) {
// check if the real item numbers the same
// item number the same numeric value
newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(decimals, rounding);
if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
}
} else {
// item number changed only check new item
newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(amountApplied).setScale(decimals, rounding);
if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale));
}
}
@@ -2615,7 +2615,7 @@
// check the invoice
newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied").subtract(amountApplied)).setScale(decimals, rounding);
if (newInvoiceApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.toMap("tooMuch",invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied),"invoiceId",invoiceId),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied),"invoiceId",invoiceId),locale));
}
}
}
@@ -2625,14 +2625,14 @@
if (toPaymentId != null && toPaymentId.equals(paymentApplication.getString("toPaymentId"))) {
newToPaymentApplyAvailable = toPaymentApplyAvailable.subtract(paymentApplication.getBigDecimal("amountApplied")).add(amountApplied).setScale(decimals, rounding);
if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale));
}
} else if (toPaymentId != null) {
// billing account entered number has changed so we have to
// check the new billing account number.
newToPaymentApplyAvailable = toPaymentApplyAvailable.add(amountApplied).setScale(decimals, rounding);
if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) {
- errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale));
+ errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale));
}
}
@@ -2678,7 +2678,7 @@
if (amountApplied.signum() == 0) {
errorMessageList.add(UtilProperties.getMessage(resource, "AccountingNoAmount",locale));
} else {
- successMessage = UtilProperties.getMessage(resource, "AccountingApplicationSuccess",UtilMisc.toMap("amountApplied",amountApplied,"paymentId",paymentId,"isoCode", payment.getString("currencyUomId"),"toMessage",toMessage),locale);
+ successMessage = UtilProperties.getMessage(resource, "AccountingApplicationSuccess",UtilMisc.<String, Object>toMap("amountApplied",amountApplied,"paymentId",paymentId,"isoCode", payment.getString("currencyUomId"),"toMessage",toMessage),locale);
}
// report error messages if any
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java?rev=585729&r1=585728&r2=585729&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilProperties.java Wed Oct 17 15:08:42 2007
@@ -50,17 +50,17 @@
* corresponding to each properties file keyed by a String for the resource location.
* This will be used for both non-locale and locale keyed FexibleProperties instances.
*/
- protected static UtilCache resourceCache = new UtilCache("properties.UtilPropertiesResourceCache");
+ protected static UtilCache<String, FlexibleProperties> resourceCache = new UtilCache<String, FlexibleProperties>("properties.UtilPropertiesResourceCache");
/** An instance of the generic cache for storing the FlexibleProperties
* corresponding to each properties file keyed by a URL object
*/
- protected static UtilCache urlCache = new UtilCache("properties.UtilPropertiesUrlCache");
+ protected static UtilCache<String, FlexibleProperties> urlCache = new UtilCache<String, FlexibleProperties>("properties.UtilPropertiesUrlCache");
/** An instance of the generic cache for storing the ResourceBundle
* corresponding to each properties file keyed by a String for the resource location and the locale
*/
- protected static UtilCache bundleLocaleCache = new UtilCache("properties.UtilPropertiesBundleLocaleCache");
+ protected static UtilCache<String, ResourceBundleMapWrapper.InternalRbmWrapper> bundleLocaleCache = new UtilCache<String, ResourceBundleMapWrapper.InternalRbmWrapper>("properties.UtilPropertiesBundleLocaleCache");
/** Compares the specified property to the compareString, returns true if they are the same, false otherwise
@@ -123,7 +123,7 @@
public static String getPropertyValue(String resource, String name) {
if (resource == null || resource.length() <= 0) return "";
if (name == null || name.length() <= 0) return "";
- FlexibleProperties properties = (FlexibleProperties) resourceCache.get(resource);
+ FlexibleProperties properties = resourceCache.get(resource);
if (properties == null) {
try {
@@ -158,7 +158,7 @@
public static Properties getProperties(String resource) {
if (resource == null || resource.length() <= 0)
return null;
- Properties properties = (FlexibleProperties) resourceCache.get(resource);
+ FlexibleProperties properties = resourceCache.get(resource);
if (properties == null) {
try {
@@ -186,12 +186,12 @@
public static Properties getProperties(URL url) {
if (url == null)
return null;
- Properties properties = (FlexibleProperties) resourceCache.get(url);
+ FlexibleProperties properties = resourceCache.get(url.toString());
if (properties == null) {
try {
properties = FlexibleProperties.makeFlexibleProperties(url);
- resourceCache.put(url, properties);
+ resourceCache.put(url.toString(), properties);
} catch (MissingResourceException e) {
Debug.log(e.getMessage(), module);
}
@@ -266,12 +266,12 @@
public static String getPropertyValue(URL url, String name) {
if (url == null) return "";
if (name == null || name.length() <= 0) return "";
- FlexibleProperties properties = (FlexibleProperties) urlCache.get(url);
+ FlexibleProperties properties = urlCache.get(url.toString());
if (properties == null) {
try {
properties = FlexibleProperties.makeFlexibleProperties(url);
- urlCache.put(url, properties);
+ urlCache.put(url.toString(), properties);
} catch (MissingResourceException e) {
Debug.log(e.getMessage(), module);
}
@@ -303,12 +303,12 @@
if (url == null) return "";
if (name == null || name.length() <= 0) return "";
- FlexibleProperties properties = (FlexibleProperties) urlCache.get(url);
+ FlexibleProperties properties = urlCache.get(url.toString());
if (properties == null) {
try {
properties = FlexibleProperties.makeFlexibleProperties(url);
- urlCache.put(url, properties);
+ urlCache.put(url.toString(), properties);
} catch (MissingResourceException e) {
Debug.log(e.getMessage(), module);
}
@@ -414,7 +414,7 @@
if (resource == null || resource.length() <= 0) return "";
if (name == null || name.length() <= 0) return "";
- Map bundle = getResourceBundleMap(resource, locale);
+ Map<String, Object> bundle = getResourceBundleMap(resource, locale);
if (bundle == null) return "";
@@ -481,7 +481,7 @@
* @param context A Map of Objects to insert into the message place holders using the ${} syntax of the FlexibleStringExpander
* @return The value of the property in the properties file
*/
- public static String getMessage(String resource, String name, Map context, Locale locale) {
+ public static String getMessage(String resource, String name, Map<String, ? extends Object> context, Locale locale) {
String value = getMessage(resource, name, locale);
if (value == null || value.length() == 0) {
@@ -517,7 +517,7 @@
* @param locale The locale that the given resource will correspond to
* @return Map containing all entries in The ResourceBundle
*/
- public static Map getResourceBundleMap(String resource, Locale locale) {
+ public static Map<String, Object> getResourceBundleMap(String resource, Locale locale) {
if (locale == null) {
throw new IllegalArgumentException("Locale cannot be null");
}
@@ -528,10 +528,10 @@
public static ResourceBundleMapWrapper.InternalRbmWrapper getInternalRbmWrapper(String resource, Locale locale) {
String resourceCacheKey = resource + "_" + locale.toString();
- ResourceBundleMapWrapper.InternalRbmWrapper bundleMap = (ResourceBundleMapWrapper.InternalRbmWrapper) bundleLocaleCache.get(resourceCacheKey);
+ ResourceBundleMapWrapper.InternalRbmWrapper bundleMap = bundleLocaleCache.get(resourceCacheKey);
if (bundleMap == null) {
synchronized (UtilProperties.class) {
- bundleMap = (ResourceBundleMapWrapper.InternalRbmWrapper) bundleLocaleCache.get(resourceCacheKey);
+ bundleMap = bundleLocaleCache.get(resourceCacheKey);
if (bundleMap == null) {
ResourceBundle bundle = getBaseResourceBundle(resource, locale);
if (bundle == null) {
@@ -547,7 +547,7 @@
return bundleMap;
}
- protected static Set resourceNotFoundMessagesShown = FastSet.newInstance();
+ protected static Set<String> resourceNotFoundMessagesShown = FastSet.newInstance();
protected static ResourceBundle getBaseResourceBundle(String resource, Locale locale) {
if (resource == null || resource.length() <= 0) return null;
if (locale == null) locale = Locale.getDefault();
@@ -619,13 +619,13 @@
String localeString = locale.toString();
String resourceLocale = resource + "_" + localeString;
- Properties properties = (FlexibleProperties) resourceCache.get(resourceLocale);
+ FlexibleProperties properties = resourceCache.get(resourceLocale);
if (properties == null) {
try {
URL url = UtilURL.fromResource(resourceLocale);
if (url == null) {
- properties = getProperties(resource);
+ properties = (FlexibleProperties) getProperties(resource);
} else {
properties = FlexibleProperties.makeFlexibleProperties(url);
}