public interface SearchRestrictionService
Provides methods for managing persisted search restrictions based on SearchRestrictionModel as well on
dynamic search restrictions which are stored directly in the session.
Please notice that any search restrictions are ignored if current logged user is admin or any other user with admin rights.
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionSearchRestrictions(java.util.Collection<SessionSearchRestriction> restrictions)
Adds session search restrictions to current session context.
|
void |
addSessionSearchRestrictions(SessionSearchRestriction... restrictions)
Adds session search restrictions to current session context.
|
void |
clearSessionSearchRestrictions()
Clear session search restrictions in current session context.
|
void |
disableSearchRestrictions()
Disable search restrictions in current session context.
|
void |
enableSearchRestrictions()
Enable search restrictions in current session context.
|
java.util.Collection<SearchRestrictionModel> |
getActiveSearchRestrictions(PrincipalModel principal,
boolean includePrincipalGroups,
java.util.Collection<ComposedTypeModel> types)
Gets only active search restrictions for given
ComposedTypeModel. |
java.util.Collection<SearchRestrictionModel> |
getInactiveSearchRestrictions(PrincipalModel principal,
boolean includePrincipalGroups,
java.util.Collection<ComposedTypeModel> types)
Gets only inactive search restrictions for given
ComposedTypeModel. |
java.util.Collection<SearchRestrictionModel> |
getSearchRestrictions(PrincipalModel principal,
boolean includePrincipalGroups,
java.util.Collection<ComposedTypeModel> types)
Gets all (active and inactive) search restrictions for given
ComposedTypeModel. |
java.util.Collection<SearchRestrictionModel> |
getSearchRestrictionsForType(ComposedTypeModel type)
Gets all search restrictions for type.
|
java.util.Collection<SessionSearchRestriction> |
getSessionSearchRestrictions()
Gets the session search restrictions from current session context.
|
java.util.Collection<SessionSearchRestriction> |
getSessionSearchRestrictions(ComposedTypeModel type)
Gets the session search restrictions from current session context for particular
ComposedTypeModel
object. |
boolean |
hasRestrictions(PrincipalModel principal,
boolean includePrincipalGroups,
ComposedTypeModel type)
Checks whether type has search restrictions (session and persisted).
|
boolean |
isSearchRestrictionsEnabled()
Checks if search restrictions feature in current session context is enabled.
|
void |
removalAllSessionSearchRestrictions()
Removes all session-scoped search restrictions from the current session.
|
void |
removeSessionSearchRestrictions(java.util.Collection<SessionSearchRestriction> restrictions)
Remove session search restrictions from current session context.
|
void addSessionSearchRestrictions(java.util.Collection<SessionSearchRestriction> restrictions)
final ComposedTypeModel restrictedType = typeService.getComposedTypeForClass(LanguageModel.class);
final SessionSearchRestriction restriction = new SessionSearchRestriction("someUniqueCode", "{active} IS TRUE", restrictedType);
final Collection<SessionSearchRestriction> restrictions = new ArrayList<SessionSearchRestriction>();
restrictions.add(restriction);
searchRestrictionService.addSessionSearchRestrictions(restrictions);
restrictions - the restrictions collection to add to session.void addSessionSearchRestrictions(SessionSearchRestriction... restrictions)
final ComposedTypeModel restrictedType = typeService.getComposedTypeForClass(LanguageModel.class);
final SessionSearchRestriction restriction1 = new SessionSearchRestriction("someUniqueCode1", "{active} IS TRUE", restrictedType);
final SessionSearchRestriction restriction2 = new SessionSearchRestriction("someUniqueCode2", "{foo}={bar}", restrictedType);
searchRestrictionService.addSessionSearchRestrictions(restriction1, restriction2);
restrictions - the restrictions to addvoid clearSessionSearchRestrictions()
void disableSearchRestrictions()
void enableSearchRestrictions()
java.util.Collection<SearchRestrictionModel> getActiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, java.util.Collection<ComposedTypeModel> types)
ComposedTypeModel.principal - the principal for which restrictions will be searchedincludePrincipalGroups - determines whether include principal groups in searchtypes - Collection of ComposedTypeModel objects for which restriction will be obtained.java.util.Collection<SearchRestrictionModel> getInactiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, java.util.Collection<ComposedTypeModel> types)
ComposedTypeModel.principal - the principal for which restrictions will be searchedincludePrincipalGroups - determines whether include principal groups in searchtypes - Collection of ComposedTypeModel objects for which restriction will be obtained.java.util.Collection<SearchRestrictionModel> getSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, java.util.Collection<ComposedTypeModel> types)
ComposedTypeModel.principal - the principal for which restrictions will be searchedincludePrincipalGroups - determines whether include principal groups in searchtypes - Collection of ComposedTypeModel objects for which restriction will be obtained.java.util.Collection<SearchRestrictionModel> getSearchRestrictionsForType(ComposedTypeModel type)
type - the typejava.util.Collection<SessionSearchRestriction> getSessionSearchRestrictions()
java.util.Collection<SessionSearchRestriction> getSessionSearchRestrictions(ComposedTypeModel type)
ComposedTypeModel
object.type - the type for which which restriction will be obtained.boolean hasRestrictions(PrincipalModel principal, boolean includePrincipalGroups, ComposedTypeModel type)
principal - the principal for which restrictions will be searchedincludePrincipalGroups - determines whether include principal groups in searchtype - the type for which check will be triggered.boolean isSearchRestrictionsEnabled()
void removeSessionSearchRestrictions(java.util.Collection<SessionSearchRestriction> restrictions)
restrictions - the restrictions collection to remove from session.void removalAllSessionSearchRestrictions()
Copyright © 2018 SAP SE. All Rights Reserved.