@Override @Transactional(readOnly = true) public boolean canRemoveMaterial(Material material) { if(material.isNewObject()) { return true; } return materialAssignmentDAO.getByMaterial(material).size() == 0; }
@Override protected void restoreOldCodes() { getCurrentEntity().setCode(oldCodes.get(getCurrentEntity())); for (Material child : ((MaterialCategory) getCurrentEntity()) .getMaterials()) { if (!child.isNewObject()) { child.setCode(oldMaterialCodes.get(child)); } } }