public class ComposedType extends Type
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:
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();
| Modifier and Type | Class and Description |
|---|---|
static interface |
ComposedType.ComposedTypeImpl
Persistence layer interface.
|
Type.TypeImplTypeManagerManaged.TypeManagerManagedImplLocalizableItem.LocalizableItemImplExtensibleItem.ExtensibleItemImplItem.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException| Modifier and Type | Field and Description |
|---|---|
static String |
ABSTRACT
The abstract attribute qualifier constant.
|
static String |
ALLSUBTYPES
The all subtypes attribute qualifier constant.
|
static String |
ALLSUPERTYPES
The all supertypes attribute qualifier constant.
|
static String |
ATTRIBUTEDESCRIPTORS
The (all) attribute descriptors attribute qualifier constant.
|
static String |
DECLAREDATTRIBUTEDESCRIPTORS
The declared attribute descriptors attribute qualifier constant.
|
static String |
DUMPPROPERTYTABLE
The dump property table attribute qualifier constant.
|
static String |
DYNAMIC
The dynami attribute qualifier constant.
|
protected static String |
INHERITANCEPATH
Internal attribute The inheritance path.
|
static String |
INHERITEDATTRIBUTEDESCRIPTORS
The inherited attribute descriptors attribute qualifier constant.
|
static String |
JALOCLASS
The jalo class attribute qualifier constant.
|
static String |
JALOONLY
The jalo-only attribute qualifier constant.
|
static String |
JNDINAME
The jndi name attribute qualifier constant.
|
static String |
SINGLETON
The singleton attribute qualifier constant.
|
static String |
SUBTYPES
The subtypes attribute qualifier constant.
|
static String |
SUPERTYPE
The supertype attribute qualifier constant.
|
static String |
TABLE
The database table attribute qualifier constant.
|
CODE, DEFAULTVALUE, DESCRIPTION, XMLDEFINITIONAUTOCREATE, DEPRECATED, EXTENSION_NAME, GENERATE, NAMELANGUAGE_FALLBACK_ENABLED_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEimpl, tenant| Constructor and Description |
|---|
ComposedType() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_sortAttributesByQualifier(List<AttributeDescriptor> lst) |
protected int |
checkItemPermission(Principal principal,
UserRight right)
Allow type package to see this method
|
boolean |
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,
String qualifier,
Type valueType,
int modifiers)
Adds a new attribute descriptor to this type.
|
AttributeDescriptor |
createAttributeDescriptor(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 by
newInstance(Map). |
protected Item |
createJaloOnlyInstance(SessionContext ctx,
Map attributes) |
String |
exportXMLDefinition(XMLOutputter xout) |
String |
exportXMLDefinition(XMLOutputter xout,
String forExtension) |
Set<Integer> |
getAllConcreteItemTypeCodes() |
Map |
getAllDefaultValues()
Returns all default values of this type.
|
Map |
getAllDefaultValues(SessionContext ctx)
Returns all default values of this type.
|
Set |
getAllInstances()
Returns all instances of this type.
|
Set |
getAllInstances(SessionContext ctx)
Returns all instances of this type.
|
long |
getAllInstancesCount()
Returns the number of instances of this type.
|
Set<ComposedType> |
getAllSubTypes()
Returns all subtypes of this type.
|
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(String qualifier)
Returns a specific attribute descriptor regardless of whether it has been declared by this type or not.
|
AttributeDescriptor |
getAttributeDescriptorIncludingPrivate(String qualifier)
Returns a declared or inherited attribute descriptor of this type even if is marked as private.
|
Set<AttributeDescriptor> |
getAttributeDescriptors()
Returns all attribute descriptors owned by this type.
|
Set<AttributeDescriptor> |
getAttributeDescriptorsIncludingPrivate()
Returns all attribute descriptors of this type including all marked as private.
|
Set<AttributeDescriptor> |
getAttributeDescriptorsIncludingPrivate(Collection<String> qualifiers) |
protected ComposedType.ComposedTypeImpl |
getComposedTypeImpl()
Internal access to persistence layer.
|
protected Item |
getCreatorInstance(Class<? extends Item> jaloClass) |
AttributeDescriptor |
getDeclaredAttributeDescriptor(String qualifier)
Returns a specific declared attribute descriptor.
|
Set |
getDeclaredAttributeDescriptors()
Returns all attributes which are declared by this type.
|
Class |
getDeclaredJaloClass() |
Map |
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.
|
Map |
getDefaultValues(Set fdCodes)
Returns the default values for a specified set of attributes.
|
String |
getDumpPropertyTable()
Returns the name of the dump property table.
|
AttributeDescriptor |
getEveryAttributeDescriptor(String qualifier)
Deprecated.
use
getAttributeDescriptorIncludingPrivate(String) instead |
protected String |
getInheritancePathString()
Returns the internal representation if this types supertype list.
|
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.
|
Set |
getInitialAttributeDescriptors()
Returns all attribute descriptors of this type which are marked as being initial.
|
int |
getItemTypeCode() |
Class |
getJaloClass() |
String |
getJNDIName() |
protected Item.ItemAttributeMap |
getNonInitialAttributes(SessionContext ctx,
Item.ItemAttributeMap allAttributes)
|
Set<AttributeDescriptor> |
getPartOfAutoRemovalAttributeDescriptors() |
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.
|
Set<ComposedType> |
getSubTypes()
Returns the direct subtypes of this type.
|
ComposedType |
getSuperType() |
String |
getTable() |
protected Map |
getXMLCustomProperties(String forExtension)
Override to add custom properties to this type's xml definition.
|
String |
getXMLDefinition()
Returns the XML definition text for declaring this type in
items.xml. |
String |
getXMLDefinition(String forExtension)
Returns the XML definition text for a specified extension.
|
boolean |
hasAttribute(String qualifier)
Returns true of the attribute with the given qualifier exist in this composed type
|
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(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.
|
Item |
newInstance(Map attributeAssignment)
Creates a new instance of the Jalo Item described by this type.
|
static <E extends Item> |
newInstance(SessionContext ctx,
Class jaloClass,
Map attributeValues)
Convenience method for creating typed instances of a given composed type.
|
static <E extends Item> |
newInstance(SessionContext ctx,
Class jaloClass,
Object... params)
Convenience method for creating typed instances of a given composed type.
|
Item |
newInstance(SessionContext ctx,
Map attributeAssignment)
Creates a new instance of the Jalo Item described by this type.
|
static <E extends Item> |
newInstance(SessionContext ctx,
String typeCode,
Map attributeValues)
Convenience method for creating typed instances of a given composed type.
|
static <E extends Item> |
newInstance(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.
|
Object |
parseValue(SessionContext ctx,
String value) |
void |
setDeclaredAttributeDescriptors(Set fds)
Deprecated.
dont use any more - add new attribute descriptors via
createAttributeDescriptor(String, Type, int) instead |
void |
setJaloClass(Class newOne)
changes this type's jalo class
|
void |
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.1
|
String |
toString()
Returns the string representation of this type including its code, supertype and its declared attribute
descriptors.
|
String |
toString(SessionContext ctx,
Object value) |
protected void |
unsetTypeSearchContext(boolean useLocal)
Deprecated.
since 5.0.1
|
compareTo, getAllDescriptions, getAllDescriptions, getCode, getDefaultValue, getDefaultValue, getDescription, getDescription, getTypeImpl, setAllDescriptions, setAllDescriptions, setDefaultValue, setDefaultValue, setDescription, setDescriptiongetAllNames, getAllNames, getExtensionName, getImpl, getName, getName, isAutocreate, isDeprecated, isGenerate, setAllNames, setAllNames, setAutocreate, setExtensionName, setGenerate, setName, setNamegetAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllLocalizedProperties, getAllValuesSessionContext, getLocalizedProperty, getLocalizedProperty, getLocalizedPropertyInternal, getLocalizedPropertyNames, getLocalizedPropertyNames, hasLanguage, isEmptyValue, isFallbackEnabled, removeLocalizedProperty, removeLocalizedProperty, setAllLocalizedProperties, setAllLocalizedProperties, setLocalizedProperty, setLocalizedPropertycreateNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyaddLinkedItems, 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, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, readResolve, refreshRemote, 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, setTransientObject, setUseTA, useTA, writeReplacegetImplementation, setTenantpublic static final String SUPERTYPE
public static final String SUBTYPES
public static final String DECLAREDATTRIBUTEDESCRIPTORS
public static final String INHERITEDATTRIBUTEDESCRIPTORS
public static final String ATTRIBUTEDESCRIPTORS
public static final String JALOCLASS
protected static final String INHERITANCEPATH
public static final String SINGLETON
public static final String JALOONLY
public static final String DYNAMIC
public static final String ABSTRACT
public static final String TABLE
public static final String DUMPPROPERTYTABLE
public static final String JNDINAME
public static final String ALLSUPERTYPES
public static final String ALLSUBTYPES
public static <E extends Item> E newInstance(SessionContext ctx, Class jaloClass, Map attributeValues) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
ctx - the session contextjaloClass - the jalo class which specifies the composed typeattributeValues - the attribute values to be used for creationJaloGenericCreationException - in case something goes wrong during creationJaloAbstractTypeException - if the actual composed type is abstractJaloItemNotFoundException - if the specified class does not belong to any composed typepublic static <E extends Item> E newInstance(SessionContext ctx, Class jaloClass, Object... params) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
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.
ctx - the session contextjaloClass - the jalo class which specifies the composed typeparams - the attribute values as list of qualifier, value, ...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 typepublic static <E extends Item> E newInstance(SessionContext ctx, String typeCode, Map attributeValues) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
ctx - the session contexttypeCode - the code which specifies the composed typeattributeValues - the attribute values to be used for creationJaloGenericCreationException - in case something goes wrong during creationJaloAbstractTypeException - if the actual composed type is abstractJaloItemNotFoundException - if the specified code does not belong to any composed typepublic static <E extends Item> E newInstance(SessionContext ctx, String typeCode, Object... params) throws JaloGenericCreationException, JaloAbstractTypeException, JaloItemNotFoundException
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.
ctx - the session contexttypeCode - the code which specifies the composed typeparams - the attribute value listJaloGenericCreationException - in case something goes wrong during creationJaloAbstractTypeException - if the actual composed type is abstractJaloItemNotFoundException - if the specified code does not belong to any composed typeprotected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
newInstance(Map).
Required attributes are:
createItem in class Itemctx - 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 )JaloBusinessException - indicates an error during creation - any changes will be rollbackedprotected Item.ItemAttributeMap getNonInitialAttributes(SessionContext ctx, Item.ItemAttributeMap allAttributes)
SUPERTYPE and Type.CODE from the attribute map since these values are already set actual
item during creation.getNonInitialAttributes in class Itemctx - session context with language = NULLallAttributes - a ItemAttributeMap contaning attribute values.ItemAttributeMap containing all attribute values, which belong to non-initial attributes.public String toString(SessionContext ctx, Object value) throws JaloInvalidParameterException
toString in class TypeJaloInvalidParameterExceptionpublic Object parseValue(SessionContext ctx, String value) throws JaloInvalidParameterException
parseValue in class TypeJaloInvalidParameterExceptionpublic String getTable()
public String getDumpPropertyTable()
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.
public String getJNDIName()
public int getItemTypeCode()
public Class getJaloClass()
public Class getDeclaredJaloClass()
public void setJaloClass(Class newOne)
newOne - the new jalo class ; setting to null means using the supertype jalo classpublic Set<AttributeDescriptor> getInheritedAttributeDescriptors()
Please note that these attribute descriptors belong to this type exclusively since it has been copied from the direct supertype's same attribute descriptor.
public List<ComposedType> getAllSuperTypes()
getSuperType()public ComposedType getSuperType()
getAllSuperTypes()protected String getInheritancePathString()
public Set<ComposedType> getSubTypes()
getAllSubTypes()public Set<ComposedType> getAllSubTypes()
getSubTypes()public Set getInitialAttributeDescriptors()
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.
protected void _sortAttributesByQualifier(List<AttributeDescriptor> lst)
public Set getDeclaredAttributeDescriptors()
The type may own additional attribute descriptors which are not declared by itself but one of its supertypes.
@Deprecated public void setDeclaredAttributeDescriptors(Set fds) throws JaloInvalidParameterException
createAttributeDescriptor(String, Type, int) insteadJaloInvalidParameterExceptionpublic Set<AttributeDescriptor> getAttributeDescriptors()
public Set<AttributeDescriptor> getPartOfAutoRemovalAttributeDescriptors()
public Set<AttributeDescriptor> getAttributeDescriptorsIncludingPrivate()
public Set<AttributeDescriptor> getAttributeDescriptorsIncludingPrivate(Collection<String> qualifiers)
public AttributeDescriptor getAttributeDescriptorIncludingPrivate(String qualifier) throws JaloItemNotFoundException
qualifier - the attribute descriptor qualifierJaloItemNotFoundExceptionpublic AttributeDescriptor getDeclaredAttributeDescriptor(String qualifier) throws JaloItemNotFoundException
qualifier - the attribute qualifier (case insensitive)JaloItemNotFoundException - in case no such attribute descriptor existspublic AttributeDescriptor getAttributeDescriptor(String qualifier) throws JaloItemNotFoundException
qualifier - the attribute qualifier (case insensitive)JaloItemNotFoundException - in case no such attribute descriptor existspublic boolean hasAttribute(String qualifier) throws JaloItemNotFoundException
qualifier - the attribute qualifier (case insensitive)JaloItemNotFoundException@Deprecated public AttributeDescriptor getEveryAttributeDescriptor(String qualifier) throws JaloItemNotFoundException
getAttributeDescriptorIncludingPrivate(String) insteadqualifier - the attribute qualifier (case insensitive)JaloItemNotFoundException - in case no such attribute descriptor existspublic Set<RelationType> getRelations()
RelationDescriptor
for this type.public AttributeDescriptor createAttributeDescriptor(String qualifier, Type valueType, int modifiers) throws JaloDuplicateQualifierException, JaloInvalidParameterException
qualifier - the qualifier of the new attributevalueType - the value type of the new attributemodifiers - attribute settings as combinations of
AttributeDescriptor.READ_FLAGAttributeDescriptor.WRITE_FLAGAttributeDescriptor.OPTIONAL_FLAGAttributeDescriptor.SEARCH_FLAGAttributeDescriptor.PARTOF_FLAGAttributeDescriptor.PRIVATE_FLAGAttributeDescriptor.INITIAL_FLAGAttributeDescriptor.REMOVE_FLAGAttributeDescriptor.PROPERTY_FLAGAttributeDescriptor.TIM_IGNORE_FLAGJaloDuplicateQualifierException - in case this type already owns an attribute descriptor with the same (case insensitive) qualifierJaloInvalidParameterException - in case of unsupported settings or value typepublic AttributeDescriptor createAttributeDescriptor(PK pk, String qualifier, Type valueType, int modifiers) throws JaloDuplicateQualifierException, JaloInvalidParameterException
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 of
AttributeDescriptor.READ_FLAGAttributeDescriptor.WRITE_FLAGAttributeDescriptor.OPTIONAL_FLAGAttributeDescriptor.SEARCH_FLAGAttributeDescriptor.PARTOF_FLAGAttributeDescriptor.PRIVATE_FLAGAttributeDescriptor.INITIAL_FLAGAttributeDescriptor.REMOVE_FLAGAttributeDescriptor.PROPERTY_FLAGAttributeDescriptor.TIM_IGNORE_FLAGJaloDuplicateQualifierException - in case this type already owns an attribute descriptor with the same (case insensitive) qualifierJaloInvalidParameterException - in case of unsupported settings or value typepublic Item newInstance(Map attributeAssignment) throws JaloGenericCreationException, JaloAbstractTypeException
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);
}
}
attributeAssignment - a map containing all attribute values required for the specific item during creation - optional
attribute may be passed as well hereJaloGenericCreationException - in case any business eaxception was raised during creationJaloAbstractTypeException - in case the type is abstract, means there cannot exist instances of itpublic Item newInstance(SessionContext ctx, Map attributeAssignment) throws JaloGenericCreationException, JaloAbstractTypeException
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);
}
}
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 hereJaloGenericCreationException - in case any business eaxception was raised during creationJaloAbstractTypeException - in case the type is abstract, means there cannot exist instances of itprotected Item getCreatorInstance(Class<? extends Item> jaloClass) throws JaloGenericCreationException
JaloGenericCreationExceptionpublic Map getAllDefaultValues()
The returned map works case insensitive.
public Map getAllDefaultValues(SessionContext ctx)
The returned map works case insensitive.
public Map getDefaultValues(Set fdCodes) throws JaloItemNotFoundException
The returned map works case insensitive.
fdCodes - a set of attribute descriptor qualifiersJaloItemNotFoundException - in case of missing attribute for one specified qualiferpublic Map getDefaultValues(SessionContext ctx, Set fdCodes) throws JaloItemNotFoundException, JaloInvalidParameterException
The returned map works case insensitive.
fdCodes - a set of attribute descriptor qualifiersJaloItemNotFoundException - in case of missing attribute for one specified qualifierJaloInvalidParameterExceptionpublic Set getAllInstances()
protected Item createJaloOnlyInstance(SessionContext ctx, Map attributes)
public Set getAllInstances(SessionContext ctx)
public long getAllInstancesCount()
public boolean isSingleton()
public boolean isJaloOnly()
public boolean isDynamic()
public boolean isAbstract()
protected boolean isJaloClassAbstract()
public void setSingleton(boolean isSingleton)
throws JaloInvalidParameterException
isSingleton - if true the type is marked as having just one instanceJaloInvalidParameterException - in case a type with more than one instance is tried to mark as singleton.public void setJaloOnly(boolean isJaloOnly)
throws JaloInvalidParameterException
isJaloOnly - if true the instance of this type is not really an item but just a jalo class which access all the
attributesJaloInvalidParameterExceptionprotected Map getXMLCustomProperties(String forExtension)
public String getXMLDefinition()
items.xml. This method will show the
declaration to put inside the items.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 -
use getXMLDefinition(String) to get them.
getXMLDefinition in class TypegetXMLDefinition(String)public String getXMLDefinition(String forExtension)
items.xml.forExtension - getXMLDefinition()public String exportXMLDefinition(XMLOutputter xout)
exportXMLDefinition in class TypeManagerManagedprotected ComposedType.ComposedTypeImpl getComposedTypeImpl()
public boolean isAssignableFrom(Type type)
isAssignableFrom in class Typetype - the type to check assignability forprotected boolean isSameOrSuperTypeOf(ComposedType type)
public boolean isInstance(Object o)
isInstance in class Typeo - the object to be checked.public String toString()
@Deprecated protected boolean setTypeSearchSessionContex()
@Deprecated protected void unsetTypeSearchContext(boolean useLocal)
public boolean checkTypePermission(UserRight right)
works similar to Item.checkPermission(UserRight) except that supertype permissions are evaluated in case
no permission is set for this type.
right - the user right to checktrue if the current session user has the permission on the specified UserRightpublic boolean checkTypePermission(Principal p, UserRight right)
works similar to Item.checkPermission(UserRight) except that supertype permissions are evaluated in case
no permission is set for this type.
p - the principal to checkright - the user right to checktrue if the specified Principal has the permission on the specified
UserRightprotected int checkItemPermission(Principal principal, UserRight right)
checkItemPermission in class Itempublic Item getSingletonInstance()
JaloInvalidParameterException - type is not marked as singleton typeJaloSystemException - error while instance creationCopyright © 2017 SAP SE. All Rights Reserved.