Search in sources :

Example 1 with Order

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));
}
Also used : Order(com.github.yukihane.hibernateissues.qiita20180224.entity.Order) User(com.github.yukihane.hibernateissues.qiita20180224.entity.User) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 2 with 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);
}
Also used : Order(charts.ex1.entity.Order) BigDecimal(java.math.BigDecimal) Subscribe(io.jmix.ui.screen.Subscribe)

Example 3 with Order

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");
}
Also used : Order(charts.ex1.entity.Order) BigDecimal(java.math.BigDecimal) Subscribe(io.jmix.ui.screen.Subscribe)

Example 4 with Order

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();
}
Also used : Order(bpm.ex1.entity.Order) HashMap(java.util.HashMap)

Example 5 with Order

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());
}
Also used : Order(dataaccess.ex1.entity.Order) OrderLine(dataaccess.ex1.entity.OrderLine) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

SpringBootTest (org.springframework.boot.test.context.SpringBootTest)18 Test (org.junit.jupiter.api.Test)17 Order (dataaccess.ex1.entity.Order)12 Order (security.ex1.entity.Order)6 OrderLine (dataaccess.ex1.entity.OrderLine)4 Subscribe (io.jmix.ui.screen.Subscribe)4 BigDecimal (java.math.BigDecimal)4 Order (maps.ex1.entity.Order)4 Order (bpm.ex1.entity.Order)3 UUID (java.util.UUID)3 EventListener (org.springframework.context.event.EventListener)3 Order (charts.ex1.entity.Order)2 Item (com.test.toyproject1.entity.Item)2 Member (com.test.toyproject1.entity.Member)2 Order (com.test.toyproject1.entity.Order)2 Customer (dataaccess.ex1.entity.Customer)2 Product (dataaccess.ex1.entity.Product)2 Order (datamodel.ex1.entity.Order)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2