Example usage for java.math BigDecimal toString

List of usage examples for java.math BigDecimal toString

Introduction

In this page you can find the example usage for java.math BigDecimal toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns the string representation of this BigDecimal , using scientific notation if an exponent is needed.

Usage

From source file:net.groupbuy.plugin.alipayBank.AlipayBankController.java

/**
 * //from ww w .  j  a  va  2s.  co  m
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = alipayBankPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.alipayDual.AlipayDualController.java

/**
 * /* www. ja  v a 2  s.  c  o m*/
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = alipayDualPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.tenpayBank.TenpayBankController.java

/**
 * /*from   w  w  w  .ja va  2  s . c om*/
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = tenpayBankPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:org.egov.ptis.actions.citizen.search.SearchAction.java

private List<Map<String, String>> getResultsFromMv(final PropertyMaterlizeView pmv) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Entered into getSearchResults method");
        LOGGER.debug("Assessment Number : " + pmv.getPropertyId());
    }//from  ww  w .  j ava  2s.  c o  m
    final BasicProperty basicProperty = basicPropertyDAO.getBasicPropertyByPropertyID(pmv.getPropertyId());
    final Property property = basicProperty.getProperty();
    if (basicProperty != null)
        checkIsDemandActive(basicProperty.getProperty());
    if (StringUtils.isNotBlank(pmv.getPropertyId())) {
        final Map<String, String> searchResultMap = new HashMap<>();
        searchResultMap.put("assessmentNum", pmv.getPropertyId());
        searchResultMap.put("ownerName", pmv.getOwnerName());
        searchResultMap.put("parcelId", pmv.getGisRefNo());
        searchResultMap.put("address", pmv.getPropertyAddress());
        searchResultMap.put("source", pmv.getSource().toString());
        searchResultMap.put("isDemandActive", String.valueOf(isDemandActive));
        searchResultMap.put("propType", property.getPropertyDetail().getPropertyTypeMaster().getCode());
        searchResultMap.put("isTaxExempted", String.valueOf(property.getIsExemptedFromTax()));
        searchResultMap.put("isUnderWorkflow", String.valueOf(basicProperty.isUnderWorkflow()));
        searchResultMap.put("enableVacancyRemission",
                String.valueOf(propertyTaxUtil.enableVacancyRemission(basicProperty.getUpicNo())));
        searchResultMap.put("enableMonthlyUpdate",
                String.valueOf(propertyTaxUtil.enableMonthlyUpdate(basicProperty.getUpicNo())));
        searchResultMap.put("enableVRApproval",
                String.valueOf(propertyTaxUtil.enableVRApproval(basicProperty.getUpicNo())));
        if (pmv.getIsExempted()) {
            searchResultMap.putAll(getDemandDetailsForExemptedProperty());
        } else {
            searchResultMap.put(CURRENT_FIRST_HALF_DEMAND,
                    getCurrFirstHalfDemand(pmv.getAggrCurrFirstHalfDmd()).toString());
            searchResultMap.put(CURRENT_FIRST_HALF_DEMAND_DUE,
                    getCurrFirstHalfDemandDue(pmv.getAggrCurrFirstHalfDmd(), pmv.getAggrCurrFirstHalfColl())
                            .toString());
            searchResultMap.put(CURRENT_FIRST_HALF_PENALTY_DUE,
                    getIntrestDueOnCurrFirstHalfDemand(pmv.getAggrCurrFirstHalfPenaly(),
                            pmv.getAggrCurrFirstHalfPenalyColl()).toString());
            searchResultMap.put(CURRENT_SECOND_HALF_DEMAND,
                    getCurrSecondHalfDemand(pmv.getAggrCurrSecondHalfDmd()).toString());
            searchResultMap.put(CURRENT_SECOND_HALF_DEMAND_DUE,
                    getCurrSecondHalfDemandDue(pmv.getAggrCurrSecondHalfDmd(), pmv.getAggrCurrSecondHalfColl())
                            .toString());
            searchResultMap.put(CURRENT_SECOND_HALF_PENALTY_DUE,
                    getIntrestDueOnCurrSecondHalfDemand(pmv.getAggrCurrSecondHalfPenaly(),
                            pmv.getAggrCurrSecondHalfPenalyColl()).toString());
            searchResultMap.put(ARREAR_DEMAND_DUE,
                    getAggrArrDmdDue(pmv.getAggrArrDmd(), pmv.getAggrArrColl()).toString());
            searchResultMap.put(ARREAR_PENALTY_DUE,
                    getIntrestDueOnArrearDemandDue(pmv.getAggrArrearPenaly(), pmv.getAggrArrearPenalyColl())
                            .toString());
            searchResultMap.put(ADVANCE, pmv.getAdvance().toString());
            BigDecimal rebate = calculateRebate(basicProperty);
            searchResultMap.put(REBATE_AMOUNT, rebate.toString());
            searchResultMap.put(NET_PAYABLE_AMOUNT,
                    calculateNetPayableAmmount(pmv).subtract(rebate).toString());
        }
        searchList.add(searchResultMap);
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Search list : " + (searchList != null ? searchList : ZERO));
        LOGGER.debug("Exit from getSearchResults method");
    }
    return searchList;
}

From source file:net.groupbuy.plugin.alipayDirect.AlipayDirectController.java

/**
 * /* w  w w  . ja v a2s .c  o  m*/
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = alipayDirectPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.tenpayDirect.TenpayDirectController.java

