Exemplo n.º 1
0
 private Order givenOrderFromPrepareForCreate() {
   adHocTransaction.runOnAnotherReadOnlyTransaction(
       new IOnTransaction<Void>() {
         @Override
         public Void execute() {
           orderModel.prepareForCreate(mockDesktop());
           return null;
         }
       });
   Order order = orderModel.getOrder();
   order.setName("name");
   order.setCode("code");
   order.setInitDate(new Date());
   order.setCustomer(createValidExternalCompany());
   return order;
 }
  private Order givenValidOrderAlreadyStored() {
    Order order = Order.create();
    order.setCode(UUID.randomUUID().toString());
    order.setName("Order name " + UUID.randomUUID());
    order.setInitDate(new Date());
    order.setCalendar(configurationDAO.getConfiguration().getDefaultCalendar());
    OrderVersion version = setupVersionUsing(scenarioManager, order);
    order.useSchedulingDataFor(version);

    orderDAO.save(order);
    orderDAO.flush();
    try {
      return orderDAO.find(order.getId());
    } catch (InstanceNotFoundException e) {
      return null;
    }
  }
Exemplo n.º 3
0
  private Order createValidOrder() {
    Order order = Order.create();
    order.setDescription("description");
    order.setInitDate(year(2000));
    order.setName("name");
    order.setResponsible("responsible");
    order.setCode("code-" + UUID.randomUUID());
    BaseCalendar calendar =
        adHocTransaction.runOnReadOnlyTransaction(
            new IOnTransaction<BaseCalendar>() {

              @Override
              public BaseCalendar execute() {
                BaseCalendar result =
                    configurationDAO.getConfigurationWithReadOnlyTransaction().getDefaultCalendar();
                BaseCalendarModel.forceLoadBaseCalendar(result);
                return result;
              }
            });
    order.setCalendar(calendar);
    return order;
  }