}
if(getProductCategory().getPlannedMargin() == 0){
addActionError("Planned Margin is required ");
}
ProductCategory productCategory;
if(getProductCategory().getId() == null || "".equalsIgnoreCase(getProductCategory().getId())){
productCategory = new ProductCategory();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
productCategory = (ProductCategory) manager.getById(ProductCategory.class, getProductCategory().getId());
logInfo = productCategory.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
productCategory.setLogInformation(logInfo);
productCategory.setSearchKey(getProductCategory().getSearchKey());
productCategory.setDescription(getProductCategory().getDescription());
productCategory.setParentId(getParentProductCategory());
productCategory.setMaterialPolice(getProductCategory().getMaterialPolice());
productCategory.setPdefault(getProductCategory().getPdefault());
productCategory.setSelfService(getProductCategory().getSelfService());
productCategory.setPlannedMargin(getProductCategory().getPlannedMargin());
productCategory.setAssetGroup(getAssetGroup());
manager.save(productCategory);
setProductCategory(getProductCategory());
return SUCCESS;
}