Examples of PaymentEntity


Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

    super(Payment.class, PaymentEntity.class);
  }

  @Override
  public PaymentEntity convertTo(Payment source, PaymentEntity destination) {
    PaymentEntity result = null;

    if (source instanceof IncomingPayment) {
      IncomingPaymentEntity incomingPaymentEntity = new IncomingPaymentEntity();

      incomingPaymentEntity.setCompleted(source.isCompleted());
View Full Code Here

Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

  @SuppressWarnings("deprecation")
  @Override
  public Payment convertFrom(PaymentEntity source, Payment destination) {
    Payment result = null;
    PaymentEntity tmp = null;

    if (source != null) {
      tmp = HibernateHelper.initializeAndUnproxy(source);
    }

    if (tmp instanceof IncomingPaymentEntity) {
      IncomingPayment incomingPayment = new IncomingPayment();

      incomingPayment.setCompleted(tmp.isCompleted());
      incomingPayment.setCreationDate(tmp.getCreationDate());
      incomingPayment.setDirection(EPaymentDirection.INCOMING);
      incomingPayment.setId(tmp.getId());

      CustomerEntity customerEntity = ((IncomingPaymentEntity) tmp).getPayer();
      Customer customer = null;
      if (customerEntity instanceof PersonalCustomerEntity) {
        customer = DozerHelper.map(customerEntity, PersonalCustomer.class);
      }
      if (customerEntity instanceof CorporateCustomerEntity) {
        customer = DozerHelper.map(customerEntity, CorporateCustomer.class);
      }

      incomingPayment.setPayer(customer);
      incomingPayment.setPaymentDate(tmp.getPaymentDate());
      incomingPayment.setSubject(tmp.getSubject());

      Subsidiary subsidiary = DozerHelper.map(tmp.getSubsidiary(),
          Subsidiary.class);
      incomingPayment.setSubsidiary(subsidiary);

      incomingPayment.setTotal(tmp.getTotal());
      incomingPayment.setType(tmp.getType());

      result = incomingPayment;
    }

    if (tmp instanceof OutgoingPaymentEntity) {
      OutgoingPayment outgoingPayment = new OutgoingPayment();

      outgoingPayment.setCompleted(tmp.isCompleted());
      outgoingPayment.setCreationDate(tmp.getCreationDate());
      outgoingPayment.setDirection(EPaymentDirection.OUTGOING);
      outgoingPayment.setId(tmp.getId());
      outgoingPayment.setPaymentDate(tmp.getPaymentDate());

      EmployeeEntity employeeEntity = ((OutgoingPaymentEntity) tmp)
          .getRecipient();
      Employee employee = null;
      if (employeeEntity instanceof MechanicEntity) {
        employee = DozerHelper.map(employee, Mechanic.class);
      }
      if (employeeEntity instanceof EmployeeEntity) {
        employee = DozerHelper.map(employee, Employee.class);
      }

      outgoingPayment.setRecipient(employee);
      outgoingPayment.setSubject(tmp.getSubject());

      Subsidiary subsidiary = DozerHelper.map(tmp.getSubsidiary(),
          Subsidiary.class);
      outgoingPayment.setSubsidiary(subsidiary);

      outgoingPayment.setTotal(tmp.getTotal());
      outgoingPayment.setType(tmp.getType());

      result = outgoingPayment;
    }

    return result;
View Full Code Here

Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

  // ===== Basic operations ===== //
  @Override
  public Long addPayment(Payment payment) {
    Long result = null;

    PaymentEntity paymentEntity = DozerHelper.map(payment,
        PaymentEntity.class);
    result = paymentRepository.save(paymentEntity);

    return result;
  }
View Full Code Here

Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

  @Override
  public Payment updatePayment(Payment payment) {
    Payment result = null;

    PaymentEntity paymentEntity = DozerHelper.map(payment,
        PaymentEntity.class);
    paymentEntity = paymentRepository.merge(paymentEntity);
    result = DozerHelper.map(paymentEntity, Payment.class);

    return result;
View Full Code Here

Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

    return result;
  }

  @Override
  public void deletePayment(Payment payment) {
    PaymentEntity paymentEntity = DozerHelper.map(payment,
        PaymentEntity.class);
    paymentRepository.delete(paymentEntity);
  }
View Full Code Here

Examples of com.expositds.ars.dao.entity.billing.PaymentEntity

  @Override
  public Payment getPaymentById(Long id) {
    Payment result = null;

    PaymentEntity paymentEntity = paymentRepository.findById(id);
    result = DozerHelper.map(paymentEntity, Payment.class);

    return result;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.