/**
 * /* w  ww .  ja va  2s  .  c o m*/
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = tenpayDirectPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.alipayPartner.AlipayPartnerController.java

/**
 * //  w  ww  .  j  a va 2  s.  co  m
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = alipayPartnerPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.pay99billBank.Pay99billBankController.java

/**
 * // www  . j  a  va 2s.c  o m
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = pay99billBankPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:net.groupbuy.plugin.tenpayPartner.TenpayPartnerController.java

/**
 * // www  . j  a  va 2 s  .co  m
 */
@RequestMapping(value = "/update", method = RequestMethod.POST)
public String update(String paymentName, String partner, String key, FeeType feeType, BigDecimal fee,
        String logo, String description, @RequestParam(defaultValue = "false") Boolean isEnabled, Integer order,
        RedirectAttributes redirectAttributes) {
    PluginConfig pluginConfig = tenpayPartnerPlugin.getPluginConfig();
    pluginConfig.setAttribute(PaymentPlugin.PAYMENT_NAME_ATTRIBUTE_NAME, paymentName);
    pluginConfig.setAttribute("partner", partner);
    pluginConfig.setAttribute("key", key);
    pluginConfig.setAttribute(PaymentPlugin.FEE_TYPE_ATTRIBUTE_NAME, feeType.toString());
    pluginConfig.setAttribute(PaymentPlugin.FEE_ATTRIBUTE_NAME, fee.toString());
    pluginConfig.setAttribute(PaymentPlugin.LOGO_ATTRIBUTE_NAME, logo);
    pluginConfig.setAttribute(PaymentPlugin.DESCRIPTION_ATTRIBUTE_NAME, description);
    pluginConfig.setIsEnabled(isEnabled);
    pluginConfig.setOrder(order);
    pluginConfigService.update(pluginConfig);
    addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
    return "redirect:/admin/payment_plugin/list.jhtml";
}

From source file:org.apache.hawq.pxf.plugins.hive.HiveResolver.java

private void resolvePrimitive(Object o, PrimitiveObjectInspector oi, List<OneField> record, boolean toFlatten)
        throws IOException {
    Object val;
    switch (oi.getPrimitiveCategory()) {
    case BOOLEAN: {
        val = (o != null) ? ((BooleanObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, BOOLEAN, val);
        break;/*from  w  w  w  .j a  v  a  2 s  .  c o  m*/
    }
    case SHORT: {
        val = (o != null) ? ((ShortObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, SMALLINT, val);
        break;
    }
    case INT: {
        val = (o != null) ? ((IntObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, INTEGER, val);
        break;
    }
    case LONG: {
        val = (o != null) ? ((LongObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, BIGINT, val);
        break;
    }
    case FLOAT: {
        val = (o != null) ? ((FloatObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, REAL, val);
        break;
    }
    case DOUBLE: {
        val = (o != null) ? ((DoubleObjectInspector) oi).get(o) : null;
        addOneFieldToRecord(record, FLOAT8, val);
        break;
    }
    case DECIMAL: {
        String sVal = null;
        if (o != null) {
            HiveDecimal hd = ((HiveDecimalObjectInspector) oi).getPrimitiveJavaObject(o);
            if (hd != null) {
                BigDecimal bd = hd.bigDecimalValue();
                sVal = bd.toString();
            }
        }
        addOneFieldToRecord(record, NUMERIC, sVal);
        break;
    }
    case STRING: {
        val = (o != null) ? ((StringObjectInspector) oi).getPrimitiveJavaObject(o) : null;
        addOneFieldToRecord(record, TEXT, toFlatten ? String.format("\"%s\"", val) : val);
        break;
    }
    case VARCHAR:
        val = (o != null) ? ((HiveVarcharObjectInspector) oi).getPrimitiveJavaObject(o) : null;
        addOneFieldToRecord(record, VARCHAR, toFlatten ? String.format("\"%s\"", val) : val);
        break;
    case CHAR:
        val = (o != null) ? ((HiveCharObjectInspector) oi).getPrimitiveJavaObject(o) : null;
        addOneFieldToRecord(record, BPCHAR, toFlatten ? String.format("\"%s\"", val) : val);
        break;
    case BINARY: {
        byte[] toEncode = null;
        if (o != null) {
            BytesWritable bw = ((BinaryObjectInspector) oi).getPrimitiveWritableObject(o);
            toEncode = new byte[bw.getLength()];
            System.arraycopy(bw.getBytes(), 0, toEncode, 0, bw.getLength());
        }
        addOneFieldToRecord(record, BYTEA, toEncode);
        break;
    }
    case TIMESTAMP: {
        val = (o != null) ? ((TimestampObjectInspector) oi).getPrimitiveJavaObject(o) : null;
        addOneFieldToRecord(record, TIMESTAMP, val);
        break;
    }
    case DATE:
        val = (o != null) ? ((DateObjectInspector) oi).getPrimitiveJavaObject(o) : null;
        addOneFieldToRecord(record, DATE, val);
        break;
    case BYTE: { /* TINYINT */
        val = (o != null) ? new Short(((ByteObjectInspector) oi).get(o)) : null;
        addOneFieldToRecord(record, SMALLINT, val);
        break;
    }
    default: {
        throw new UnsupportedTypeException(
                oi.getTypeName() + " conversion is not supported by " + getClass().getSimpleName());
    }
    }
}