Search in sources :

Example 1 with Order

use of test_support.entity.sales.Order in project jmix by jmix-framework.

the class OrderScreen method onBeforeShow.

@Subscribe
protected void onBeforeShow(BeforeShowEvent event) {
    Order mergedOrder = dataContext.merge(order);
    orderDc.setItem(mergedOrder);
}
Also used : Order(test_support.entity.sales.Order) Subscribe(io.jmix.ui.screen.Subscribe)

Example 2 with Order

use of test_support.entity.sales.Order in project jmix by jmix-framework.

the class MultiSelectListTestScreen method onInit.

@Subscribe
private void onInit(InitEvent event) {
    Order order = metadata.create(Order.class);
    orderDc.setItem(order);
    List<OrderLine> orderLines = IntStream.range(0, 5).mapToObj(i -> metadata.create(OrderLine.class)).collect(Collectors.toList());
    allOrderLinesDc.getMutableItems().addAll(orderLines);
    OrderLine orderLine = metadata.create(OrderLine.class);
    orderLineDc.setItem(orderLine);
    List<Product> products = IntStream.range(0, 5).mapToObj(i -> metadata.create(Product.class)).collect(Collectors.toList());
    allProductsDc.getMutableItems().addAll(products);
    CatalogObject catalog = metadata.create(CatalogObject.class);
    catalogDc.setItem(catalog);
}
Also used : Order(test_support.entity.sales.Order) IntStream(java.util.stream.IntStream) Subscribe(io.jmix.ui.screen.Subscribe) CollectionContainer(io.jmix.ui.model.CollectionContainer) UiController(io.jmix.ui.screen.UiController) Autowired(org.springframework.beans.factory.annotation.Autowired) Metadata(io.jmix.core.Metadata) Screen(io.jmix.ui.screen.Screen) Order(test_support.entity.sales.Order) OrderLine(test_support.entity.sales.OrderLine) Collectors(java.util.stream.Collectors) UiDescriptor(io.jmix.ui.screen.UiDescriptor) List(java.util.List) MultiSelectList(io.jmix.ui.component.MultiSelectList) InstanceContainer(io.jmix.ui.model.InstanceContainer) InstancePropertyContainer(io.jmix.ui.model.InstancePropertyContainer) Product(test_support.entity.sales.Product) CatalogObject(test_support.entity.model_objects.CatalogObject) OrderLine(test_support.entity.sales.OrderLine) Product(test_support.entity.sales.Product) CatalogObject(test_support.entity.model_objects.CatalogObject) Subscribe(io.jmix.ui.screen.Subscribe)

Example 3 with Order

use of test_support.entity.sales.Order in project jmix by jmix-framework.

the class NativeQueryTest method testNativeQueryWithDataManager.

@Test
@Disabled
public void testNativeQueryWithDataManager() {
    // https://www.cuba-platform.ru/discuss/t/problema-s-podgruzkoj-obekta-po-view-dobavlennogo-v-toj-zhe-tranzakiczii/5123
    // given:
    Customer customer = dataManager.create(Customer.class);
    customer.setName("c1");
    Order order = dataManager.create(Order.class);
    order.setNumber("c1");
    order.setCustomer(customer);
    dataManager.save(customer, order);
    storeAwareLocator.getTransactionTemplate(Stores.MAIN).executeWithoutResult(tx -> {
        EntityManager entityManager = storeAwareLocator.getEntityManager(Stores.MAIN);
        entityManager.createNativeQuery("select id from SALES_ORDER where ID = ?1", Order.class).setParameter(1, order.getId()).getSingleResult();
        Order reloadedOrder = dataManager.load(Order.class).id(order.getId()).fetchPlan(builder -> {
            builder.add("number").add("customer", FetchPlan.LOCAL);
        }).one();
        assertEquals("c1", reloadedOrder.getNumber());
        assertEquals(customer, reloadedOrder.getCustomer());
    });
}
Also used : Order(test_support.entity.sales.Order) BeforeEach(org.junit.jupiter.api.BeforeEach) DataManager(io.jmix.core.DataManager) DataAccessException(org.springframework.dao.DataAccessException) SpringExtension(org.springframework.test.context.junit.jupiter.SpringExtension) CoreConfiguration(io.jmix.core.CoreConfiguration) FetchPlan(io.jmix.core.FetchPlan) Autowired(org.springframework.beans.factory.annotation.Autowired) Customer(test_support.entity.sales.Customer) Order(test_support.entity.sales.Order) EntityManager(javax.persistence.EntityManager) Disabled(org.junit.jupiter.api.Disabled) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) DataConfiguration(io.jmix.data.DataConfiguration) Test(org.junit.jupiter.api.Test) AfterEach(org.junit.jupiter.api.AfterEach) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Stores(io.jmix.core.Stores) ContextConfiguration(org.springframework.test.context.ContextConfiguration) TestContextInititalizer(test_support.TestContextInititalizer) EclipselinkConfiguration(io.jmix.eclipselink.EclipselinkConfiguration) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataTestConfiguration(test_support.DataTestConfiguration) StoreAwareLocator(io.jmix.data.StoreAwareLocator) EntityManager(javax.persistence.EntityManager) Customer(test_support.entity.sales.Customer) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 4 with Order

use of test_support.entity.sales.Order in project jmix by jmix-framework.

the class CalendarTestScreen method initDataContainer.

protected void initDataContainer() {
    Order order = metadata.create(Order.class);
    ordersDc.setItems(Collections.singletonList(order));
}
Also used : Order(test_support.entity.sales.Order)

Example 5 with Order

use of test_support.entity.sales.Order in project jmix by jmix-framework.

the class EditorScreenFacetTestScreen method provideEntity.

@Install(to = "editorScreenFacet", subject = "entityProvider")
public Order provideEntity() {
    Order order = metadata.create(Order.class);
    order.setNumber("Test order");
    return order;
}
Also used : Order(test_support.entity.sales.Order) Install(io.jmix.ui.screen.Install)

Aggregations

Order (test_support.entity.sales.Order)8 Subscribe (io.jmix.ui.screen.Subscribe)4 Install (io.jmix.ui.screen.Install)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 CoreConfiguration (io.jmix.core.CoreConfiguration)1 DataManager (io.jmix.core.DataManager)1 FetchPlan (io.jmix.core.FetchPlan)1 Metadata (io.jmix.core.Metadata)1 Stores (io.jmix.core.Stores)1 DataConfiguration (io.jmix.data.DataConfiguration)1 StoreAwareLocator (io.jmix.data.StoreAwareLocator)1 EclipselinkConfiguration (io.jmix.eclipselink.EclipselinkConfiguration)1 MultiSelectList (io.jmix.ui.component.MultiSelectList)1 CollectionContainer (io.jmix.ui.model.CollectionContainer)1 InstanceContainer (io.jmix.ui.model.InstanceContainer)1 InstancePropertyContainer (io.jmix.ui.model.InstancePropertyContainer)1 Screen (io.jmix.ui.screen.Screen)1 UiController (io.jmix.ui.screen.UiController)1 UiDescriptor (io.jmix.ui.screen.UiDescriptor)1 List (java.util.List)1