Examples of OrderNumberAndDateDto


Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

        .readCustomer(source.getId());
    List<Order> parts = customerServiceModelDomainService
        .getOrders(businessSource);
    List<OrderNumberAndDateDto> result = new ArrayList<OrderNumberAndDateDto>();
    for (Order element : parts) {
      OrderNumberAndDateDto item = orderNumberAndDateDtoTranslator
          .toDto(element);
      result.add(item);
    }
    return result;
  }
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

      final Map<Object, Object> translated) {
    if (translated.containsKey((source))) {
      return (OrderNumberAndDateDto) translated.get(source);
    }
    Assert.notNull(source, "argument [source] may not be null");
    OrderNumberAndDateDto result = new OrderNumberAndDateDto(
        source.getId(), source.getVersion());
    result.setOrderNumber(source.getOrderNumber());
    result.setOrderDate(source.getOrderDate());

    translated.put(source, result);

    if (source.getCustomer() != null) {
      result.setCustomer(simpleCustomerDtoTranslator.toDto(source
          .getCustomer(), translated));
    }

    return result;
  }
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    simpleCust.setLastName("Van Gogh");
    simpleCust.setCustomerNr(1234);
    simpleCust.setSexe(SexeEnumDto.MALE);
    simpleCust.setBirthDate(new DateTime(2008, 1, 1, 1, 1, 0, 0));

    OrderNumberAndDateDto orderDto = new OrderNumberAndDateDto();
    orderDto.setOrderNumber("1");
    orderDto.setCustomer(simpleCust);

    simpleCust.addToOrders(orderDto);

    Customer newCust = simpleCustomerDtoTranslator.fromDto(simpleCust);
    assertEquals("Vincent", newCust.getFirstName());
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    checkCustomer(customer, new String[] { "2" });

    /**
     * Add another order to the DTO to see if it gets added to the DO.
     */
    OrderNumberAndDateDto orderDto = new OrderNumberAndDateDto();
    orderDto.setOrderNumber("3");
    orderDto.setCustomer(customerDto);
    customerDto.addToOrders(orderDto);
    customer = simpleCustomerDtoTranslator.fromDto(customerDto, customer);
    customer = repository.get(repository.save(customer));
    checkCustomer(customer, new String[] { "2", "3" });

View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    customerDto.setFirstName(first);
    customerDto.setLastName(last);
    customerDto.setCustomerNr(number);

    for (int i = 0; i < orders.length; i++) {
      OrderNumberAndDateDto orderDto = new OrderNumberAndDateDto();
      orderDto.setOrderNumber(orders[i]);
      orderDto.setCustomer(customerDto);
      customerDto.addToOrders(orderDto);
    }
    return customerDto;
  }
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    @Test
    public final void testAddOrder() {
        Long id = createdOrder.getId();
        customerService.addToOrders(createdCustomer, createdOrder);

        OrderNumberAndDateDto o = orderService.readOrderAsOrderNumberAndDateDto(createdOrder
                .getId());
        SimpleCustomerDto orderCustomer = o.getCustomer();
        Assert.assertEquals(o.getCustomer().getId(), createdCustomer.getId());
        Assert.assertTrue(o.getCustomer().getOrders().size() == 1);
    }
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    @Test
    public final void testSetCustomer() {
        customerService.setCustomer(createdOrder, createdCustomer);

        OrderNumberAndDateDto order = orderService.readOrderAsOrderNumberAndDateDto(createdOrder
                .getId());
        SimpleCustomerDto orderCustomer = order.getCustomer();
        Assert.assertEquals(order.getCustomer().getId(), createdCustomer.getId());

        Set<OrderNumberAndDateDto> orders = order.getCustomer().getOrders();
        Assert.assertEquals(((OrderNumberAndDateDto) (orders.toArray()[0])).getId(), createdOrder
                .getId());

        customerService.setCustomer(createdOrder, null);
        order = orderService.readOrderAsOrderNumberAndDateDto(createdOrder.getId());
        Assert.assertNull(order.getCustomer());

        SimpleCustomerDto sim = customerService.readCustomer(createdCustomer.getId());
        Assert.assertTrue(sim.getOrders().size() == 0);
    }
View Full Code Here

Examples of org.company.recordshop.service.dto.OrderNumberAndDateDto

    public final void testRemoveOrder() {
        customerService.addToOrders(createdCustomer, createdOrder);
        OrderDto newOrder = orderService.readOrderAsOrderDto(createdOrder.getId());
        customerService.removeFromOrders(createdCustomer, newOrder);

        OrderNumberAndDateDto o2 = orderService.readOrderAsOrderNumberAndDateDto(createdOrder
                .getId());
        SimpleCustomerDto orderCustomer2 = o2.getCustomer();
        Assert.assertEquals(orderCustomer2, null);
    }
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.