use of datamodel.ex1.entity.ProductPart in project jmix-docs by Haulmont.
the class ProductEdit method onPartsTableCreate.
@Subscribe("partsTable.create")
public void onPartsTableCreate(Action.ActionPerformedEvent event) {
ProductPart part = dataContext.create(ProductPart.class);
partsDc.getMutableItems().add(part);
}
use of datamodel.ex1.entity.ProductPart 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