Author: deepak
Date: Tue Feb 19 17:30:35 2019 New Revision: 1853904 URL: http://svn.apache.org/viewvc?rev=1853904&view=rev Log: Improved: Updated plugin code to fix console warning related to deprecated method. Removed Double constructor call as its depracated since jdk 9. Also replace the CellType::getCellTypeEnum method call with CellTyoe::getCellType Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java ofbiz/ofbiz-plugins/trunk/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/EbayOrderServices.java Tue Feb 19 17:30:35 2019 @@ -743,16 +743,16 @@ public class EbayOrderServices { double shippingSurcharge = 0; if (UtilValidate.isNotEmpty(incuranceCost)) { - shippingInsuranceCost = new Double(incuranceCost); + shippingInsuranceCost = Double.parseDouble(incuranceCost); } if (UtilValidate.isNotEmpty(additionalCost)) { - shippingServiceAdditionalCost = new Double(additionalCost); + shippingServiceAdditionalCost = Double.parseDouble(additionalCost); } if (UtilValidate.isNotEmpty(surchargeCost)) { - shippingSurcharge = new Double(surchargeCost); + shippingSurcharge = Double.parseDouble(surchargeCost); } double shippingTotalAdditionalCost = shippingInsuranceCost + shippingServiceAdditionalCost + shippingSurcharge; - String totalAdditionalCost = new Double(shippingTotalAdditionalCost).toString(); + String totalAdditionalCost = Double.toString(shippingTotalAdditionalCost); shippingServiceSelectedCtx.put("shippingTotalAdditionalCost", totalAdditionalCost); } orderCtx.put("shippingServiceSelectedCtx", shippingServiceSelectedCtx); @@ -1063,7 +1063,7 @@ public class EbayOrderServices { String shippingCost = (String) shippingServiceSelectedCtx.get("shippingServiceCost"); if (UtilValidate.isNotEmpty(shippingCost)) { - double shippingAmount = new Double(shippingCost); + double shippingAmount = Double.parseDouble(shippingCost); if (shippingAmount > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, shippingAmount, 0.0); if (shippingAdjustment != null) { @@ -1074,7 +1074,7 @@ public class EbayOrderServices { // Apply additional shipping costs as order adjustment String shippingTotalAdditionalCost = (String) shippingServiceSelectedCtx.get("shippingTotalAdditionalCost"); if (UtilValidate.isNotEmpty(shippingTotalAdditionalCost)) { - double shippingAdditionalCost = new Double(shippingTotalAdditionalCost); + double shippingAdditionalCost = Double.parseDouble(shippingTotalAdditionalCost); if (shippingAdditionalCost > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, null, shippingAdditionalCost, 0.0); if (shippingAdjustment != null) { @@ -1087,11 +1087,11 @@ public class EbayOrderServices { String salesTaxAmount = (String) shippingDetailsCtx.get("salesTaxAmount"); String salesTaxPercent = (String) shippingDetailsCtx.get("salesTaxPercent"); if (UtilValidate.isNotEmpty(salesTaxAmount)) { - double salesTaxAmountTotal = new Double(salesTaxAmount); + double salesTaxAmountTotal = Double.parseDouble(salesTaxAmount); if (salesTaxAmountTotal > 0) { double salesPercent = 0.0; if (UtilValidate.isNotEmpty(salesTaxPercent)) { - salesPercent = new Double(salesTaxPercent); + salesPercent = Double.parseDouble(salesTaxPercent); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmountTotal, salesPercent); if (salesTaxAdjustment != null) { Modified: ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebay/src/main/java/org/apache/ofbiz/ebay/ImportOrdersFromEbay.java Tue Feb 19 17:30:35 2019 @@ -545,19 +545,19 @@ public class ImportOrdersFromEbay { double shippingSurcharge = 0; if (UtilValidate.isNotEmpty(incuranceCost)) { - shippingInsuranceCost = new Double(incuranceCost); + shippingInsuranceCost = Double.parseDouble(incuranceCost); } if (UtilValidate.isNotEmpty(additionalCost)) { - shippingServiceAdditionalCost = new Double(additionalCost); + shippingServiceAdditionalCost = Double.parseDouble(additionalCost); } if (UtilValidate.isNotEmpty(surchargeCost)) { - shippingSurcharge = new Double(surchargeCost); + shippingSurcharge = Double.parseDouble(surchargeCost); } double shippingTotalAdditionalCost = shippingInsuranceCost + shippingServiceAdditionalCost + shippingSurcharge; - String totalAdditionalCost = new Double(shippingTotalAdditionalCost).toString(); + String totalAdditionalCost = Double.toString(shippingTotalAdditionalCost); order.put("shippingTotalAdditionalCost", totalAdditionalCost); } @@ -681,7 +681,7 @@ public class ImportOrdersFromEbay { // Apply shipping costs as order adjustment String shippingCost = (String) parameters.get("shippingServiceCost"); if (UtilValidate.isNotEmpty(shippingCost)) { - double shippingAmount = new Double(shippingCost); + double shippingAmount = Double.parseDouble(shippingCost); if (shippingAmount > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SHIPPING_CHARGES", cart.getOrderId(), null, null, shippingAmount, 0.0); if (shippingAdjustment != null) { @@ -693,7 +693,7 @@ public class ImportOrdersFromEbay { // Apply additional shipping costs as order adjustment String shippingTotalAdditionalCost = (String) parameters.get("shippingTotalAdditionalCost"); if (UtilValidate.isNotEmpty(shippingTotalAdditionalCost)) { - double shippingAdditionalCost = new Double(shippingTotalAdditionalCost); + double shippingAdditionalCost = Double.parseDouble(shippingTotalAdditionalCost); if (shippingAdditionalCost > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, null, shippingAdditionalCost, 0.0); if (shippingAdjustment != null) { @@ -706,11 +706,11 @@ public class ImportOrdersFromEbay { String salesTaxAmount = (String) parameters.get("salesTaxAmount"); String salesTaxPercent = (String) parameters.get("salesTaxPercent"); if (UtilValidate.isNotEmpty(salesTaxAmount)) { - double salesTaxAmountTotal = new Double(salesTaxAmount); + double salesTaxAmountTotal = Double.parseDouble(salesTaxAmount); if (salesTaxAmountTotal > 0) { double salesPercent = 0.0; if (UtilValidate.isNotEmpty(salesTaxPercent)) { - salesPercent = new Double(salesTaxPercent); + salesPercent = Double.parseDouble(salesTaxPercent); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmountTotal, salesPercent); if (salesTaxAdjustment != null) { Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java Tue Feb 19 17:30:35 2019 @@ -1978,7 +1978,7 @@ public class EbayStore { double reservPrice = 0; if (UtilValidate.isNotEmpty(sst)) { AmountType amt = sst.getCurrentPrice(); - currentPrice = amt != null ? (new Double(amt.getValue())) : 0; + currentPrice = amt != null ? (Double.parseDouble(amt.getValue())) : 0; bidCount = sst.getBidCount() != null ? sst.getBidCount() : 0; } cols.put("buyItNowPrice", item.getBuyItNowPrice().getValue()); @@ -2010,7 +2010,7 @@ public class EbayStore { java.util.Calendar startTime = item.getListingDetails() == null ? null : item.getListingDetails().getStartTime(); cols.put("startTime", startTime != null ? eBayUtil.toAPITimeString(startTime.getTime()) : ""); AmountType amt = item.getStartPrice(); - cols.put("StartPrice", amt != null ? (new Double(amt.getValue()).toString()) : ""); + cols.put("StartPrice", amt != null ? (Double.toString(amt.getValue())) : ""); Integer quantity = item.getQuantity(); String quantityStr = null; @@ -2033,7 +2033,7 @@ public class EbayStore { cols.put("title", item.getTitle() != null ? item.getTitle() : ""); AmountType amt = item.getStartPrice(); - cols.put("price", amt != null ? (new Double(amt.getValue()).toString()) : ""); + cols.put("price", amt != null ? (Double.toString(amt.getValue())) : ""); java.util.Calendar startTime = item.getListingDetails() == null ? null : item.getListingDetails().getStartTime(); cols.put("startTime", startTime != null ? eBayUtil.toAPITimeString(startTime.getTime()) : ""); @@ -2216,7 +2216,7 @@ public class EbayStore { result.put("title", title); result.put("description", description); AmountType amt = item.getStartPrice(); - result.put("price", amt != null ? (new Double(amt.getValue()).toString()) : ""); + result.put("price", amt != null ? (Double.toString(amt.getValue())) : ""); result.put("currencyId", amt.getCurrencyID().toString()); result.put("listingType", listingType); } catch (Exception e) { Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreAutoPreferences.java Tue Feb 19 17:30:35 2019 @@ -1334,7 +1334,7 @@ public class EbayStoreAutoPreferences { UserType buyer = bestOfferType.getBuyer(); String buyerUserID = buyer.getUserID(); AmountType price = bestOfferType.getPrice(); - String offerPrice = new Double(price.getValue()).toString(); + String offerPrice = Double.toString(price.getValue()); Double doCerrentPrice = Double.parseDouble(offerPrice); int offerQuantity = bestOfferType.getQuantity(); String[] bestOfferIDs = { bestOfferID }; Modified: ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java (original) +++ ofbiz/ofbiz-plugins/trunk/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreOrder.java Tue Feb 19 17:30:35 2019 @@ -187,7 +187,7 @@ public class EbayStoreOrder { String shippingTotalAdditionalCost = context.get("shippingTotalAdditionalCost").toString(); if (UtilValidate.isNotEmpty(shippingTotalAdditionalCost)) { - double shippingAdditionalCost = new Double(shippingTotalAdditionalCost); + double shippingAdditionalCost = Double.parseDouble(shippingTotalAdditionalCost); if (shippingAdditionalCost > 0) { GenericValue shippingAdjustment = EbayHelper.makeOrderAdjustment(delegator, "MISCELLANEOUS_CHARGE", cart.getOrderId(), null, null, shippingAdditionalCost, 0.0); if (shippingAdjustment != null) { @@ -199,11 +199,11 @@ public class EbayStoreOrder { String salesTaxAmount = context.get("salesTaxAmount").toString(); String salesTaxPercent = context.get("salesTaxPercent").toString(); if (UtilValidate.isNotEmpty(salesTaxAmount)) { - double salesTaxAmountTotal = new Double(salesTaxAmount); + double salesTaxAmountTotal = Double.parseDouble(salesTaxAmount); if (salesTaxAmountTotal > 0) { double salesPercent = 0.0; if (UtilValidate.isNotEmpty(salesTaxPercent)) { - salesPercent = new Double(salesTaxPercent); + salesPercent = Double.parseDouble(salesTaxPercent); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmountTotal, salesPercent); if (salesTaxAdjustment != null) { @@ -404,7 +404,7 @@ public class EbayStoreOrder { if (salesTaxAmount.doubleValue() > 0) { double salesPercent = 0.0; if (UtilValidate.isNotEmpty(shippingDetailsCtx.get("salesTaxPercent"))) { - salesPercent = new Double(shippingDetailsCtx.get("salesTaxPercent").toString()); + salesPercent = Double.parseDouble(shippingDetailsCtx.get("salesTaxPercent").toString()); } GenericValue salesTaxAdjustment = EbayHelper.makeOrderAdjustment(delegator, "SALES_TAX", cart.getOrderId(), null, null, salesTaxAmount.doubleValue(), salesPercent); if (salesTaxAdjustment != null) { Modified: ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java (original) +++ ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/AbstractPricatParser.java Tue Feb 19 17:30:35 2019 @@ -296,7 +296,7 @@ public abstract class AbstractPricatPars XSSFCell cell = sourceRow.getCell(j); if (cell != null) { XSSFCell newCell = targetRow.createCell(j); - CellType cellType = cell.getCellTypeEnum(); + CellType cellType = cell.getCellType(); newCell.setCellType(cellType); switch (cellType) { case BOOLEAN: @@ -428,7 +428,7 @@ public abstract class AbstractPricatPars cell = row.createCell(i); } } - CellType cellType = cell.getCellTypeEnum(); + CellType cellType = cell.getCellType(); String cellValue = formatter.formatCellValue(cell); if (UtilValidate.isNotEmpty(cellValue)) { if (cellType == CellType.FORMULA) { @@ -452,7 +452,7 @@ public abstract class AbstractPricatPars if (colNames.get(i)[1] == CellType.STRING) { results.add(cellValue); } else if (colNames.get(i)[1] == CellType.NUMERIC) { - if (cell.getCellTypeEnum() != CellType.STRING) { + if (cell.getCellType() != CellType.STRING) { cell.setCellType(CellType.STRING); } try { @@ -468,20 +468,20 @@ public abstract class AbstractPricatPars continue; } if (colNames.get(i)[1] == CellType.STRING) { - if (cell.getCellTypeEnum() == CellType.STRING) { + if (cell.getCellType() == CellType.STRING) { results.add(cell.getStringCellValue()); } else { results.add(cellValue); } } else if (colNames.get(i)[1] == CellType.NUMERIC) { - if (cell.getCellTypeEnum() == CellType.STRING) { + if (cell.getCellType() == CellType.STRING) { try { results.add(BigDecimal.valueOf(Double.valueOf(cell.getStringCellValue()))); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } - } else if (cell.getCellTypeEnum() == CellType.NUMERIC) { + } else if (cell.getCellType() == CellType.NUMERIC) { try { results.add(BigDecimal.valueOf(cell.getNumericCellValue()).setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { Modified: ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java (original) +++ ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java Tue Feb 19 17:30:35 2019 @@ -565,7 +565,7 @@ public class SamplePricatParser extends cell = row.createCell(i); } } - CellType cellType = cell.getCellTypeEnum(); + CellType cellType = cell.getCellType(); String cellValue = formatter.formatCellValue(cell); if (UtilValidate.isNotEmpty(cellValue) && UtilValidate.isNotEmpty(cellValue.trim())) { if (cellType == CellType.FORMULA) { @@ -601,7 +601,7 @@ public class SamplePricatParser extends results.add(null); } } else if (colNames.get(i)[1] == CellType.NUMERIC) { - if (cell.getCellTypeEnum() != CellType.STRING) { + if (cell.getCellType() != CellType.STRING) { cell.setCellType(CellType.STRING); } try { @@ -617,21 +617,21 @@ public class SamplePricatParser extends continue; } if (colNames.get(i)[1] == CellType.STRING) { - if (cell.getCellTypeEnum() == CellType.STRING) { + if (cell.getCellType() == CellType.STRING) { cellValue = cell.getStringCellValue().trim(); results.add(cellValue); } else { results.add(cellValue.trim()); } } else if (colNames.get(i)[1] == CellType.NUMERIC) { - if (cell.getCellTypeEnum() == CellType.STRING) { + if (cell.getCellType() == CellType.STRING) { try { results.add(BigDecimal.valueOf(Double.valueOf(cell.getStringCellValue()))); } catch (NumberFormatException e) { results.add(null); errorMessages.put(new CellReference(cell), UtilProperties.getMessage(resource, "ErrorParseValueToNumeric", locale)); } - } else if (cell.getCellTypeEnum() == CellType.NUMERIC) { + } else if (cell.getCellType() == CellType.NUMERIC) { try { results.add(BigDecimal.valueOf(cell.getNumericCellValue()).setScale(FinAccountHelper.decimals, FinAccountHelper.rounding)); } catch (NumberFormatException e) { Modified: ofbiz/ofbiz-plugins/trunk/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java?rev=1853904&r1=1853903&r2=1853904&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java (original) +++ ofbiz/ofbiz-plugins/trunk/projectmgr/src/main/java/org/apache/ofbiz/project/Various.java Tue Feb 19 17:30:35 2019 @@ -62,7 +62,7 @@ public class Various { List<GenericValue> standards = task.getRelated("WorkEffortSkillStandard", null, null, false); for (GenericValue standard : standards) { if (standard.getDouble("estimatedNumPeople") == null) { - standard.put("estimatedNumPeople", new Double("1")); + standard.put("estimatedNumPeople", Double.valueOf("1")); } if (standard.get("estimatedDuration") != null) { plannedHours += standard.getDouble("estimatedDuration") / standard.getDouble("estimatedNumPeople"); @@ -73,7 +73,7 @@ public class Various { Debug.logError("Could not updte task: " + e.getMessage(), module); } if (plannedHours == 0.00) { - plannedHours = new Double("24.00"); // default length of task is 3 days. + plannedHours = Double.valueOf("24.00"); // default length of task is 3 days. } // only add days which are not saturday(7) or sunday(1) |
Free forum by Nabble | Edit this page |