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

(OFBIZ-10757)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/trunk@1853904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Deepak Dixit
2019-02-19 17:30:35 +00:00
parent c7f9cbdd0c
commit 5579e37bde
8 changed files with 38 additions and 38 deletions
@@ -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) {
@@ -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) {
@@ -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) {
@@ -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 };
@@ -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) {
@@ -296,7 +296,7 @@ public abstract class AbstractPricatParser implements InterfacePricatParser {
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 AbstractPricatParser implements InterfacePricatParser {
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 AbstractPricatParser implements InterfacePricatParser {
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 AbstractPricatParser implements InterfacePricatParser {
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) {
@@ -565,7 +565,7 @@ public class SamplePricatParser extends AbstractPricatParser {
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 AbstractPricatParser {
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 AbstractPricatParser {
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) {
@@ -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)