This is an automated email from the ASF dual-hosted git repository.
pawan pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git The following commit(s) were added to refs/heads/trunk by this push: new 8dd7f30 Improved: Replace for-loop with forEach loop(OFBIZ-11829) 8dd7f30 is described below commit 8dd7f302472eea98852c168a3796c32fe1c09259 Author: Pawan Verma <[hidden email]> AuthorDate: Mon Jun 22 21:19:40 2020 +0530 Improved: Replace for-loop with forEach loop(OFBIZ-11829) Also modified some checkstyle issues. Set checkstyleMain.maxErrors to 26684 (-61) Thanks: Jacques for the review. --- .../org/apache/ofbiz/ebaystore/EbayEvents.java | 34 +++--- .../org/apache/ofbiz/ebaystore/EbayFeedback.java | 44 ++++---- .../java/org/apache/ofbiz/ebaystore/EbayStore.java | 66 ++++++----- .../ofbiz/ebaystore/EbayStoreAutoPreferences.java | 84 +++++++------- .../ofbiz/ebaystore/EbayStoreCategoryFacade.java | 8 +- .../apache/ofbiz/ebaystore/EbayStoreHelper.java | 123 ++++++++++----------- 6 files changed, 173 insertions(+), 186 deletions(-) diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java index 43e641f..463326c 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayEvents.java @@ -600,8 +600,8 @@ public class EbayEvents { /* for shipping service detail filter */ private static boolean isFlat(ShippingTypeCodeType[] st) { - for (int i = 0; i < st.length; i++) { - if (st[i].compareTo(ShippingTypeCodeType.FLAT) == 0) { + for (ShippingTypeCodeType shippingTypeCodeType : st) { + if (shippingTypeCodeType.compareTo(ShippingTypeCodeType.FLAT) == 0) { return true; } } @@ -610,9 +610,10 @@ public class EbayEvents { public static ShippingServiceDetailsType[] filterShippingService(ShippingServiceDetailsType[] array) { List<ShippingServiceDetailsType> list = new ArrayList<ShippingServiceDetailsType>(); - for (int i = 0; i < array.length; i++) { - if (isFlat(array[i].getServiceType()) && array[i].getShippingServiceID() < SHIPPING_SERVICE_ID_LIMIT) { - list.add(array[i]); + for (ShippingServiceDetailsType shippingServiceDetailsType : array) { + if (isFlat(shippingServiceDetailsType.getServiceType()) + && shippingServiceDetailsType.getShippingServiceID() < SHIPPING_SERVICE_ID_LIMIT) { + list.add(shippingServiceDetailsType); } } return list.toArray(new ShippingServiceDetailsType[0]); @@ -1154,8 +1155,8 @@ public class EbayEvents { resp = (GetSellingManagerInventoryResponseType)call.execute(req); if (resp != null && "SUCCESS".equals(resp.getAck().toString())) { returnedSellingManagerProductType = resp.getSellingManagerProduct(); - for (int i = 0; i < returnedSellingManagerProductType.length; i++) { - SellingManagerProductDetailsType prodDetailType = returnedSellingManagerProductType[i].getSellingManagerProductDetails(); + for (SellingManagerProductType sellingManagerProductType : returnedSellingManagerProductType) { + SellingManagerProductDetailsType prodDetailType = sellingManagerProductType.getSellingManagerProductDetails(); String productIdInv = Long.toString(prodDetailType.getProductID()); if (productId.equals(productIdInv)) { int qty = prodDetailType.getQuantityAvailable(); @@ -1168,7 +1169,8 @@ public class EbayEvents { revReq.setSellingManagerProductDetails(prodDetailType); revResp = (ReviseSellingManagerProductResponseType) revProdCall.execute(revReq); if (revResp != null && "SUCCESS".equals(revResp.getAck().toString())) { - Debug.logInfo(" Already update quantity on eBay inventory with product id ::"+revResp.getSellingManagerProductDetails().getProductID(), MODULE); + Debug.logInfo("Already update quantity on eBay inventory with product id ::" + + revResp.getSellingManagerProductDetails().getProductID(), MODULE); } else { EbayStoreHelper.createErrorLogMessage(userLogin, dispatcher, productStoreId, revResp.getAck().toString(), "ReviseSellingManagerProductCall : updateQuantityInventoryProduct", revResp.getErrors(0).getLongMessage()); } @@ -1203,16 +1205,16 @@ public class EbayEvents { }; categorySpecifics.setDetailLevel(detailLevel); RecommendationsType[] recommend = categorySpecifics.getCategorySpecifics(); - - for (int i = 0; i < recommend.length; i++) { - NameRecommendationType[] nameRecommend = recommend[i].getNameRecommendation(); + + for (RecommendationsType recommendationsType : recommend) { + NameRecommendationType[] nameRecommend = recommendationsType.getNameRecommendation(); Map<String, List<String>> nameRecommendationMap = new HashMap<String, List<String>>(); - for (int j = 0; j < nameRecommend.length; j++) { - String name = nameRecommend[j].getName(); + for (NameRecommendationType nameRecommendationType : nameRecommend) { + String name = nameRecommendationType.getName(); List<String> valueList = new LinkedList<String>(); - ValueRecommendationType[] valueRecommend = nameRecommend[j].getValueRecommendation(); - for (int k = 0; k < valueRecommend.length; k++) { - String value = valueRecommend[k].getValue(); + ValueRecommendationType[] valueRecommend = nameRecommendationType.getValueRecommendation(); + for (ValueRecommendationType valueRecommendationType : valueRecommend) { + String value = valueRecommendationType.getValue(); valueList.add(value); } nameRecommendationMap.put(name, valueList); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java index 9f4b1bc..4a13622 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java @@ -109,29 +109,29 @@ public class EbayFeedback { partyRole.create(); } int feedbackLength = feedback.length; - for (int i = 0; i < feedbackLength; i++) { + for (FeedbackDetailType feedbackDetailType : feedback) { //convert to ofbiz - String contentId = feedback[i].getFeedbackID(); - Date eBayDateTime = feedback[i].getCommentTime().getTime(); + String contentId = feedbackDetailType.getFeedbackID(); + Date eBayDateTime = feedbackDetailType.getCommentTime().getTime(); GenericValue contentCheck = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne(); if (contentCheck != null) { continue; } - String textData = feedback[i].getCommentText(); - String commentingUserId= feedback[i].getCommentingUser(); + String textData = feedbackDetailType.getCommentText(); + String commentingUserId = feedbackDetailType.getCommentingUser(); String commentingPartyId = null; GenericValue CommentingUserLogin = EntityQuery.use(delegator).from("UserLogin") - .where("userLoginId", commentingUserId) - .queryOne(); + .where("userLoginId", commentingUserId) + .queryOne(); if (UtilValidate.isEmpty(CommentingUserLogin)) { //Party - GenericValue party = delegator.makeValue("Party"); + GenericValue party = delegator.makeValue("Party"); commentingPartyId = delegator.getNextSeqId("Party"); party.put("partyId", commentingPartyId); party.put("partyTypeId", "PERSON"); party.create(); //UserLogin - userLoginEx = delegator.makeValue("UserLogin"); + userLoginEx = delegator.makeValue("UserLogin"); userLoginEx.put("userLoginId", commentingUserId); userLoginEx.put("partyId", commentingPartyId); userLoginEx.create(); @@ -139,45 +139,45 @@ public class EbayFeedback { commentingPartyId = CommentingUserLogin.getString("partyId"); } //DataResource - GenericValue dataResource = delegator.makeValue("DataResource"); + GenericValue dataResource = delegator.makeValue("DataResource"); String dataResourceId = delegator.getNextSeqId("DataResource"); dataResource.put("dataResourceId", dataResourceId); dataResource.put("dataResourceTypeId", "ELECTRONIC_TEXT"); dataResource.put("mimeTypeId", "text/html"); dataResource.create(); //ElectronicText - GenericValue electronicText = delegator.makeValue("ElectronicText"); + GenericValue electronicText = delegator.makeValue("ElectronicText"); electronicText.put("dataResourceId", dataResourceId); electronicText.put("textData", textData); electronicText.create(); //Content - GenericValue content = delegator.makeValue("Content"); + GenericValue content = delegator.makeValue("Content"); content.put("contentId", contentId); content.put("contentTypeId", "DOCUMENT"); content.put("dataResourceId", dataResourceId); content.put("createdDate", UtilDateTime.toTimestamp(eBayDateTime)); content.create(); //ContentPurpose - GenericValue contentPurpose = delegator.makeValue("ContentPurpose"); + GenericValue contentPurpose = delegator.makeValue("ContentPurpose"); contentPurpose.put("contentId", contentId); contentPurpose.put("contentPurposeTypeId", "FEEDBACK"); contentPurpose.create(); //PartyRole For eBay Commentator GenericValue commentingPartyRole = EntityQuery.use(delegator).from("PartyRole") - .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR") - .queryOne(); + .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR") + .queryOne(); if (UtilValidate.isEmpty(commentingPartyRole)) { - GenericValue partyRole = delegator.makeValue("PartyRole"); + GenericValue partyRole = delegator.makeValue("PartyRole"); partyRole.put("partyId", commentingPartyId); partyRole.put("roleTypeId", "COMMENTATOR"); partyRole.create(); } //ContentRole for eBay User GenericValue ownerContentRole = EntityQuery.use(delegator).from("ContentRole") - .where("partyId", partyId, "roleTypeId", "OWNER", "contentId", contentId) - .queryFirst(); + .where("partyId", partyId, "roleTypeId", "OWNER", "contentId", contentId) + .queryFirst(); if (UtilValidate.isEmpty(ownerContentRole)) { - GenericValue contentRole = delegator.makeValue("ContentRole"); + GenericValue contentRole = delegator.makeValue("ContentRole"); contentRole.put("contentId", contentId); contentRole.put("partyId", partyId); contentRole.put("roleTypeId", "OWNER"); @@ -186,10 +186,10 @@ public class EbayFeedback { } //ContentRole for Commentator GenericValue commentingContentRole = EntityQuery.use(delegator).from("ContentRole") - .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR", "contentId", contentId) - .queryFirst(); + .where("partyId", commentingPartyId, "roleTypeId", "COMMENTATOR", "contentId", contentId) + .queryFirst(); if (UtilValidate.isEmpty(commentingContentRole)) { - GenericValue contentRole = delegator.makeValue("ContentRole"); + GenericValue contentRole = delegator.makeValue("ContentRole"); contentRole.put("contentId", contentId); contentRole.put("partyId", commentingPartyId); contentRole.put("roleTypeId", "COMMENTATOR"); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java index ff5e37c..96cdcb2 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java @@ -1437,14 +1437,13 @@ public class EbayStore { if (UtilValidate.isNotEmpty(sellingManagerSoldOrders)) { int soldOrderLength = sellingManagerSoldOrders.length; - for (int i = 0; i < soldOrderLength; i++) { - SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i]; + for (SellingManagerSoldOrderType sellingManagerSoldOrder : sellingManagerSoldOrders) { if (sellingManagerSoldOrder != null) { SellingManagerSoldTransactionType[] sellingManagerSoldTransactions = sellingManagerSoldOrder.getSellingManagerSoldTransaction(); int sellingManagerSoldTransactionLength = sellingManagerSoldTransactions.length; - for (int j = 0; j < sellingManagerSoldTransactionLength; j++) { + for (SellingManagerSoldTransactionType managerSoldTransaction : sellingManagerSoldTransactions) { Map<String, Object> entry = new HashMap<String, Object>(); - SellingManagerSoldTransactionType sellingManagerSoldTransaction = sellingManagerSoldTransactions[j]; + SellingManagerSoldTransactionType sellingManagerSoldTransaction = managerSoldTransaction; entry.put("itemId", sellingManagerSoldTransaction.getItemID()); entry.put("title", sellingManagerSoldTransaction.getItemTitle()); entry.put("transactionId", sellingManagerSoldTransaction.getTransactionID().toString()); @@ -1453,21 +1452,21 @@ public class EbayStore { String buyer = null; if (sellingManagerSoldOrder.getBuyerID() != null) { - buyer = sellingManagerSoldOrder.getBuyerID(); + buyer = sellingManagerSoldOrder.getBuyerID(); } entry.put("buyer", buyer); String buyerEmail = null; if (sellingManagerSoldOrder.getBuyerID() != null) { - buyerEmail = sellingManagerSoldOrder.getBuyerEmail(); + buyerEmail = sellingManagerSoldOrder.getBuyerEmail(); } entry.put("buyerEmail", buyerEmail); GetItemCall api = new GetItemCall(apiContext); api.setItemID(sellingManagerSoldTransaction.getItemID()); - DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { - DetailLevelCodeType.RETURN_ALL, - DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, - DetailLevelCodeType.ITEM_RETURN_DESCRIPTION - }; + DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[]{ + DetailLevelCodeType.RETURN_ALL, + DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, + DetailLevelCodeType.ITEM_RETURN_DESCRIPTION + }; api.setDetailLevel(detailLevels); ItemType itemType = api.getItem(); String itemUrl = null; @@ -1478,17 +1477,17 @@ public class EbayStore { entry.put("hitCount", itemType.getHitCount() != null ? itemType.getHitCount() : 0); if (itemType.getListingDetails() != null) { - itemUrl = itemType.getListingDetails().getViewItemURL(); + itemUrl = itemType.getListingDetails().getViewItemURL(); } entry.put("itemUrl", itemUrl); String itemUrlNatural = null; if (itemType.getListingDetails() != null) { - itemUrlNatural = itemType.getListingDetails().getViewItemURLForNaturalSearch(); + itemUrlNatural = itemType.getListingDetails().getViewItemURLForNaturalSearch(); } entry.put("itemUrlNatural", itemUrlNatural); String unpaidItemStatus = null; if (sellingManagerSoldOrder.getUnpaidItemStatus() != null) { - unpaidItemStatus = sellingManagerSoldOrder.getUnpaidItemStatus().value(); + unpaidItemStatus = sellingManagerSoldOrder.getUnpaidItemStatus().value(); } entry.put("unpaidItemStatus", unpaidItemStatus); Date creationTime = null; @@ -1498,7 +1497,7 @@ public class EbayStore { entry.put("creationTime", creationTime); double totalAmount = 0; if (sellingManagerSoldOrder.getTotalAmount() != null) { - totalAmount = sellingManagerSoldOrder.getTotalAmount().getValue(); + totalAmount = sellingManagerSoldOrder.getTotalAmount().getValue(); } entry.put("totalAmount", totalAmount); if (sellingManagerSoldOrder.getSalePrice() != null) { @@ -1510,10 +1509,10 @@ public class EbayStore { Date shippedTime = null; if (sellingManagerSoldOrder.getOrderStatus() != null) { if (sellingManagerSoldOrder.getOrderStatus().getPaidTime() != null) { - paidTime = sellingManagerSoldOrder.getOrderStatus().getPaidTime().getTime(); + paidTime = sellingManagerSoldOrder.getOrderStatus().getPaidTime().getTime(); } if (sellingManagerSoldOrder.getOrderStatus().getCheckoutStatus() != null) { - checkoutStatus = sellingManagerSoldOrder.getOrderStatus().getCheckoutStatus().value(); + checkoutStatus = sellingManagerSoldOrder.getOrderStatus().getCheckoutStatus().value(); } if (sellingManagerSoldOrder.getOrderStatus().getShippedStatus() != null) { shippedStatus = sellingManagerSoldOrder.getOrderStatus().getShippedStatus().value(); @@ -1795,13 +1794,13 @@ public class EbayStore { api.setCallMode(GetAllBiddersModeCodeType.VIEW_ALL); OfferType[] bidders = api.getAllBidders(); - for (int count = 0; count < bidders.length; count++) { + for (OfferType bidder : bidders) { Map<String, Object> entry = new HashMap<String, Object>(); - OfferType offer = bidders[count]; + OfferType offer = bidder; entry.put("userId", offer.getUser().getUserID()); entry.put("bidder", offer.getUser()); allBidders.add(entry); - } + } result.put("allBidders", allBidders); } catch (Exception e) { Debug.logError(e.getMessage(), MODULE); @@ -2067,8 +2066,8 @@ public class EbayStore { if (UtilValidate.isNotEmpty(order)) { TransactionType[] trans = order.getTransactionArray().getTransaction(); String orderId = order.getOrderID(); - for (int rowIndex1 = 0; rowIndex1 < trans.length; rowIndex1++) { - Map<String, Object> transactionMap = EbayStore.getTransaction(trans[rowIndex1]); + for (TransactionType tran : trans) { + Map<String, Object> transactionMap = EbayStore.getTransaction(tran); transactionMap.put("orderId", orderId); colsList.add(transactionMap); } @@ -2335,8 +2334,8 @@ public class EbayStore { if (UtilValidate.isNotEmpty(getMyeBaySelling.getReturnedUnsoldList())) tempUnSoldItems = (getMyeBaySelling.getReturnedUnsoldList().getItemArray()).getItem(); if (UtilValidate.isNotEmpty(tempUnSoldItems)) { - for (int i = 0; i < tempUnSoldItems.length; i++) { - Map <String, Object> unsoldItemMap = getClosedItem(tempUnSoldItems[i]); + for (ItemType tempUnSoldItem : tempUnSoldItems) { + Map<String, Object> unsoldItemMap = getClosedItem(tempUnSoldItem); unsoldItemMap.put("sellingStatus", "unsold"); closedItems.add(unsoldItemMap); } @@ -2345,9 +2344,9 @@ public class EbayStore { if (UtilValidate.isNotEmpty(getMyeBaySelling.getReturnedSoldList())) tempSoldItems = (getMyeBaySelling.getReturnedSoldList().getOrderTransactionArray()).getOrderTransaction(); if (UtilValidate.isNotEmpty(tempSoldItems)) { - for (int i = 0; i < tempSoldItems.length; i++) { - ItemType soldItem = tempSoldItems[i].getTransaction().getItem(); - Map <String, Object> soldItemMap = getClosedItem(soldItem); + for (OrderTransactionType tempSoldItem : tempSoldItems) { + ItemType soldItem = tempSoldItem.getTransaction().getItem(); + Map<String, Object> soldItemMap = getClosedItem(soldItem); soldItemMap.put("sellingStatus", "sold"); closedItems.add(soldItemMap); } @@ -2671,8 +2670,7 @@ public class EbayStore { TimeFilter modifiedTimeFilter = new TimeFilter(fromDate, toDate); getSellerTransaction.setModifiedTimeFilter(modifiedTimeFilter); TransactionType[] transactions = getSellerTransaction.getSellerTransactions(); - for (int tranCount = 0; tranCount < transactions.length; tranCount++) { - TransactionType transaction = transactions[tranCount]; + for (TransactionType transaction : transactions) { if (UtilValidate.isNotEmpty(transaction.getContainingOrder())) { String orderId = transaction.getContainingOrder().getOrderID(); if (!orderIdList.contains(orderId)) { @@ -2729,8 +2727,7 @@ public class EbayStore { getOrder.setOrderStatus(OrderStatusCodeType.COMPLETED); OrderType[] orders = getOrder.getOrders(); - for (int orderCount = 0; orderCount < orders.length; orderCount++) { - OrderType order = orders[orderCount]; + for (OrderType order : orders) { Map<String, Object> orderMap = EbayStore.getOrderHelper(order, locale); orderList.add(orderMap); } @@ -2863,8 +2860,7 @@ public class EbayStore { if (UtilValidate.isNotEmpty(order.getExternalTransaction())) { ExternalTransactionType[] externalTransactions = order.getExternalTransaction(); - for (int count = 0; count < externalTransactions.length; count++) { - ExternalTransactionType externalTransaction = externalTransactions[count]; + for (ExternalTransactionType externalTransaction : externalTransactions) { if (UtilValidate.isNotEmpty(externalTransaction.getExternalTransactionID())) { externalTransactionId = externalTransaction.getExternalTransactionID(); } @@ -2887,9 +2883,9 @@ public class EbayStore { List<Map<String, Object>> orderItemList = new LinkedList<Map<String,Object>>(); if (UtilValidate.isNotEmpty(order.getTransactionArray().getTransaction())) { TransactionType[] transactions = order.getTransactionArray().getTransaction(); - for (int tranCount = 0; tranCount < transactions.length; tranCount++) { + for (TransactionType transactionType : transactions) { Map<String, Object> orderItemCtx = new HashMap<String, Object>(); - TransactionType transaction = transactions[tranCount]; + TransactionType transaction = transactionType; int quantityPurchased = 0; double transactionPrice = 0.0; String createdDate = null; diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java index bc2a5ea..43d2373 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java @@ -437,8 +437,7 @@ public class EbayStoreAutoPreferences { } List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems")); if (soldItems.size() != 0) { - for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) { - Map<String, Object> soldItemMap = soldItems.get(itemCount); + for (Map<String, Object> soldItemMap : soldItems) { if (UtilValidate.isNotEmpty(soldItemMap.get("itemId"))) { GenericValue productCheck = EntityQuery.use(delegator).from("Product").where("productId", soldItemMap.get("itemId")).queryOne(); if (productCheck == null) { @@ -480,8 +479,8 @@ public class EbayStoreAutoPreferences { List<Map<String, Object>> activeItems = UtilGenerics.checkList(serviceResult.get("activeItems")); List<String> activeItemMaps = new LinkedList<String>(); if (activeItems.size() != 0) { - for (int itemCount = 0; itemCount < activeItems.size(); itemCount++) { - Map<String, Object> activeItemMap = UtilGenerics.checkMap(activeItems.get(itemCount)); + for (Map<String, Object> activeItem : activeItems) { + Map<String, Object> activeItemMap = UtilGenerics.checkMap(activeItem); if (UtilValidate.isNotEmpty(activeItemMap.get("itemId"))) { activeItemMaps.add((String) activeItemMap.get("itemId")); } @@ -491,8 +490,8 @@ public class EbayStoreAutoPreferences { List<GenericValue> productRoles = EntityQuery.use(delegator).from("ProductRole").where("partyId", partyId, "roleTypeId", "VENDOR").queryList(); List<String> productRoleIds = new LinkedList<String>(); if (productRoles.size() != 0) { - for (int itemCount = 0; itemCount < productRoles.size(); itemCount++) { - String productId = productRoles.get(itemCount).getString("productId"); + for (GenericValue productRole : productRoles) { + String productId = productRole.getString("productId"); productRoleIds.add(productId); } } @@ -509,10 +508,10 @@ public class EbayStoreAutoPreferences { if (itemsToRelist.size() != 0) { //re-list sold items and not active ApiContext apiContext = EbayStoreHelper.getApiContext(productStoreId, locale, delegator); - for (int itemRelist = 0; itemRelist < itemsToRelist.size(); itemRelist++) { + for (GenericValue genericValue : itemsToRelist) { RelistItemCall relistItemCall = new RelistItemCall(apiContext); ItemType itemToBeRelisted = new ItemType(); - GenericValue product = itemsToRelist.get(itemRelist); + GenericValue product = genericValue; itemToBeRelisted.setItemID(product.getString("productId")); relistItemCall.setItemToBeRelisted(itemToBeRelisted); relistItemCall.relistItem(); @@ -570,8 +569,8 @@ public class EbayStoreAutoPreferences { List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems")); // check items to dispute List<Map<String, Object>> itemsToDispute = new LinkedList<Map<String,Object>>(); - for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) { - Map<String, Object> item = UtilGenerics.checkMap(soldItems.get(itemCount)); + for (Map<String, Object> soldItem : soldItems) { + Map<String, Object> item = UtilGenerics.checkMap(soldItem); String checkoutStatus = (String) item.get("checkoutStatus"); Date creationTime = (Date) item.get("creationTime"); Date paidTime = (Date) item.get("paidTime"); @@ -589,8 +588,7 @@ public class EbayStoreAutoPreferences { DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, DetailLevelCodeType.ITEM_RETURN_DESCRIPTION }; - for (int count = 0; count < itemsToDispute.size(); count++) { - Map<String, Object> item = itemsToDispute.get(count); + for (Map<String, Object> item : itemsToDispute) { AddDisputeCall api = new AddDisputeCall(apiContext); api.setDetailLevel(detailLevels); api.setItemID((String) item.get("itemId")); @@ -646,8 +644,8 @@ public class EbayStoreAutoPreferences { List<Map<String, Object>> soldItems = UtilGenerics.checkList(serviceResult.get("soldItems")); // check items to dispute List<Map<String, Object>> itemsToDispute = new LinkedList<Map<String,Object>>(); - for (int itemCount = 0; itemCount < soldItems.size(); itemCount++) { - Map<String, Object> item = UtilGenerics.checkMap(soldItems.get(itemCount)); + for (Map<String, Object> soldItem : soldItems) { + Map<String, Object> item = UtilGenerics.checkMap(soldItem); String checkoutStatus = (String) item.get("checkoutStatus"); Date creationTime = (Date) item.get("creationTime"); Date paidTime = (Date) item.get("paidTime"); @@ -665,8 +663,7 @@ public class EbayStoreAutoPreferences { DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES, DetailLevelCodeType.ITEM_RETURN_DESCRIPTION }; - for (int count = 0; count < itemsToDispute.size(); count++) { - Map<String, Object> item = itemsToDispute.get(count); + for (Map<String, Object> item : itemsToDispute) { AddDisputeCall api = new AddDisputeCall(apiContext); api.setDetailLevel(detailLevels); api.setItemID((String) item.get("itemId")); @@ -782,10 +779,9 @@ public class EbayStoreAutoPreferences { Long daysCount = Long.parseLong(ebayPref.get("condition1").toString()); Hashtable<String, List<Map<String, Object>>> h = new Hashtable<String, List<Map<String, Object>>>(); - for (int i = 0; i < soldOrderLength; i++) { - SellingManagerSoldOrderType sellingManagerSoldOrder = sellingManagerSoldOrders[i]; + for (SellingManagerSoldOrderType sellingManagerSoldOrder : sellingManagerSoldOrders) { String buyerId = sellingManagerSoldOrder.getBuyerID().toString(); - List<Map<String, Object>> soldGroupList = new LinkedList<Map<String,Object>>(); + List<Map<String, Object>> soldGroupList = new LinkedList<Map<String, Object>>(); Map<String, Object> mymap = new HashMap<String, Object>(); mymap.put("group", ""); mymap.put("soldorder", sellingManagerSoldOrder); @@ -847,8 +843,7 @@ public class EbayStoreAutoPreferences { CurrencyCodeType currencyId = null; int totalQty = 0; - for (int j = 0; j < soldGroupList.size(); j++) { - Map<String, Object> myMap = soldGroupList.get(j); + for (Map<String, Object> myMap : soldGroupList) { if (UtilValidate.isNotEmpty(myMap.get("group"))) { if (x == Integer.parseInt(myMap.get("group").toString())) { SellingManagerSoldOrderType sellingManagerSoldOrder = (SellingManagerSoldOrderType) myMap.get("soldorder"); @@ -868,8 +863,7 @@ public class EbayStoreAutoPreferences { totalAmt = totalAmt + totalAmount; SellingManagerSoldTransactionType[] sellingManagerSoldTransactions = sellingManagerSoldOrder.getSellingManagerSoldTransaction(); //set transaction - for (int count = 0; count < sellingManagerSoldTransactions.length; count++) { - SellingManagerSoldTransactionType sellingManagerSoldTransaction = sellingManagerSoldTransactions[count]; + for (SellingManagerSoldTransactionType sellingManagerSoldTransaction : sellingManagerSoldTransactions) { TransactionType transtype = new TransactionType(); ItemType itemtype = new ItemType(); if (UtilValidate.isNotEmpty(sellingManagerSoldTransaction.getItemID())) { @@ -964,8 +958,7 @@ public class EbayStoreAutoPreferences { } List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems")); if (soldItems.size() != 0) { - for (int i = 0; i < soldItems.size(); i++) { - Map<String, Object> item = soldItems.get(i); + for (Map<String, Object> item : soldItems) { Timestamp lastestTime = UtilDateTime.getDayStart(UtilDateTime.nowTimestamp(), 1); Date creationDate = (Date) item.get("creationTime"); Timestamp creationTime = UtilDateTime.toTimestamp(creationDate); @@ -976,16 +969,15 @@ public class EbayStoreAutoPreferences { serviceMap.put("locale", locale); serviceMap.put("productStoreId", productStoreId); serviceMap.put("itemId", item.get("itemId").toString()); - Map<String, Object> resultBid = dispatcher.runSync("getEbayAllBidders", serviceMap); + Map<String, Object> resultBid = dispatcher.runSync("getEbayAllBidders", serviceMap); if (ServiceUtil.isError(resultBid)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultBid)); } - List<Map<String, Object>> allBidders = UtilGenerics.checkList(resultBid.get("allBidders")); + List<Map<String, Object>> allBidders = UtilGenerics.checkList(resultBid.get("allBidders")); if (allBidders.size() != 0) { // call to send email to bidder - for (int j = 0; j < allBidders.size(); j++) { - Map<String, Object> bidder = allBidders.get(j); + for (Map<String, Object> bidder : allBidders) { UserType user = (UserType) bidder.get("bidder"); String buyerUserId = bidder.get("userId").toString(); @@ -1041,8 +1033,7 @@ public class EbayStoreAutoPreferences { } List<Map<String, Object>> soldItems = UtilGenerics.checkList(resultSold.get("soldItems")); if (soldItems.size() != 0) { - for (int i = 0; i < soldItems.size(); i++) { - Map<String, Object> item = soldItems.get(i); + for (Map<String, Object> item : soldItems) { String shippedStatus = item.get("shippedStatus").toString(); Timestamp lastestTime = UtilDateTime.getDayStart(UtilDateTime.nowTimestamp(), 1); Date shippedTime = (Date) item.get("shippedTime"); @@ -1075,7 +1066,7 @@ public class EbayStoreAutoPreferences { Debug.logError(e, MODULE); return ServiceUtil.returnError(e.getMessage()); } - + } } } @@ -1104,28 +1095,28 @@ public class EbayStoreAutoPreferences { resp = (GetSellingManagerInventoryResponseType)call.execute(req); if (resp != null && "SUCCESS".equals(resp.getAck().toString())) { returnedSellingManagerProductType = resp.getSellingManagerProduct(); - for (int i = 0; i < returnedSellingManagerProductType.length; i++) { - SellingManagerProductDetailsType prodDetailType = returnedSellingManagerProductType[i].getSellingManagerProductDetails(); + for (SellingManagerProductType sellingManagerProductType : returnedSellingManagerProductType) { + SellingManagerProductDetailsType prodDetailType = sellingManagerProductType.getSellingManagerProductDetails(); int qty = prodDetailType.getQuantityAvailable(); if (qty == 0) { - SellingManagerTemplateDetailsArrayType sellingTempArr = returnedSellingManagerProductType[i].getSellingManagerTemplateDetailsArray(); + SellingManagerTemplateDetailsArrayType sellingTempArr = sellingManagerProductType.getSellingManagerTemplateDetailsArray(); SellingManagerTemplateDetailsType[] selllingTempType = null; if (UtilValidate.isNotEmpty(sellingTempArr)) { selllingTempType = sellingTempArr.getSellingManagerTemplateDetails(); } if (selllingTempType.length > 0) { - for (int j = 0; j < selllingTempType.length; j++) { - Long longTemplete = Long.parseLong(selllingTempType[j].getSaleTemplateID()); - DeleteSellingManagerTemplateCall tcall = new DeleteSellingManagerTemplateCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); + for (SellingManagerTemplateDetailsType sellingManagerTemplateDetailsType : selllingTempType) { + Long longTemplete = Long.parseLong(sellingManagerTemplateDetailsType.getSaleTemplateID()); + DeleteSellingManagerTemplateCall tcall = new DeleteSellingManagerTemplateCall(EbayStoreHelper.getApiContext((String) context.get("productStoreId"), locale, delegator)); DeleteSellingManagerTemplateRequestType treq = new DeleteSellingManagerTemplateRequestType(); - DeleteSellingManagerTemplateResponseType tresp = null; + DeleteSellingManagerTemplateResponseType tresp = null; treq.setSaleTemplateID(longTemplete); tresp = (DeleteSellingManagerTemplateResponseType) tcall.execute(treq); if (tresp != null && "SUCCESS".equals(tresp.getAck().toString())) { - result = ServiceUtil.returnSuccess(); + result = ServiceUtil.returnSuccess(); } else { EbayStoreHelper.createErrorLogMessage(userLogin, dctx.getDispatcher(), context.get("productStoreId").toString(), tresp.getAck().toString(), "Delete selling manager template : autoBlockItemsOutOfStock", tresp.getErrors(0).getLongMessage()); } @@ -1165,10 +1156,10 @@ public class EbayStoreAutoPreferences { expressions.add(expression3); EntityCondition cond = EntityCondition.makeCondition(expressions, EntityOperator.AND); List<GenericValue> ebayProductListings = EntityQuery.use(delegator).from("EbayProductListing").where(expressions).queryList(); - for (int index = 0; index < ebayProductListings.size(); index++) { + for (GenericValue productListing : ebayProductListings) { Map<String, Object> inMap = new HashMap<String, Object>(); - AddItemCall addItemCall = new AddItemCall(EbayStoreHelper.getApiContext((String)context.get("productStoreId"), locale, delegator)); - GenericValue ebayProductListing = ebayProductListings.get(index); + AddItemCall addItemCall = new AddItemCall(EbayStoreHelper.getApiContext((String) context.get("productStoreId"), locale, delegator)); + GenericValue ebayProductListing = productListing; ItemType item = EbayStoreHelper.prepareAddItem(delegator, ebayProductListing); addItemCall.setItem(item); itemObject.put("addItemCall", addItemCall); @@ -1325,8 +1316,7 @@ public class EbayStoreAutoPreferences { //Loop for get data best offer from buyer RespondToBestOfferCall respondToBestOfferCall = new RespondToBestOfferCall(apiContext); respondToBestOfferCall.setItemID(itemID); - for (int offerCount = 0; offerCount < bestOffers.length; offerCount++) { - BestOfferType bestOfferType = bestOffers[offerCount]; + for (BestOfferType bestOfferType : bestOffers) { BestOfferStatusCodeType bestOfferStatusCodeType = bestOfferType.getStatus(); //Check status of best offer if (bestOfferStatusCodeType == BestOfferStatusCodeType.PENDING) { @@ -1337,7 +1327,7 @@ public class EbayStoreAutoPreferences { String offerPrice = Double.toString(price.getValue()); Double doCerrentPrice = Double.parseDouble(offerPrice); int offerQuantity = bestOfferType.getQuantity(); - String[] bestOfferIDs = { bestOfferID }; + String[] bestOfferIDs = {bestOfferID}; respondToBestOfferCall.setBestOfferIDs(bestOfferIDs); if ("Y".equals(rejectOffer)) { @@ -1368,7 +1358,7 @@ public class EbayStoreAutoPreferences { acceptBestOfferIndexId.add(bestOfferID); String Quantity = String.valueOf(offerQuantity); acceptBestOfferIDs.put(bestOfferID, Quantity); - } else if ((cerrentPrice.compareTo(greaterPrice) >= 0) && (cerrentPrice.compareTo(lessThanPrice) <= 0 ) && "Y".equals(rejectGreaterEnable)) { + } else if ((cerrentPrice.compareTo(greaterPrice) >= 0) && (cerrentPrice.compareTo(lessThanPrice) <= 0) && "Y".equals(rejectGreaterEnable)) { respondToBestOfferCall.setBestOfferAction(BestOfferActionCodeType.DECLINE); respondToBestOfferCall.setSellerResponse(rejectGreaterMsg); respondToBestOfferCall.respondToBestOffer(); diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java index 1dbfdee..1e70199 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreCategoryFacade.java @@ -130,8 +130,8 @@ public class EbayStoreCategoryFacade { ListingDurationDefinitionsType listDuration = featureDefinition.getListingDurations(); ListingDurationDefinitionType[] durationArray = listDuration.getListingDuration(); listingDurationMap = new HashMap<Integer, String[]>(); - for (int i = 0; i < durationArray.length; i++) { - listingDurationMap.put(durationArray[i].getDurationSetID(), durationArray[i].getDuration()); + for (ListingDurationDefinitionType listingDurationDefinitionType : durationArray) { + listingDurationMap.put(listingDurationDefinitionType.getDurationSetID(), listingDurationDefinitionType.getDuration()); } //get listing types @@ -140,8 +140,8 @@ public class EbayStoreCategoryFacade { listingDuration = siteDefaults.getListingDuration(); } listingDurationReferenceMap = new HashMap<String, Integer>(); - for (int i = 0; i < listingDuration.length; i++) { - listingDurationReferenceMap.put(listingDuration[i].getType().value(),listingDuration[i].getValue()); + for (ListingDurationReferenceType listingDurationReferenceType : listingDuration) { + listingDurationReferenceMap.put(listingDurationReferenceType.getType().value(), listingDurationReferenceType.getValue()); } //get payment methods diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java index 81b5bb9..4119b1e 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreHelper.java @@ -362,8 +362,8 @@ public class EbayStoreHelper { Map<String, Object>inMap = new HashMap<String, Object>(); inMap.put("userLogin", userLogin); - for (int index = 0; index < jobs.size(); index++) { - inMap.put("jobId", jobs.get(index).getString("jobId")); + for (GenericValue job : jobs) { + inMap.put("jobId", job.getString("jobId")); result = dispatcher.runSync("cancelScheduledJob", inMap); if (ServiceUtil.isError(result)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); @@ -483,12 +483,11 @@ public class EbayStoreHelper { Map<String, Object> ebayProductListingAttributeMap = new HashMap<String, Object>(); try { List<GenericValue> attributeToClears = EntityQuery.use(delegator).from("EbayProductListingAttribute").where("productListingId", productListingId).queryList(); - for (int clearCount = 0; clearCount < attributeToClears.size(); clearCount++) { - GenericValue valueToClear = attributeToClears.get(clearCount); - if (valueToClear != null) { - valueToClear.remove(); - } - } + for (GenericValue valueToClear : attributeToClears) { + if (valueToClear != null) { + valueToClear.remove(); + } + } for (Map.Entry<String,Object> entry : attributeMapList.entrySet()) { if (UtilValidate.isNotEmpty(entry.getKey())) { ebayProductListingAttributeMap.put("productListingId", productListingId); @@ -520,69 +519,69 @@ public class EbayStoreHelper { ListingDesignerType designer = new ListingDesignerType(); ShippingDetailsType shippingDetail = new ShippingDetailsType(); ShippingServiceOptionsType shippingOption = new ShippingServiceOptionsType(); - for (int index = 0; index < attrs.size(); index++) { - if ("Title".equals(attrs.get(index).getString("attrName"))) { - item.setTitle(attrs.get(index).getString("attrValue")); - } else if ("SKU".equals(attrs.get(index).getString("attrName"))) { - item.setSKU(attrs.get(index).getString("attrValue")); - } else if ("Currency".equals(attrs.get(index).getString("attrName"))) { - amount.setCurrencyID(CurrencyCodeType.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("Description".equals(attrs.get(index).getString("attrName"))) { - item.setDescription(attrs.get(index).getString("attrValue")); - } else if ("ApplicationData".equals(attrs.get(index).getString("attrName"))) { - item.setApplicationData(attrs.get(index).getString("attrValue")); - } else if ("Country".equals(attrs.get(index).getString("attrName"))) { - item.setCountry(CountryCodeType.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("PictureURL".equals(attrs.get(index).getString("attrName"))) { - String[] pictureUrl = {attrs.get(index).getString("attrValue")}; + for (GenericValue attr : attrs) { + if ("Title".equals(attr.getString("attrName"))) { + item.setTitle(attr.getString("attrValue")); + } else if ("SKU".equals(attr.getString("attrName"))) { + item.setSKU(attr.getString("attrValue")); + } else if ("Currency".equals(attr.getString("attrName"))) { + amount.setCurrencyID(CurrencyCodeType.valueOf(attr.getString("attrValue"))); + } else if ("Description".equals(attr.getString("attrName"))) { + item.setDescription(attr.getString("attrValue")); + } else if ("ApplicationData".equals(attr.getString("attrName"))) { + item.setApplicationData(attr.getString("attrValue")); + } else if ("Country".equals(attr.getString("attrName"))) { + item.setCountry(CountryCodeType.valueOf(attr.getString("attrValue"))); + } else if ("PictureURL".equals(attr.getString("attrName"))) { + String[] pictureUrl = {attr.getString("attrValue")}; picture.setPictureURL(pictureUrl); - } else if ("Site".equals(attrs.get(index).getString("attrName"))) { - item.setSite(SiteCodeType.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("UseTaxTable".equals(attrs.get(index).getString("attrName"))) { - item.setUseTaxTable(Boolean.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("BestOfferEnabled".equals(attrs.get(index).getString("attrName"))) { - item.setBestOfferEnabled(Boolean.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("AutoPayEnabled".equals(attrs.get(index).getString("attrName"))) { - item.setAutoPay(Boolean.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("CategoryID".equals(attrs.get(index).getString("attrName"))) { - category.setCategoryID(attrs.get(index).getString("attrValue")); - } else if ("CategoryLevel".equals(attrs.get(index).getString("attrName"))) { - category.setCategoryLevel(Integer.parseInt(attrs.get(index).getString("attrValue"))); - } else if ("CategoryName".equals(attrs.get(index).getString("attrName"))) { - category.setCategoryName(attrs.get(index).getString("attrValue")); - } else if ("CategoryParentID".equals(attrs.get(index).getString("attrName"))) { - String[] parent = {attrs.get(index).getString("attrValue")}; - category.setCategoryParentID(parent ); - } else if ("LeafCategory".equals(attrs.get(index).getString("attrName"))) { - category.setLeafCategory(Boolean.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("LSD".equals(attrs.get(index).getString("attrName"))) { - category.setLSD(Boolean.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("ReturnsAcceptedOption".equals(attrs.get(index).getString("attrName"))) { + } else if ("Site".equals(attr.getString("attrName"))) { + item.setSite(SiteCodeType.valueOf(attr.getString("attrValue"))); + } else if ("UseTaxTable".equals(attr.getString("attrName"))) { + item.setUseTaxTable(Boolean.valueOf(attr.getString("attrValue"))); + } else if ("BestOfferEnabled".equals(attr.getString("attrName"))) { + item.setBestOfferEnabled(Boolean.valueOf(attr.getString("attrValue"))); + } else if ("AutoPayEnabled".equals(attr.getString("attrName"))) { + item.setAutoPay(Boolean.valueOf(attr.getString("attrValue"))); + } else if ("CategoryID".equals(attr.getString("attrName"))) { + category.setCategoryID(attr.getString("attrValue")); + } else if ("CategoryLevel".equals(attr.getString("attrName"))) { + category.setCategoryLevel(Integer.parseInt(attr.getString("attrValue"))); + } else if ("CategoryName".equals(attr.getString("attrName"))) { + category.setCategoryName(attr.getString("attrValue")); + } else if ("CategoryParentID".equals(attr.getString("attrName"))) { + String[] parent = {attr.getString("attrValue")}; + category.setCategoryParentID(parent); + } else if ("LeafCategory".equals(attr.getString("attrName"))) { + category.setLeafCategory(Boolean.valueOf(attr.getString("attrValue"))); + } else if ("LSD".equals(attr.getString("attrName"))) { + category.setLSD(Boolean.valueOf(attr.getString("attrValue"))); + } else if ("ReturnsAcceptedOption".equals(attr.getString("attrName"))) { ReturnPolicyType policy = new ReturnPolicyType(); - policy.setReturnsAcceptedOption(attrs.get(index).getString("attrValue")); + policy.setReturnsAcceptedOption(attr.getString("attrValue")); item.setReturnPolicy(policy); - } else if ("LayoutID".equals(attrs.get(index).getString("attrName"))) { - designer.setLayoutID(Integer.parseInt(attrs.get(index).getString("attrValue"))); - } else if ("ThemeID".equals(attrs.get(index).getString("attrName"))) { - designer.setThemeID(Integer.parseInt(attrs.get(index).getString("attrValue"))); - } else if ("BuyItNowPrice".equals(attrs.get(index).getString("attrName"))) { + } else if ("LayoutID".equals(attr.getString("attrName"))) { + designer.setLayoutID(Integer.parseInt(attr.getString("attrValue"))); + } else if ("ThemeID".equals(attr.getString("attrName"))) { + designer.setThemeID(Integer.parseInt(attr.getString("attrValue"))); + } else if ("BuyItNowPrice".equals(attr.getString("attrName"))) { amount = new AmountType(); - amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue"))); + amount.setValue(Double.parseDouble(attr.getString("attrValue"))); item.setBuyItNowPrice(amount); - } else if ("ReservePrice".equals(attrs.get(index).getString("attrName"))) { + } else if ("ReservePrice".equals(attr.getString("attrName"))) { amount = new AmountType(); - amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue"))); + amount.setValue(Double.parseDouble(attr.getString("attrValue"))); item.setReservePrice(amount); - } else if ("ListingType".equals(attrs.get(index).getString("attrName"))) { - item.setListingType(ListingTypeCodeType.valueOf(attrs.get(index).getString("attrValue"))); - } else if ("StartPrice".equals(attrs.get(index).getString("attrName"))) { + } else if ("ListingType".equals(attr.getString("attrName"))) { + item.setListingType(ListingTypeCodeType.valueOf(attr.getString("attrValue"))); + } else if ("StartPrice".equals(attr.getString("attrName"))) { amount = new AmountType(); - amount.setValue(Double.parseDouble(attrs.get(index).getString("attrValue"))); + amount.setValue(Double.parseDouble(attr.getString("attrValue"))); item.setStartPrice(amount); - } else if ("ShippingService".equals(attrs.get(index).getString("attrName"))) { - shippingOption.setShippingService(attrs.get(index).getString("attrValue")); - } else if ("ShippingServiceCost".equals(attrs.get(index).getString("attrName"))) { - shippingServiceCost.setValue(Double.parseDouble(attrs.get(index).getString("attrValue"))); + } else if ("ShippingService".equals(attr.getString("attrName"))) { + shippingOption.setShippingService(attr.getString("attrValue")); + } else if ("ShippingServiceCost".equals(attr.getString("attrName"))) { + shippingServiceCost.setValue(Double.parseDouble(attr.getString("attrValue"))); shippingOption.setShippingServiceCost(shippingServiceCost); } else if ("ShippingServiceCostCurrency".equals(attrs.get(index).getString("attrName"))) { shippingServiceCost.setCurrencyID(CurrencyCodeType.valueOf(attrs.get(index).getString("attrValue"))); |
Free forum by Nabble | Edit this page |