Source:
public List<RichMember> convertMembersToRichMembersWithAttributes(PerunSession sess, Group group, List<RichMember> richMembers, List<AttributeDefinition> attrsDef) throws InternalErrorException, WrongAttributeAssignmentException { List<AttributeDefinition> usersAttributesDef = new ArrayList<AttributeDefinition>(); List<AttributeDefinition> membersAttributesDef = new ArrayList<AttributeDefinition>(); List<AttributeDefinition> groupAttributesDef = new ArrayList<AttributeDefinition>(); for(AttributeDefinition attrd: attrsDef) { if(attrd.getName().startsWith(AttributesManager.NS_USER_ATTR)) usersAttributesDef.add(attrd); else if(attrd.getName().startsWith(AttributesManager.NS_MEMBER_ATTR)) membersAttributesDef.add(attrd); else if(attrd.getName().startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) groupAttributesDef.add(attrd); } for (RichMember richMember: richMembers) { List<Attribute> userAttributes = new ArrayList<Attribute>(); List<Attribute> memberAttributes = new ArrayList<Attribute>(); List<String> userAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: usersAttributesDef) { userAttrNames.add(ad.getName()); } userAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember.getUser(), userAttrNames)); List<String> memberAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: membersAttributesDef) { memberAttrNames.add(ad.getName()); } memberAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember, memberAttrNames)); List<String> groupAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: groupAttributesDef) { groupAttrNames.add(ad.getName()); } memberAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember, group, groupAttrNames)); richMember.setUserAttributes(userAttributes); richMember.setMemberAttributes(memberAttributes); } return richMembers; }

Target:
public List<RichMember> convertMembersToRichMembersWithAttributes(PerunSession sess, Group group, List<RichMember> richMembers, List<AttributeDefinition> attrsDef) throws InternalErrorException { List<AttributeDefinition> usersAttributesDef = new ArrayList<AttributeDefinition>(); List<AttributeDefinition> membersAttributesDef = new ArrayList<AttributeDefinition>(); List<AttributeDefinition> memberGroupAttributesDef = new ArrayList<AttributeDefinition>(); for(AttributeDefinition attrd: attrsDef) { if(attrd.getName().startsWith(AttributesManager.NS_USER_ATTR)) usersAttributesDef.add(attrd); else if(attrd.getName().startsWith(AttributesManager.NS_MEMBER_ATTR)) membersAttributesDef.add(attrd); else if(attrd.getName().startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)) memberGroupAttributesDef.add(attrd); } for (RichMember richMember: richMembers) { List<Attribute> userAttributes = new ArrayList<Attribute>(); List<Attribute> memberAttributes = new ArrayList<Attribute>(); List<String> userAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: usersAttributesDef) { userAttrNames.add(ad.getName()); } userAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember.getUser(), userAttrNames)); List<String> memberAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: membersAttributesDef) { memberAttrNames.add(ad.getName()); } memberAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember, memberAttrNames)); List<String> groupAttrNames = new ArrayList<String>(); for(AttributeDefinition ad: memberGroupAttributesDef) { groupAttrNames.add(ad.getName()); } memberAttributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, richMember, group, groupAttrNames)); richMember.setUserAttributes(userAttributes); richMember.setMemberAttributes(memberAttributes); } return richMembers; }