Example usage for java.math BigDecimal ZERO

List of usage examples for java.math BigDecimal ZERO

Introduction

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

Prototype

BigDecimal ZERO

To view the source code for java.math BigDecimal ZERO.

Click Source Link

Document

The value 0, with a scale of 0.

Usage

From source file:repository.CustomerRepositoryTest.java

@Test
public CustomerRepositoryTest() {

    repo = ctx.getBean(CustomerRepository.class);

    DeliveryLog delivery = new DeliveryLog.Builder("true").deliveryTime(Calendar.getInstance()).build();

    List<DeliveryLog> deliveries = new ArrayList<>();
    deliveries.add(delivery);/*from w ww .ja  v  a  2  s.  com*/

    List<CustomerOrder> orders = new ArrayList<>();
    CustomerOrder order = new CustomerOrder.Builder("1221").fine(BigDecimal.ZERO).deliveryLog(deliveries)
            .build();
    orders.add(order);

    Name nam = new Name.Builder("Khanya").lastname("Mvumbi").build();
    Demographic demo = new Demographic.Builder("male").race("Black").build();
    Contact con = new Contact.Builder("0783732323").address("27 Mdundu street").phone("0414628119").build();
    Customer cust = new Customer.Builder("staySoft").contact(con).demographic(demo).name(nam).orders(orders)
            .build();

    repo.save(cust);
    id = cust.getCustomerId();
    Assert.assertNotNull(id);

}

From source file:com.ar.dev.tierra.api.controller.ReservaController.java

@RequestMapping(value = "/add", method = RequestMethod.POST)
public ResponseEntity<?> add(OAuth2Authentication authentication, @RequestBody Factura factura) {
    Usuarios user = facadeService.getUsuariosDAO().findUsuarioByUsername(authentication.getName());
    factura.setUsuarioCreacion(user.getIdUsuario());
    factura.setFechaCreacion(new Date());
    factura.setEstado("RESERVADO");
    factura.setIdSucursal(user.getUsuarioSucursal().getIdSucursal());
    factura.setTotal(BigDecimal.ZERO);
    int idFactura = facadeService.getFacturaDAO().add(factura);
    JsonResponse msg = new JsonResponse("Success", String.valueOf(idFactura));
    return new ResponseEntity<>(msg, HttpStatus.OK);
}

From source file:com.oreilly.springdata.jdbc.domain.Product.java

/**
 * Creates a new {@link Product} from the given name and description.
 * /*from ww  w. ja v  a2s  .  co m*/
 * @param name must not be {@literal null} or empty.
 * @param price must not be {@literal null} or less than or equal to zero.
 * @param description
 */
public Product(String name, BigDecimal price, String description) {

    Assert.hasText(name, "Name must not be null or empty!");
    Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!");

    this.name = name;
    this.price = price;
    this.description = description;
}

From source file:com.github.fge.jsonschema.core.keyword.syntax.checkers.helpers.DivisorSyntaxChecker.java

@Override
protected void checkValue(final Collection<JsonPointer> pointers, final MessageBundle bundle,
        final ProcessingReport report, final SchemaTree tree) throws ProcessingException {
    final JsonNode node = getNode(tree);
    final BigDecimal divisor = node.decimalValue();

    if (divisor.compareTo(BigDecimal.ZERO) <= 0)
        report.error(newMsg(tree, bundle, "common.divisor.notPositive").put("found", node));
}

From source file:org.intan.hotelMaestro.springdata.model.RoomType.java

@PersistenceConstructor
public RoomType(String name, BigDecimal price, String description) {

    Assert.hasText(name, "Name must not be null or empty!");
    Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!");

    this.name = name;
    this.price = price;
    this.description = description;
}

From source file:com.haulmont.timesheets.global.WorkTimeConfigBean.java

public BigDecimal getUserWorkHourForWeek(User user) {
    if (user instanceof ExtUser) {
        ExtUser extUser = (ExtUser) user;
        return extUser.getWorkHoursForWeek();
    }//w ww.j a va  2  s. c  o m
    return BigDecimal.ZERO;
}

From source file:com.nkapps.billing.services.PaymentServiceImpl.java

@Override
public AccountInfoBean getAccountInfo(String tin) throws Exception {
    AccountInfoBean aib = new AccountInfoBean();

    BigDecimal overpaymentSum = paymentDao.getOverpaymentSumByTin(tin);
    if (overpaymentSum == null) {
        throw new Exception("Overpayment sum returned null value");
    }//  ww  w  .  j av  a  2 s .  c  om
    if (overpaymentSum.compareTo(BigDecimal.ZERO) == -1) {
        throw new Exception("Overpayment sum returned negative value");
    }

    BigDecimal keyCost = getKeyCost();

    aib.setTin(tin);
    aib.setOverpaymentSum(overpaymentSum);
    aib.setKeyCost(keyCost);
    return aib;
}

From source file:com.creditcloud.ump.model.ump.utils.UmpUtils.java

public static List<UmpSeqTransaction> parseSeqTrans(String transDetail) {
    List<UmpSeqTransaction> transList = new ArrayList<>();
    if (StringUtils.isBlank(transDetail)) {
        return transList;
    }//from  ww w.  j ava2s.c  o m
    String[] transStrArray = StringUtils.split(transDetail, '|');
    for (String transStr : transStrArray) {
        String[] fieldStrArray = transStr.split(",");
        Map<String, String> values = new HashMap<String, String>();
        for (String fieldStr : fieldStrArray) {
            String[] pair = fieldStr.split("=");
            if (pair.length != 2) {
                logger.log(Level.WARNING, "cannot parse transaction field string:" + fieldStr + ", ignore");
                continue;
            } else {
                values.put(pair[0], pair[1]);
            }
        }
        UmpSeqTransaction trans = new UmpSeqTransaction();
        trans.setAccCheckDate(values.get("acc_check_date"));
        trans.setAmount(fromCents(values.get("amount")));
        trans.setComAmt(
                values.get("com_amt") != null ? fromCents(values.get("com_amt")).setScale(2) : BigDecimal.ZERO);
        trans.setDcMark(UmpSeqCashFlow.getEnum(values.get("dc_mark")));
        trans.setTransType(UmpBusiType.getEnum(values.get("trans_type")));
        trans.setTransState(UmpSeqTransStatus.getEnum(values.get("trans_state")));
        transList.add(trans);
    }
    return transList;
}

From source file:com.miko.demo.mongo.model.EntityC.java

@PersistenceConstructor
public EntityC(String name, BigDecimal value) {

    Assert.hasText(name, "Name can not be empty");
    Assert.isTrue(BigDecimal.ZERO.compareTo(value) < 0, "Value must be greater than zero!");

    this.name = name;
    this.value = value;
}

From source file:com.oreilly.springdata.mongodb.core.Product.java

/**
 * Creates a new {@link Product} from the given name and description.
 * //  w ww.  jav  a 2  s .c  o m
 * @param name must not be {@literal null} or empty.
 * @param price must not be {@literal null} or less than or equal to zero.
 * @param description
 */
@PersistenceConstructor
public Product(String name, BigDecimal price, String description) {

    Assert.hasText(name, "Name must not be null or empty!");
    Assert.isTrue(BigDecimal.ZERO.compareTo(price) < 0, "Price must be greater than zero!");

    this.name = name;
    this.price = price;
    this.description = description;
}