Search in sources :

Example 26 with Order

use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.

the class RelatedEntityLoadingTest method setUp.

@BeforeEach
void setUp() {
    authenticator.withSystem(() -> {
        Customer customer = dataManager.create(Customer.class);
        customer.setName("customer-1");
        customer.setRegion("UK");
        Order order = dataManager.create(Order.class);
        order.setCustomer(customer);
        order.setDate(LocalDate.now());
        order.setAmount(BigDecimal.TEN);
        dataManager.save(order, customer);
        customerId = customer.getId();
        orderId = order.getId();
        return null;
    });
}
Also used : Order(security.ex1.entity.Order) Customer(security.ex1.entity.Customer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 27 with Order

use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.

the class RelatedEntityLoadingTest method jpqlAndPredicate_relatedEntityIsNotLoadedEagerly.

@Test
void jpqlAndPredicate_relatedEntityIsNotLoadedEagerly() {
    authenticator.withUser("test2", () -> {
        Order order = dataManager.load(Order.class).id(orderId).fetchPlanProperties("customer.name").one();
        assertNull(order.getCustomer());
        return null;
    });
}
Also used : Order(security.ex1.entity.Order) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 28 with Order

use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.

the class RelatedEntityLoadingTest method jpqlAndPredicate_relatedEntityIsNotLoadedLazily.

@Test
void jpqlAndPredicate_relatedEntityIsNotLoadedLazily() {
    authenticator.withUser("test2", () -> {
        Order order = dataManager.load(Order.class).id(orderId).one();
        assertNull(order.getCustomer());
        return null;
    });
}
Also used : Order(security.ex1.entity.Order) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 29 with Order

use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.

the class OrderBrowse method onUpdateClick.

@Subscribe("update")
public void onUpdateClick(Button.ClickEvent event) {
    Order order = ordersTable.getSingleSelected();
    order.setAmount(10);
    dataManager.save(order);
}
Also used : Order(audit.ex1.entity.Order)

Example 30 with Order

use of dataaccess.ex1.entity.Order in project jmix-docs by Haulmont.

the class OrderEdit2 method onBeforeShow.

@Subscribe
public void onBeforeShow(BeforeShowEvent event) {
    // end::vector-controller1[]
    TileLayer tileLayer = new TileLayer("tileLayer");
    tileLayer.setUrl("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");
    tileLayer.setAttributionString("&copy; <a href=\"http://www.openstreetmap.org/copyright\"" + ">OpenStreetMap</a> &copy; <a href=\"https://carto.com/attributions\">CARTO</a>");
    map.addLayer(tileLayer);
    // tag::vector-controller2[]
    VectorLayer<Order> orderLayer = new VectorLayer<>("orderLayer", orderDc);
    orderLayer.setEditable(true);
    map.addLayer(orderLayer);
    map.selectLayer(orderLayer);
}
Also used : Order(maps.ex1.entity.Order) TileLayer(io.jmix.mapsui.component.layer.TileLayer) VectorLayer(io.jmix.mapsui.component.layer.VectorLayer)

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