Class ComposedType
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
- Direct Known Subclasses:
EnumerationType
,GeneratedCMSComponentType
,GeneratedCMSPageType
,GeneratedRestrictionType
,GeneratedVariantType
,RelationType
,ViewType
public class ComposedType extends Type
The base type describing jalo item instances. The name composed type refers toAtomicType
which describes just single values whereas composed types describe objects which consists of many values. Inside the hybris platform normally these are Items.Composed types hold
AttributeDescriptors
which describes a single field of the item. Attribute descriptors are inherited from the declaring type to all its subtypes. Subtypes may change them afterwards locally which does not affect the original attribute descriptor belonging to the declaring type (though type compatibility checks are made).Additionally non-abstract composed types show all persistence information belonging to the item:
- database table
- dump property database table
- ejb jndi name
- ejb bean typecode
These types may be used for creating new item instances generically without having to call their actual managers via
newInstance(Map)
. This provides a way of creating and setting additionally data inside one step (which normally cannot be done using the manager).Composed type can be retrieved by
jalo class
orcode
.An essential use case of composed types are searches via FlexibleSearch:
ComposedType myType = TypeManager.getInstance().getComposedType(MyClass.class); List<MyClass> myItems = jaloSession.getFlexibleSearch().search(// "SELECT {" + Item.PK + "} FROM {" + myType.getCode() + "}", // Collections.EMPTY_MAP, // MyClass.class).getResult();
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ComposedType.ComposedTypeImpl
Persistence layer interface.-
Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.Type
Type.TypeImpl
-
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.String
ABSTRACT
The abstract attribute qualifier constant.static java.lang.String
ALLSUBTYPES
The all subtypes attribute qualifier constant.static java.lang.String
ALLSUPERTYPES
The all supertypes attribute qualifier constant.static java.lang.String
ATTRIBUTEDESCRIPTORS
The (all) attribute descriptors attribute qualifier constant.static java.lang.String
DECLAREDATTRIBUTEDESCRIPTORS
The declared attribute descriptors attribute qualifier constant.static java.lang.String
DUMPPROPERTYTABLE
The dump property table attribute qualifier constant.static java.lang.String
DYNAMIC
The dynami attribute qualifier constant.protected static java.lang.String
INHERITANCEPATH
Internal attribute The inheritance path.static java.lang.String
INHERITEDATTRIBUTEDESCRIPTORS
The inherited attribute descriptors attribute qualifier constant.static java.lang.String
JALOCLASS
The jalo class attribute qualifier constant.static java.lang.String
JALOONLY
The jalo-only attribute qualifier constant.static java.lang.String
JNDINAME
The jndi name attribute qualifier constant.static java.lang.String
SINGLETON
The singleton attribute qualifier constant.static java.lang.String
SUBTYPES
The subtypes attribute qualifier constant.static java.lang.String
SUPERTYPE
The supertype attribute qualifier constant.static java.lang.String
TABLE
The database table attribute qualifier constant.-
Fields inherited from class de.hybris.platform.jalo.type.Type
CODE, DEFAULTVALUE, DESCRIPTION, XMLDEFINITION
-
Fields inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
AUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE, NAME
-
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 ComposedType()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
_sortAttributesByQualifier(java.util.List<AttributeDescriptor> lst)
protected int
checkItemPermission(Principal principal, UserRight right)
Allow type package to see this methodboolean
checkTypePermission(Principal p, UserRight right)
Checks the type permission of a given user.boolean
checkTypePermission(UserRight right)
Checks the type permission of the current session user.AttributeDescriptor
createAttributeDescriptor(PK pk, java.lang.String qualifier, Type valueType, int modifiers)
Adds a new attribute descriptor to this type.AttributeDescriptor
createAttributeDescriptor(java.lang.String qualifier, Type valueType, int modifiers)
Adds a new attribute descriptor to this type.protected Item
createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes)
The generic creator method for creating new composed types bynewInstance(Map)
.protected Item
createJaloOnlyInstance(SessionContext ctx, java.util.Map attributes)
java.lang.String
exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
java.lang.String
exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout, java.lang.String forExtension)
java.util.Set<java.lang.Integer>
getAllConcreteItemTypeCodes()
java.util.Map
getAllDefaultValues()
Returns all default values of this type.java.util.Map
getAllDefaultValues(SessionContext ctx)
Returns all default values of this type.java.util.Set
getAllInstances()
Returns all instances of this type.java.util.Set
getAllInstances(SessionContext ctx)
Returns all instances of this type.long
getAllInstancesCount()
Returns the number of instances of this type.java.util.Set<ComposedType>
getAllSubTypes()
Returns all subtypes of this type.java.util.List<ComposedType>
getAllSuperTypes()
Returns the complete supertype list of this type containing the top-most type at the end of the list and its direct supertype at first.AttributeDescriptor
getAttributeDescriptor(java.lang.String qualifier)
Returns a specific attribute descriptor regardless of whether it has been declared by this type or not.AttributeDescriptor
getAttributeDescriptorIncludingPrivate(java.lang.String qualifier)
Returns a declared or inherited attribute descriptor of this type even if is marked as private.java.util.Set<AttributeDescriptor>
getAttributeDescriptors()
Returns all attribute descriptors owned by this type.java.util.Set<AttributeDescriptor>
getAttributeDescriptorsIncludingPrivate()
Returns all attribute descriptors of this type including all marked as private.java.util.Set<AttributeDescriptor>
getAttributeDescriptorsIncludingPrivate(java.util.Collection<java.lang.String> qualifiers)
protected ComposedType.ComposedTypeImpl
getComposedTypeImpl()
Internal access to persistence layer.protected Item
getCreatorInstance(java.lang.Class<? extends Item> jaloClass)
AttributeDescriptor
getDeclaredAttributeDescriptor(java.lang.String qualifier)
Returns a specific declared attribute descriptor.java.util.Set
getDeclaredAttributeDescriptors()
Returns all attributes which are declared by this type.java.lang.Class
getDeclaredJaloClass()
java.util.Map
getDefaultValues(SessionContext ctx, java.util.Set fdCodes)
Returns the default values for a specified set of attributes.The map contains mapping from attribute qualifiers to their default values unless the attribute do not own a default value or is not writable.java.util.Map
getDefaultValues(java.util.Set fdCodes)
Returns the default values for a specified set of attributes.java.lang.String
getDumpPropertyTable()
Returns the name of the dump property table.AttributeDescriptor
getEveryAttributeDescriptor(java.lang.String qualifier)
Deprecated.since ages - usegetAttributeDescriptorIncludingPrivate(String)
insteadprotected java.lang.String
getInheritancePathString()
Returns the internal representation if this types supertype list.java.util.Set<AttributeDescriptor>
getInheritedAttributeDescriptors()
Returns all attribute descriptors of this composedy type which have been declared by one of its supertype and are inherited (copied) for this type.java.util.Set
getInitialAttributeDescriptors()
Returns all attribute descriptors of this type which are marked as being initial.int
getItemTypeCode()
java.lang.Class
getJaloClass()
java.lang.String
getJNDIName()
protected Item.ItemAttributeMap
getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
java.util.Set<AttributeDescriptor>
getPartOfAutoRemovalAttributeDescriptors()
java.util.Set<RelationType>
getRelations()
Returns all relations this type is involved in.Item
getSingletonInstance()
Gets the singleton instance of this type if the type is marked as singleton.java.util.Set<ComposedType>
getSubTypes()
Returns the direct subtypes of this type.ComposedType
getSuperType()
java.lang.String
getTable()
protected java.util.Map
getXMLCustomProperties(java.lang.String forExtension)
Override to add custom properties to this type's xml definition.java.lang.String
getXMLDefinition()
Returns the XML definition text for declaring this type initems.xml
.java.lang.String
getXMLDefinition(java.lang.String forExtension)
Returns the XML definition text for a specified extension.boolean
hasAttribute(java.lang.String qualifier)
Returns true of the attribute with the given qualifier exist in this composed typeboolean
hasOwnDeployment()
Tells whether this type has defined his own deployment.boolean
isAbstract()
Tells whether this type may have instances or not.boolean
isAssignableFrom(Type type)
Checks whether this type is assignable from the specified type.boolean
isDynamic()
Tells whether this type is dynamic.boolean
isInstance(java.lang.Object o)
Tests if the given object is an item instance of this type.protected boolean
isJaloClassAbstract()
boolean
isJaloOnly()
Tells whether this type is not really an item but just a jalo class which access all the attributes.protected boolean
isSameOrSuperTypeOf(ComposedType type)
Tests if this type is the same or supertype of the specified type.boolean
isSingleton()
Tells whether or not this type describes at most one instance or not.static <E extends Item>
EnewInstance(SessionContext ctx, java.lang.Class jaloClass, java.lang.Object... params)
Convenience method for creating typed instances of a given composed type.static <E extends Item>
EnewInstance(SessionContext ctx, java.lang.Class jaloClass, java.util.Map attributeValues)
Convenience method for creating typed instances of a given composed type.static <E extends Item>
EnewInstance(SessionContext ctx, java.lang.String typeCode, java.lang.Object... params)
Convenience method for creating typed instances of a given composed type.This method does not take a parameter map but allows to pass parameters as value list.static <E extends Item>
EnewInstance(SessionContext ctx, java.lang.String typeCode, java.util.Map attributeValues)
Convenience method for creating typed instances of a given composed type.Item
newInstance(SessionContext ctx, java.util.Map attributeAssignment)
Creates a new instance of the Jalo Item described by this type.Item
newInstance(java.util.Map attributeAssignment)
Creates a new instance of the Jalo Item described by this type.java.lang.Object
parseValue(SessionContext ctx, java.lang.String value)
void
setDeclaredAttributeDescriptors(java.util.Set fds)
Deprecated.since ages - dont use any more - add new attribute descriptors viacreateAttributeDescriptor(String, Type, int)
insteadvoid
setJaloClass(java.lang.Class newOne)
changes this type's jalo classvoid
setJaloOnly(boolean isJaloOnly)
Changes this types jalo-only status.void
setSingleton(boolean isSingleton)
Changes this types singleton status.protected boolean
setTypeSearchSessionContex()
Deprecated.since 5.0.1java.lang.String
toString()
Returns the string representation of this type including its code, supertype and its declared attribute descriptors.java.lang.String
toString(SessionContext ctx, java.lang.Object value)
protected void
unsetTypeSearchContext(boolean useLocal)
Deprecated.since 5.0.1-
Methods inherited from class de.hybris.platform.jalo.type.Type
compareTo, getAllDescriptions, getAllDescriptions, getCode, getDefaultValue, getDefaultValue, getDescription, getDescription, getTypeImpl, setAllDescriptions, setAllDescriptions, setDefaultValue, setDefaultValue, setDescription, setDescription
-
Methods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getAllNames, getExtensionName, getImpl, getName, getName, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate, setName, setName
-
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, 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, 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
-
SUPERTYPE
public static final java.lang.String SUPERTYPE
The supertype attribute qualifier constant.
-
SUBTYPES
public static final java.lang.String SUBTYPES
The subtypes attribute qualifier constant.
-
DECLAREDATTRIBUTEDESCRIPTORS
public static final java.lang.String DECLAREDATTRIBUTEDESCRIPTORS
The declared attribute descriptors attribute qualifier constant.
-
INHERITEDATTRIBUTEDESCRIPTORS
public static final java.lang.String INHERITEDATTRIBUTEDESCRIPTORS
The inherited attribute descriptors attribute qualifier constant.
-
ATTRIBUTEDESCRIPTORS
public static final java.lang.String ATTRIBUTEDESCRIPTORS
The (all) attribute descriptors attribute qualifier constant.
-
JALOCLASS
public static final java.lang.String JALOCLASS
The jalo class attribute qualifier constant.
-
INHERITANCEPATH
protected static final java.lang.String INHERITANCEPATH
Internal attribute The inheritance path.
-
SINGLETON
public static final java.lang.String SINGLETON
The singleton attribute qualifier constant.
-
JALOONLY
public static final java.lang.String JALOONLY
The jalo-only attribute qualifier constant.
-
DYNAMIC
public static final java.lang.String DYNAMIC
The dynami attribute qualifier constant.
-
ABSTRACT
public static final java.lang.String ABSTRACT
The abstract attribute qualifier constant.
-
TABLE
public static final java.lang.String TABLE
The database table attribute qualifier constant.
-
DUMPPROPERTYTABLE
public static final java.lang.String DUMPPROPERTYTABLE
The dump property table attribute qualifier constant.
-
JNDINAME
public static final java.lang.String JNDINAME
The jndi name attribute qualifier constant.
-
ALLSUPERTYPES
public static final java.lang.String ALLSUPERTYPES
The all supertypes attribute qualifier constant.
-
ALLSUBTYPES
public static final java.lang.String ALLSUBTYPES
The all subtypes attribute qualifier constant.
-
-
Method Detail
-
newInstance
public static <E extends Item> E newInstance(SessionContext ctx, java.lang.Class jaloClass, java.util.Map attributeValues) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
Convenience method for creating typed instances of a given composed type.- Parameters:
ctx
- the session contextjaloClass
- the jalo class which specifies the composed typeattributeValues
- the attribute values to be used for creation- Returns:
- the new item
- Throws:
JaloGenericCreationException
- in case something goes wrong during creationJaloAbstractTypeException
- if the actual composed type is abstractJaloItemNotFoundException
- if the specified class does not belong to any composed type
-
newInstance
public static <E extends Item> E newInstance(SessionContext ctx, java.lang.Class jaloClass, java.lang.Object... params) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
Convenience method for creating typed instances of a given composed type. This method does not take a parameter map but allows to pass parameters as value list.Use as follows:
Product p = ComposedType.newInstance(ctx, Product.class, Product.CODE, "myCode", Product.UNIT, unit);
In other words: make sure the parameter list always contains one attribute qualifer followed by its value etc. Otherwise an exception will be raised.
- Parameters:
ctx
- the session contextjaloClass
- the jalo class which specifies the composed typeparams
- the attribute values as list of qualifier, value, ...- Returns:
- the new item
- Throws:
JaloGenericCreationException
- in case something goes wrong during creationJaloAbstractTypeException
- if the actual composed type is abstractJaloItemNotFoundException
- if the specified class does not belong to any composed type
-
newInstance
public static <E extends Item> E newInstance(SessionContext ctx, java.lang.String typeCode, java.util.Map attributeValues) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
Convenience method for creating typed instances of a given composed type.- Parameters:
ctx
- the session contexttypeCode
- the code which specifies the composed typeattributeValues
- the attribute values to be used for creation- Returns:
- the new item
- Throws:
JaloGenericCreationException
- in case something goes wrong during creationJaloAbstractTypeException
- if the actual composed type is abstractJaloItemNotFoundException
- if the specified code does not belong to any composed type
-
newInstance
public static <E extends Item> E newInstance(SessionContext ctx, java.lang.String typeCode, java.lang.Object... params) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
Convenience method for creating typed instances of a given composed type.This method does not take a parameter map but allows to pass parameters as value list.Use as follows:
Product p = ComposedType.newInstance(ctx, Product.class, Product.CODE, "myCode", Product.UNIT, unit);
In other words: make sure the parameter list always contains one attribute qualifer followed by its value etc. Otherwise an exception will be raised.
- Parameters:
ctx
- the session contexttypeCode
- the code which specifies the composed typeparams
- the attribute value list- Returns:
- the new item
- Throws:
JaloGenericCreationException
- in case something goes wrong during creationJaloAbstractTypeException
- if the actual composed type is abstractJaloItemNotFoundException
- if the specified code does not belong to any composed type
-
createItem
protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
The generic creator method for creating new composed types bynewInstance(Map)
.Required attributes are:
- Specified by:
createItem
in 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)
CutsSUPERTYPE
andType.CODE
from the attribute map since these values are already set actual item during creation.- Overrides:
getNonInitialAttributes
in classItem
- Parameters:
ctx
- session context with language = NULLallAttributes
- aItemAttributeMap
contaning attribute values.- Returns:
- a
ItemAttributeMap
containing all attribute values, which belong to non-initial attributes.
-
toString
public java.lang.String toString(SessionContext ctx, java.lang.Object value) throws JaloInvalidParameterException
- Specified by:
toString
in classType
- Throws:
JaloInvalidParameterException
- Since:
- 2.10
-
parseValue
public java.lang.Object parseValue(SessionContext ctx, java.lang.String value) throws JaloInvalidParameterException
- Specified by:
parseValue
in classType
- Throws:
JaloInvalidParameterException
- Since:
- 2.10
-
getTable
public java.lang.String getTable()
- Returns:
- the name of the database table assoziated with this type. for abstract types this name may be NULL.
-
getDumpPropertyTable
public java.lang.String getDumpPropertyTable()
Returns the name of the dump property table. Any untyped property attribute is read and written from and into this table.Typed property attributes are attributes declared in
items.xml
and so created during system initialization. Any other property attribute which was created afterwards will store its values inside the dump table just like properties which do not have an attribute at all.
-
getJNDIName
public java.lang.String getJNDIName()
- Returns:
- the JNDI name of the assoziated item EJB. since abstract types normally dont have deployed item EJB's this may return NULL for such types.
-
getItemTypeCode
public int getItemTypeCode()
- Returns:
- the typecode of the assoziated item EJB. abstract types doesnt have such typecode, so 0 will be returned.
-
getAllConcreteItemTypeCodes
public java.util.Set<java.lang.Integer> getAllConcreteItemTypeCodes()
- Since:
- 2.10
-
getJaloClass
public java.lang.Class getJaloClass()
- Returns:
- the jalo class object of the item defined by this type. if this type doesnt have a own jalo class the supertype is used.
-
getDeclaredJaloClass
public java.lang.Class getDeclaredJaloClass()
- Returns:
- the jalo class which has been declared for this type. if no class has been declared null is returned.
-
setJaloClass
public void setJaloClass(java.lang.Class newOne)
changes this type's jalo class- Parameters:
newOne
- the new jalo class ; setting to null means using the supertype jalo class
-
getInheritedAttributeDescriptors
public java.util.Set<AttributeDescriptor> getInheritedAttributeDescriptors()
Returns all attribute descriptors of this composedy type which have been declared by one of its supertype and are inherited (copied) for this type.Please note that these attribute descriptors belong to this type exclusively since it has been copied from the direct supertype's same attribute descriptor.
-
getAllSuperTypes
public java.util.List<ComposedType> getAllSuperTypes()
Returns the complete supertype list of this type containing the top-most type at the end of the list and its direct supertype at first.- See Also:
getSuperType()
-
getSuperType
public ComposedType getSuperType()
- Returns:
- this types direct supertype.
- See Also:
getAllSuperTypes()
-
getInheritancePathString
protected java.lang.String getInheritancePathString()
Returns the internal representation if this types supertype list. Dont use directly!
-
getSubTypes
public java.util.Set<ComposedType> getSubTypes()
Returns the direct subtypes of this type.- See Also:
getAllSubTypes()
-
getAllSubTypes
public java.util.Set<ComposedType> getAllSubTypes()
Returns all subtypes of this type. This includes its direct subtypes, their subtypes, etc.- See Also:
getSubTypes()
-
getInitialAttributeDescriptors
public java.util.Set getInitialAttributeDescriptors()
Returns all attribute descriptors of this type which are marked as being initial.Initial attributes are normally non-writable attributes intented to be set during item creation only. Therefore having initial and writable attributed doesnt make much sense.
-
_sortAttributesByQualifier
protected void _sortAttributesByQualifier(java.util.List<AttributeDescriptor> lst)
-
getDeclaredAttributeDescriptors
public java.util.Set getDeclaredAttributeDescriptors()
Returns all attributes which are declared by this type.The type may own additional attribute descriptors which are not declared by itself but one of its supertypes.
-
setDeclaredAttributeDescriptors
@Deprecated public void setDeclaredAttributeDescriptors(java.util.Set fds) throws JaloInvalidParameterException
Deprecated.since ages - dont use any more - add new attribute descriptors viacreateAttributeDescriptor(String, Type, int)
instead- Throws:
JaloInvalidParameterException
-
getAttributeDescriptors
public java.util.Set<AttributeDescriptor> getAttributeDescriptors()
Returns all attribute descriptors owned by this type. This includes attributes declared by it as well as attributes declared by any of its supertypes.
-
getPartOfAutoRemovalAttributeDescriptors
public java.util.Set<AttributeDescriptor> getPartOfAutoRemovalAttributeDescriptors()
-
getAttributeDescriptorsIncludingPrivate
public java.util.Set<AttributeDescriptor> getAttributeDescriptorsIncludingPrivate()
Returns all attribute descriptors of this type including all marked as private.
-
getAttributeDescriptorsIncludingPrivate
public java.util.Set<AttributeDescriptor> getAttributeDescriptorsIncludingPrivate(java.util.Collection<java.lang.String> qualifiers)
-
getAttributeDescriptorIncludingPrivate
public AttributeDescriptor getAttributeDescriptorIncludingPrivate(java.lang.String qualifier) throws JaloItemNotFoundException
Returns a declared or inherited attribute descriptor of this type even if is marked as private.- Parameters:
qualifier
- the attribute descriptor qualifier- Throws:
JaloItemNotFoundException
-
getDeclaredAttributeDescriptor
public AttributeDescriptor getDeclaredAttributeDescriptor(java.lang.String qualifier) throws JaloItemNotFoundException
Returns a specific declared attribute descriptor.- Parameters:
qualifier
- the attribute qualifier (case insensitive)- Throws:
JaloItemNotFoundException
- in case no such attribute descriptor exists
-
getAttributeDescriptor
public AttributeDescriptor getAttributeDescriptor(java.lang.String qualifier) throws JaloItemNotFoundException
Returns a specific attribute descriptor regardless of whether it has been declared by this type or not.- Parameters:
qualifier
- the attribute qualifier (case insensitive)- Throws:
JaloItemNotFoundException
- in case no such attribute descriptor exists
-
hasAttribute
public boolean hasAttribute(java.lang.String qualifier) throws JaloItemNotFoundException
Returns true of the attribute with the given qualifier exist in this composed type- Parameters:
qualifier
- the attribute qualifier (case insensitive)- Throws:
JaloItemNotFoundException
-
getEveryAttributeDescriptor
@Deprecated public AttributeDescriptor getEveryAttributeDescriptor(java.lang.String qualifier) throws JaloItemNotFoundException
Deprecated.since ages - usegetAttributeDescriptorIncludingPrivate(String)
insteadReturns a specific attribute descriptor regardless of whether it has been declared by this type or not. Additionally this method will also find attribute descriptors marked as private.- Parameters:
qualifier
- the attribute qualifier (case insensitive)- Throws:
JaloItemNotFoundException
- in case no such attribute descriptor exists
-
getRelations
public java.util.Set<RelationType> getRelations()
Returns all relations this type is involved in. These are all relations which define aRelationDescriptor
for this type.
-
createAttributeDescriptor
public AttributeDescriptor createAttributeDescriptor(java.lang.String qualifier, Type valueType, int modifiers) throws JaloDuplicateQualifierException, JaloInvalidParameterException
Adds a new attribute descriptor to this type.- Parameters:
qualifier
- the qualifier of the new attributevalueType
- the value type of the new attributemodifiers
- attribute settings as combinations ofAttributeDescriptor.READ_FLAG
AttributeDescriptor.WRITE_FLAG
-
AttributeDescriptor.OPTIONAL_FLAG
AttributeDescriptor.SEARCH_FLAG
-
AttributeDescriptor.PARTOF_FLAG
AttributeDescriptor.PRIVATE_FLAG
-
AttributeDescriptor.INITIAL_FLAG
AttributeDescriptor.REMOVE_FLAG
-
AttributeDescriptor.PROPERTY_FLAG
AttributeDescriptor.TIM_IGNORE_FLAG
- Throws:
JaloDuplicateQualifierException
- in case this type already owns an attribute descriptor with the same (case insensitive) qualifierJaloInvalidParameterException
- in case of unsupported settings or value type
-
createAttributeDescriptor
public AttributeDescriptor createAttributeDescriptor(PK pk, java.lang.String qualifier, Type valueType, int modifiers) throws JaloDuplicateQualifierException, JaloInvalidParameterException
Adds a new attribute descriptor to this type.- Parameters:
pk
- the pk for the new item; it will be equipped with type code additionally (- ) qualifier
- the qualifier of the new attributevalueType
- the value type of the new attributemodifiers
- attribute settings as combinations ofAttributeDescriptor.READ_FLAG
AttributeDescriptor.WRITE_FLAG
-
AttributeDescriptor.OPTIONAL_FLAG
AttributeDescriptor.SEARCH_FLAG
-
AttributeDescriptor.PARTOF_FLAG
AttributeDescriptor.PRIVATE_FLAG
-
AttributeDescriptor.INITIAL_FLAG
AttributeDescriptor.REMOVE_FLAG
-
AttributeDescriptor.PROPERTY_FLAG
AttributeDescriptor.TIM_IGNORE_FLAG
- Throws:
JaloDuplicateQualifierException
- in case this type already owns an attribute descriptor with the same (case insensitive) qualifierJaloInvalidParameterException
- in case of unsupported settings or value type
-
newInstance
public Item newInstance(java.util.Map attributeAssignment) throws JaloGenericCreationException, JaloAbstractTypeException
Creates a new instance of the Jalo Item described by this type. The whole creation can be considered as being atomic - if any error was raised during creation all changes will not take effect.Please refer to the documentation regarding transaction support for the installation plaform and database to ensure if this behaviour can be guaranteed!
An example:
// get the desired type ComposedType currencyType = jaloSession.getTypeManager().getComposedType(Currency.class); // fill attribute value map Map attributes = new HashMap(); attibutes.put(C2LItem.ISOCODE, "DE"); attibutes.put(Currency.DIGITS, new Integer(2)); attibutes.put(C2LItem.SYMBOL, "EUR"); // create item instance Currency newOne = null; try { newOne = (Currency) currencyType.newInstance(attributes); } catch (JaloGenericCreationException e) { Throwable cause = e.getCause(); // check expected exceptions if (cause instanceof ConsistencyCheckException) { System.err.println("duplicate ISO code : " + cause); } // report unexpected exceptions else { throw new JaloSystemException(e); } }
- Parameters:
attributeAssignment
- a map containing all attribute values required for the specific item during creation - optional attribute may be passed as well here- Throws:
JaloGenericCreationException
- in case any business eaxception was raised during creationJaloAbstractTypeException
- in case the type is abstract, means there cannot exist instances of it
-
newInstance
public Item newInstance(SessionContext ctx, java.util.Map attributeAssignment) throws JaloGenericCreationException, JaloAbstractTypeException
Creates a new instance of the Jalo Item described by this type. The whole creation can be considered as being atomic - if any error was raised during creation all changes will not take effect.Please refer to the documentation regarding transaction support for the installation plaform and database to ensure if this behaviour can be guaranteed!
An example:
// get the desired type ComposedType currencyType = jaloSession.getTypeManager().getComposedType(Currency.class); // fill attribute value map Map attributes = new HashMap(); attibutes.put(C2LItem.ISOCODE, "EUR"); attibutes.put(Currency.DIGITS, new Integer(2)); attibutes.put(C2LItem.SYMBOL, "EUR"); // localized attributes too attibutes.put(C2LItem.NAME, "Deutsch"); // create item instance Currency newOne = null; try { SessionContext deCtx = jaloSession.createSessionContext(); deCtx.setLanguage(jaloSession.getC2LManager().getLanguageByIsoCode("de")); newOne = (Currency) currencyType.newInstance(deCtx, attributes); } catch (JaloGenericCreationException e) { Throwable cause = e.getCause(); // check expected exceptions if (cause instanceof ConsistencyCheckException) { System.err.println("duplicate ISO code : " + cause); } // report unexpected exceptions else { throw new JaloSystemException(e); } }
- Parameters:
ctx
- the session context which the new item should be created within - define language of localized values hereattributeAssignment
- a map containing all attribute values required for the specific item during creation - optional attribute may be passed as well here- Throws:
JaloGenericCreationException
- in case any business eaxception was raised during creationJaloAbstractTypeException
- in case the type is abstract, means there cannot exist instances of it
-
getCreatorInstance
protected Item getCreatorInstance(java.lang.Class<? extends Item> jaloClass) throws JaloGenericCreationException
- Throws:
JaloGenericCreationException
-
getAllDefaultValues
public java.util.Map getAllDefaultValues()
Returns all default values of this type. The map contains mapping from attribute qualifiers to their default values unless the attribute do not own a default value or is not writable.The returned map works case insensitive.
-
getAllDefaultValues
public java.util.Map getAllDefaultValues(SessionContext ctx)
Returns all default values of this type. The map contains mapping from attribute qualifiers to their default values unless the attribute do not own a default value or is not writable.The returned map works case insensitive.
-
getDefaultValues
public java.util.Map getDefaultValues(java.util.Set fdCodes) throws JaloItemNotFoundException
Returns the default values for a specified set of attributes. The map contains mapping from attribute qualifiers to their default values unless the attribute do not own a default value or is not writable.The returned map works case insensitive.
- Parameters:
fdCodes
- a set of attribute descriptor qualifiers- Throws:
JaloItemNotFoundException
- in case of missing attribute for one specified qualifer
-
getDefaultValues
public java.util.Map getDefaultValues(SessionContext ctx, java.util.Set fdCodes) throws JaloItemNotFoundException, JaloInvalidParameterException
Returns the default values for a specified set of attributes.The map contains mapping from attribute qualifiers to their default values unless the attribute do not own a default value or is not writable.The returned map works case insensitive.
- Parameters:
fdCodes
- a set of attribute descriptor qualifiers- Throws:
JaloItemNotFoundException
- in case of missing attribute for one specified qualifierJaloInvalidParameterException
-
getAllInstances
public java.util.Set getAllInstances()
Returns all instances of this type. Since search restrictions may apply this includes all jalo items which are visible to the current session user.
-
createJaloOnlyInstance
protected Item createJaloOnlyInstance(SessionContext ctx, java.util.Map attributes)
-
getAllInstances
public java.util.Set getAllInstances(SessionContext ctx)
Returns all instances of this type. Since search restrictions may apply this includes all jalo items which are visible to the current session user.
-
getAllInstancesCount
public long getAllInstancesCount()
Returns the number of instances of this type. Since search restrictions may apply to the current user this will show the number of visible instances only.
-
isSingleton
public boolean isSingleton()
Tells whether or not this type describes at most one instance or not.- Returns:
- true if this type describes at most one instance
-
isJaloOnly
public boolean isJaloOnly()
Tells whether this type is not really an item but just a jalo class which access all the attributes.
NOTE: This attribute is applicable on the singleton type only!- Returns:
- true if this type is not really an item but just a jalo class which access all the attributes
-
isDynamic
public boolean isDynamic()
Tells whether this type is dynamic.
NOTE: This attribute is applicable on the enumeration type only!- Returns:
- true if this type is changeable at runtime
-
isAbstract
public boolean isAbstract()
Tells whether this type may have instances or not.- Returns:
- true if the type cannot have instances.
-
isJaloClassAbstract
protected boolean isJaloClassAbstract()
-
setSingleton
public void setSingleton(boolean isSingleton) throws JaloInvalidParameterException
Changes this types singleton status.- Parameters:
isSingleton
- if true the type is marked as having just one instance- Throws:
JaloInvalidParameterException
- in case a type with more than one instance is tried to mark as singleton.
-
setJaloOnly
public void setJaloOnly(boolean isJaloOnly) throws JaloInvalidParameterException
Changes this types jalo-only status.
NOTE: This attribute is applicable on the singleton type only!- Parameters:
isJaloOnly
- if true the instance of this type is not really an item but just a jalo class which access all the attributes- Throws:
JaloInvalidParameterException
-
getXMLCustomProperties
protected java.util.Map getXMLCustomProperties(java.lang.String forExtension)
Override to add custom properties to this type's xml definition.
-
getXMLDefinition
public java.lang.String getXMLDefinition()
Returns the XML definition text for declaring this type initems.xml
. This method will show the declaration to put inside theitems.xml
of the extension which this type belongs to.Any changes made to this type by means of other extensions
items.xml
will not show up here - usegetXMLDefinition(String)
to get them.- Specified by:
getXMLDefinition
in classType
- See Also:
getXMLDefinition(String)
-
getXMLDefinition
public java.lang.String getXMLDefinition(java.lang.String forExtension)
Returns the XML definition text for a specified extension. This will include any attributes added by this extensionsitems.xml
.- Parameters:
forExtension
-- See Also:
getXMLDefinition()
-
exportXMLDefinition
public java.lang.String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout)
- Specified by:
exportXMLDefinition
in classTypeManagerManaged
-
exportXMLDefinition
public java.lang.String exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout, java.lang.String forExtension)
-
hasOwnDeployment
public final boolean hasOwnDeployment()
Tells whether this type has defined his own deployment.- Returns:
- true if this type has own deployment
-
getComposedTypeImpl
protected ComposedType.ComposedTypeImpl getComposedTypeImpl()
Internal access to persistence layer.
-
isAssignableFrom
public boolean isAssignableFrom(Type type)
Checks whether this type is assignable from the specified type. This is the case if this type is the same or supertype of the specified type and this type's jalo class is assignable from the specified type's jalo class.- Specified by:
isAssignableFrom
in classType
- Parameters:
type
- the type to check assignability for
-
isSameOrSuperTypeOf
protected boolean isSameOrSuperTypeOf(ComposedType type)
Tests if this type is the same or supertype of the specified type.
-
isInstance
public boolean isInstance(java.lang.Object o)
Tests if the given object is an item instance of this type.- Specified by:
isInstance
in classType
- Parameters:
o
- the object to be checked.
-
toString
public java.lang.String toString()
Returns the string representation of this type including its code, supertype and its declared attribute descriptors. Use carefully since this method may become quite costly putting together all attributes.
-
setTypeSearchSessionContex
@Deprecated protected boolean setTypeSearchSessionContex()
Deprecated.since 5.0.1Internal - dont use.
-
unsetTypeSearchContext
@Deprecated protected void unsetTypeSearchContext(boolean useLocal)
Deprecated.since 5.0.1Internal - dont use.
-
checkTypePermission
public boolean checkTypePermission(UserRight right)
Checks the type permission of the current session user.works similar to
Item.checkPermission(UserRight)
except that supertype permissions are evaluated in case no permission is set for this type.- Parameters:
right
- the user right to check- Returns:
true
if the current session user has the permission on the specifiedUserRight
-
checkTypePermission
public boolean checkTypePermission(Principal p, UserRight right)
Checks the type permission of a given user.works similar to
Item.checkPermission(UserRight)
except that supertype permissions are evaluated in case no permission is set for this type.- Parameters:
p
- the principal to checkright
- the user right to check- Returns:
true
if the specifiedPrincipal
has the permission on the specifiedUserRight
-
checkItemPermission
protected int checkItemPermission(Principal principal, UserRight right)
Allow type package to see this method- Overrides:
checkItemPermission
in classItem
-
getSingletonInstance
public Item getSingletonInstance()
Gets the singleton instance of this type if the type is marked as singleton. Tries to get the existing instance, if not existent a new one will be created.- Returns:
- the singleton instance of this type
- Throws:
JaloInvalidParameterException
- type is not marked as singleton typeJaloSystemException
- error while instance creation- Since:
- 3.0
-
-