Class AttributeDescriptor
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
ConfigAttributeDescriptor,ExpressionAttributeDescriptor,GeneratedVariantAttributeDescriptor,RelationDescriptor,ViewAttributeDescriptor
ComposedType
exclusively.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe persistence layer interface.Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.Descriptor
Descriptor.DescriptorImplNested classes/interfaces inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
TypeManagerManaged.TypeManagerManagedImplNested classes/interfaces inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LocalizableItem.LocalizableItemImplNested classes/interfaces inherited from class de.hybris.platform.jalo.ExtensibleItem
ExtensibleItem.ExtensibleItemImplNested 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
FieldsModifier and TypeFieldDescriptionstatic final intAll flags combined.static final intAll publicly changeable flags combined.static final StringThe attributeHandler string attribute constant.static final StringThe database column name string attribute constant.static final StringThe declaring enclosing type string attribute constant.static final StringThe default value attribute constant.static final StringThe default value definiton string attribute constant.static final StringThe description string attribute constant.static final StringThe dontCopy string attribute constant.static final StringThe enclosing type string attribute constant.static final StringThe encrypted string attribute constant.static final intThe encrypted -Flag used bygetModifiers().static final StringDeprecated.static final StringThe inherited string attribute constant.static final intThe inherited -Flag used bygetModifiers().static final StringThe initial string attribute constant.static final intThe initial -Flag used bygetModifiers().static final StringThe localized string attribute constant.static final intThe localized -Flag used bygetModifiers().static final StringThe modifiers string attribute constant.static final StringThe optional string attribute constant.static final intThe optional -Flag used bygetModifiers().static final StringThe part of string attribute constant.static final intThe partOf -Flag used bygetModifiers().static final StringThe persistence class string attribute constant.static final StringThe persistence type string attribute constant.static final StringThe primitive string attribute constant.static final intThe primitive-Flag used bygetModifiers().static final StringThe private string attribute constant.static final intThe private -Flag used bygetModifiers().static final StringThe property string attribute constant.static final intThe property -Flag used bygetModifiers().static final StringThe proposed database column name string attribute constant.static final StringDeprecated.static final intThe read -Flag used bygetModifiers().static final StringThe readable string attribute constant.static final StringThe readOnlyForUI string attribute constant.static final StringThe removable string attribute constant.static final StringDeprecated.static final intThe remove -Flag used bygetModifiers().static final StringThe search string attribute constant.static final intThe search -Flag used bygetModifiers().static final StringThe do not optimize string attribute constant.static final intThe dontOptimize -Flag used bygetModifiers().static final StringThe unique string attribute constant.static final StringThe writable string attribute constant.static final StringDeprecated.since ages - please useWRITABLEinsteadstatic final intThe write -Flag used bygetModifiers().Fields inherited from class de.hybris.platform.jalo.type.Descriptor
ATTRIBUTETYPE, QUALIFIERFields inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
AUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE, NAMEFields inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
LANGUAGE_FALLBACK_ENABLEDFields 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, TYPEFields inherited from class de.hybris.platform.util.BridgeAbstraction
impl, tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckDefaultValueAssignability(SessionContext ctx, Object newVal) Internal - checks compatibility of default value with attribute value type.protected voidcheckLocalizedChange(boolean newLoc) Internal localization flag change check.protected voidcheckPartOfChange(boolean newPartOf) Internal: checks partOf flag change.protected voidcheckPropertyChange(boolean newProp) Internal property flag change check.protected voidcheckSearchableChange(boolean newSearchable) Internal - for checking whether an attribute can be made searchable or not.protected voidcheckSelectionOfDescriptor(AttributeDescriptor newSelect) Internal - compatibility check for selection of sttributes.protected voidcheckTypeChange(Type newType) Internal - do not use.booleancheckTypePermission(Principal p, UserRight right) Checks the type permission upon this attribute of the given principal.booleancheckTypePermission(UserRight right) Checks the type permission upon this attribute of the current session user.protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) Creator method for generic creation of attribute descriptor.exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout) protected voidexportXMLDefinitionDefaultValue(org.znerd.xmlenc.XMLOutputter xout) Returns all names of this attribute descriptor as map.Returns all sub attribute descriptors of this attribute.Internal - access to persistence layer implementation.If the attribute has been inherited this returns the type which originally declared this attribute.Returns the default value of this attribute descriptor ornullif no value was set and there is no default value defined for the attribute value type.Returns the default value of this attribute descriptor ornullif no value was set and there is no default value defined for the attribute value type.Returns the defaul value definition fromitems.xmlin case this attribute was declared there having a<defaultvalue>tag.booleanTells whether this attribute descriptor has an "optimized" database layout or is stored in the dump table (dontOptimize=true).The composed type which owns this attribute descriptor.protected intgetIntModifiersFromMap(Map allAttributes) Internal - converts single flag attributes into int constants combinations for generic creation process.intReturns the attribute settings as combination of:READ_FLAGWRITE_FLAGOPTIONAL_FLAGREMOVE_FLAGPARTOF_FLAGINITIAL_FLAGPRIVATE_FLAGPROPERTY_FLAGSEARCH_FLAGTIM_IGNORE_FLAGENCRYPTED_FLAGgetName(SessionContext ctx) Returns the name of this attribute descriptor.protected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Cuts the following attributes from value map since these values have been set during creation:ENCLOSING_TYPEDescriptor.QUALIFIERDescriptor.ATTRIBUTETYPEIf the attribute is backed by a EJB CMP field this method returns the CMP field name.Since all attributes created after initialization are not mapped to a own database column this method provides a column name proposal.Returns the selection-of attribute descriptor.Returns direct sub attribute descriptors of this attribute.protected MapOverride to add custom properties to this type's xml definition.Assembles the attribute descriptors XML definition required foritems.xml.protected ObjectinterpretAndReplaceDefaultValue(Object current) booleanTells whether this attribute should be stored in an encrypted waybooleanbooleanTells whether an attribute descriptor was inherited or not.booleanTells whether an attribute is initial or not.booleanTells whether an attribute is localized or not.booleanTells whether or not the described attribute has to be provided with a non-null value when creating a new item instance viaComposedType.newInstance(Map).booleanisPartOf()Tells whether this attribute descriptor describes a part-of relation or not.booleanTells whether this attribute represents a java primitive type.booleanTells whether an attribute is private or not.booleanTells whether the attribute is realized as property or not.booleanbooleanbooleanTells whether a inherited attribute descriptor has different modifiers and/or a different value type than its super attribute descriptor.booleanTells whether or not this attribute is is allowed to be removed.Checks if the attribute descriptor is a runtime one.booleanTells whether a attribute is searchable or not.booleanisUnique()Tells whether this attribute is unique.booleanReturnstrueif the attribute is writable.booleanDeprecated.since ages - useisWritable()voidredeclareAttributeType(Type type, int modifiers) Deprecated.since ages - please usesetAttributeType(Type)insteadremoveLocalizedProperty(SessionContext ctx, String name) Removes a localized property.protected ObjectRemoves a localized property without removing it from sub attributes too.removeProperty(SessionContext ctx, String name) Removes a property.protected ObjectremovePropertyNonRecursively(SessionContext ctx, String name) Removes a property without removing it from sub attributes too.voidsetAllDescriptions(SessionContext ctx, Map descriptions) Changes all localized attribute descriptions by providing a language-to-description map.voidsetAllDescriptions(Map descriptions) Changes all localized attribute descriptions by providing a language-to-description map.voidsetAttributeHandler(String attributeHandler) voidsetAttributeType(Type type) Changes the value type of this attribute descriptor.voidsetDatabaseColumn(String col) Changes the database column of this attribute.voidsetDefaultValue(SessionContext ctx, Object value) Changes the default value of this attribute.voidsetDefaultValue(Object value) Changes the default value of this attribute.voidsetDescription(SessionContext ctx, String description) Changes the attribute description text for the specified languag.voidsetDescription(String description) Changes the attribute description text for the current session languag.voidsetDontOptimize(boolean dontopt) Changes the optimize flag of this attribute descriptor.voidsetEncrypted(boolean encrypt) Changes the encrypted flag of this attribute descriptor.voidsetHiddenForUI(boolean hiddenForUI) voidsetInitial(boolean initial) Changes the initial flag of this attribute descriptor.voidsetLocalized(boolean localized) Changes localized flag of this attribute descriptor.setLocalizedProperty(SessionContext ctx, String name, Object value) Sets a localized property and copies the new value down to all sub attribute descriptors.protected ObjectsetLocalizedPropertyNonRecursively(SessionContext ctx, String name, Object value) Sets a localized property without copying it down to all sub attribute descriptors.voidsetModifiers(int modifiers) voidsetOptional(boolean optional) Changes whether or not the described attribute has to be provided with a non-null value when creating a new item instance viaComposedType.newInstance(Map).voidsetPartOf(boolean partOf) Changes the partOf flag of this attribute descriptor.voidsetPrimitive(boolean primitive) Changes the primitive flag of this attribute descriptor.voidsetPrivate(boolean priv) Changes the private flag of this attribute descriptor.voidsetProperty(boolean isProperty) Changes the property flag of this attribute descriptor.setProperty(SessionContext ctx, String name, Object value) Sets a property and copies the new value down to all sub attribute descriptors.protected ObjectsetPropertyNonRecursively(SessionContext ctx, String name, Object value) Sets a property without copying it down to all sub attribute descriptors.voidsetReadable(boolean readable) Changes the attribute describtor's readable status.voidsetReadOnlyForUI(boolean readOnlyForUI) voidsetRemovable(boolean removable) Changes whether or not this attribute is is allowed to be removed.voidsetSearchable(boolean searchable) Changes the searchable flag of this attribute descriptor.voidsetSelectionOf(AttributeDescriptor descriptor) Changes the selection-of attribute.voidsetUnique(boolean unique) Changes the unique flag of this attribute descriptor.voidsetWritable(boolean writable) Changes the attribute describtor's writable status.toString()The string represenation of this attribute descriptor.static StringtoString(int modifiers) protected voidwriteDefaultValueTagAtomic(org.znerd.xmlenc.XMLOutputter xout, String atomictype, String value) Methods inherited from class de.hybris.platform.jalo.type.Descriptor
compareTo, getAttributeType, getAttributeType, getContextAdjustedAttributeType, getDescriptorImpl, getQualifier, getRealAttributeTypeMethods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getExtensionName, getImpl, getName, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate, setName, setNameMethods inherited from class de.hybris.platform.jalo.c2l.LocalizableItem
getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedPropertyMethods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getImplementation, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, setAllProperties, setAllProperties, setPropertyMethods 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, 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, getPartOfRemovedSessionMarker, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRelatedItems, 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, suppressRelation, useTA, writeReplaceMethods inherited from class de.hybris.platform.util.BridgeAbstraction
setTenant
-
Field Details
-
DEFAULTVALUE
The default value attribute constant. -
DEFAULTVALUE_DEFINITIONSTRING
The default value definiton string attribute constant. -
DESCRIPTION
The description string attribute constant. -
ENCLOSING_TYPE
The enclosing type string attribute constant. -
DECLARING_ENCLOSING_TYPE
The declaring enclosing type string attribute constant. -
WRITABLE
The writable string attribute constant. -
READABLE
The readable string attribute constant. -
REMOVABLE
The removable string attribute constant. -
OPTIONAL
The optional string attribute constant. -
SEARCH
The search string attribute constant. -
PARTOF
The part of string attribute constant. -
PRIVATE
The private string attribute constant. -
PROPERTY
The property string attribute constant. -
LOCALIZED
The localized string attribute constant. -
INHERITED
The inherited string attribute constant. -
UNIQUE
The unique string attribute constant. -
INITIAL
The initial string attribute constant. -
TIM_IGNORE
The do not optimize string attribute constant. -
MODIFIERS
The modifiers string attribute constant. -
DATABASECOLUMN
The database column name string attribute constant. -
PERSISTENCETYPE
The persistence type string attribute constant. -
ATTRIBUTE_HANDLER
The attributeHandler string attribute constant. -
PROPOSED_DATABASE_COLUMN
The proposed database column name string attribute constant. -
PERSISTENCE_CLASS
The persistence class string attribute constant. -
ENCRYPTED
The encrypted string attribute constant. -
PRIMITIVE
The primitive string attribute constant. -
HIDDENFORUI
Deprecated.The hiddenForUI string attribute constant.- See Also:
-
READONLYFORUI
The readOnlyForUI string attribute constant.- See Also:
-
DONT_COPY
The dontCopy string attribute constant.- See Also:
-
READ
Deprecated. -
WRITE
Deprecated.since ages - please useWRITABLEinstead -
REMOVE
Deprecated.since ages - please useREMOVABLEinstead -
READ_FLAG
public static final int READ_FLAGThe read -Flag used bygetModifiers().- See Also:
-
WRITE_FLAG
public static final int WRITE_FLAGThe write -Flag used bygetModifiers().- See Also:
-
REMOVE_FLAG
public static final int REMOVE_FLAGThe remove -Flag used bygetModifiers().- See Also:
-
OPTIONAL_FLAG
public static final int OPTIONAL_FLAGThe optional -Flag used bygetModifiers().- See Also:
-
SEARCH_FLAG
public static final int SEARCH_FLAGThe search -Flag used bygetModifiers().- See Also:
-
PARTOF_FLAG
public static final int PARTOF_FLAGThe partOf -Flag used bygetModifiers().- See Also:
-
PRIVATE_FLAG
public static final int PRIVATE_FLAGThe private -Flag used bygetModifiers().- See Also:
-
PROPERTY_FLAG
public static final int PROPERTY_FLAGThe property -Flag used bygetModifiers().- See Also:
-
LOCALIZED_FLAG
public static final int LOCALIZED_FLAGThe localized -Flag used bygetModifiers().- See Also:
-
INHERITED_FLAG
public static final int INHERITED_FLAGThe inherited -Flag used bygetModifiers().- See Also:
-
INITIAL_FLAG
public static final int INITIAL_FLAGThe initial -Flag used bygetModifiers().- See Also:
-
TIM_IGNORE_FLAG
public static final int TIM_IGNORE_FLAGThe dontOptimize -Flag used bygetModifiers().- See Also:
-
ENCRYPTED_FLAG
public static final int ENCRYPTED_FLAGThe encrypted -Flag used bygetModifiers().- See Also:
-
PRIMITIVE_FLAG
public static final int PRIMITIVE_FLAGThe primitive-Flag used bygetModifiers().- See Also:
-
ALL
public static final int ALLAll flags combined. Use for bit wise operations.- See Also:
-
ALL_PUBLIC
public static final int ALL_PUBLICAll publicly changeable flags combined. Use for bit wise operations.- See Also:
-
-
Constructor Details
-
AttributeDescriptor
public AttributeDescriptor()
-
-
Method Details
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException Creator method for generic creation of attribute descriptor. The following attributes are required:- 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 rollbacked
-
getNonInitialAttributes
protected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Cuts the following attributes from value map since these values have been set during creation:- 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.
-
setProperty
Sets a property and copies the new value down to all sub attribute descriptors.- Overrides:
setPropertyin classExtensibleItem- Parameters:
ctx- the session contextname- the property namevalue- the new value- Returns:
- the old value
- See Also:
-
setPropertyNonRecursively
Sets a property without copying it down to all sub attribute descriptors.- Parameters:
ctx- the session contextname- the property namevalue- the new value- Returns:
- the old value
- Since:
- 2.10 (previous method name contained a typo)
- See Also:
-
setLocalizedProperty
Sets a localized property and copies the new value down to all sub attribute descriptors.- Overrides:
setLocalizedPropertyin classLocalizableItem- Parameters:
ctx- the session context defining the languagename- the property namevalue- the new value- Returns:
- the old value
- See Also:
-
setLocalizedPropertyNonRecursively
Sets a localized property without copying it down to all sub attribute descriptors.- Parameters:
ctx- the session context defining the languagename- the property namevalue- the new value- Returns:
- the old value
- Since:
- 2.10 (previous method name contained a typo)
- See Also:
-
removeLocalizedProperty
Removes a localized property. The property is also removed from all subattributes.- Overrides:
removeLocalizedPropertyin classLocalizableItem- Parameters:
ctx- the session context defining the languagename- the property name- Returns:
- the localized property value which was removed
-
removeLocalizedPropertyNonRecursively
Removes a localized property without removing it from sub attributes too.- Parameters:
ctx- the session context defining the languagename- the property name- Since:
- 2.10 (previous method name contained a typo)
-
removeProperty
Removes a property. The property is also removed from all subattributes.- Overrides:
removePropertyin classExtensibleItem- Parameters:
ctx- the session contextname- the property name- Returns:
- the property that was bound to the name before removal or
nullif there was no property.
-
removePropertyNonRecursively
Removes a property without removing it from sub attributes too.- Parameters:
ctx- the session contextname- the property name- Since:
- 2.10 (previous method name contained a typo)
-
getSubAttributeDescriptors
Returns direct sub attribute descriptors of this attribute. These are the attribute descriptors copied for direct subtypes of this attribute descriptor's enclosing type. -
getAllSubAttributeDescriptors
Returns all sub attribute descriptors of this attribute. These are the attribute descriptors copied for all subtypes of this attribute descriptor's enclosing type. -
getName
Returns the name of this attribute descriptor. In case no name was set and the attribute descriptor has been inherited it tries to fetch the name from its super attribute descriptior(s).- Overrides:
getNamein classTypeManagerManaged- Parameters:
ctx- the session context defining the language to get the name for- Returns:
- the name of this type system item localized for the specified session context
-
getAllNames
Returns all names of this attribute descriptor as map. In case some names were not set and the attribute descriptor has been inherited it tries to fill the names map from its super attribute descriptior(s).- Overrides:
getAllNamesin classTypeManagerManaged
-
checkTypeChange
Internal - do not use.- Parameters:
newType-- Throws:
JaloInvalidParameterException
-
setAttributeType
Changes the value type of this attribute descriptor.This functionality should be used rarely since attribute type changes may impose different handling of item instances by all applications using this type. Generally attribute type changes should be done during system initialization or similar steps.
- Parameters:
type- the new value type- Throws:
JaloInvalidParameterException- in case the previous type was not assignable from the new one; if the attribute has been inherited the previous type is taken from the super attribute
-
redeclareAttributeType
@Deprecated(since="ages", forRemoval=false) public void redeclareAttributeType(Type type, int modifiers) throws JaloInvalidParameterException Deprecated.since ages - please usesetAttributeType(Type)instead- Throws:
JaloInvalidParameterException
-
getDeclaringEnclosingType
If the attribute has been inherited this returns the type which originally declared this attribute. Otherwise it just returns the own enclosing type. -
getEnclosingType
The composed type which owns this attribute descriptor. -
getModifiers
public int getModifiers()Returns the attribute settings as combination of: -
setModifiers
public void setModifiers(int modifiers) -
isReadable
public boolean isReadable()- Returns:
- true if the attribute is readable.
- See Also:
-
setReadable
Changes the attribute describtor's readable status.Please note that changing an attribute descritors readability cannot affect the actual implementation ( see
AttributeAccess). If an implementation does not allow reading the value setting the attribute descriptor readable doesnt make much sense.- Throws:
JaloInvalidParameterException- See Also:
-
isWriteable
Deprecated.since ages - useisWritable()- Returns:
- true if the attribute is writable.
- See Also:
-
isWritable
public boolean isWritable()Returnstrueif the attribute is writable.- See Also:
-
setWritable
Changes the attribute describtor's writable status.Please note that changing an attribute descritors writability cannot affect the actual implementation ( see
AttributeAccess). If an implementation does not allow writing the value setting the attribute descriptor writable doesnt make much sense.- Throws:
JaloInvalidParameterException- See Also:
-
isRemovable
public boolean isRemovable()Tells whether or not this attribute is is allowed to be removed. Only removable attribute descriptors are allowed to be removed viaItem.remove().The remove flag is intented to provide a certain safety for the type system designer to mark all required attribute as non-removable contrary to attribute descriptors created during system runtime which may be removed again.
- See Also:
-
setRemovable
Changes whether or not this attribute is is allowed to be removed. Only removable attribute descriptors are allowed to be removed viaItem.remove().The remove flag is intented to provide a certain safety for the type system designer to mark all required attribute as non-removable contrary to attribute descriptors created during system runtime which may be removed again.
- Throws:
JaloInvalidParameterException- See Also:
-
isOptional
public boolean isOptional()Tells whether or not the described attribute has to be provided with a non-null value when creating a new item instance viaComposedType.newInstance(Map).Since the actual item creation logic is coded in
Item.createItem(SessionContext, ComposedType, Item.ItemAttributeMap)it is very likely that some attributes are always required so setting their attribute descriptors to be optional doesnt make much sense, even if it's possible. -
setOptional
Changes whether or not the described attribute has to be provided with a non-null value when creating a new item instance viaComposedType.newInstance(Map).Since the actual item creation logic is coded in
Item.createItem(SessionContext, ComposedType, Item.ItemAttributeMap)it is very likely that some attributes are always required so setting their attribute descriptors to be optional doesnt make much sense, even if it's possible.- Throws:
JaloInvalidParameterException
-
isSearchable
public boolean isSearchable()Tells whether a attribute is searchable or not. Usually this may only be true if the attribute has got persistence informations likegetDatabaseColumn()andgetPersistenceClass(). -
setSearchable
Changes the searchable flag of this attribute descriptor.Please note that setting an attribute descriptor searchable which does not have persistence informations doesnt make much sense ( unless the FlexibleSearch was replaced by a search engine which is capable of searching such fields ).
- Throws:
JaloInvalidParameterException- in case the persistence information does not allow this attribute to be made searchable
-
checkSearchableChange
Internal - for checking whether an attribute can be made searchable or not.- Throws:
JaloInvalidParameterException- if it cannot become searchable
-
isPartOf
public boolean isPartOf()Tells whether this attribute descriptor describes a part-of relation or not.Part-of attributes describe fields which store references to items which belong to the owner of the attribute.
To name one example:
AbstractOrder.entrieswhere the AbstractOrder instance owns a collection of AbstractOrderEntry instances. Since one entry belongs to this order exclusively theentriesattribute is marked as being part of .- See Also:
-
getDontOptimize
public boolean getDontOptimize()Tells whether this attribute descriptor has an "optimized" database layout or is stored in the dump table (dontOptimize=true).- See Also:
-
isEncrypted
public boolean isEncrypted()Tells whether this attribute should be stored in an encrypted way- See Also:
-
isPrimitive
public boolean isPrimitive()Tells whether this attribute represents a java primitive type. -
setPartOf
Changes the partOf flag of this attribute descriptor.- Throws:
JaloInvalidParameterException- if the attribute does not hold Items but other objects and it is tried to be set partOf- See Also:
-
checkPartOfChange
Internal: checks partOf flag change.- Throws:
JaloInvalidParameterException- in case change is not allowed
-
isPrivate
public boolean isPrivate()Tells whether an attribute is private or not.Private attributes are intented for internal use and therefore hidden from general methods like
ComposedType.getAttributeDescriptors()- they may only be found usingComposedType.getEveryAttributeDescriptor(String).
Apart from that private attributes behave like non-private ones.- Returns:
- true if the attribute is private
- See Also:
-
setPrivate
public void setPrivate(boolean priv) Changes the private flag of this attribute descriptor.- Parameters:
priv- the new private status- See Also:
-
setDontOptimize
public void setDontOptimize(boolean dontopt) Changes the optimize flag of this attribute descriptor.- Parameters:
dontopt- the new dont optimize status- See Also:
-
setEncrypted
public void setEncrypted(boolean encrypt) Changes the encrypted flag of this attribute descriptor.- Parameters:
encrypt- the new encrypt status- See Also:
-
setPrimitive
public void setPrimitive(boolean primitive) Changes the primitive flag of this attribute descriptor.- Parameters:
primitive- the new primitive status
-
isLocalized
public boolean isLocalized()Tells whether an attribute is localized or not. Localized attributes hold multiple values, one per language. Therefore the attribute descriptor's value type must be aMapTypehaving the language item type as argument type and the actual attribute value type as return type.An example:
TypeManager tm = jaloSession.getTypeManager(); // we like to define a new localized attribute holding users ComposedType userType = tm.getComposedType( User.class ); ComposedType langType = tm.getComposedType( Language.class ); ComposedType myType = ... myType.createAttributeDescriptor( "myAttribute", tm.createMapType("locUserType", langType, userType), AttributeDescriptor.READ_FLAG + AttributeDescriptor.WRITE_FLAG + AttributeDescriptor.OPTIONAL_FLAG + AttributeDescriptor.PROPERTY_FLAG );Another diference between unlocalized and localized attributes is the result of
Item.getAttribute(SessionContext, String). As long as the specified session context contains a session language the result will be the value mapped to this language. If no language is specified the result will contain all values in form of a map containing language-to-value mappings!
The same rule applies toItem.setAttribute(SessionContext, String, Object).- See Also:
-
setLocalized
Changes localized flag of this attribute descriptor. Only attributes holding aMapTypewith a language composed type as their argumenttype as attribute value type may become localized.Generally changing an attribute's localization status should seldom be necessary since during attribute creation the persistence settings have been chosen anyway which defines clearly if the field is localized or not.
- Parameters:
localized- the new localized status- Throws:
JaloInvalidParameterException- in case the attribute value type doesnt allow attribute to be localized.
-
checkLocalizedChange
Internal localization flag change check.- Throws:
JaloInvalidParameterException- in case localized flag change is allowed
-
isInherited
public boolean isInherited()Tells whether an attribute descriptor was inherited or not. Inherited attribute descriptors are copies of the same attribute descriptor belonging to the direct supertype of its enclosing type. -
isInitial
public boolean isInitial()Tells whether an attribute is initial or not.More precisely this flag would be named initially writable which means the attribute value may be written during instance creation. Usually it is used in combination with setting the writable flag to false which describes a field which has to be filled during creation but cannot be changed afterwards.
-
setInitial
public void setInitial(boolean initial) Changes the initial flag of this attribute descriptor.- Parameters:
initial- the new initial flag
-
isProperty
public boolean isProperty()Tells whether the attribute is realized as property or not.A attribute realized as property may always be accessed via
ExtensibleItem.getProperty(String)andExtensibleItem.setProperty(String, Object)as well as the generic way.Due to the fact that only
ExtensibleItemsubclasses can have properties the enclosing type cannot describe a jalo item which is not.- See Also:
-
setProperty
Changes the property flag of this attribute descriptor.If true the attribute is backed by a property field. Each property attribute owns automatically a
AttributeAccesswhich redirects to property getter and setter methods. Nevertheless it is possible to register a own access for this attribute as well.Please note that setting this flag to
falserequires that a ownAttributeAccessis registered. Otherwise each access to this attribute will raise an exception from now on.- Parameters:
isProperty- the new property flag status- Throws:
JaloInvalidParameterException- in case the enclosing type does not describe a subclass ofExtensibleItem- See Also:
-
checkPropertyChange
Internal property flag change check.- Throws:
JaloInvalidParameterException- in case the enclosing type does not belong to a subclass of extensible item- See Also:
-
isUnique
public boolean isUnique()Tells whether this attribute is unique.Unique attributes describe the fact that no two instances (of the enclosing type) may hold the same value within this attribute.
Please note that right now there is no automatic check built in hybris platform - each
AttributeAccesswill need to implement its own check. This may change in future releases. -
setUnique
public void setUnique(boolean unique) Changes the unique flag of this attribute descriptor.- Parameters:
unique- the new unique status.
-
isHiddenForUI
public boolean isHiddenForUI() -
setHiddenForUI
public void setHiddenForUI(boolean hiddenForUI) -
isReadOnlyForUI
public boolean isReadOnlyForUI() -
setReadOnlyForUI
public void setReadOnlyForUI(boolean readOnlyForUI) -
setAttributeHandler
-
getAttributeHandler
-
getDefaultValueDefinitionString
Returns the defaul value definition fromitems.xmlin case this attribute was declared there having a<defaultvalue>tag. Otherwisenullis returned.- See Also:
-
getDefaultValue
Returns the default value of this attribute descriptor ornullif no value was set and there is no default value defined for the attribute value type. If the value provides a default value this one is taken if the attribute doesnt provide a own value.Please note that the default value for the current session context is retrieved: for localized attributes the value belonging to the current session language!
-
getDefaultValue
Returns the default value of this attribute descriptor ornullif no value was set and there is no default value defined for the attribute value type. If the value provides a default value this one is taken if the attribute doesnt provide a own value.Please note that the default value for the specified session context is retrieved: for localized attributes the value belonging to the current session language! If no language is set or the context is
nullall localized values are returned in form of a map holding language-to-value mappings.- Parameters:
ctx- the session context specifying the language ( affect for localized attributes only )- See Also:
-
interpretAndReplaceDefaultValue
-
setDefaultValue
Changes the default value of this attribute.Please note that the value is set using the current session context. For localized attributes this means the value belonging to the current session language is changed - all other stay unchanged. Non-localized attributes are not affected by session context.
- Parameters:
value- the new default value- Throws:
JaloInvalidParameterException- in case the new value is not compatible with the attribute value type.- See Also:
-
setDefaultValue
Changes the default value of this attribute.Please note that the value is set using the specified session context. For localized attributes this means the value belonging to the current session language is changed - all other stay unchanged. If no language is set the value must be a map containing all localized values as language-to-value mappings.
Unlocalized attributes are not affected by session context.- Parameters:
ctx- the session context specifying the languagevalue- the new default value- Throws:
JaloInvalidParameterException- in case the new value is not compatible with the attribute value type.- See Also:
-
checkDefaultValueAssignability
protected void checkDefaultValueAssignability(SessionContext ctx, Object newVal) throws JaloInvalidParameterException Internal - checks compatibility of default value with attribute value type.- Parameters:
newVal- the new value- Throws:
JaloInvalidParameterException- in case the value is not compatible- See Also:
-
getDescription
- Returns:
- the attribute description text localized for the current session language.
-
getDescription
- Parameters:
ctx- the session context specifying the language to get the localized description for- Returns:
- the attribute description text localized as spcified by the given session context
-
setDescription
Changes the attribute description text for the current session languag.- Parameters:
description- the new (localized) description
-
setDescription
Changes the attribute description text for the specified languag.- Parameters:
ctx- the session contex specifying the language to change the description fordescription- the new (localized) description
-
getAllDescriptions
- Returns:
- all localized attribute descriptions as language-to-description map
-
getAllDescriptions
- Returns:
- all localized attribute descriptions as language-to-description map
-
setAllDescriptions
Changes all localized attribute descriptions by providing a language-to-description map. -
setAllDescriptions
Changes all localized attribute descriptions by providing a language-to-description map. -
getSelectionOf
Returns the selection-of attribute descriptor.Attributes which own a selection-of attribute descriptor must to choose their values from the values readable from the selecion-of attribute.
Usually selection-of attribute descriptors describe collection attributes so that there are multiple values to chose from.
Of course the attribute value types have to be compatible.
-
setSelectionOf
Changes the selection-of attribute.- Parameters:
descriptor- the new selection-of attribute- Throws:
JaloInvalidParameterException- if- the attribute equals this attribute
- the attribute does not belong to the same enclosing type
- the value type of the selection attribute is incompatible with this attributes value type
- See Also:
-
checkSelectionOfDescriptor
protected void checkSelectionOfDescriptor(AttributeDescriptor newSelect) throws JaloInvalidParameterException Internal - compatibility check for selection of sttributes.- Throws:
JaloInvalidParameterException- if- the attribute equals this attribute
- the attribute does not belong to the same enclosing type
- the value type of the selection attribute is incompatible with this attributes value type
- See Also:
-
getDatabaseColumn
- Returns:
- the database column of this attribute or
nullif the attribute has no persistence representation.
-
setDatabaseColumn
Changes the database column of this attribute.This change will be only effective after server restart ! Also note that you have to make sure the column exists since it is not atomatically created due to some database ALTER TABLE limitations.
- Parameters:
col- the new column name
-
getProposedDatabaseColumn
Since all attributes created after initialization are not mapped to a own database column this method provides a column name proposal.Such a property attribute can be mapped to a own column as follows:
- set the column name (as proposed or any other possible name) by
setDatabaseColumn(String) - shutdown all hybris platform instances
- create this column manually in the proper database table (use
ComposedType.getTable()to get item table name; for localized attributes use table itemtable +'LP' instead) - start the hybris platform again
- the attribute should be read from and stored into the new column now
- Returns:
- the proposed column name
- set the column name (as proposed or any other possible name) by
-
getPersistenceClass
- Returns:
- the java class describing this attribute's persistence type.
- See Also:
-
getPersistenceType
- Returns:
- the atomic type describing this attributes persistence type.
- See Also:
-
getAttributeDescriptorImpl
Internal - access to persistence layer implementation. -
getIntModifiersFromMap
Internal - converts single flag attributes into int constants combinations for generic creation process.- Parameters:
allAttributes- the attribute values- Returns:
- a combination of:
-
toString
The string represenation of this attribute descriptor.- Overrides:
toStringin classDescriptor- Returns:
- the
Stringrepresentation of this item.
-
toString
-
getPersistenceQualifier
If the attribute is backed by a EJB CMP field this method returns the CMP field name. Otherwisenullis returned. -
isRedeclared
public boolean isRedeclared()Tells whether a inherited attribute descriptor has different modifiers and/or a different value type than its super attribute descriptor.A redeclared attribute will be included in the XML definition of its type even though it was originally declared in one of its supertypes.
-
getXMLCustomProperties
Override to add custom properties to this type's xml definition. -
getXMLDefinition
Assembles the attribute descriptors XML definition required foritems.xml. This definiton will be included in the XML definition of its enclosing type if the attribute has been declarded by it or has been redeclared. -
exportXMLDefinition
- Specified by:
exportXMLDefinitionin classTypeManagerManaged
-
exportXMLDefinitionDefaultValue
protected void exportXMLDefinitionDefaultValue(org.znerd.xmlenc.XMLOutputter xout) throws IOException - Throws:
IOException
-
writeDefaultValueTagAtomic
-
checkTypePermission
Checks the type permission upon this attribute of the current session user.Works similar to
Item.checkPermission(UserRight)except that the permissions of the enclosing type and super attribute are evaluated in case no permission is set for this attribute.The evaluation first checks the enclosing type and in case no permission is defined there too just checks the super attribute recursively.
- Parameters:
right- the user right to check
-
checkTypePermission
Checks the type permission upon this attribute of the given principal.Works similar to
Item.checkPermission(UserRight)except that the permissions of the enclosing type and super attribute are evaluated in case no permission is set for this attribute.The evaluation first checks the enclosing type and in case no permission is defined there too just checks the super attribute recursively.
- Parameters:
p- the principal to checkright- the user right to check
-
isRuntime
Checks if the attribute descriptor is a runtime one. A runtime attribute was created from a code and does not have a definition in the *item.xml. For attributes marked as dontoptimize it returns false.
-
REMOVABLEinstead