Class AttributeDescriptor

All Implemented Interfaces:
Serializable, Comparable
Direct Known Subclasses:
ConfigAttributeDescriptor, ExpressionAttributeDescriptor, GeneratedVariantAttributeDescriptor, RelationDescriptor, ViewAttributeDescriptor

public class AttributeDescriptor extends Descriptor
The attribute descriptor describes item attributes. It describes its value type as well as its persistence implementation. Each attribute descriptor belongs to oneComposedType exclusively.
See Also:
  • Field Details

    • DEFAULTVALUE

      public static final String DEFAULTVALUE
      The default value attribute constant.
    • DEFAULTVALUE_DEFINITIONSTRING

      public static final String DEFAULTVALUE_DEFINITIONSTRING
      The default value definiton string attribute constant.
    • DESCRIPTION

      public static final String DESCRIPTION
      The description string attribute constant.
    • ENCLOSING_TYPE

      public static final String ENCLOSING_TYPE
      The enclosing type string attribute constant.
    • DECLARING_ENCLOSING_TYPE

      public static final String DECLARING_ENCLOSING_TYPE
      The declaring enclosing type string attribute constant.
    • WRITABLE

      public static final String WRITABLE
      The writable string attribute constant.
    • READABLE

      public static final String READABLE
      The readable string attribute constant.
    • REMOVABLE

      public static final String REMOVABLE
      The removable string attribute constant.
    • OPTIONAL

      public static final String OPTIONAL
      The optional string attribute constant.
    • PARTOF

      public static final String PARTOF
      The part of string attribute constant.
    • PRIVATE

      public static final String PRIVATE
      The private string attribute constant.
    • PROPERTY

      public static final String PROPERTY
      The property string attribute constant.
    • LOCALIZED

      public static final String LOCALIZED
      The localized string attribute constant.
    • INHERITED

      public static final String INHERITED
      The inherited string attribute constant.
    • UNIQUE

      public static final String UNIQUE
      The unique string attribute constant.
    • INITIAL

      public static final String INITIAL
      The initial string attribute constant.
    • TIM_IGNORE

      public static final String TIM_IGNORE
      The do not optimize string attribute constant.
    • MODIFIERS

      public static final String MODIFIERS
      The modifiers string attribute constant.
    • DATABASECOLUMN

      public static final String DATABASECOLUMN
      The database column name string attribute constant.
    • PERSISTENCETYPE

      public static final String PERSISTENCETYPE
      The persistence type string attribute constant.
    • ATTRIBUTE_HANDLER

      public static final String ATTRIBUTE_HANDLER
      The attributeHandler string attribute constant.
    • PROPOSED_DATABASE_COLUMN

      public static final String PROPOSED_DATABASE_COLUMN
      The proposed database column name string attribute constant.
    • PERSISTENCE_CLASS

      public static final String PERSISTENCE_CLASS
      The persistence class string attribute constant.
    • ENCRYPTED

      public static final String ENCRYPTED
      The encrypted string attribute constant.
    • PRIMITIVE

      public static final String PRIMITIVE
      The primitive string attribute constant.
    • HIDDENFORUI

      public static final String HIDDENFORUI
      Deprecated.
      The hiddenForUI string attribute constant.
      See Also:
    • READONLYFORUI

      public static final String READONLYFORUI
      The readOnlyForUI string attribute constant.
      See Also:
    • DONT_COPY

      public static final String DONT_COPY
      The dontCopy string attribute constant.
      See Also:
    • READ

      @Deprecated(since="ages", forRemoval=false) public static final String READ
      Deprecated.
    • WRITE

      @Deprecated(since="ages", forRemoval=false) public static final String WRITE
      Deprecated.
      since ages - please useWRITABLEinstead
    • REMOVE

      @Deprecated(since="ages", forRemoval=false) public static final String REMOVE
      Deprecated.
      since ages - please useREMOVABLEinstead
    • READ_FLAG

      public static final int READ_FLAG
      The read -Flag used by getModifiers().
      See Also:
    • WRITE_FLAG

      public static final int WRITE_FLAG
      The write -Flag used by getModifiers().
      See Also:
    • REMOVE_FLAG

      public static final int REMOVE_FLAG
      The remove -Flag used by getModifiers().
      See Also:
    • OPTIONAL_FLAG

      public static final int OPTIONAL_FLAG
      The optional -Flag used by getModifiers().
      See Also:
    • SEARCH_FLAG

      public static final int SEARCH_FLAG
      The search -Flag used by getModifiers().
      See Also:
    • PARTOF_FLAG

      public static final int PARTOF_FLAG
      The partOf -Flag used by getModifiers().
      See Also:
    • PRIVATE_FLAG

      public static final int PRIVATE_FLAG
      The private -Flag used by getModifiers().
      See Also:
    • PROPERTY_FLAG

      public static final int PROPERTY_FLAG
      The property -Flag used by getModifiers().
      See Also:
    • LOCALIZED_FLAG

      public static final int LOCALIZED_FLAG
      The localized -Flag used by getModifiers().
      See Also:
    • INHERITED_FLAG

      public static final int INHERITED_FLAG
      The inherited -Flag used by getModifiers().
      See Also:
    • INITIAL_FLAG

      public static final int INITIAL_FLAG
      The initial -Flag used by getModifiers().
      See Also:
    • TIM_IGNORE_FLAG

      public static final int TIM_IGNORE_FLAG
      The dontOptimize -Flag used by getModifiers().
      See Also:
    • ENCRYPTED_FLAG

      public static final int ENCRYPTED_FLAG
      The encrypted -Flag used by getModifiers().
      See Also:
    • PRIMITIVE_FLAG

      public static final int PRIMITIVE_FLAG
      The primitive-Flag used by getModifiers().
      See Also:
    • ALL

      public static final int ALL
      All flags combined. Use for bit wise operations.
      See Also:
    • ALL_PUBLIC

      public static final int ALL_PUBLIC
      All 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:
      createItem in class Item
      Parameters:
      ctx - the current session context which this item is created within
      type - 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:
      getNonInitialAttributes in class Item
      Parameters:
      ctx - session context with language = NULL
      allAttributes - a ItemAttributeMap contaning attribute values.
      Returns:
      a ItemAttributeMap containing all attribute values, which belong to non-initial attributes.
    • setProperty

      public Object setProperty(SessionContext ctx, String name, Object value)
      Sets a property and copies the new value down to all sub attribute descriptors.
      Overrides:
      setProperty in class ExtensibleItem
      Parameters:
      ctx - the session context
      name - the property name
      value - the new value
      Returns:
      the old value
      See Also:
    • setPropertyNonRecursively

      protected Object setPropertyNonRecursively(SessionContext ctx, String name, Object value)
      Sets a property without copying it down to all sub attribute descriptors.
      Parameters:
      ctx - the session context
      name - the property name
      value - the new value
      Returns:
      the old value
      Since:
      2.10 (previous method name contained a typo)
      See Also:
    • setLocalizedProperty

      public Object setLocalizedProperty(SessionContext ctx, String name, Object value)
      Sets a localized property and copies the new value down to all sub attribute descriptors.
      Overrides:
      setLocalizedProperty in class LocalizableItem
      Parameters:
      ctx - the session context defining the language
      name - the property name
      value - the new value
      Returns:
      the old value
      See Also:
    • setLocalizedPropertyNonRecursively

      protected Object setLocalizedPropertyNonRecursively(SessionContext ctx, String name, Object value)
      Sets a localized property without copying it down to all sub attribute descriptors.
      Parameters:
      ctx - the session context defining the language
      name - the property name
      value - the new value
      Returns:
      the old value
      Since:
      2.10 (previous method name contained a typo)
      See Also:
    • removeLocalizedProperty

      public Object removeLocalizedProperty(SessionContext ctx, String name)
      Removes a localized property. The property is also removed from all subattributes.
      Overrides:
      removeLocalizedProperty in class LocalizableItem
      Parameters:
      ctx - the session context defining the language
      name - the property name
      Returns:
      the localized property value which was removed
    • removeLocalizedPropertyNonRecursively

      protected Object removeLocalizedPropertyNonRecursively(SessionContext ctx, String name)
      Removes a localized property without removing it from sub attributes too.
      Parameters:
      ctx - the session context defining the language
      name - the property name
      Since:
      2.10 (previous method name contained a typo)
    • removeProperty

      public Object removeProperty(SessionContext ctx, String name)
      Removes a property. The property is also removed from all subattributes.
      Overrides:
      removeProperty in class ExtensibleItem
      Parameters:
      ctx - the session context
      name - the property name
      Returns:
      the property that was bound to the name before removal or null if there was no property.
    • removePropertyNonRecursively

      protected Object removePropertyNonRecursively(SessionContext ctx, String name)
      Removes a property without removing it from sub attributes too.
      Parameters:
      ctx - the session context
      name - the property name
      Since:
      2.10 (previous method name contained a typo)
    • getSubAttributeDescriptors

      public Set<AttributeDescriptor> 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

      public Set<AttributeDescriptor> 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

      public String getName(SessionContext ctx)
      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:
      getName in class TypeManagerManaged
      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

      public Map 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:
      getAllNames in class TypeManagerManaged
    • checkTypeChange

      protected void checkTypeChange(Type newType) throws JaloInvalidParameterException
      Internal - do not use.
      Parameters:
      newType -
      Throws:
      JaloInvalidParameterException
    • setAttributeType

      public void setAttributeType(Type type) throws JaloInvalidParameterException
      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

      public ComposedType 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

      public ComposedType getEnclosingType()
      The composed type which owns this attribute descriptor.
    • getModifiers

      public int getModifiers()
    • setModifiers

      public void setModifiers(int modifiers)
    • isReadable

      public boolean isReadable()
      Returns:
      true if the attribute is readable.
      See Also:
    • setReadable

      public void setReadable(boolean readable) throws JaloInvalidParameterException
      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", forRemoval=false) public boolean isWriteable()
      Deprecated.
      since ages - useisWritable()
      Returns:
      true if the attribute is writable.
      See Also:
    • isWritable

      public boolean isWritable()
      Returns true if the attribute is writable.
      See Also:
    • setWritable

      public void setWritable(boolean writable) throws JaloInvalidParameterException
      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 via Item.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

      public void setRemovable(boolean removable) throws JaloInvalidParameterException
      Changes whether or not this attribute is is allowed to be removed. Only removable attribute descriptors are allowed to be removed via Item.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 via ComposedType.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

      public void setOptional(boolean optional) throws JaloInvalidParameterException
      Changes whether or not the described attribute has to be provided with a non-null value when creating a new item instance via ComposedType.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 like getDatabaseColumn()and getPersistenceClass().
    • setSearchable

      public void setSearchable(boolean searchable) throws JaloInvalidParameterException
      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

      protected void checkSearchableChange(boolean newSearchable) throws JaloInvalidParameterException
      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.entries where the AbstractOrder instance owns a collection of AbstractOrderEntry instances. Since one entry belongs to this order exclusively the entries attribute 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

      public void setPartOf(boolean partOf) throws JaloInvalidParameterException
      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

      protected void checkPartOfChange(boolean newPartOf) throws JaloInvalidParameterException
      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 using ComposedType.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 a MapTypehaving 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 to Item.setAttribute(SessionContext, String, Object).

      See Also:
    • setLocalized

      public void setLocalized(boolean localized) throws JaloInvalidParameterException
      Changes localized flag of this attribute descriptor. Only attributes holding a MapTypewith 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

      protected void checkLocalizedChange(boolean newLoc) throws JaloInvalidParameterException
      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)and ExtensibleItem.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

      public void setProperty(boolean isProperty) throws JaloInvalidParameterException
      Changes the property flag of this attribute descriptor.

      If true the attribute is backed by a property field. Each property attribute owns automatically a AttributeAccess which 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 false requires that a own AttributeAccessis 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 of ExtensibleItem
      See Also:
    • checkPropertyChange

      protected void checkPropertyChange(boolean newProp) throws JaloInvalidParameterException
      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 AttributeAccess will 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

      public void setAttributeHandler(String attributeHandler)
    • getAttributeHandler

      public String getAttributeHandler()
    • getDefaultValueDefinitionString

      public String getDefaultValueDefinitionString()
      Returns the defaul value definition from items.xml in case this attribute was declared there having a <defaultvalue> tag. Otherwise null is returned.
      See Also:
    • getDefaultValue

      public Object getDefaultValue()
      Returns the default value of this attribute descriptor or null if 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!

      See Also:
    • getDefaultValue

      public Object getDefaultValue(SessionContext ctx)
      Returns the default value of this attribute descriptor or null if 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 null all 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

      protected Object interpretAndReplaceDefaultValue(Object current)
    • setDefaultValue

      public void setDefaultValue(Object value) throws JaloInvalidParameterException
      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

      public void setDefaultValue(SessionContext ctx, Object value) throws JaloInvalidParameterException
      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 language
      value - 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

      public String getDescription()
      Returns:
      the attribute description text localized for the current session language.
    • getDescription

      public String getDescription(SessionContext ctx)
      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

      public void setDescription(String description)
      Changes the attribute description text for the current session languag.
      Parameters:
      description - the new (localized) description
    • setDescription

      public void setDescription(SessionContext ctx, String description)
      Changes the attribute description text for the specified languag.
      Parameters:
      ctx - the session contex specifying the language to change the description for
      description - the new (localized) description
    • getAllDescriptions

      public Map getAllDescriptions()
      Returns:
      all localized attribute descriptions as language-to-description map
    • getAllDescriptions

      public Map getAllDescriptions(SessionContext ctx)
      Returns:
      all localized attribute descriptions as language-to-description map
    • setAllDescriptions

      public void setAllDescriptions(Map descriptions)
      Changes all localized attribute descriptions by providing a language-to-description map.
    • setAllDescriptions

      public void setAllDescriptions(SessionContext ctx, Map descriptions)
      Changes all localized attribute descriptions by providing a language-to-description map.
    • getSelectionOf

      public AttributeDescriptor 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

      public void setSelectionOf(AttributeDescriptor descriptor) throws JaloInvalidParameterException
      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

      public String getDatabaseColumn()
      Returns:
      the database column of this attribute or null if the attribute has no persistence representation.
    • setDatabaseColumn

      public void setDatabaseColumn(String col)
      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

      public String 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
    • getPersistenceClass

      public Class getPersistenceClass()
      Returns:
      the java class describing this attribute's persistence type.
      See Also:
    • getPersistenceType

      public AtomicType getPersistenceType()
      Returns:
      the atomic type describing this attributes persistence type.
      See Also:
    • getAttributeDescriptorImpl

      protected AttributeDescriptor.AttributeDescriptorImpl getAttributeDescriptorImpl()
      Internal - access to persistence layer implementation.
    • getIntModifiersFromMap

      protected int getIntModifiersFromMap(Map allAttributes)
      Internal - converts single flag attributes into int constants combinations for generic creation process.
      Parameters:
      allAttributes - the attribute values
      Returns:
      a combination of:
    • toString

      public String toString()
      The string represenation of this attribute descriptor.
      Overrides:
      toString in class Descriptor
      Returns:
      the String representation of this item.
    • toString

      public static String toString(int modifiers)
    • getPersistenceQualifier

      public String getPersistenceQualifier()
      If the attribute is backed by a EJB CMP field this method returns the CMP field name. Otherwise null is 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

      protected Map getXMLCustomProperties()
      Override to add custom properties to this type's xml definition.
    • getXMLDefinition

      public String getXMLDefinition()
      Assembles the attribute descriptors XML definition required for items.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

      public String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
      Specified by:
      exportXMLDefinition in class TypeManagerManaged
    • exportXMLDefinitionDefaultValue

      protected void exportXMLDefinitionDefaultValue(org.znerd.xmlenc.XMLOutputter xout) throws IOException
      Throws:
      IOException
    • writeDefaultValueTagAtomic

      protected void writeDefaultValueTagAtomic(org.znerd.xmlenc.XMLOutputter xout, String atomictype, String value)
    • checkTypePermission

      public boolean checkTypePermission(UserRight right)
      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

      public boolean checkTypePermission(Principal p, UserRight right)
      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 check
      right - the user right to check
    • isRuntime

      public Boolean 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.