use of cz.metacentrum.perun.core.api.Member in project perun by CESNET.
the class FacilitiesManagerBlImpl method getFacilitiesByPerunBean.
public List<Facility> getFacilitiesByPerunBean(PerunSession sess, PerunBean perunBean) throws InternalErrorException {
List<Facility> facilities = new ArrayList<Facility>();
//All possible useful objects
Vo vo = null;
Facility facility = null;
Group group = null;
Member member = null;
User user = null;
Host host = null;
Resource resource = null;
if (perunBean != null) {
if (perunBean instanceof Vo)
vo = (Vo) perunBean;
else if (perunBean instanceof Facility)
facility = (Facility) perunBean;
else if (perunBean instanceof Group)
group = (Group) perunBean;
else if (perunBean instanceof Member)
member = (Member) perunBean;
else if (perunBean instanceof User)
user = (User) perunBean;
else if (perunBean instanceof Host)
host = (Host) perunBean;
else if (perunBean instanceof Resource)
resource = (Resource) perunBean;
else {
throw new InternalErrorException("There is unrecognized object in primaryHolder of aidingAttr.");
}
} else {
throw new InternalErrorException("Aiding attribtue must have primaryHolder which is not null.");
}
if (group != null) {
List<Resource> resources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group);
for (Resource resourceElemenet : resources) {
facilities.add(getPerunBl().getResourcesManagerBl().getFacility(sess, resourceElemenet));
}
} else if (member != null) {
List<Group> groupsForMember = getPerunBl().getGroupsManagerBl().getAllMemberGroups(sess, member);
List<Resource> resourcesFromMember = new ArrayList<Resource>();
for (Group groupElement : groupsForMember) {
resourcesFromMember.addAll(getPerunBl().getResourcesManagerBl().getAssignedResources(sess, groupElement));
}
for (Resource resourceElement : resourcesFromMember) {
facilities.add(getPerunBl().getResourcesManagerBl().getFacility(sess, resourceElement));
}
} else if (resource != null) {
facilities.add(getPerunBl().getResourcesManagerBl().getFacility(sess, resource));
} else if (user != null) {
List<Member> membersFromUser = getPerunBl().getMembersManagerBl().getMembersByUser(sess, user);
List<Resource> resourcesFromMembers = new ArrayList<Resource>();
for (Member memberElement : membersFromUser) {
resourcesFromMembers.addAll(getPerunBl().getResourcesManagerBl().getAssignedResources(sess, member));
}
for (Resource resourceElement : resourcesFromMembers) {
facilities.add(getPerunBl().getResourcesManagerBl().getFacility(sess, resourceElement));
}
} else if (host != null) {
facilities.add(getPerunBl().getFacilitiesManagerBl().getFacilityForHost(sess, host));
} else if (vo != null) {
List<Resource> resources = getPerunBl().getResourcesManagerBl().getResources(sess, vo);
for (Resource resourceElemenet : resources) {
facilities.add(getPerunBl().getResourcesManagerBl().getFacility(sess, resourceElemenet));
}
}
facilities = new ArrayList<Facility>(new HashSet<Facility>(facilities));
return facilities;
}
use of cz.metacentrum.perun.core.api.Member in project perun by CESNET.
the class urn_perun_member_resource_attribute_def_virt_isBanned method resolveVirtualAttributeValueChange.
@Override
public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl perunSession, String message) throws InternalErrorException, WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException {
List<String> resolvingMessages = new ArrayList<>();
if (message == null)
return resolvingMessages;
Matcher banModificationMatcher = banModification.matcher(message);
List<Pair<Resource, Member>> listOfAffectedObjects = new ArrayList<>();
String operationType = "";
if (banModificationMatcher.find()) {
try {
String banType = banModificationMatcher.group(1);
operationType = banModificationMatcher.group(2);
int firstHolderId = Integer.valueOf(banModificationMatcher.group(3));
int secondHolderId = Integer.valueOf(banModificationMatcher.group(4));
if (operationType.equals(OPERATION_UPDATED)) {
operationType = OPERATION_SET;
} else if (!operationType.equals(OPERATION_SET) && !operationType.equals(OPERATION_REMOVED)) {
throw new InternalErrorException("Type of operation '" + operationType + "' is unknown by module.");
}
if (banType.equals(BanOnResource.class.getSimpleName())) {
Member member = perunSession.getPerunBl().getMembersManagerBl().getMemberById(perunSession, firstHolderId);
Resource resource = perunSession.getPerunBl().getResourcesManagerBl().getResourceById(perunSession, secondHolderId);
listOfAffectedObjects.add(new Pair(resource, member));
} else if (banType.equals(BanOnFacility.class.getSimpleName())) {
User user = perunSession.getPerunBl().getUsersManagerBl().getUserById(perunSession, firstHolderId);
Facility facility = perunSession.getPerunBl().getFacilitiesManagerBl().getFacilityById(perunSession, secondHolderId);
listOfAffectedObjects = getAffectedMemberResourceObjects(perunSession, user, facility);
} else {
throw new InternalErrorException("Type of ban '" + banType + "' is unkown by module.");
}
} catch (Exception e) {
log.error("Can't resolve virtual attribute value change for " + this.getClass().getSimpleName() + " module because of exception.", e);
//return empty array, do not throw exception because it can create problems
return new ArrayList<>();
}
}
for (Pair<Resource, Member> affectedObjects : listOfAffectedObjects) {
try {
Attribute attrVirtMemberResourceIsBanned = perunSession.getPerunBl().getAttributesManagerBl().getAttribute(perunSession, affectedObjects.getLeft(), affectedObjects.getRight(), AttributesManager.NS_MEMBER_RESOURCE_ATTR_VIRT + ":isBanned");
resolvingMessages.add(attrVirtMemberResourceIsBanned.serializeToString() + " " + operationType + " for " + affectedObjects.getLeft().serializeToString() + " and " + affectedObjects.getRight().serializeToString());
} catch (AttributeNotExistsException ex) {
//This means that attribute isBanned not exists at all so we can skip this process
log.info("Virtual attribute {} not exists.", this.getClass().getSimpleName());
break;
}
}
return resolvingMessages;
}
use of cz.metacentrum.perun.core.api.Member in project perun by CESNET.
the class FacilitiesManagerEntryIntegrationTest method addFacilityContactForAll2.
@Test
public void addFacilityContactForAll2() throws Exception {
System.out.println(CLASS_NAME + "addFacilityContactForAll2");
Member member = setUpMember(vo);
Group group = setUpGroup(vo, member);
User user = perun.getUsersManagerBl().getUserByMember(sess, member);
String contactGroupName = "testContactGroup01";
ContactGroup cg = new ContactGroup(contactGroupName, facility);
cg.setOwners(new ArrayList<>(Arrays.asList(owner)));
cg.setGroups(new ArrayList<>(Arrays.asList(group)));
RichUser richUser = new RichUser(user, null);
List<RichUser> users = perun.getUsersManagerBl().convertUsersToRichUsersWithAttributes(sess, Arrays.asList(richUser), getMandatoryAttrs());
cg.setUsers(new ArrayList<>(users));
facilitiesManagerEntry.addFacilityContact(sess, cg);
List<ContactGroup> cgs = facilitiesManagerEntry.getFacilityContactGroups(sess, facility);
assertTrue(cg.equals(cgs.get(0)));
assertEquals(owner.getId(), cgs.get(0).getOwners().get(0).getId());
assertEquals(group.getId(), cgs.get(0).getGroups().get(0).getId());
assertEquals(user.getId(), cgs.get(0).getUsers().get(0).getId());
}
use of cz.metacentrum.perun.core.api.Member in project perun by CESNET.
the class VOOT method isMemberOf.
/**
* Return groups that user is member of.
*
* @return groups that user is member of
* @throws VOOTException if the can not read groups of user
*/
private List<Group> isMemberOf() throws VOOTException {
List<Group> groups = new ArrayList<Group>();
List<Vo> vos = new ArrayList<Vo>();
try {
vos.addAll(perun.getUsersManagerBl().getVosWhereUserIsMember(session, user));
} catch (InternalErrorException ex) {
throw new VOOTException("internal_server_error");
}
try {
for (Vo vo : vos) {
Member member = perun.getMembersManagerBl().getMemberByUser(session, vo, user);
groups.addAll(perun.getGroupsManagerBl().getAllMemberGroups(session, member));
}
} catch (InternalErrorException ex) {
throw new VOOTException("internal_server_error");
} catch (MemberNotExistsException ex) {
throw new VOOTException("not_a_member");
}
return groups;
}
use of cz.metacentrum.perun.core.api.Member in project perun by CESNET.
the class AttributesManagerBlImpl method getRichAttributesWithHoldersForAttributeDefinition.
@Override
public List<RichAttribute> getRichAttributesWithHoldersForAttributeDefinition(PerunSession sess, AttributeDefinition attrDef, RichAttribute aidingAttr) throws AttributeNotExistsException, UserNotExistsException, VoNotExistsException, WrongAttributeAssignmentException, GroupResourceMismatchException, MemberResourceMismatchException, MemberGroupMismatchException {
// Filling objects from aidingAttr
if (aidingAttr == null)
throw new InternalErrorException("Aiding attribute cant be null.");
if (attrDef == null)
throw new InternalErrorException("attrDef cant be null.");
List<RichAttribute> listOfRichAttributes = new ArrayList<>();
// All possible useful objects
Vo vo = null;
Facility facility = null;
Group group = null;
Member member = null;
User user = null;
Host host = null;
Resource resource = null;
String key = null;
UserExtSource userExtSource = null;
// Get object for primaryHolder of aidingAttr
if (aidingAttr.getPrimaryHolder() != null) {
if (aidingAttr.getPrimaryHolder() instanceof Vo)
vo = (Vo) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof Facility)
facility = (Facility) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof Group)
group = (Group) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof Member)
member = (Member) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof User)
user = (User) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof Host)
host = (Host) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof Resource)
resource = (Resource) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof UserExtSource)
userExtSource = (UserExtSource) aidingAttr.getPrimaryHolder();
else if (aidingAttr.getPrimaryHolder() instanceof String)
key = (String) aidingAttr.getPrimaryHolder();
else {
throw new InternalErrorException("There is unrecognized object in primaryHolder of aidingAttr.");
}
} else {
throw new InternalErrorException("Aiding attribute must have primaryHolder which is not null.");
}
// Get object for secondaryHolder of aidingAttr
if (aidingAttr.getSecondaryHolder() != null) {
if (aidingAttr.getSecondaryHolder() instanceof Vo)
vo = (Vo) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof Facility)
facility = (Facility) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof Group)
group = (Group) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof Member)
member = (Member) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof User)
user = (User) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof Host)
host = (Host) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof Resource)
resource = (Resource) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof UserExtSource)
userExtSource = (UserExtSource) aidingAttr.getSecondaryHolder();
else if (aidingAttr.getSecondaryHolder() instanceof String)
key = (String) aidingAttr.getSecondaryHolder();
else {
throw new InternalErrorException("There is unrecognized object in secondaryHolder of aidingAttr");
}
}
if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_VO_ATTR)) {
if (resource != null && member != null) {
// we do not need object resource to resolve this case
listOfRichAttributes.addAll(this.getVoAttributes(sess, member, attrDef));
} else if (group != null && resource != null) {
// we do not need object resource to resolve this case
listOfRichAttributes.addAll(this.getVoAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
// we do not need object group to resolve this case
listOfRichAttributes.addAll(this.getVoAttributes(sess, member, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getVoAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_GROUP_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getGroupAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getGroupAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_FACILITY_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the group object here
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getFacilityAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_MEMBER_ATTR)) {
if (resource != null && member != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getMemberAttributes(sess, member, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getMemberAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
// we do not need to use the group object here
listOfRichAttributes.addAll(this.getMemberAttributes(sess, member, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getMemberAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_RESOURCE_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the group object here
listOfRichAttributes.addAll(this.getResourceAttributes(sess, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getResourceAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_USER_ATTR)) {
if (resource != null && member != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getUserAttributes(sess, member, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getUserAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
// we do not need to use the group object here
listOfRichAttributes.addAll(this.getUserAttributes(sess, member, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getUserAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, AttributesManager.NS_HOST_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
// we do not need to user the group object here
listOfRichAttributes.addAll(this.getHostAttributes(sess, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getHostAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_GROUP_RESOURCE_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, group, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getGroupResourceAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_MEMBER_GROUP_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the resource object
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getMemberGroupAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_MEMBER_RESOURCE_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, group, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getMemberResourceAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_USER_FACILITY_ATTR)) {
if (resource != null && member != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, member, resource, attrDef));
} else if (group != null && resource != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, group, resource, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, member, group, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getUserFacilityAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, NS_UES_ATTR)) {
if (resource != null && member != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, member, attrDef));
} else if (group != null && resource != null) {
// we do not need to use the resource object here
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, group, attrDef));
} else if (user != null && facility != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, user, facility, attrDef));
} else if (member != null && group != null) {
// we do not need to use the group object here
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, member, attrDef));
} else if (group != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, group, attrDef));
} else if (member != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, member, attrDef));
} else if (resource != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, resource, attrDef));
} else if (user != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, user, attrDef));
} else if (host != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, host, attrDef));
} else if (facility != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, facility, attrDef));
} else if (vo != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, vo, attrDef));
} else if (userExtSource != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, userExtSource, attrDef));
} else if (key != null) {
listOfRichAttributes.addAll(this.getUserExtSourceAttributes(sess, attrDef));
} else {
throw new InternalErrorException("Unknown combination of PerunBeans: " + aidingAttr);
}
} else if (getAttributesManagerImpl().isFromNamespace(attrDef, AttributesManager.NS_ENTITYLESS_ATTR)) {
if (key != null) {
listOfRichAttributes.addAll(getEntitylessAttributes(sess, key, attrDef));
} else {
listOfRichAttributes.addAll(getEntitylessAttributes(sess, attrDef));
}
} else {
throw new InternalErrorException("There is unrecognized namespace in attribute " + attrDef);
}
listOfRichAttributes = new ArrayList<>(new HashSet<>(listOfRichAttributes));
return listOfRichAttributes;
}
Aggregations