Class ComposedType
- All Implemented Interfaces:
Serializable,Comparable
- Direct Known Subclasses:
EnumerationType,GeneratedCMSComponentType,GeneratedCMSPageType,GeneratedRestrictionType,GeneratedVariantType,RelationType,ViewType
AtomicType 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 holdAttributeDescriptors 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 byjalo class
or code .
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacePersistence layer interface.Nested classes/interfaces inherited from class de.hybris.platform.jalo.type.Type
Type.TypeImplNested 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 StringThe abstract attribute qualifier constant.static final StringThe all subtypes attribute qualifier constant.static final StringThe all supertypes attribute qualifier constant.static final StringThe (all) attribute descriptors attribute qualifier constant.static final StringThe declared attribute descriptors attribute qualifier constant.static final StringThe dump property table attribute qualifier constant.static final StringThe dynami attribute qualifier constant.protected static final StringInternal attribute The inheritance path.static final StringThe inherited attribute descriptors attribute qualifier constant.static final StringThe jalo class attribute qualifier constant.static final StringThe jalo-only attribute qualifier constant.static final StringThe jndi name attribute qualifier constant.static final StringThe singleton attribute qualifier constant.static final StringThe subtypes attribute qualifier constant.static final StringThe supertype attribute qualifier constant.static final StringThe database table attribute qualifier constant.Fields inherited from class de.hybris.platform.jalo.type.Type
CODE, DEFAULTVALUE, DESCRIPTION, XMLDEFINITIONFields 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 voidprotected intcheckItemPermission(Principal principal, UserRight right) Allow type package to see this methodbooleancheckTypePermission(Principal p, UserRight right) Checks the type permission of a given user.booleancheckTypePermission(UserRight right) Checks the type permission of the current session user.createAttributeDescriptor(PK pk, String qualifier, Type valueType, int modifiers) Adds a new attribute descriptor to this type.createAttributeDescriptor(String qualifier, Type valueType, int modifiers) Adds a new attribute descriptor to this type.protected ItemcreateItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) The generic creator method for creating new composed types bynewInstance(Map).protected ItemcreateJaloOnlyInstance(SessionContext ctx, Map attributes) exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout) exportXMLDefinition(org.znerd.xmlenc.XMLOutputter xout, String forExtension) Returns all default values of this type.Returns all default values of this type.Returns all instances of this type.Returns all instances of this type.longReturns the number of instances of this type.Returns all subtypes of this type.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.getAttributeDescriptor(String qualifier) Returns a specific attribute descriptor regardless of whether it has been declared by this type or not.getAttributeDescriptorIncludingPrivate(String qualifier) Returns a declared or inherited attribute descriptor of this type even if is marked as private.Returns all attribute descriptors owned by this type.Returns all attribute descriptors of this type including all marked as private.getAttributeDescriptorsIncludingPrivate(Collection<String> qualifiers) protected ComposedType.ComposedTypeImplInternal access to persistence layer.protected ItemgetCreatorInstance(Class<? extends Item> jaloClass) getDeclaredAttributeDescriptor(String qualifier) Returns a specific declared attribute descriptor.Returns all attributes which are declared by this type.getDefaultValues(SessionContext ctx, 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.getDefaultValues(Set fdCodes) Returns the default values for a specified set of attributes.Returns the name of the dump property table.getEveryAttributeDescriptor(String qualifier) Deprecated.protected StringReturns the internal representation if this types supertype list.Returns all attribute descriptors of this composedy type which have been declared by one of its supertype and are inherited (copied) for this type.Returns all attribute descriptors of this type which are marked as being initial.intprotected Item.ItemAttributeMapgetNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes) Returns all relations this type is involved in.Gets the singleton instance of this type if the type is marked as singleton.Returns the direct subtypes of this type.getTable()protected MapgetXMLCustomProperties(String forExtension) Override to add custom properties to this type's xml definition.Returns the XML definition text for declaring this type initems.xml.getXMLDefinition(String forExtension) Returns the XML definition text for a specified extension.booleanhasAttribute(String qualifier) Returns true of the attribute with the given qualifier exist in this composed typefinal booleanTells whether this type has defined his own deployment.booleanTells whether this type may have instances or not.booleanisAssignableFrom(Type type) Checks whether this type is assignable from the specified type.booleanTells whether this type is dynamic.booleanisInstance(Object o) Tests if the given object is an item instance of this type.protected booleanbooleanTells whether this type is not really an item but just a jalo class which access all the attributes.protected booleanTests if this type is the same or supertype of the specified type.booleanTells whether or not this type describes at most one instance or not.static <E extends Item>
EnewInstance(SessionContext ctx, Class jaloClass, Object... params) Convenience method for creating typed instances of a given composed type.static <E extends Item>
EnewInstance(SessionContext ctx, Class jaloClass, Map attributeValues) Convenience method for creating typed instances of a given composed type.static <E extends Item>
EnewInstance(SessionContext ctx, String typeCode, 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, String typeCode, Map attributeValues) Convenience method for creating typed instances of a given composed type.newInstance(SessionContext ctx, Map attributeAssignment) Creates a new instance of the Jalo Item described by this type.newInstance(Map attributeAssignment) Creates a new instance of the Jalo Item described by this type.parseValue(SessionContext ctx, String value) voidDeprecated.since ages - dont use any more - add new attribute descriptors viacreateAttributeDescriptor(String, Type, int)insteadvoidsetJaloClass(Class newOne) changes this type's jalo classvoidsetJaloOnly(boolean isJaloOnly) Changes this types jalo-only status.voidsetSingleton(boolean isSingleton) Changes this types singleton status.protected booleanDeprecated.since 5.0.1toString()Returns the string representation of this type including its code, supertype and its declared attribute descriptors.toString(SessionContext ctx, Object value) protected voidunsetTypeSearchContext(boolean useLocal) Deprecated.since 5.0.1Methods inherited from class de.hybris.platform.jalo.type.Type
compareTo, getAllDescriptions, getAllDescriptions, getCode, getDefaultValue, getDefaultValue, getDescription, getDescription, getTypeImpl, setAllDescriptions, setAllDescriptions, setDefaultValue, setDefaultValue, setDescription, setDescriptionMethods inherited from class de.hybris.platform.jalo.type.TypeManagerManaged
getAllNames, getAllNames, getExtensionName, getImpl, getName, 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, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertyMethods inherited from class de.hybris.platform.jalo.ExtensibleItem
createNonClassAccessor, getAllProperties, getAllProperties, getImplementation, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyMethods 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, 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
-
SUPERTYPE
The supertype attribute qualifier constant. -
SUBTYPES
The subtypes attribute qualifier constant. -
DECLAREDATTRIBUTEDESCRIPTORS
The declared attribute descriptors attribute qualifier constant. -
INHERITEDATTRIBUTEDESCRIPTORS
The inherited attribute descriptors attribute qualifier constant. -
ATTRIBUTEDESCRIPTORS
The (all) attribute descriptors attribute qualifier constant. -
JALOCLASS
The jalo class attribute qualifier constant. -
INHERITANCEPATH
Internal attribute The inheritance path. -
SINGLETON
The singleton attribute qualifier constant. -
JALOONLY
The jalo-only attribute qualifier constant. -
DYNAMIC
The dynami attribute qualifier constant. -
ABSTRACT
The abstract attribute qualifier constant. -
TABLE
The database table attribute qualifier constant. -
DUMPPROPERTYTABLE
The dump property table attribute qualifier constant. -
JNDINAME
The jndi name attribute qualifier constant. -
ALLSUPERTYPES
The all supertypes attribute qualifier constant. -
ALLSUBTYPES
The all subtypes attribute qualifier constant.
-
-
Constructor Details
-
ComposedType
public ComposedType()
-
-
Method Details
-
newInstance
public static <E extends Item> E newInstance(SessionContext ctx, Class jaloClass, 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, Class jaloClass, 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, String typeCode, 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, String typeCode, 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:
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) CutsSUPERTYPEandType.CODEfrom the attribute map since these values are already set actual item 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.
-
toString
- Specified by:
toStringin classType- Throws:
JaloInvalidParameterException- Since:
- 2.10
-
parseValue
- Specified by:
parseValuein classType- Throws:
JaloInvalidParameterException- Since:
- 2.10
-
getTable
- Returns:
- the name of the database table assoziated with this type. for abstract types this name may be NULL.
-
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.xmland 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
- 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
- Since:
- 2.10
-
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
- Returns:
- the jalo class which has been declared for this type. if no class has been declared null is returned.
-
setJaloClass
changes this type's jalo class- Parameters:
newOne- the new jalo class ; setting to null means using the supertype jalo class
-
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
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
- Returns:
- this types direct supertype.
- See Also:
-
getInheritancePathString
Returns the internal representation if this types supertype list. Dont use directly! -
getSubTypes
Returns the direct subtypes of this type.- See Also:
-
getAllSubTypes
Returns all subtypes of this type. This includes its direct subtypes, their subtypes, etc.- See Also:
-
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
-
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(since="ages", forRemoval=false) public void setDeclaredAttributeDescriptors(Set fds) throws JaloInvalidParameterException Deprecated.since ages - dont use any more - add new attribute descriptors viacreateAttributeDescriptor(String, Type, int)instead- Throws:
JaloInvalidParameterException
-
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
-
getAttributeDescriptorsIncludingPrivate
Returns all attribute descriptors of this type including all marked as private. -
getAttributeDescriptorsIncludingPrivate
public Set<AttributeDescriptor> getAttributeDescriptorsIncludingPrivate(Collection<String> qualifiers) -
getAttributeDescriptorIncludingPrivate
public AttributeDescriptor getAttributeDescriptorIncludingPrivate(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(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(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
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(since="ages", forRemoval=false) public AttributeDescriptor getEveryAttributeDescriptor(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
Returns all relations this type is involved in. These are all relations which define aRelationDescriptorfor this type. -
createAttributeDescriptor
public AttributeDescriptor createAttributeDescriptor(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_FLAGAttributeDescriptor.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, 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_FLAGAttributeDescriptor.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(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, 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(Class<? extends Item> jaloClass) throws JaloGenericCreationException - Throws:
JaloGenericCreationException
-
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
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
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 Map getDefaultValues(SessionContext ctx, 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
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
-
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. -
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
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
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
Override to add custom properties to this type's xml definition. -
getXMLDefinition
Returns the XML definition text for declaring this type initems.xml. This method will show the declaration to put inside theitems.xmlof the extension which this type belongs to.Any changes made to this type by means of other extensions
items.xmlwill not show up here - usegetXMLDefinition(String)to get them.- Specified by:
getXMLDefinitionin classType- See Also:
-
getXMLDefinition
Returns the XML definition text for a specified extension. This will include any attributes added by this extensionsitems.xml.- Parameters:
forExtension-- See Also:
-
exportXMLDefinition
- Specified by:
exportXMLDefinitionin classTypeManagerManaged
-
exportXMLDefinition
-
hasOwnDeployment
public final boolean hasOwnDeployment()Tells whether this type has defined his own deployment.- Returns:
- true if this type has own deployment
-
getComposedTypeImpl
Internal access to persistence layer. -
isAssignableFrom
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:
isAssignableFromin classType- Parameters:
type- the type to check assignability for
-
isSameOrSuperTypeOf
Tests if this type is the same or supertype of the specified type. -
isInstance
Tests if the given object is an item instance of this type.- Specified by:
isInstancein classType- Parameters:
o- the object to be checked.
-
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.since 5.0.1Internal - dont use. -
unsetTypeSearchContext
@Deprecated(since="5.0.1", forRemoval=false) protected void unsetTypeSearchContext(boolean useLocal) Deprecated.since 5.0.1Internal - dont use. -
checkTypePermission
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:
trueif the current session user has the permission on the specifiedUserRight
-
checkTypePermission
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:
trueif the specifiedPrincipalhas the permission on the specifiedUserRight
-
checkItemPermission
Allow type package to see this method- Overrides:
checkItemPermissionin classItem
-
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
-
getAttributeDescriptorIncludingPrivate(String)instead