use of dataaccess.ex1.entity.Order in project hello-java by yukihane.
the class Qiita20180224ApplicationTests method contextLoads.
@Test
public void contextLoads() {
User user = new User();
user.setUserNo("no_01");
Order order = new Order();
User savedUser = repository.save(user);
savedUser.setOrders(Arrays.asList(order));
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrdersHistory method onInit.
// end::queue[]
// tag::orders-history2[]
@Subscribe
private void onInit(InitEvent event) {
// <2>
Order initialValue = metadata.create(Order.class);
initialValue.setAmount(new BigDecimal(random.nextInt(1000) + 100));
initialValue.setDate(timeSource.currentTimestamp());
// <3>
ordersDc.getMutableItems().add(initialValue);
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrdersHistory method onTimerTick.
// end::orders-history2[]
// tag::orders-history3[]
@Subscribe("updateChartTimer")
private void onTimerTick(Timer.TimerActionEvent event) {
// <4>
Order orderHistory = metadata.create(Order.class);
orderHistory.setAmount(new BigDecimal(random.nextInt(1000) + 100));
orderHistory.setDate(timeSource.currentTimestamp());
ordersDc.getMutableItems().add(orderHistory);
// end::orders-history3[]
// tag::queue-code[]
// <1>
itemsQueue.add(orderHistory);
if (itemsQueue.size() > 10) {
// <2>
ordersDc.getMutableItems().remove(0);
System.out.println("in");
}
// end::queue-code[]
// tag::orders-history4[]
System.out.println("get");
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrderEdit method onStartProcessBtnClick.
@Subscribe("startProcessBtn")
public void onStartProcessBtnClick(Button.ClickEvent event) {
Order order = getEditedEntity();
Map<String, Object> processVariables = new HashMap<>();
// <1>
processVariables.put("order", order);
// <2>
runtimeService.startProcessInstanceByKey(// <2>
"order-approval", order.getNumber(), processVariables);
closeWithCommit();
}
use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.
the class OrderServiceTest method testLazyLoading.
@Test
void testLazyLoading() {
String customerName = orderService.getCustomerName(Id.of(order1));
assertEquals("Alice", customerName);
List<String> productNames = orderService.getProductNames(Id.of(order1));
assertEquals(Collections.singletonList("MacBook Pro"), productNames);
Order order = dataManager.load(Id.of(order1)).one();
OrderLine orderLine = order.getLines().iterator().next();
assertSame(order, orderLine.getOrder());
}
Aggregations