Package org.company.recordshop.domain

Examples of org.company.recordshop.domain.Customer


  /**
   * {@inheritDoc}
   */
  public SimpleCustomerDto getCustomer(OrderDto source) {
    Assert.notNull(source, "argument [source] may not be null");
    Customer target = null;
    Order sourceBusinessObject = customerServiceModelDomainService
        .readOrder(source.getId());
    target = customerServiceModelDomainService
        .getCustomer(sourceBusinessObject);
    return simpleCustomerDtoTranslator.toDto(target);
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void setCustomer(OrderDto whole, SimpleCustomerDto part) {
    Assert.notNull(whole, "argument [whole] may not be null");
    Customer partBusinessObject = null;
    if (part != null) {
      partBusinessObject = customerServiceModelDomainService
          .readCustomer(part.getId());
    }
    Order mainBusinessObject = customerServiceModelDomainService
View Full Code Here

      } else {

        /* An existing object to be updated */
        if (target.getFromBuyers(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Customer original = customerDao.retrieve(element.getId());
          Customer updated = simpleCustomerDtoTranslator.fromDto(
              element, original, translated);
          target.addToBuyers(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          simpleCustomerDtoTranslator.fromDto(element, target
View Full Code Here

    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Customer target = new Customer(source.getFirstName(), source
        .getLastName(), source.getBirthDate(), source.getCustomerNr()

    );
    return fromDto(source, target, translated);
View Full Code Here

     */
    @Before
    public void setUp() {

        for (int i = 1; i <= NUMBER_OF_ITEMS; i++) {
            Customer customer = new Customer("Customer" + i, "Last name", date(), i);
            customerDao.add(customer);
        }
        flush();
        clear();
    }
View Full Code Here

      target.setCustomer(null);
    } else { // source.getCustomer() != null ) {
      /* Add a new associated object */
      if (source.getCustomer().getId() != null) {
        /* Add an existing object */
        Customer original = customerDao.retrieve(source.getCustomer()
            .getId());
        Customer updated = simpleCustomerDtoTranslator.fromDto(source
            .getCustomer(), original, translated);
        target.setCustomer(updated);
      } else {
        /* Add a new object */
        target.setCustomer(simpleCustomerDtoTranslator.fromDto(source
 
View Full Code Here

   * because in Mod4j 1.0.0 validators are not being added to a persistent
   * object when loaded by Hibernate.
   */
  @Test
  public void testValidateAfterRetrieve() {
    Customer customer = new Customer("Johannes", "Vermeer", date(), 222);
    try {
      customer.setNumberOfEars(1);
      fail("Expected BusinessRuleException");
    } catch (BusinessRuleException e) {
      /**
       * This method throws an exception because a validation is
       * triggered. Validators are added in the minimal constructor
       * invoked above.
       */
    }
    try {
      customer.setUsername("12");
      fail("Expected BusinessRuleException");
    } catch (BusinessRuleException e) {
    }
    Long id = customerDao.add(customer);
    flush();
    clear();

    customer = customerDao.retrieve(id);
    /*
     * Now the object is instantiated by Hibernate. Hibernate does not use
     * the minimal constructor, but the default no-arg constructor. The
     * validators must still be added, causing the exception to be thrown.
     */
    try {
      customer.setNumberOfEars(1);
      fail("Expected BusinessRuleException");
    } catch (BusinessRuleException e) {
    }
  }
View Full Code Here

    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Customer target = new Customer(source.getFirstName(), source
        .getLastName(), source.getBirthDate(), source.getCustomerNr()

    );
    return fromDto(source, target, translated);
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public SimpleCustomerDto readCustomerAAA(Long id) {
    Customer result = orderServiceModelDomainService.readCustomer(id);
    return (result == null) ? null : simpleCustomerDtoTranslator
        .toDto(result);
  }
View Full Code Here

  @Test
  public void testPolymorphism() {
    Person person = new Person("Rembrandt", "van Rhijn", date());
    personDao.add(person);
    Customer customer = new Customer("Simon", "de Wit", date(), 1);
    personDao.add(customer);
    assertEquals(0, SimpleJdbcTestUtils.countRowsInTable(
        simpleJdbcTemplate, "Person_TABLE"));
    assertEquals(0, SimpleJdbcTestUtils.countRowsInTable(
        simpleJdbcTemplate, "Customer_TABLE"));
View Full Code Here

TOP

Related Classes of org.company.recordshop.domain.Customer

Copyright © 2018 www.massapicom. 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.