Class DefaultSearchRestrictionService
java.lang.Object
de.hybris.platform.search.restriction.impl.DefaultSearchRestrictionService
- All Implemented Interfaces:
SearchRestrictionService
Default implementation of
SearchRestrictionService interface.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSessionSearchRestrictions(SessionSearchRestriction... restrictions) Adds session search restrictions to current session context.voidaddSessionSearchRestrictions(Collection<SessionSearchRestriction> restrictions) Adds session search restrictions to current session context.voidClear session search restrictions in current session context.voidDisable search restrictions in current session context.voidEnable search restrictions in current session context.getActiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets only active search restrictions for givenComposedTypeModel.getInactiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets only inactive search restrictions for givenComposedTypeModel.getSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets all (active and inactive) search restrictions for givenComposedTypeModel.Gets all search restrictions for type.Gets the session search restrictions from current session context.Gets the session search restrictions from current session context for particularComposedTypeModelobject.booleanhasRestrictions(PrincipalModel principal, boolean includePrincipalGroups, ComposedTypeModel type) Checks whether type has search restrictions (session and persisted).booleanChecks if search restrictions feature in current session context is enabled.voidRemoves all session-scoped search restrictions from the current session.voidremoveSessionSearchRestrictions(Collection<SessionSearchRestriction> restrictions) Remove session search restrictions from current session context.voidsetConverter(SessionSearchRestrictionConverter converter) voidsetSearchRestrictionDao(SearchRestrictionDao searchRestrictionDao) voidsetSessionService(SessionService sessionService)
-
Field Details
-
CTX_SEARCH_RESTRICTIONS
- See Also:
-
DISABLE_RESTRICTIONS
- See Also:
-
-
Constructor Details
-
DefaultSearchRestrictionService
public DefaultSearchRestrictionService()
-
-
Method Details
-
addSessionSearchRestrictions
Adds session search restrictions to current session context. If currently there are some session search restrictions, passed as parameter collection of restrictions will be added to current one.
Example usage:
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);- Specified by:
addSessionSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
restrictions- the restrictions collection to add to session.
-
addSessionSearchRestrictions
Adds session search restrictions to current session context. If currently there are some session search restrictions, passed as parameter restriction(s) will be added to current one.
Example usage:
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);- Specified by:
addSessionSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
restrictions- the restrictions to add
-
clearSessionSearchRestrictions
public void clearSessionSearchRestrictions()Clear session search restrictions in current session context.- Specified by:
clearSessionSearchRestrictionsin interfaceSearchRestrictionService
-
disableSearchRestrictions
public void disableSearchRestrictions()Disable search restrictions in current session context.- Specified by:
disableSearchRestrictionsin interfaceSearchRestrictionService
-
enableSearchRestrictions
public void enableSearchRestrictions()Enable search restrictions in current session context.- Specified by:
enableSearchRestrictionsin interfaceSearchRestrictionService
-
getActiveSearchRestrictions
public Collection<SearchRestrictionModel> getActiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets only active search restrictions for givenComposedTypeModel.- Specified by:
getActiveSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
principal- the principal for which restrictions will be searchedincludePrincipalGroups- determines whether include principal groups in searchtypes- Collection ofComposedTypeModelobjects for which restriction will be obtained.- Returns:
- the active search restrictions collection.
-
getInactiveSearchRestrictions
public Collection<SearchRestrictionModel> getInactiveSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets only inactive search restrictions for givenComposedTypeModel.- Specified by:
getInactiveSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
principal- the principal for which restrictions will be searchedincludePrincipalGroups- determines whether include principal groups in searchtypes- Collection ofComposedTypeModelobjects for which restriction will be obtained.- Returns:
- the active search restrictions collection.
-
getSearchRestrictions
public Collection<SearchRestrictionModel> getSearchRestrictions(PrincipalModel principal, boolean includePrincipalGroups, Collection<ComposedTypeModel> types) Gets all (active and inactive) search restrictions for givenComposedTypeModel.- Specified by:
getSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
principal- the principal for which restrictions will be searchedincludePrincipalGroups- determines whether include principal groups in searchtypes- Collection ofComposedTypeModelobjects for which restriction will be obtained.- Returns:
- the all search restrictions.
-
getSearchRestrictionsForType
Description copied from interface:SearchRestrictionServiceGets all search restrictions for type.- Specified by:
getSearchRestrictionsForTypein interfaceSearchRestrictionService- Parameters:
type- the type- Returns:
- the search restrictions for type
-
getSessionSearchRestrictions
Gets the session search restrictions from current session context.- Specified by:
getSessionSearchRestrictionsin interfaceSearchRestrictionService- Returns:
- the session search restrictions collection.
-
getSessionSearchRestrictions
Gets the session search restrictions from current session context for particularComposedTypeModelobject.- Specified by:
getSessionSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
type- the type for which which restriction will be obtained.- Returns:
- the session search restrictions collection.
-
hasRestrictions
public boolean hasRestrictions(PrincipalModel principal, boolean includePrincipalGroups, ComposedTypeModel type) Checks whether type has search restrictions (session and persisted).- Specified by:
hasRestrictionsin interfaceSearchRestrictionService- Parameters:
principal- the principal for which restrictions will be searchedincludePrincipalGroups- determines whether include principal groups in searchtype- the type for which check will be triggered.- Returns:
- true if has restrictions, false otherwise.
-
isSearchRestrictionsEnabled
public boolean isSearchRestrictionsEnabled()Checks if search restrictions feature in current session context is enabled.- Specified by:
isSearchRestrictionsEnabledin interfaceSearchRestrictionService- Returns:
- true is search restrictions are enabled
-
removeSessionSearchRestrictions
Remove session search restrictions from current session context.- Specified by:
removeSessionSearchRestrictionsin interfaceSearchRestrictionService- Parameters:
restrictions- the restrictions collection to remove from session.
-
removalAllSessionSearchRestrictions
public void removalAllSessionSearchRestrictions()Removes all session-scoped search restrictions from the current session.- Specified by:
removalAllSessionSearchRestrictionsin interfaceSearchRestrictionService
-
setConverter
-
setSearchRestrictionDao
-
setSessionService
-