Package de.hybris.platform.jalo.type
Class SearchRestriction
- java.lang.Object
-
- de.hybris.platform.util.BridgeAbstraction
-
- de.hybris.platform.jalo.Item
-
- de.hybris.platform.jalo.ExtensibleItem
-
- de.hybris.platform.jalo.c2l.LocalizableItem
-
- de.hybris.platform.jalo.type.TypeManagerManaged
-
- de.hybris.platform.jalo.type.SearchRestriction
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable
public class SearchRestriction extends TypeManagerManaged
A SearchRestriction represents a restricted search for a principal, which will be used for realizingpersonalization- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSearchRestriction.SearchRestrictionImplinterface to persistence layer-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
TypeManagerManaged.TypeManagerManagedImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImpl
-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.Item
Item.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringACTIVEstatic java.lang.StringCODEstatic java.lang.StringNAMEstatic java.lang.StringPRINCIPALstatic java.lang.StringQUERYstatic java.lang.StringRESTRICTEDTYPEstatic java.lang.StringRESTRICTION_TYPE_ALIAS-
Fields inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
AUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE
-
Fields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLED
-
Fields inherited from class de.hybris.platform.jalo.Item
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, HJMPTS, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPE
-
Fields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant
-
-
Constructor Summary
Constructors Constructor Description SearchRestriction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcheckRestrictionQuery(ComposedType restrictedType, java.lang.String query)static voidcheckUniqueCodeTypePrincipal(Principal principal, ComposedType type, java.lang.String code)Check that the code-type-principal combination is unique.protected SearchRestrictioncreateEntity(Principal principal, ComposedType restrictedType, java.lang.String query, java.lang.String code, java.lang.Boolean active)protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap atts)Has to be implemented for each concrete subtype of item.java.lang.StringexportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)java.util.MapgetAllName()java.util.MapgetAllName(SessionContext ctx)java.lang.StringgetCode()java.lang.StringgetCode(SessionContext ctx)java.util.Set<ComposedType>getExcludedSubtypes()Deprecated.since ages - not needed any longerjava.lang.StringgetName()java.lang.StringgetName(SessionContext ctx)protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)Defines all attributes which should be set after item creation.PrincipalgetPrincipal()PrincipalgetPrincipal(SessionContext ctx)java.lang.StringgetQuery()java.lang.StringgetQuery(SessionContext ctx)ComposedTypegetRestrictionType()ComposedTypegetRestrictionType(SessionContext ctx)protected SearchRestriction.SearchRestrictionImplimpl()booleanisActive()voidsetActive(boolean active)voidsetAllName(SessionContext ctx, java.util.Map names)voidsetAllName(java.util.Map names)voidsetCode(SessionContext ctx, java.lang.String code)voidsetCode(java.lang.String code)voidsetName(SessionContext ctx, java.lang.String name)Changes the name of this type system item for the specified language.voidsetName(java.lang.String name)Changes the name of this type system item for the current session language.voidsetPrincipal(Principal p)voidsetPrincipal(SessionContext ctx, Principal p)voidsetQuery(SessionContext ctx, java.lang.String query)voidsetQuery(java.lang.String query)voidsetRestrictionType(SessionContext ctx, ComposedType type)voidsetRestrictionType(ComposedType type)java.lang.StringtoString()Returns theStringrepresentation of this item.-
Methods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getAllNames, getExtensionName, getImpl, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate
-
Methods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedProperty
-
Methods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getImplementation, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setProperty
-
Methods inherited from class de.hybris.platform.jalo.Item
addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, compareTo, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getDefaultAttributeModes, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getOwner, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRelatedItems, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isMarkModifiedDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, notifyManagerAboutItemRemoval, readResolve, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setRelatedItems, setTransientObject, setUseTA, useTA, writeReplace
-
Methods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
CODE
public static final java.lang.String CODE
- See Also:
- Constant Field Values
-
ACTIVE
public static final java.lang.String ACTIVE
- Since:
- 2.10
- See Also:
- Constant Field Values
-
QUERY
public static final java.lang.String QUERY
- See Also:
- Constant Field Values
-
PRINCIPAL
public static final java.lang.String PRINCIPAL
- See Also:
- Constant Field Values
-
RESTRICTEDTYPE
public static final java.lang.String RESTRICTEDTYPE
- See Also:
- Constant Field Values
-
RESTRICTION_TYPE_ALIAS
public static final java.lang.String RESTRICTION_TYPE_ALIAS
- See Also:
- Constant Field Values
-
-
Method Detail
-
impl
protected SearchRestriction.SearchRestrictionImpl impl()
-
createEntity
protected SearchRestriction createEntity(Principal principal, ComposedType restrictedType, java.lang.String query, java.lang.String code, java.lang.Boolean active) throws ConsistencyCheckException
- Throws:
ConsistencyCheckException
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap atts) throws JaloBusinessException, JaloInvalidParameterException
Description copied from class:ItemHas to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) duringComposedType.newInstance(Map).In case this method uses any of the attribute values during creation it is required to override
Item.getNonInitialAttributes(SessionContext, ItemAttributeMap)too.
Sn example:public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) ); // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes( SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret = super.getNonInitialAttributes( ctx, allAttributes ); // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }- Specified by:
createItemin classItem- Parameters:
ctx- the current session context which this item is created withintype- the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )- Returns:
- the new item instance
- Throws:
JaloBusinessException- indicates an error during creation - any changes will be rollbackedJaloInvalidParameterException
-
getNonInitialAttributes
protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
Description copied from class:ItemDefines all attributes which should be set after item creation. this is done be removing all attributes which are already set byItem.createItem(SessionContext, ComposedType, ItemAttributeMap).use it like this:
protected ItemAttributeMap getNonInitialAttributes( SessionContext ctx, ItemAttributeMap allAttributes ) { // let all superclasses remove their intial attributes too final ItemAttributeMap attributes = super.getNonInitialAttributes( ctx, allAttributes ); // remove own initial attributes here attributes.remove( MyItem.MY_INITIAL_ATTR ); return ret; }it is vital to optain the map via super.getNonInitialAttributes and pass it on as such since this ensures that attribute qualifiers are treated case insensitive!- Overrides:
getNonInitialAttributesin classItem- Parameters:
ctx- session context with language = NULLallAttributes- aItemAttributeMapcontaning attribute values.- Returns:
- a
ItemAttributeMapcontaining all attribute values, which belong to non-initial attributes.
-
getCode
public java.lang.String getCode(SessionContext ctx)
-
getCode
public java.lang.String getCode()
-
setCode
public void setCode(SessionContext ctx, java.lang.String code)
-
setCode
public void setCode(java.lang.String code)
-
isActive
public boolean isActive()
- Since:
- 2.10
-
setActive
public void setActive(boolean active)
- Since:
- 2.10
-
getName
public java.lang.String getName(SessionContext ctx)
- Overrides:
getNamein classTypeManagerManaged- Parameters:
ctx- the session context specifying the language to get the name for- Returns:
- the name of this type system item localized for the specified session context
-
getName
public java.lang.String getName()
- Overrides:
getNamein classTypeManagerManaged- Returns:
- the name of this type system item localized for the current session language
-
getAllName
public java.util.Map getAllName(SessionContext ctx)
-
getAllName
public java.util.Map getAllName()
-
setName
public void setName(SessionContext ctx, java.lang.String name)
Description copied from class:TypeManagerManagedChanges the name of this type system item for the specified language.- Overrides:
setNamein classTypeManagerManaged- Parameters:
ctx- the session context defining the language to change the name forname- the new name
-
setName
public void setName(java.lang.String name)
Description copied from class:TypeManagerManagedChanges the name of this type system item for the current session language.- Overrides:
setNamein classTypeManagerManaged- Parameters:
name- the new name
-
setAllName
public void setAllName(SessionContext ctx, java.util.Map names)
-
setAllName
public void setAllName(java.util.Map names) throws JaloInvalidParameterException- Throws:
JaloInvalidParameterException
-
getQuery
public java.lang.String getQuery(SessionContext ctx)
-
getQuery
public java.lang.String getQuery()
-
setQuery
public void setQuery(SessionContext ctx, java.lang.String query) throws JaloInvalidParameterException
- Throws:
JaloInvalidParameterException
-
setQuery
public void setQuery(java.lang.String query) throws JaloInvalidParameterException- Throws:
JaloInvalidParameterException
-
getRestrictionType
public ComposedType getRestrictionType(SessionContext ctx)
-
getRestrictionType
public ComposedType getRestrictionType()
-
setRestrictionType
public void setRestrictionType(SessionContext ctx, ComposedType type)
-
setRestrictionType
public void setRestrictionType(ComposedType type)
-
getPrincipal
public Principal getPrincipal(SessionContext ctx)
-
getPrincipal
public Principal getPrincipal()
-
setPrincipal
public void setPrincipal(SessionContext ctx, Principal p)
-
setPrincipal
public void setPrincipal(Principal p)
-
getExcludedSubtypes
@Deprecated public java.util.Set<ComposedType> getExcludedSubtypes()
Deprecated.since ages - not needed any longerReturns all subtypes of this restrictions type for which a specialized form of this restriction exists.These restrictions must have the exactly the same code but are assigned to subtypes of the original restriction.
Within FlexibleSearch queries all these subtypes are excluded from the original restriction considering that their own restrictions are inserted too.
- Since:
- 2.10
-
toString
public java.lang.String toString()
Description copied from class:ItemReturns theStringrepresentation of this item. This is by default the representation of the primary key of this item.
-
exportXMLDefinition
public java.lang.String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
- Specified by:
exportXMLDefinitionin classTypeManagerManaged
-
checkRestrictionQuery
protected void checkRestrictionQuery(ComposedType restrictedType, java.lang.String query) throws JaloInvalidParameterException
- Throws:
JaloInvalidParameterException
-
checkUniqueCodeTypePrincipal
public static void checkUniqueCodeTypePrincipal(Principal principal, ComposedType type, java.lang.String code)
Check that the code-type-principal combination is unique.- Parameters:
principal- the principaltype- the typecode- the code
-
-