Package cz.metacentrum.perun.core.blImpl
Class SearcherBlImpl
java.lang.Object
cz.metacentrum.perun.core.blImpl.SearcherBlImpl
- All Implemented Interfaces:
SearcherBl
Searcher Class for searching objects by Map of Attributes
- Author:
- Michal Stava invalid input: '<'stavamichal@gmail.com>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFacilities
(PerunSession sess, Map<String, String> attributesWithSearchingValues) This method get Map of Attributes with searching values and try to find all facilities, which have specific attributes in format.Filter output from getGroups by vo_id.getGroups
(PerunSession sess, Map<String, String> attributesWithSearchingValues) This method get Map of Attributes with searching values and try to find all groups, which have specific attributes in format.getGroupsByGroupResourceSetting
(PerunSession sess, Attribute groupResourceAttribute, Attribute resourceAttribute) Return all groups assigned to any resource with following conditions: 1] resource has set "resourceAttribute" attribute with same value 2] group and resource has set "groupResourceAttribute" attribute with same value Attribute values can't be empty.Gets groups ids for potential application auto rejection.getMembers
(PerunSession sess, Vo vo, Map<String, String> attributesWithSearchingValues) This method takes Map of Attributes (both member and user) with searching values and tries to find all users, with specific values in the given attributes More information about format below.getMembersByExpiration
(PerunSession sess, String operator, int days) Return members with expiration date set, which will expire on today +/- X days.getMembersByExpiration
(PerunSession sess, String operator, LocalDate date) Return members with expiration date set, which will expire on specified date.getMembersByGroupExpiration
(PerunSession sess, Group group, String operator, LocalDate date) Return members with group expiration date set, which will expire on specified date in given group.getResources
(PerunSession sess, Map<String, String> attributesWithSearchingValues, boolean allowPartialMatchForString) This method get Map of Attributes with searching values and try to find all resources, which have specific attributes in format.getUsers
(PerunSession sess, Map<String, String> attributesWithSearchingValues) This method get Map of Attributes with searching values and try to find all users, which have specific attributes in format.getUsersForCoreAttributes
(PerunSession sess, Map<String, String> coreAttributesWithSearchingValues) This method take map of coreAttributes with search values and return all users who have the specific match for all of these core attributes.Gets VOs ids for potential application auto rejection.globalSearch
(PerunSession sess, String searchString) Similarity substring search in VOs, groups and facilities.globalSearchIDOnly
(PerunSession sess, int searchId) Performs exact match on ID for user, VO, group and facility.globalSearchPerunAdmin
(PerunSession sess, String searchString) Similarity substring search in users, VOs, groups and facilities.void
setPerunBl
(PerunBl perunBl)
-
Constructor Details
-
SearcherBlImpl
-
-
Method Details
-
getFacilities
public List<Facility> getFacilities(PerunSession sess, Map<String, String> attributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method get Map of Attributes with searching values and try to find all facilities, which have specific attributes in format. Better information about format below. When there are more than 1 attribute in Map, it means all must be true "looking for all of them" (AND)- Specified by:
getFacilities
in interfaceSearcherBl
- Parameters:
sess
- perun sessionattributesWithSearchingValues
- map of attributes names when attribute is type String, so value is string and we are looking for total match (Partial is not supported now, will be supported later by symbol *) when attribute is type Integer, so value is integer in String and we are looking for total match when attribute is type List, so value is String and we are looking for at least one total or partial matching element when attribute is type Map so value is String in format "key=value" and we are looking total match of both or if is it "key" so we are looking for total match of key IMPORTANT: In map there is not allowed char '=' in key. First char '=' is delimiter in MAP item key=value!!! - Returns:
- list of facilities that have attributes with specific values (behaviour above) if no such facility exists, returns empty list
- Throws:
AttributeNotExistsException
- when specified attribute does not existWrongAttributeAssignmentException
- wrong attribute assignmentWrongAttributeValueException
- wrong attribute value
-
getGroups
public List<Group> getGroups(PerunSession sess, Vo vo, Map<String, String> attributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
Filter output from getGroups by vo_id.- Specified by:
getGroups
in interfaceSearcherBl
- Throws:
AttributeNotExistsException
WrongAttributeValueException
- See Also:
-
getGroups
public List<Group> getGroups(PerunSession sess, Map<String, String> attributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method get Map of Attributes with searching values and try to find all groups, which have specific attributes in format. Better information about format below. When there are more than 1 attribute in Map, it means all must be true "looking for all of them" (AND)IMPORTANT: can't get CORE ATTRIBUTES, it will skip any core attribute in map without information about it
- Specified by:
getGroups
in interfaceSearcherBl
- Parameters:
sess
- perun sessionattributesWithSearchingValues
- map of attributes names when attribute is type String, so value is string and we are looking for total match (Partial is not supported now, will be supported later by symbol *) when attribute is type Integer, so value is integer in String and we are looking for total match when attribute is type List, so value is String and we are looking for at least one total or partial matching element when attribute is type Map so value is String in format "key=value" and we are looking total match of both or if is it "key" so we are looking for total match of key IMPORTANT: In map there is not allowed char '=' in key. First char '=' is delimiter in MAP item key=value!!! - Returns:
- list of groups who have attributes with specific values (behavior above) if no group exist, return empty list of groups if empty map, return all groups
- Throws:
AttributeNotExistsException
WrongAttributeValueException
- wrong attribute value
-
getGroupsByGroupResourceSetting
public List<Group> getGroupsByGroupResourceSetting(PerunSession sess, Attribute groupResourceAttribute, Attribute resourceAttribute) Description copied from interface:SearcherBl
Return all groups assigned to any resource with following conditions: 1] resource has set "resourceAttribute" attribute with same value 2] group and resource has set "groupResourceAttribute" attribute with same value Attribute values can't be empty. If there is no such group, return empty array.- Specified by:
getGroupsByGroupResourceSetting
in interfaceSearcherBl
- Parameters:
sess
-groupResourceAttribute
- expected attribute set between a group and a resource (group need to be assigned to the resource)resourceAttribute
- expected attribute set for assigned resource- Returns:
- list of groups with following conditions
-
getGroupsIdsForAppAutoRejection
Description copied from interface:SearcherBl
Gets groups ids for potential application auto rejection.- Specified by:
getGroupsIdsForAppAutoRejection
in interfaceSearcherBl
- Returns:
- groups ids
-
getMembersByExpiration
Description copied from interface:SearcherBl
Return members with expiration date set, which will expire on today +/- X days. You can specify operator for comparison (by default "=") returning exact match. So you can get all expired members (including today) using "invalid input: '<'=" and zero days shift. or using "invalid input: '<'" and +1 day shift.Method ignores current member state, just compares expiration date !
- Specified by:
getMembersByExpiration
in interfaceSearcherBl
- Parameters:
sess
- PerunSessionoperator
- One of "=", "invalid input: '<'", ">", "invalid input: '<'=", ">=". If null, "=" is anticipated.days
- X days before/after today- Returns:
- Members with expiration relative to method params.
-
getMembersByExpiration
Description copied from interface:SearcherBl
Return members with expiration date set, which will expire on specified date. You can specify operator for comparison (by default "=") returning exact match. So you can get all expired members (including today) using "invalid input: '<'=" and today date. or using "invalid input: '<'" and tomorrow date.Method ignores current member state, just compares expiration date !
- Specified by:
getMembersByExpiration
in interfaceSearcherBl
- Parameters:
sess
- PerunSessionoperator
- One of "=", "invalid input: '<'", ">", "invalid input: '<'=", ">=". If null, "=" is anticipated.date
- Date to compare expiration with (if null, current date is used).- Returns:
- Members with expiration relative to method params.
-
getMembersByGroupExpiration
public List<Member> getMembersByGroupExpiration(PerunSession sess, Group group, String operator, LocalDate date) Description copied from interface:SearcherBl
Return members with group expiration date set, which will expire on specified date in given group. You can specify operator for comparison (by default "=") returning exact match. So you can get all expired members (including today) using "invalid input: '<'=" and today date. or using "invalid input: '<'" and tomorrow date.Method returns members with its expiration status for given group. Method ignores current member state, just compares expiration date!
Method returns also indirect members of group with expiration set (by accident probably), but we manage status only for direct members !!
- Specified by:
getMembersByGroupExpiration
in interfaceSearcherBl
- Parameters:
sess
- Perun sessionoperator
- One of "=", "invalid input: '<'", ">", "invalid input: '<'=", ">=". If null, "=" is anticipated.date
- Date to compare expiration with (if null, current date is used).- Returns:
- Members with expiration relative to method params.
-
getPerunBl
-
getResources
public List<Resource> getResources(PerunSession sess, Map<String, String> attributesWithSearchingValues, boolean allowPartialMatchForString) throws AttributeNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method get Map of Attributes with searching values and try to find all resources, which have specific attributes in format. Better information about format below. When there are more than 1 attribute in Map, it means all must be true "looking for all of them" (AND)- Specified by:
getResources
in interfaceSearcherBl
- Parameters:
sess
- perun sessionattributesWithSearchingValues
- map of attributes names when attribute is type String, so value is string and we are looking for exact or partial match based by parameter 'allowPartialMatchForString' when attribute is type Integer, so value is integer in String and we are looking for total match when attribute is type List, so value is String and we are looking for at least one total or partial matching element when attribute is type Map so value is String in format "key=value" and we are looking total match of both or if is it "key" so we are looking for total match of key IMPORTANT: In map there is not allowed char '=' in key. First char '=' is delimiter in MAP item key=value!!! allowPartialMatchForString
- if true, we are looking for partial match, if false, we are looking only for exact match (only for STRING type attributes)- Returns:
- list of resources that have attributes with specific values (behaviour above) if no such resource exists, returns empty list
- Throws:
AttributeNotExistsException
- when specified attribute does not existWrongAttributeAssignmentException
- wrong attribute assignmentWrongAttributeValueException
- wrong attribute value
-
getSearcherImpl
-
getMembers
public List<Member> getMembers(PerunSession sess, Vo vo, Map<String, String> attributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method takes Map of Attributes (both member and user) with searching values and tries to find all users, with specific values in the given attributes More information about format below. An AND condition is implicit between the attributes we are searching by.- Specified by:
getMembers
in interfaceSearcherBl
- Parameters:
sess
- perun sessionattributesWithSearchingValues
- map of attributes names when attribute is type String, so value is string and we are looking for total match, when attribute is type Integer, so value is integer in String and we are looking for total match when attribute is type List, so value is String and we are looking for at least one total or partial matching element when attribute is type Map so value is String in format "key=value" and we are looking total match of both or if is it "key" so we are looking for total match of key IMPORTANT: In map there is not allowed char '=' in key. First char '=' is delimiter in MAP item key=value!!! - Returns:
- list of members who have attributes with specific values (behavior above) if no member exist, return empty list
- Throws:
AttributeNotExistsException
WrongAttributeAssignmentException
- wrong attribute valueWrongAttributeValueException
-
getUsers
public List<User> getUsers(PerunSession sess, Map<String, String> attributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method get Map of Attributes with searching values and try to find all users, which have specific attributes in format. Better information about format below. When there are more than 1 attribute in Map, it means all must be true "looking for all of them" (AND)- Specified by:
getUsers
in interfaceSearcherBl
- Parameters:
sess
- perun sessionattributesWithSearchingValues
- map of attributes names when attribute is type String, so value is string and we are looking for total match (Partial is not supported now, will be supported later by symbol *) when attribute is type Integer, so value is integer in String and we are looking for total match when attribute is type List, so value is String and we are looking for at least one total or partial matching element when attribute is type Map so value is String in format "key=value" and we are looking total match of both or if is it "key" so we are looking for total match of key IMPORTANT: In map there is not allowed char '=' in key. First char '=' is delimiter in MAP item key=value!!! - Returns:
- list of users who have attributes with specific values (behavior above) if no user exist, return empty list of users
- Throws:
AttributeNotExistsException
WrongAttributeAssignmentException
WrongAttributeValueException
-
getUsersForCoreAttributes
public List<User> getUsersForCoreAttributes(PerunSession sess, Map<String, String> coreAttributesWithSearchingValues) throws AttributeNotExistsException, WrongAttributeAssignmentException, WrongAttributeValueExceptionDescription copied from interface:SearcherBl
This method take map of coreAttributes with search values and return all users who have the specific match for all of these core attributes.- Specified by:
getUsersForCoreAttributes
in interfaceSearcherBl
- Parameters:
sess
-coreAttributesWithSearchingValues
-- Returns:
- Throws:
AttributeNotExistsException
WrongAttributeAssignmentException
WrongAttributeValueException
-
getVosIdsForAppAutoRejection
Description copied from interface:SearcherBl
Gets VOs ids for potential application auto rejection.- Specified by:
getVosIdsForAppAutoRejection
in interfaceSearcherBl
- Returns:
- VOs ids
-
globalSearch
Description copied from interface:SearcherBl
Similarity substring search in VOs, groups and facilities. The amount of results is limited, based on the globalSearchLimit CoreConfig property- Specified by:
globalSearch
in interfaceSearcherBl
- Parameters:
sess
- sessionsearchString
- string to search for- Returns:
- map with lists of matched entities. The keys are `users`, `vos`, `groups`, `facilities` and values are lists containing the matched objects
-
globalSearchIDOnly
Description copied from interface:SearcherBl
Performs exact match on ID for user, VO, group and facility. Use this method only when the search string is shorter than 3 digits, use other globalSearch methods otherwise. The amount of results is limited, based on the globalSearchLimit CoreConfig property- Specified by:
globalSearchIDOnly
in interfaceSearcherBl
- Parameters:
sess
- sessionsearchId
- id to search for- Returns:
- map with lists of matched entities. The keys are `users`, `vos`, `groups`, `facilities` and values are lists containing the matched objects
-
globalSearchPerunAdmin
Description copied from interface:SearcherBl
Similarity substring search in users, VOs, groups and facilities. Performs also an exact match for IDs should the search string be a number. The amount of results is limited, based on the globalSearchLimit CoreConfig property- Specified by:
globalSearchPerunAdmin
in interfaceSearcherBl
- Parameters:
sess
- sessionsearchString
- string to search for- Returns:
- map with lists of matched entities. The keys are `users`, `vos`, `groups`, `facilities` and values are lists containing the matched objects
-
setPerunBl
-