コード例 #1
0
  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;
    }
  }
コード例 #2
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;
  }