Source:
public void assignService(PerunSession sess, Resource resource, Service service) throws InternalErrorException, ServiceNotExistsException, ServiceAlreadyAssignedException, WrongAttributeValueException, WrongReferenceAttributeValueException { getResourcesManagerImpl().assignService(sess, resource, service); getPerunBl().getAuditer().log(sess, "{} asigned to {}", service, resource); AttributesManagerBl attributesManagerBl = getPerunBl().getAttributesManagerBl(); try { List<Group> groups = getAssignedGroups(sess, resource); for(Group group : groups) { List<Attribute> attributes; attributes = attributesManagerBl.getRequiredAttributes(sess, service, resource, group, true); attributes = attributesManagerBl.fillAttributes(sess, resource, group, attributes, true); attributesManagerBl.setAttributes(sess, resource, group, attributes, true); } Facility facility = getFacility(sess, resource); for(Attribute attr: attributesManagerBl.getAttributes(sess, facility)) attributesManagerBl.checkAttributeValue(sess, facility, attr); for(Attribute attr: attributesManagerBl.getAttributes(sess, resource)) attributesManagerBl.checkAttributeValue(sess, resource, attr); List<Member> members = getAllowedMembers(sess, resource); List<Attribute> attributes; for(Member member : members) { User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); attributes = attributesManagerBl.getRequiredAttributes(sess, service, facility, resource, user, member); attributes = attributesManagerBl.fillAttributes(sess, facility, resource, user, member, attributes); attributesManagerBl.setAttributes(sess, facility, resource, user, member, attributes); } } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } }

Target:
public void assignService(PerunSession sess, Resource resource, Service service) throws InternalErrorException, ServiceNotExistsException, ServiceAlreadyAssignedException, WrongAttributeValueException, WrongReferenceAttributeValueException { getResourcesManagerImpl().assignService(sess, resource, service); getPerunBl().getAuditer().log(sess, "{} asigned to {}", service, resource); AttributesManagerBl attributesManagerBl = getPerunBl().getAttributesManagerBl(); try { List<Group> groups = getAssignedGroups(sess, resource); for(Group group : groups) { List<Attribute> attributes; attributes = attributesManagerBl.getRequiredAttributes(sess, service, resource, group, true); attributes = attributesManagerBl.fillAttributes(sess, resource, group, attributes, true); attributesManagerBl.setAttributes(sess, resource, group, attributes, true); } Facility facility = getFacility(sess, resource); attributesManagerBl.checkAttributesValue(sess, facility, attributesManagerBl.getAttributes(sess, facility)); attributesManagerBl.checkAttributesValue(sess, resource, attributesManagerBl.getAttributes(sess, resource)); List<Member> members = getAllowedMembers(sess, resource); for(Member member : members) { User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); List<Attribute> attributes = attributesManagerBl.getRequiredAttributes(sess, service, facility, resource, user, member); attributes = attributesManagerBl.fillAttributes(sess, facility, resource, user, member, attributes); attributesManagerBl.setAttributes(sess, facility, resource, user, member, attributes); } } catch(WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } }