use of ui.ex1.entity.Product in project jmix-docs by Haulmont.
the class CurrencyFieldScreen method onInit.
@Subscribe
public void onInit(InitEvent event) {
// InstanceContainer initialization. It is usually done automatically if the screen is
// inherited from StandardEditor and is used as an entity editor.
Product product = metadata.create(Product.class);
productDc.setItem(product);
}
use of ui.ex1.entity.Product in project odata-client by davidmoten.
the class CustomRequestTest method testCustomRequestGet.
@Test
public void testCustomRequestGet() {
Test5Service client = //
Test5Service.test().expectRequest(//
"/Products/1").withResponse(//
"/response-product-1.json").withRequestHeaders(RequestHeader.ACCEPT_JSON, //
RequestHeader.ODATA_VERSION).build();
Product p = client._custom().get("https://testing.com/Products/1", Product.class, HttpRequestOptions.EMPTY);
System.out.println(p);
assertEquals(1, (int) p.getID().get());
}
use of ui.ex1.entity.Product in project jmix-docs by Haulmont.
the class OrderServiceTest method setUp.
@BeforeEach
void setUp() {
Customer customer1 = dataManager.create(Customer.class);
customer1.setName("Alice");
customer1.setEmail("alice@company.com");
Product product1 = dataManager.create(Product.class);
product1.setName("MacBook Pro");
product1.setPrice(BigDecimal.valueOf(2500));
order1 = dataManager.create(Order.class);
order1.setCustomer(customer1);
order1.setDate(LocalDate.now());
order1.setAmount(BigDecimal.valueOf(5000));
OrderLine orderLine1 = dataManager.create(OrderLine.class);
orderLine1.setOrder(order1);
orderLine1.setProduct(product1);
orderLine1.setQuantity(2.0);
dataManager.save(customer1, order1, orderLine1, product1);
}
use of ui.ex1.entity.Product in project jmix-docs by Haulmont.
the class OrderServiceTest method testHardDelete.
@Test
void testHardDelete() {
Product product1 = dataManager.create(Product.class);
product1.setName("MacBook Pro");
dataManager.save(product1);
orderService.hardDelete(product1);
assertFalse(dataManager.load(Id.of(product1)).hint(PersistenceHints.SOFT_DELETION, false).optional().isPresent());
}
use of ui.ex1.entity.Product in project jmix-docs by Haulmont.
the class ProductEntityEventListener method onProductLoading.
@EventListener
void onProductLoading(EntityLoadingEvent<Product> event) {
Product product = event.getEntity();
try {
ProductPart[] productPartsArray = objectMapper.readValue(product.getParts(), ProductPart[].class);
product.setPartsList(productPartsArray == null ? null : Arrays.asList(productPartsArray));
} catch (JsonProcessingException e) {
throw new RuntimeException("Error reading JSON", e);
}
}
Aggregations