You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/12/12 15:53:38 UTC
svn commit: r1550429 - in /ofbiz/trunk:
applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/
applications/content/src/org/ofbiz/content/content/
applications/order/src/org/ofbiz/order/order/
applications/order/src/org/ofbiz/order/task...
Author: jleroux
Date: Thu Dec 12 14:53:38 2013
New Revision: 1550429
URL: http://svn.apache.org/r1550429
Log:
No functional changes, code improvements
Fixes some dead code entries
Automatically adds some override annotations
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java
ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java Thu Dec 12 14:53:38 2013
@@ -114,13 +114,16 @@ public class ValueLinkApi {
* @return ValueLinkApi reference
*/
public static ValueLinkApi getInstance(Delegator delegator, Properties props, boolean reload) {
- String merchantId = (String) props.get("payment.valuelink.merchantId");
if (props == null) {
throw new IllegalArgumentException("Properties cannot be null");
}
+ String merchantId = (String) props.get("payment.valuelink.merchantId");
ValueLinkApi api = (ValueLinkApi) objectCache.get(merchantId);
- if (api == null || reload) {
+ if (api == null) {
+ throw new RuntimeException("Runtime problems with ValueLinkApi; unable to create instance");
+ }
+ if (reload) {
synchronized(ValueLinkApi.class) {
api = (ValueLinkApi) objectCache.get(merchantId);
if (api == null || reload) {
@@ -130,9 +133,6 @@ public class ValueLinkApi {
}
}
- if (api == null) {
- throw new RuntimeException("Runtime problems with ValueLinkApi; unable to create instance");
- }
return api;
}
Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Thu Dec 12 14:53:38 2013
@@ -885,7 +885,7 @@ public class ContentServices {
locale = (Locale) templateContext.get("locale");
}
GenericValue subContentDataResourceView = (GenericValue) context.get("subContentDataResourceView");
- if (subContentDataResourceView != null && subContentDataResourceView == null) {
+ if (templateContext != null && subContentDataResourceView == null) {
subContentDataResourceView = (GenericValue) templateContext.get("subContentDataResourceView");
}
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Dec 12 14:53:38 2013
@@ -2359,6 +2359,9 @@ public class OrderReturnServices {
if ((returnAmountByOrder != null) && (returnAmountByOrder.keySet() != null)) {
for (String orderId : returnAmountByOrder.keySet()) {
BigDecimal returnAmount = returnAmountByOrder.get(orderId);
+ if (returnAmount == null) {
+ return ServiceUtil.returnError("No returnAmount found for order:" + orderId);
+ }
if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) {
Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -2366,14 +2369,10 @@ public class OrderReturnServices {
}
OrderReadHelper helper = new OrderReadHelper(delegator, orderId);
BigDecimal grandTotal = helper.getOrderGrandTotal();
- if (returnAmount == null) {
- Debug.logInfo("No returnAmount found for order:" + orderId, module);
- } else {
- if (returnAmount.subtract(grandTotal).compareTo(new BigDecimal("0.01")) > 0) {
- Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] exceeds order total [" + grandTotal + "]", module);
- return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
- "OrderRefundAmountExceedsOrderTotal", locale));
- }
+ if (returnAmount.subtract(grandTotal).compareTo(new BigDecimal("0.01")) > 0) {
+ Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] exceeds order total [" + grandTotal + "]", module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
+ "OrderRefundAmountExceedsOrderTotal", locale));
}
}
}
@@ -2402,7 +2401,11 @@ public class OrderReturnServices {
if (orderAdjustmentId != null) {
try {
orderAdjustment = delegator.findOne("OrderAdjustment", UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), false);
-
+ if (orderAdjustment == null) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "OrderCreateReturnAdjustmentNotFoundOrderAdjustment",
+ UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), locale));
+ }
// get returnHeaderTypeId from ReturnHeader and then use it to figure out return item type mapping
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null)) ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN";
@@ -2449,12 +2452,6 @@ public class OrderReturnServices {
if (returnItem != null) { // returnAdjustment for returnItem
if (needRecalculate(returnAdjustmentTypeId)) {
Debug.logInfo("returnPrice:" + returnItem.getBigDecimal("returnPrice") + ",returnQuantity:" + returnItem.getBigDecimal("returnQuantity") + ",sourcePercentage:" + orderAdjustment.getBigDecimal("sourcePercentage"), module);
- if (orderAdjustment == null) {
- Debug.logError("orderAdjustment [" + orderAdjustmentId + "] not found", module);
- return ServiceUtil.returnError(UtilProperties.getMessage(resource,
- "OrderCreateReturnAdjustmentNotFoundOrderAdjustment",
- UtilMisc.toMap("orderAdjustmentId", orderAdjustmentId), locale));
- }
BigDecimal returnTotal = returnItem.getBigDecimal("returnPrice").multiply(returnItem.getBigDecimal("returnQuantity"));
BigDecimal orderTotal = orderItem.getBigDecimal("quantity").multiply(orderItem.getBigDecimal("unitPrice"));
amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, orderTotal, orderAdjustment.getBigDecimal("amount"));
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java Thu Dec 12 14:53:38 2013
@@ -36,17 +36,14 @@ public class TaskWorker {
String lastName = orderTaskList.getString("customerLastName");
String firstName = orderTaskList.getString("customerFirstName");
//String groupName = orderTaskList.getString("customerGroupName");
- String groupName = null; // this is only until the entity gets fixed
- if (groupName != null) {
- return groupName;
- } else if (lastName != null) {
- String name = lastName;
- if (firstName != null)
- name = name + ", " + firstName;
- return name;
- } else {
- return "";
- }
+ if (lastName != null) {
+ String name = lastName;
+ if (firstName != null)
+ name = name + ", " + firstName;
+ return name;
+ } else {
+ return "";
+ }
}
static Map<String, String> statusMapping = UtilMisc.toMap("WF_NOT_STARTED", "Waiting", "WF_RUNNING", "Active", "WF_COMPLETE", "Complete", "WF_SUSPENDED", "Hold");
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/login/LoginServices.java Thu Dec 12 14:53:38 2013
@@ -729,7 +729,7 @@ public class LoginServices {
// Debug.logWarning(e, "", module);
//}
- if (loggedInUserLogin != null) {
+ if (!loggedInUserLogin.isEmpty()) {
// security check: userLogin partyId must equal partyId, or must have PARTYMGR_CREATE permission
if (!partyId.equals(loggedInUserLogin.getString("partyId"))) {
errMsg = UtilProperties.getMessage(resource,"loginservices.party_with_party_id_exists_not_permission_create_user_login", locale);
Modified: ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java (original)
+++ ofbiz/trunk/framework/datafile/src/org/ofbiz/datafile/ModelDataFileReader.java Thu Dec 12 14:53:38 2013
@@ -241,18 +241,12 @@ public final class ModelDataFileReader {
Element fieldElement = (Element) fList.item(i);
ModelField modelField = createModelField(fieldElement);
- // if the position is not specified, assume the start position based on last
- // entry
+ // if the position is not specified, assume the start position based on last entry
if ((i > 0) && (modelField.position == -1)) {
modelField.position = priorEnd;
}
priorEnd = modelField.position + modelField.length;
-
- if (modelField != null) {
- record.fields.add(modelField);
- } else {
- Debug.logWarning("[ModelDataFileReader.createModelRecord] Weird, modelField was null", module);
- }
+ record.fields.add(modelField);
}
return record;
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java Thu Dec 12 14:53:38 2013
@@ -132,7 +132,7 @@ public class ScreenFactory {
}
}
- if (modelScreenMap == null) {
+ if (modelScreenMap.isEmpty()) {
throw new IllegalArgumentException("Could not find screen file with name [" + resourceName + "]");
}
return modelScreenMap;
Modified: ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java?rev=1550429&r1=1550428&r2=1550429&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (original)
+++ ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java Thu Dec 12 14:53:38 2013
@@ -1311,9 +1311,6 @@ public class EbayStore {
storeType.setCustomHeader((String)context.get("storeCustomHeader"));
storeType.setCustomHeaderLayout(StoreCustomHeaderLayoutCodeType.valueOf((String)context.get("storeCustomHeaderLayout")));
- if ( storeType == null )
- throw new SdkException("StoreType property is not set.");
-
req.setStore(storeType);
resp = (SetStoreResponseType) call.execute(req);
@@ -1885,8 +1882,11 @@ public class EbayStore {
final ItemType[] activeItems = tempActiveItems;
// Display active items in table.
AbstractTableModel dataModel = new AbstractTableModel() {
+ @Override
public int getColumnCount() { return 0; }
+ @Override
public int getRowCount() { return activeItems == null ? 0 : activeItems.length;}
+ @Override
public Map<String, Object> getValueAt(int row, int col) {
ItemType item = activeItems[row];
return itemToColumns(item);
@@ -1900,8 +1900,11 @@ public class EbayStore {
final ItemType[] scheItems = tempItems;
// Display Scheduled items in table.
dataModel = new AbstractTableModel() {
+ @Override
public int getColumnCount() { return 0; }
+ @Override
public int getRowCount() { return scheItems == null ? 0 : scheItems.length;}
+ @Override
public Map<String, Object> getValueAt(int row, int col) {
ItemType item = scheItems[row];
return schItemToColumns(item);
@@ -1923,8 +1926,11 @@ public class EbayStore {
final ItemType[] unSoldItems = tempUnSoldItems;
// Display unsold items in table.
dataModel = new AbstractTableModel() {
+ @Override
public int getColumnCount() { return 0; }
+ @Override
public int getRowCount() { return unSoldItems == null ? 0 : unSoldItems.length;}
+ @Override
public Map<String, Object> getValueAt(int row, int col) {
ItemType item = unSoldItems[row];
return unsoldItemToColumns(item);