Package cz.metacentrum.perun.core.impl
Class ResourcesManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.ResourcesManagerImpl
- All Implemented Interfaces:
ResourcesManagerImplApi
- Author:
- Slavek Licehammer glory@ics.muni.cz
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final RowMapper
<AssignedResource> protected static final String
protected static final RowMapper
<BanOnResource> protected static final String
protected static final RowMapper
<GroupResourceAssignment> protected static final String
protected static final String
protected static final RowMapper
<ResourceTag> protected static final String
protected static final RowMapper
<RichResource> protected static final cz.metacentrum.perun.core.impl.ResourcesManagerImpl.RichResourceExtractor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
assignAutomaticGroupToResource
(PerunSession sess, Group group, Resource resource, Group sourceGroup) Assign group to a resource (automatic subgroup assignment).void
assignGroupToResource
(PerunSession sess, Group group, Resource resource, boolean autoAssignSubgroups) Assign group to a resource.void
assignGroupToResourceState
(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) Set initial status to group-resource assignment.void
assignResourceTagToResource
(PerunSession perunSession, ResourceTag resourceTag, Resource resource) Assign existing ResourceTag on existing Resource.void
assignService
(PerunSession sess, Resource resource, Service service) Assign service to resource.boolean
banExists
(PerunSession sess, int banId) Get true if any band defined by id exists for any member and resource.boolean
banExists
(PerunSession sess, int memberId, int resourceId) Get true if any ban for member and resource exists.void
checkResourceExists
(PerunSession sess, Resource resource) Check if resource exists in underlaying data source.void
checkResourceTagExists
(PerunSession sess, ResourceTag resourceTag) Check if resource tag exists in underlaying data source.createResource
(PerunSession sess, Vo vo, Resource resource, Facility facility) Creates the resource.createResourceTag
(PerunSession perunSession, ResourceTag resourceTag, Vo vo) Create new Resource tag.void
deleteAllResourcesTagsForVo
(PerunSession perunSession, Vo vo) Delete all ResourcesTags for specific VO.void
deleteResource
(PerunSession sess, Vo vo, Resource resource) Deletes resource by id.void
deleteResourceTag
(PerunSession perunSession, ResourceTag resourceTag) Delete existing Resource tag.getAdminGroups
(PerunSession sess, Resource resource) Gets list of all group administrators of the Resource.getAdmins
(PerunSession sess, Resource resource) Gets list of all user administrators of the Resource.Get all expired bans on any resource to now dategetAllowedMembers
(PerunSession sess, Resource resource) Returns all members who are "allowed" on the resource disregarding their possible expired status in a group.getAllowedMembersNotExpiredInGroup
(PerunSession sess, Resource resource) Returns all members which are allowed on the resource and are not expired within their assigned groups.getAllowedResources
(PerunSession sess, Facility facility, User user) Return all resources through which user is allowed on facility.getAllowedUsers
(PerunSession sess, Resource resource) Returns all users who are allowed on the defined resource.getAllowedUsersNotExpiredInGroup
(PerunSession sess, Resource resource) Returns all users which are allowed on the resource and are not expired within their assigned groups.getAllResources
(PerunSession sess) Get all resources from database.getAllResourcesByResourceTag
(PerunSession perunSession, ResourceTag resourceTag) Get all resources in specific Vo (specific by resourceTag.getVoId) for existing resourceTaggetAllResourcesTagsForResource
(PerunSession perunSession, Resource resource) Get all resourcesTags for existing ResourcegetAllResourcesTagsForVo
(PerunSession perunSession, Vo vo) Get all resourcesTags for existing Vo.getAssignedMembers
(PerunSession sess, Resource resource) Returns all members who are assigned on the defined resource.getAssignedMembersWithStatus
(PerunSession sess, Resource resource) Returns members of groups assigned to resource with status of group-resource assignment.getAssignedResources
(PerunSession sess, Group group) List all resources to which the group is assigned.getAssignedResources
(PerunSession sess, Member member) Returns all resources where the member is assigned through the groups.getAssignedResources
(PerunSession sess, Member member, Service service) Returns all resources where member and service are assigned together.getAssignedResources
(PerunSession sess, User user, Vo vo) Returns all resources where the user is assigned through the specified vo and its groups.getAssignedResourcesWithStatus
(PerunSession sess, Member member) Returns all assigned resources where member is assigned through the groups.getAssignedRichResources
(PerunSession sess, Group group) List of all rich resources associated with the group.getAssignedRichResources
(PerunSession sess, Member member) Returns all rich resources where the member is assigned through the groups.getAssignedRichResources
(PerunSession sess, Member member, Service service) Returns all rich resources where the service and the member are assigned through the groups.getAssignedServices
(PerunSession sess, Resource resource) List all services' id associated with the resource.getAssignedUsers
(PerunSession sess, Resource resource) Returns all user assigned to the resource.getAssociatedMembers
(PerunSession sess, Resource resource) Returns all members who are associated with the resource.getAssociatedResources
(PerunSession sess, Group group) List all resources associated with the group.getAssociatedResources
(PerunSession sess, Member member) Returns all resources with which the member is associated through the groups.getAssociatedUsers
(PerunSession sess, Resource resource) Returns all users who are associated with the defined resource.getBan
(PerunSession sess, int memberId, int resourceId) Get specific resource ban.getBanById
(PerunSession sess, int banId) Get Ban for member on resource by it's idgetBansForMember
(PerunSession sess, int memberId) Get all resources bans for member.getBansForResource
(PerunSession sess, int resourceId) Get all members bans for resourcegetDirectAdmins
(PerunSession perunSession, Resource resource) Gets list of direct user administrators of the Resource.int
getFacilityId
(PerunSession sess, Resource resource) Deprecated.getFailedGroupResourceAssignmentCause
(PerunSession sess, Group group, Resource resource) Gets the current cause of failed group-resource assignment.getGroupAssignments
(PerunSession sess, Resource resource) Lists all of the assigned groups for the given resource without the groups' attributes.getGroupResourceAssignments
(PerunSession sess, List<GroupResourceStatus> statuses) Lists all group-resource assignments with given statuses.getGroupResourceStatus
(PerunSession sess, Group group, Resource resource) Gets status of given group-resource assignment.getResourceAssignments
(PerunSession sess, Group group) Lists all of the resource assignments for the given group without the resources' attributes.getResourceById
(PerunSession sess, int id) Searches for the Resource with specified id.getResourceByName
(PerunSession sess, Vo vo, Facility facility, String name) Return resource by its name.getResources
(PerunSession sess) Get all resources.getResources
(PerunSession sess, User user, List<Status> memberStatuses, List<MemberGroupStatus> memberGroupStatuses, List<GroupResourceStatus> groupResourceStatuses) Return all resources where user is assigned.getResources
(PerunSession sess, Vo vo) Get all VO resources.getResourcesByAttribute
(PerunSession sess, Attribute attribute) Returns all resources which have set the attribute with the value.getResourcesByIds
(PerunSession sess, List<Integer> ids) Gets resources by their ids.int
Get count of all resources.int
getResourcesCount
(PerunSession perunSession, Vo vo) Get all VO resources count.getResourcesWhereGroupIsAdmin
(PerunSession sess, Facility facility, Vo vo, Group authorizedGroup) Return all resources for the facility and the vo where the group is authorized as resource manager.getResourcesWhereUserIsAdmin
(PerunSession sess, Facility facility, Vo vo, User authorizedUser) Return all resources for the facility and the vo where user is authorized as resource manager.getResourcesWhereUserIsAdmin
(PerunSession sess, User user) Returns list of resources, where the user is an admin.getResourcesWhereUserIsAdmin
(PerunSession sess, Vo vo, User authorizedUser) Return all resources for the vo where user is authorized as resource manager.getRichResourceById
(PerunSession sess, int id) Searches for the Rich Resource with specified id.getRichResources
(PerunSession sess, Vo vo) Get all VO rich resources.getRichResourcesByIds
(PerunSession perunSession, List<Integer> ids) Gets rich resources by their ids.getRichResourcesWithMemberAndAttribute
(PerunSession perunSession, Member member, AttributeDefinition ad) Return all rich resources with given attribute where given member is assigned.boolean
groupResourceAssignmentExists
(PerunSession sess, Resource resource, Group group) Returns true if the group is assigned to the current resource with any status, false otherwise.protected void
boolean
isGroupAssigned
(PerunSession sess, Resource resource, Group group) Returns true if the group is assigned to the current resource with ACTIVE status, false otherwise.boolean
isGroupManuallyAssigned
(PerunSession sess, Group group, Resource resource) Returns true if the group is assigned to the given resource manually, false otherwise.boolean
isUserAllowed
(PerunSession sess, User user, Resource resource) Check if the user is allowed as a member on the selected resource.boolean
isUserAssigned
(PerunSession sess, User user, Resource resource) Check if the user is assigned as a member on the selected resource.void
removeAllResourcesTagFromResource
(PerunSession perunSession, Resource resource) Remove all existing Resource tags for specific resource.void
removeAutomaticGroupFromResource
(PerunSession perunSession, Group group, Resource resource, int sourceGroupId) Remove automatically assigned group from resource.void
removeBan
(PerunSession sess, int banId) Remove ban by id from resources bans.void
removeBan
(PerunSession sess, int memberId, int resourceId) Remove ban by member_id and facility_idvoid
removeGroupFromResource
(PerunSession sess, Group group, Resource resource) Remove group from a resource.void
removeResourceTagFromResource
(PerunSession perunSession, ResourceTag resourceTag, Resource resource) Remove specific ResourceTag from existing Resource.void
removeService
(PerunSession sess, Resource resource, Service service) Remove service from resource.boolean
resourceExists
(PerunSession sess, Resource resource) Check if resource exists in underlaying data source.boolean
resourceTagExists
(PerunSession sess, ResourceTag resourceTag) setBan
(PerunSession sess, BanOnResource banOnResource) Set ban for member on resourcevoid
setFailedGroupResourceAssignmentCause
(PerunSession sess, Group group, Resource resource, String cause) Sets the cause of failed group-resource assignmentvoid
setGroupResourceStatus
(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) Sets status of given group-resource assignment to the specified status.updateBan
(PerunSession sess, BanOnResource banOnResource) Update description and validity timestamp of specific ban.updateResource
(PerunSession sess, Resource resource) Updates Resource.updateResourceTag
(PerunSession perunSession, ResourceTag resourceTag) Update existing Resource tag.
-
Field Details
-
RESOURCE_MAPPING_SELECT_QUERY
- See Also:
-
ASSIGNED_RESOURCE_MAPPING_SELECT_QUERY
- See Also:
-
GROUP_RESOURCE_ASSIGNMENT_MAPPING_SELECT_QUERY
- See Also:
-
RESOURCE_TAG_MAPPING_SELECT_QUERY
- See Also:
-
BAN_ON_RESOURCE_MAPPING_SELECT_QUERY
- See Also:
-
RESOURCE_MAPPER
-
ASSIGNED_RESOURCE_MAPPER
-
GROUP_RESOURCE_ASSIGNMENT_MAPPER
-
RESOURCE_TAG_MAPPER
-
RICH_RESOURCE_MAPPER
-
BAN_ON_RESOURCE_MAPPER
-
RICH_RESOURCE_WITH_TAGS_EXTRACTOR
protected static final cz.metacentrum.perun.core.impl.ResourcesManagerImpl.RichResourceExtractor RICH_RESOURCE_WITH_TAGS_EXTRACTOR
-
-
Constructor Details
-
ResourcesManagerImpl
-
-
Method Details
-
assignAutomaticGroupToResource
public void assignAutomaticGroupToResource(PerunSession sess, Group group, Resource resource, Group sourceGroup) throws GroupAlreadyAssignedException Description copied from interface:ResourcesManagerImplApi
Assign group to a resource (automatic subgroup assignment).- Specified by:
assignAutomaticGroupToResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-resource
-sourceGroup
-- Throws:
GroupAlreadyAssignedException
-
assignGroupToResource
public void assignGroupToResource(PerunSession sess, Group group, Resource resource, boolean autoAssignSubgroups) throws GroupAlreadyAssignedException Description copied from interface:ResourcesManagerImplApi
Assign group to a resource.- Specified by:
assignGroupToResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-resource
-autoAssignSubgroups
-- Throws:
GroupAlreadyAssignedException
-
assignGroupToResourceState
public void assignGroupToResourceState(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) Description copied from interface:ResourcesManagerImplApi
Set initial status to group-resource assignment.- Specified by:
assignGroupToResourceState
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-resource
-status
- Status of the group-resource assignment
-
assignResourceTagToResource
public void assignResourceTagToResource(PerunSession perunSession, ResourceTag resourceTag, Resource resource) Description copied from interface:ResourcesManagerImplApi
Assign existing ResourceTag on existing Resource.- Specified by:
assignResourceTagToResource
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resource
-
-
assignService
public void assignService(PerunSession sess, Resource resource, Service service) throws ServiceAlreadyAssignedException Description copied from interface:ResourcesManagerImplApi
Assign service to resource.- Specified by:
assignService
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-service
-- Throws:
ServiceAlreadyAssignedException
-
banExists
Description copied from interface:ResourcesManagerImplApi
Get true if any ban for member and resource exists.- Specified by:
banExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-memberId
- id of memberresourceId
- id of resource- Returns:
- true if ban exists
-
banExists
Description copied from interface:ResourcesManagerImplApi
Get true if any band defined by id exists for any member and resource.- Specified by:
banExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-banId
- id of ban- Returns:
- true if ban exists
-
checkResourceExists
public void checkResourceExists(PerunSession sess, Resource resource) throws ResourceNotExistsException Description copied from interface:ResourcesManagerImplApi
Check if resource exists in underlaying data source.- Specified by:
checkResourceExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Throws:
ResourceNotExistsException
-
checkResourceTagExists
public void checkResourceTagExists(PerunSession sess, ResourceTag resourceTag) throws ResourceTagNotExistsException Description copied from interface:ResourcesManagerImplApi
Check if resource tag exists in underlaying data source.- Specified by:
checkResourceTagExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resourceTag
-- Throws:
ResourceTagNotExistsException
-
createResource
Description copied from interface:ResourcesManagerImplApi
Creates the resource. This methods sets ids and uuid to the given resource object but returns a new resource object loaded from db.- Specified by:
createResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
-resource
-facility
-- Returns:
- newly created resource with id
-
createResourceTag
Description copied from interface:ResourcesManagerImplApi
Create new Resource tag.- Specified by:
createResourceTag
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resourceTag
-vo
-- Returns:
- new created resourceTag
-
deleteAllResourcesTagsForVo
Description copied from interface:ResourcesManagerImplApi
Delete all ResourcesTags for specific VO.- Specified by:
deleteAllResourcesTagsForVo
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-vo
-
-
deleteResource
public void deleteResource(PerunSession sess, Vo vo, Resource resource) throws ResourceAlreadyRemovedException Description copied from interface:ResourcesManagerImplApi
Deletes resource by id.- Specified by:
deleteResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
-resource
-- Throws:
ResourceAlreadyRemovedException
- if there are 0 rows affected by deleting from DB
-
deleteResourceTag
Description copied from interface:ResourcesManagerImplApi
Delete existing Resource tag.- Specified by:
deleteResourceTag
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resourceTag
-
-
getAdminGroups
Description copied from interface:ResourcesManagerImplApi
Gets list of all group administrators of the Resource.- Specified by:
getAdminGroups
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of groups who are admins in the resource
-
getAdmins
Description copied from interface:ResourcesManagerImplApi
Gets list of all user administrators of the Resource. If some group is administrator of the given resource, all VALID members are included in the list.- Specified by:
getAdmins
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of users who are admins in the resource
-
getAllExpiredBansOnResources
Description copied from interface:ResourcesManagerImplApi
Get all expired bans on any resource to now date- Specified by:
getAllExpiredBansOnResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-- Returns:
- list of expired bans for any resource
-
getAllResources
Description copied from interface:ResourcesManagerImplApi
Get all resources from database.- Specified by:
getAllResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
- Perun session- Returns:
- list of all resources
-
getAllResourcesByResourceTag
public List<Resource> getAllResourcesByResourceTag(PerunSession perunSession, ResourceTag resourceTag) Description copied from interface:ResourcesManagerImplApi
Get all resources in specific Vo (specific by resourceTag.getVoId) for existing resourceTag- Specified by:
getAllResourcesByResourceTag
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resourceTag
-- Returns:
- list of Resources
-
getAllResourcesTagsForResource
public List<ResourceTag> getAllResourcesTagsForResource(PerunSession perunSession, Resource resource) Description copied from interface:ResourcesManagerImplApi
Get all resourcesTags for existing Resource- Specified by:
getAllResourcesTagsForResource
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resource
-- Returns:
- list of ResourcesTags
-
getAllResourcesTagsForVo
Description copied from interface:ResourcesManagerImplApi
Get all resourcesTags for existing Vo.- Specified by:
getAllResourcesTagsForVo
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-vo
-- Returns:
- list of all resourcesTags for existing Vo
-
getAllowedMembers
Description copied from interface:ResourcesManagerImplApi
Returns all members who are "allowed" on the resource disregarding their possible expired status in a group. All members include all group statuses, through which they can be filtered if necessary.- Specified by:
getAllowedMembers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of members
-
getAllowedMembersNotExpiredInGroup
Description copied from interface:ResourcesManagerImplApi
Returns all members which are allowed on the resource and are not expired within their assigned groups. It means if member is allowed on the resource, but only through expired groups, it is filtered out.- Specified by:
getAllowedMembersNotExpiredInGroup
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of members
-
getAllowedResources
Description copied from interface:ResourcesManagerImplApi
Return all resources through which user is allowed on facility.- Specified by:
getAllowedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-facility
-user
-- Returns:
- List of allowed resources for the user on facility
-
getAllowedUsers
Description copied from interface:ResourcesManagerImplApi
Returns all users who are allowed on the defined resource.- Specified by:
getAllowedUsers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of users
-
getAllowedUsersNotExpiredInGroup
Description copied from interface:ResourcesManagerImplApi
Returns all users which are allowed on the resource and are not expired within their assigned groups. It means if user is allowed on the resource, but only through expired groups, it is filtered out.- Specified by:
getAllowedUsersNotExpiredInGroup
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of users
-
getAssignedMembers
Description copied from interface:ResourcesManagerImplApi
Returns all members who are assigned on the defined resource.- Specified by:
getAssignedMembers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of members
-
getAssignedMembersWithStatus
Description copied from interface:ResourcesManagerImplApi
Returns members of groups assigned to resource with status of group-resource assignment. RichMember attribute has only Member set.- Specified by:
getAssignedMembersWithStatus
in interfaceResourcesManagerImplApi
- Parameters:
sess
- perunSessionresource
- resource- Returns:
- list of members of groups assigned to given resource
-
getAssignedResources
Description copied from interface:ResourcesManagerImplApi
List all resources to which the group is assigned.- Specified by:
getAssignedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-- Returns:
- list of assigned resources
-
getAssignedResources
Description copied from interface:ResourcesManagerImplApi
Returns all resources where the member is assigned through the groups.- Specified by:
getAssignedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-member
-- Returns:
- list of resources
-
getAssignedResources
Description copied from interface:ResourcesManagerImplApi
Returns all resources where member and service are assigned together.- Specified by:
getAssignedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-member
-service
-- Returns:
- list of resources
-
getAssignedResources
Description copied from interface:ResourcesManagerImplApi
Returns all resources where the user is assigned through the specified vo and its groups.- Specified by:
getAssignedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-user
-vo
-- Returns:
- list of resources
- See Also:
-
getAssignedResourcesWithStatus
Description copied from interface:ResourcesManagerImplApi
Returns all assigned resources where member is assigned through the groups.- Specified by:
getAssignedResourcesWithStatus
in interfaceResourcesManagerImplApi
- Parameters:
sess
- perun sessionmember
- member- Returns:
- list of assigned resources
-
getAssignedRichResources
Description copied from interface:ResourcesManagerImplApi
List of all rich resources associated with the group.- Specified by:
getAssignedRichResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-- Returns:
- list of assigned rich resources
-
getAssignedRichResources
Description copied from interface:ResourcesManagerImplApi
Returns all rich resources where the member is assigned through the groups.- Specified by:
getAssignedRichResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-member
-- Returns:
- list of rich resources
-
getAssignedRichResources
public List<RichResource> getAssignedRichResources(PerunSession sess, Member member, Service service) Description copied from interface:ResourcesManagerImplApi
Returns all rich resources where the service and the member are assigned through the groups.- Specified by:
getAssignedRichResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-member
-service
-- Returns:
- list of rich resources
-
getAssignedServices
Description copied from interface:ResourcesManagerImplApi
List all services' id associated with the resource.- Specified by:
getAssignedServices
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of assigned service' id
-
getAssignedUsers
Description copied from interface:ResourcesManagerImplApi
Returns all user assigned to the resource.- Specified by:
getAssignedUsers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of user assigned to the resource
-
getAssociatedMembers
Description copied from interface:ResourcesManagerImplApi
Returns all members who are associated with the resource. Does not require ACTIVE group-resource status or any specific member status.- Specified by:
getAssociatedMembers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of members
-
getAssociatedResources
Description copied from interface:ResourcesManagerImplApi
List all resources associated with the group. Does not require ACTIVE group-resource status.- Specified by:
getAssociatedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-- Returns:
- list of associated resources
-
getAssociatedResources
Description copied from interface:ResourcesManagerImplApi
Returns all resources with which the member is associated through the groups. Does not require ACTIVE group-resource status.- Specified by:
getAssociatedResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-member
-- Returns:
- list of resources
-
getAssociatedUsers
Description copied from interface:ResourcesManagerImplApi
Returns all users who are associated with the defined resource. Does not require ACTIVE group-resource status.- Specified by:
getAssociatedUsers
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- list of users
-
getBan
public BanOnResource getBan(PerunSession sess, int memberId, int resourceId) throws BanNotExistsException Description copied from interface:ResourcesManagerImplApi
Get specific resource ban.- Specified by:
getBan
in interfaceResourcesManagerImplApi
- Parameters:
sess
-memberId
- the member idresourceId
- the resource id- Returns:
- specific resource ban
- Throws:
BanNotExistsException
-
getBanById
Description copied from interface:ResourcesManagerImplApi
Get Ban for member on resource by it's id- Specified by:
getBanById
in interfaceResourcesManagerImplApi
- Parameters:
sess
-banId
- the ban id- Returns:
- resource ban by it's id
- Throws:
BanNotExistsException
-
getBansForMember
Description copied from interface:ResourcesManagerImplApi
Get all resources bans for member.- Specified by:
getBansForMember
in interfaceResourcesManagerImplApi
- Parameters:
sess
-memberId
- the member id- Returns:
- list of bans for member on any resource
-
getBansForResource
Description copied from interface:ResourcesManagerImplApi
Get all members bans for resource- Specified by:
getBansForResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resourceId
- the resource id- Returns:
- list of all members bans on resource
-
getDirectAdmins
Description copied from interface:ResourcesManagerImplApi
Gets list of direct user administrators of the Resource. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.- Specified by:
getDirectAdmins
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resource
-- Returns:
- list of direct admins of the resource
-
getFacilityId
Deprecated.Description copied from interface:ResourcesManagerImplApi
Get facility id which belongs to the concrete resource.- Specified by:
getFacilityId
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- facility id
-
getFailedGroupResourceAssignmentCause
public String getFailedGroupResourceAssignmentCause(PerunSession sess, Group group, Resource resource) Description copied from interface:ResourcesManagerImplApi
Gets the current cause of failed group-resource assignment. Returns null if there is no such group-resource assignment.- Specified by:
getFailedGroupResourceAssignmentCause
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessiongroup
- groupresource
- resource- Returns:
- error message
-
getGroupAssignments
Description copied from interface:ResourcesManagerImplApi
Lists all of the assigned groups for the given resource without the groups' attributes.- Specified by:
getGroupAssignments
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessionresource
- resource- Returns:
- list of assigned groups for given resource
-
getGroupResourceAssignments
public List<GroupResourceAssignment> getGroupResourceAssignments(PerunSession sess, List<GroupResourceStatus> statuses) Description copied from interface:ResourcesManagerImplApi
Lists all group-resource assignments with given statuses. If statuses are empty or null, lists assignments with all statuses.- Specified by:
getGroupResourceAssignments
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessionstatuses
- list of allowed statuses- Returns:
- list of group-resource assignments with given statuses
-
getGroupResourceStatus
public GroupResourceStatus getGroupResourceStatus(PerunSession sess, Group group, Resource resource) throws GroupNotDefinedOnResourceException Description copied from interface:ResourcesManagerImplApi
Gets status of given group-resource assignment.- Specified by:
getGroupResourceStatus
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessiongroup
- groupresource
- resource- Returns:
- assignment status of the given group and resource
- Throws:
GroupNotDefinedOnResourceException
- if there is no such group-resource assignment
-
getResourceAssignments
Description copied from interface:ResourcesManagerImplApi
Lists all of the resource assignments for the given group without the resources' attributes.- Specified by:
getResourceAssignments
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessiongroup
- group- Returns:
- list of assigned resources for given group
-
getResourceById
Description copied from interface:ResourcesManagerImplApi
Searches for the Resource with specified id.- Specified by:
getResourceById
in interfaceResourcesManagerImplApi
- Parameters:
sess
-id
-- Returns:
- Resource with specified id
- Throws:
ResourceNotExistsException
-
getResourceByName
public Resource getResourceByName(PerunSession sess, Vo vo, Facility facility, String name) throws ResourceNotExistsException Description copied from interface:ResourcesManagerImplApi
Return resource by its name.- Specified by:
getResourceByName
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
-facility
-name
-- Returns:
- resource
- Throws:
ResourceNotExistsException
-
getResources
Description copied from interface:ResourcesManagerImplApi
Get all VO resources.- Specified by:
getResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
-- Returns:
- list of resources
-
getResources
Description copied from interface:ResourcesManagerImplApi
Get all resources.- Specified by:
getResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
- session- Returns:
- list of resources
-
getResources
public List<Resource> getResources(PerunSession sess, User user, List<Status> memberStatuses, List<MemberGroupStatus> memberGroupStatuses, List<GroupResourceStatus> groupResourceStatuses) Description copied from interface:ResourcesManagerImplApi
Return all resources where user is assigned. Checks member's status in VO and group and status of group-resource assignment. If statuses are null or empty all statuses are used.- Specified by:
getResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-user
-memberStatuses
- allowed member's statuses in VOmemberGroupStatuses
- allowed member's statuses in groupgroupResourceStatuses
- allowed statuses of group-resource assignment- Returns:
- List of allowed resources for the user
-
getResourcesByAttribute
Description copied from interface:ResourcesManagerImplApi
Returns all resources which have set the attribute with the value. Searching only def and opt attributes.- Specified by:
getResourcesByAttribute
in interfaceResourcesManagerImplApi
- Parameters:
sess
-attribute
-- Returns:
-
getResourcesByIds
Description copied from interface:ResourcesManagerImplApi
Gets resources by their ids. Silently skips non-existing resources.- Specified by:
getResourcesByIds
in interfaceResourcesManagerImplApi
- Parameters:
sess
-ids
-- Returns:
- List of resources with specified ids
-
getResourcesCount
Description copied from interface:ResourcesManagerImplApi
Get all VO resources count.- Specified by:
getResourcesCount
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-vo
-- Returns:
- count of vo resources
-
getResourcesCount
Description copied from interface:ResourcesManagerImplApi
Get count of all resources.- Specified by:
getResourcesCount
in interfaceResourcesManagerImplApi
- Parameters:
sess
-- Returns:
- count of all resources
-
getResourcesWhereGroupIsAdmin
public List<Resource> getResourcesWhereGroupIsAdmin(PerunSession sess, Facility facility, Vo vo, Group authorizedGroup) Description copied from interface:ResourcesManagerImplApi
Return all resources for the facility and the vo where the group is authorized as resource manager.- Specified by:
getResourcesWhereGroupIsAdmin
in interfaceResourcesManagerImplApi
- Parameters:
sess
-facility
- the facility to which resources should be assigned tovo
- the vo to which resources should be assigned toauthorizedGroup
- group with resource manager role for all those resources- Returns:
- list of defined resources where groups has role resource manager
-
getResourcesWhereUserIsAdmin
Description copied from interface:ResourcesManagerImplApi
Returns list of resources, where the user is an admin. Including resources, where the user is a VALID member of authorized group.- Specified by:
getResourcesWhereUserIsAdmin
in interfaceResourcesManagerImplApi
- Parameters:
sess
-user
-- Returns:
- list of resources, where the user is an admin
-
getResourcesWhereUserIsAdmin
public List<Resource> getResourcesWhereUserIsAdmin(PerunSession sess, Facility facility, Vo vo, User authorizedUser) Description copied from interface:ResourcesManagerImplApi
Return all resources for the facility and the vo where user is authorized as resource manager. Including resources, where the user is a VALID member of authorized group.- Specified by:
getResourcesWhereUserIsAdmin
in interfaceResourcesManagerImplApi
- Parameters:
sess
-facility
- the facility to which resources should be assigned tovo
- the vo to which resources should be assigned toauthorizedUser
- user with resource manager role for all those resources- Returns:
- list of defined resources where user has role resource manager
-
getResourcesWhereUserIsAdmin
Description copied from interface:ResourcesManagerImplApi
Return all resources for the vo where user is authorized as resource manager. Including resources, where the user is a VALID member of authorized group.- Specified by:
getResourcesWhereUserIsAdmin
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
- the vo to which resources should be assigned toauthorizedUser
- user with resource manager role for all those resources- Returns:
- list of defined resources where user has role resource manager
-
getRichResourceById
public RichResource getRichResourceById(PerunSession sess, int id) throws ResourceNotExistsException Description copied from interface:ResourcesManagerImplApi
Searches for the Rich Resource with specified id.- Specified by:
getRichResourceById
in interfaceResourcesManagerImplApi
- Parameters:
sess
-id
-- Returns:
- RichResource with specified id
- Throws:
ResourceNotExistsException
-
getRichResources
Description copied from interface:ResourcesManagerImplApi
Get all VO rich resources.- Specified by:
getRichResources
in interfaceResourcesManagerImplApi
- Parameters:
sess
-vo
-- Returns:
- list of rich resources
-
getRichResourcesByIds
Description copied from interface:ResourcesManagerImplApi
Gets rich resources by their ids. Silently skips non-existing rich resources.- Specified by:
getRichResourcesByIds
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-ids
-- Returns:
- List of rich resources with specified ids
-
getRichResourcesWithMemberAndAttribute
public List<RichResource> getRichResourcesWithMemberAndAttribute(PerunSession perunSession, Member member, AttributeDefinition ad) Description copied from interface:ResourcesManagerImplApi
Return all rich resources with given attribute where given member is assigned.- Specified by:
getRichResourcesWithMemberAndAttribute
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
- sessionmember
- memberad
- attribute definition- Returns:
- list of corresponding rich resources
-
groupResourceAssignmentExists
Description copied from interface:ResourcesManagerImplApi
Returns true if the group is assigned to the current resource with any status, false otherwise.- Specified by:
groupResourceAssignmentExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-group
-- Returns:
- true if the group is assigned to the current resource.
-
initialize
protected void initialize() -
isGroupAssigned
Description copied from interface:ResourcesManagerImplApi
Returns true if the group is assigned to the current resource with ACTIVE status, false otherwise.- Specified by:
isGroupAssigned
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-group
-- Returns:
- true if the group is assigned to the current resource with active status.
-
isGroupManuallyAssigned
Description copied from interface:ResourcesManagerImplApi
Returns true if the group is assigned to the given resource manually, false otherwise.- Specified by:
isGroupManuallyAssigned
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-resource
-- Returns:
- true if the group is assigned to the given resource manually.
-
isUserAllowed
Description copied from interface:ResourcesManagerImplApi
Check if the user is allowed as a member on the selected resource.- Specified by:
isUserAllowed
in interfaceResourcesManagerImplApi
- Parameters:
sess
-user
-resource
-- Returns:
- true if the user is allowed as a member on the selected resource.
-
isUserAssigned
Description copied from interface:ResourcesManagerImplApi
Check if the user is assigned as a member on the selected resource.- Specified by:
isUserAssigned
in interfaceResourcesManagerImplApi
- Parameters:
sess
-user
-resource
-- Returns:
- true if the user is assigned as a member on the selected resource.
-
removeAllResourcesTagFromResource
Description copied from interface:ResourcesManagerImplApi
Remove all existing Resource tags for specific resource.- Specified by:
removeAllResourcesTagFromResource
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resource
-
-
removeAutomaticGroupFromResource
public void removeAutomaticGroupFromResource(PerunSession perunSession, Group group, Resource resource, int sourceGroupId) throws GroupAlreadyRemovedFromResourceException Description copied from interface:ResourcesManagerImplApi
Remove automatically assigned group from resource.- Specified by:
removeAutomaticGroupFromResource
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-group
-resource
-sourceGroupId
- id of a source group through which was the group automatically assigned- Throws:
GroupAlreadyRemovedFromResourceException
- if there are 0 rows affected by removing group from resource
-
removeBan
Description copied from interface:ResourcesManagerImplApi
Remove ban by id from resources bans.- Specified by:
removeBan
in interfaceResourcesManagerImplApi
- Parameters:
sess
-banId
- id of specific ban- Throws:
BanNotExistsException
-
removeBan
Description copied from interface:ResourcesManagerImplApi
Remove ban by member_id and facility_id- Specified by:
removeBan
in interfaceResourcesManagerImplApi
- Parameters:
sess
-memberId
- the id of memberresourceId
- the id of resource- Throws:
BanNotExistsException
-
removeGroupFromResource
public void removeGroupFromResource(PerunSession sess, Group group, Resource resource) throws GroupAlreadyRemovedFromResourceException Description copied from interface:ResourcesManagerImplApi
Remove group from a resource.- Specified by:
removeGroupFromResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-group
-resource
-- Throws:
GroupAlreadyRemovedFromResourceException
- if there are 0 rows affected by removing group from resource
-
removeResourceTagFromResource
public void removeResourceTagFromResource(PerunSession perunSession, ResourceTag resourceTag, Resource resource) Description copied from interface:ResourcesManagerImplApi
Remove specific ResourceTag from existing Resource.- Specified by:
removeResourceTagFromResource
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resourceTag
-resource
-
-
removeService
public void removeService(PerunSession sess, Resource resource, Service service) throws ServiceNotAssignedException Description copied from interface:ResourcesManagerImplApi
Remove service from resource.- Specified by:
removeService
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-service
-- Throws:
ServiceNotAssignedException
-
resourceExists
Description copied from interface:ResourcesManagerImplApi
Check if resource exists in underlaying data source.- Specified by:
resourceExists
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- true if resource exists in underlaying data source, false otherwise
-
resourceTagExists
-
setBan
Description copied from interface:ResourcesManagerImplApi
Set ban for member on resource- Specified by:
setBan
in interfaceResourcesManagerImplApi
- Parameters:
sess
-banOnResource
- the ban- Returns:
- ban on resource
-
setFailedGroupResourceAssignmentCause
public void setFailedGroupResourceAssignmentCause(PerunSession sess, Group group, Resource resource, String cause) throws GroupNotDefinedOnResourceException Description copied from interface:ResourcesManagerImplApi
Sets the cause of failed group-resource assignment- Specified by:
setFailedGroupResourceAssignmentCause
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessiongroup
- groupresource
- resourcecause
- the cause of assignment failure- Throws:
GroupNotDefinedOnResourceException
- if there is no such group-resource assignment
-
setGroupResourceStatus
public void setGroupResourceStatus(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) throws GroupNotDefinedOnResourceException Description copied from interface:ResourcesManagerImplApi
Sets status of given group-resource assignment to the specified status.- Specified by:
setGroupResourceStatus
in interfaceResourcesManagerImplApi
- Parameters:
sess
- sessiongroup
- groupresource
- resourcestatus
- new status of the group-resource assignment- Throws:
GroupNotDefinedOnResourceException
- if there is no such group-resource assignment
-
updateBan
Description copied from interface:ResourcesManagerImplApi
Update description and validity timestamp of specific ban.- Specified by:
updateBan
in interfaceResourcesManagerImplApi
- Parameters:
sess
-banOnResource
- ban to be updated- Returns:
- updated ban
-
updateResource
Description copied from interface:ResourcesManagerImplApi
Updates Resource.- Specified by:
updateResource
in interfaceResourcesManagerImplApi
- Parameters:
sess
-resource
-- Returns:
- returns updated Resource
-
updateResourceTag
Description copied from interface:ResourcesManagerImplApi
Update existing Resource tag.- Specified by:
updateResourceTag
in interfaceResourcesManagerImplApi
- Parameters:
perunSession
-resourceTag
-- Returns:
- updated ResourceTag
-