public class StoreAppRoleSearchQuery extends BaseSearchQuery
Following code snippet illustrates how to build a search criteria to search by the DisplayName
StoreAppRoleSearchQuery query = new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.DISPLAY_NAME, false, ComparatorType.EQUALITY, "DisplayName Value to searchBy", BaseSearchQuery.MATCHER.EXACT); getAppRoles ( query );The above query will search across ALL available applications for the app role with the particular display name.
To build more complex search criterias, use the Constructor for complex search query (as shown next). Consider the following example to search for app roles by name = Bob in application by name = WebCenter The combinedQuery
needs to be evaluated (for both search criteria to be enforced in tandem, i.e., AND'ed)
List<StoreAppRoleSearchQuery> list = new ArrayList<StoreAppRoleSearchQuery>(); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.NAME, false, ComparatorType.EQUALITY, "Bob", BaseSearchQuery.MATCHER.EXACT)); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.APPLICATION_NAME, false, ComparatorType.EQUALITY, "WebCenter", BaseSearchQuery.MATCHER.EXACT)); StoreAppRoleSearchQuery combinedQuery = new StoreAppRoleSearchQuery(list, false, false);Note that the first query constructs the 'role-name = Bob' criteria, while the next query states the 'application name= WebCenter' criteria. Both these criteria have been AND'ed in the complex query constructor.
Consider the following example to search AppRoles by a specific description and display name. Obviously, the two criterias (below) have to be AND-ed (in the complex query constructor).
List<StoreAppRoleSearchQuery> list = new ArrayList<StoreAppRoleSearchQuery>(); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.DISPLAY_NAME, false, ComparatorType.EQUALITY, "The Display Name", BaseSearchQuery.MATCHER.EXACT)); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.DESCRIPTION, false, ComparatorType.EQUALITY, "The Description", BaseSearchQuery.MATCHER.EXACT)); StoreAppRoleSearchQuery combinedQuery = new StoreAppRoleSearchQuery(list, false, false);
Similarly, we can have two criterias with OR syntax as shown below (note the change in combinedQuery constructor parameters).
List<StoreAppRoleSearchQuery> list = new ArrayList<StoreAppRoleSearchQuery>(); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.DISPLAY_NAME, false, ComparatorType.EQUALITY, "The Display Name", BaseSearchQuery.MATCHER.EXACT)); list.add(new StoreAppRoleSearchQuery( StoreAppRoleSearchQuery.SEARCH_PROPERTY.DESCRIPTION, false, ComparatorType.EQUALITY, "The Description", BaseSearchQuery.MATCHER.EXACT)); StoreAppRoleSearchQuery combinedQuery = new StoreAppRoleSearchQuery(list, false, true);It is ok to construct a complex query with more than one APPLICATION_NAME query. However, such a query cannot state the condition that
application name = 'APP1' AND application name ='APP2'
StoreAppRoleSearchQuery combinedQuery = new StoreAppRoleSearchQuery(list_of_app_name_subqueries, false, true);Here list_of_app_name_subqueries variable is a
List<StoreAppRoleSearchQuery>
variable thatapplication name = 'APP1' OR application name ='APP2' OR ....
Modifier and Type | Class and Description |
---|---|
static class |
StoreAppRoleSearchQuery.SEARCH_PROPERTY
Criterias to search AppRoles By
|
SearchQuery.MATCHER
Constructor and Description |
---|
StoreAppRoleSearchQuery(java.util.List<StoreAppRoleSearchQuery> queries, boolean negation, boolean isORMatch)
Constructor
|
StoreAppRoleSearchQuery(StoreAppRoleSearchQuery.SEARCH_PROPERTY property, boolean negation, ComparatorType operator, java.lang.Object valueObject, SearchQuery.MATCHER match)
Constructor
|
StoreAppRoleSearchQuery(StoreAppRoleSearchQuery.SEARCH_PROPERTY property, boolean negation, ComparatorType operator, java.lang.String value, SearchQuery.MATCHER match)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<StoreAppRoleSearchQuery> |
getAllQueries() |
java.util.Set<java.lang.String> |
getAppNames() |
StoreAppRoleSearchQuery.SEARCH_PROPERTY |
getSearchByProperty()
Gets the search by property in this search query
|
StoreAppRoleSearchQuery[] |
getSearchQueryInOrder()
Gets the child search query in this search query.
|
getBaseSearchQueryInOrder, getComparator, getEntityType, getQueries, toString
addBaseQuery, getSearchByPropertyString, getSearchByValue, getSearchByValueObject, getSearchComparator, getSearchQueries, getSearchValueMatch, isANDMatch, isComplexQuery, isNegativeMatch, isORMatch
public StoreAppRoleSearchQuery(StoreAppRoleSearchQuery.SEARCH_PROPERTY property, boolean negation, ComparatorType operator, java.lang.String value, SearchQuery.MATCHER match)
property
- the property to search bySEARCH PROPERTY NAME | Value Parameter type |
APPLICATION_NAME | String |
NAME | String |
DISPLAY_NAME | String |
DESCRIPTION | String |
ASSIGNED_APP_ROLE | String |
PRINCIPAL | String |
negation
- if true, then the NOT operator is appliedoperator
- the operator to applyvalue
- the value to search for
If match
is ANY, the value is ignored.
If value is non-null, this value is matched against the values to search for. The match
algorithm is applied to values to search against.
match
- how the value should match-ed with the values to search against. If match is null, an EXACT match is assumed. value should be non-null.public StoreAppRoleSearchQuery(StoreAppRoleSearchQuery.SEARCH_PROPERTY property, boolean negation, ComparatorType operator, java.lang.Object valueObject, SearchQuery.MATCHER match)
property
- the property to search bySEARCH PROPERTY NAME | Value Parameter type | Other information |
APPLICATION_NAME | String | |
NAME | String | |
DISPLAY_NAME | String | |
DESCRIPTION | String | |
ASSIGNED_APP_ROLE | AppRoleEntry (or PrincipalEntry or Principal or String) | Matcher should be EXACT if non-string value is used |
PRINCIPAL | Principal (or PrincipalEntry or String) | Matcher should be EXACT if non-string value is used |
negation
- if true, then the NOT operator is appliedoperator
- the operator to applyvalueObject
- the value to search for
If value is null, the match
must be ANY
If value is non-null, this value is matched against the values to search for. The match
algorithm is applied to values to search against.
match
- how the value should match-ed with the values to search against. If match is null, an EXACT match is assumed. value should be non-null.public StoreAppRoleSearchQuery(java.util.List<StoreAppRoleSearchQuery> queries, boolean negation, boolean isORMatch)
queries
- child queries of this querynegation
- if true, then the NOT operator is applied.isORMatch
- if true, then the syntax among child queries is 'OR', if false the syntax among child queries is 'AND'public java.util.List<StoreAppRoleSearchQuery> getAllQueries() throws InvalidArgumentException
InvalidArgumentException
public java.util.Set<java.lang.String> getAppNames()
public StoreAppRoleSearchQuery.SEARCH_PROPERTY getSearchByProperty()
public StoreAppRoleSearchQuery[] getSearchQueryInOrder()