use of com.qcadoo.mes.basic.constants.ProductFamilyElementType in project mes by qcadoo.
the class ProductHooksD method onSave.
public void onSave(final DataDefinition dataDefinition, final Entity product) {
if (Objects.nonNull(product.getId())) {
Entity productFromDB = dataDefinition.get(product.getId());
ProductFamilyElementType oldProductType = ProductFamilyElementType.from(productFromDB);
ProductFamilyElementType newProductType = ProductFamilyElementType.from(product);
if (oldProductType.compareTo(newProductType) != 0) {
if (ProductFamilyElementType.PARTICULAR_PRODUCT.compareTo(newProductType) == 0) {
moveCompanyProductFamiliesToCompanyProducts(product);
} else if (ProductFamilyElementType.PRODUCTS_FAMILY.compareTo(newProductType) == 0) {
moveCompanyProductsToCompanyProductFamilies(product);
}
}
}
updateDefaultSupplier(dataDefinition, product);
}
Aggregations