Package mc.core.domain.base.aspect
Class AspectAttributeRead<T extends ComplexEntity>
java.lang.Object
mc.core.system.base.BaseBean
mc.core.domain.base.dobj.AbstractAspect<T>
mc.core.domain.base.aspect.AspectAttributeRead<T>
- Direct Known Subclasses:
AspectAttributeWrite
abstract base aspect for attribute values. has the READ and the legacy WRITE methods
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttributeValueByAttribute(ComplexEntity object, Attribute attribute, DataValueFilter dvFilter) get AttributeValue for one attributegetAttributeValuesByAssignment(List<? extends ComplexEntity> objects, List<? extends IAttributeAssignment> assignments, DataValueFilter dvFilter) get all attribute values of objects for the given list of attributes, ordered first by ordering of objects, then by prio of attributes and prio of values.getAttributeValuesByAttributes(List<? extends ComplexEntity> objects, List<Attribute> attributes, DataValueFilter dvFilter) get all attribute values of objects for the given list of attributes, ordered first by ordering of objects, then by prio of attributes and prio of values.getAttributeValuesByAttributes(ComplexEntity object, List<Attribute> attributes, DataValueFilter dvFilter) getAttributeValuesByCollection(ComplexEntity object, Collection collection, DataValueFilter dvFilter) Returns all AttributeValues of this entity that belong to given collection.getAttributeValuesBySubType(List<? extends ComplexEntity> objects, AttributeType.SubType subType, DataValueFilter dvFilter) Get all attributes of objects for given AttributeType.SubType.getAttributeValuesBySubType(ComplexEntity object, AttributeType.SubType subType, DataValueFilter dvFilter) get all attributes of object for given AttributeType.SubType.getAttributeValuesByType(ComplexEntity object, AttributeType attributeType, DataValueFilter dvFilter) getAttributeValuesByTypes(List<? extends ComplexEntity> objects, List<AttributeType> attributeTypes, DataValueFilter dvFilter) searches for all entityAttributes of given complexEntities where attributes belong to given attributeTypes.getAttributeValuesByTypes(ComplexEntity object, List<AttributeType> attributeTypes, DataValueFilter dvFilter) getPreviewAsset(T entity) getPreviewAssetsMap(List<T> entityList) Returns the assets used as default preview asset which is found by the following search: Get all type attributes from ComplexEntity's type that have an Asset-Datatype, ordered by prio.getTypeAttributesBySubType(ComplexTypeEntity objectType, AttributeType.SubType subType) get all configured type attributes for an ComplexTypeEntity.booleanisAllowed(ComplexEntity entity, Attribute attributeToCheck) check if type or object attribute is allowed by configuration for this objectnewAttributeValue(ComplexEntity object, IAttributeAssignment assignment) newAttributeValue(ComplexEntity object, Attribute attribute) access to the attribute value parameter API
-
Constructor Details
-
AspectAttributeRead
public AspectAttributeRead()
-
-
Method Details
-
parameter
access to the attribute value parameter API -
getTypeAttributesBySubType
public List<TypeEntityToAttribute> getTypeAttributesBySubType(ComplexTypeEntity objectType, AttributeType.SubType subType) get all configured type attributes for an ComplexTypeEntity.- Parameters:
objectType- ComplexTypeEntity - mandatorysubType- subType of attribute type - must be an subType.isConfigType. throws error if not.- Returns:
- list of TypeEntityToAttribute assignments on this complex type
-
isAllowed
check if type or object attribute is allowed by configuration for this object- Parameters:
entity- mandatoryattributeToCheck- mandatory- Returns:
- true if attribute is allowed by configuration or attributeType has isSystem flag
-
getAttributeValuesByType
public AttributeValues getAttributeValuesByType(ComplexEntity object, AttributeType attributeType, DataValueFilter dvFilter) -
getAttributeValuesByTypes
public AttributeValues getAttributeValuesByTypes(List<? extends ComplexEntity> objects, List<AttributeType> attributeTypes, DataValueFilter dvFilter) searches for all entityAttributes of given complexEntities where attributes belong to given attributeTypes. For config-attributeTypes only loads configured attributes for each object. By default does not return children of group-attributes, set includeGroupChildren to true in DataValueFilter, if wished otherwise.- Parameters:
objects- optional, if empty returns empty AttributeValues.attributeTypes- mandatory, if empty returns empty AttributeValues.dvFilter- optional, can be null. filter AttributeValues by locale, territories and/or validDate, include/exclude group children.- Returns:
- List of AttributeValue sorted first by ordering of objects, then by prio of attribute (for type attributes prio of typeEntityAttribute) and prioValue
-
getAttributeValuesByTypes
public AttributeValues getAttributeValuesByTypes(ComplexEntity object, List<AttributeType> attributeTypes, DataValueFilter dvFilter) - Parameters:
object- mandatoryattributeTypes- mandatorydvFilter- optional- Returns:
- empty list, if complexEntity is not persistent or List of attributeTypes is empty
-
getAttributeValuesBySubType
public AttributeValues getAttributeValuesBySubType(ComplexEntity object, AttributeType.SubType subType, DataValueFilter dvFilter) get all attributes of object for given AttributeType.SubType. Of config-attribute only return those which are currently allowed through configured TypeEntityToAttribute assignments. Of object attributes only return those that are within allowed attributeTypes of the entitie's type. type attributes are ordered by prio as configured by assignment to type, object attributes are ordered by entityToAttribute prio- Parameters:
object- mandatorysubType- mandatorydvFilter- filter for data value query - optional, can be null- Returns:
- list of AttributeValues for this object and subType
-
getAttributeValuesBySubType
public AttributeValues getAttributeValuesBySubType(List<? extends ComplexEntity> objects, AttributeType.SubType subType, DataValueFilter dvFilter) Get all attributes of objects for given AttributeType.SubType. Of config-attribute only return those which are currently allowed through configured TypeEntityToAttribute assignments. Of object attributes only return those that are within allowed attributeTypes of the entity's type. The whole list is ordered by ordering of given objects. Within the AttributeValues for one object first come the type attributes, ordered by prio as configured by assignment to type, then object attributes ordered by entityToAttribute prio.- Parameters:
objects- mandatory, if empty returns empty listsubType- mandatorydvFilter- filter for data value query - optional, can be null- Returns:
- list of AttributeValues for this object and subType
-
getAttributeValueByAttribute
public AttributeValue getAttributeValueByAttribute(ComplexEntity object, Attribute attribute, DataValueFilter dvFilter) get AttributeValue for one attribute- Parameters:
object- mandatoryattribute- mandatorydvFilter- optional- Returns:
- value if exists, else null
-
getAttributeValuesByAttributes
public AttributeValues getAttributeValuesByAttributes(ComplexEntity object, List<Attribute> attributes, DataValueFilter dvFilter) - Parameters:
object- mandatory. if object is not persistent returns empty listattributes- optional, default is to return all configured type attribute values and all object attributes assigned to objects. When attributes are provided it is assumed that they are configured, useDataValueFilter.includeOnlyAllowed()to force check with config.dvFilter- optional, if null the default filter is used- Returns:
- list of AttributeValues for this object and attributes, type attributes ordered by prio of attribute assignment to type, object attributes ordered by prio of entityToAttribute.
-
getAttributeValuesByAttributes
public AttributeValues getAttributeValuesByAttributes(List<? extends ComplexEntity> objects, List<Attribute> attributes, DataValueFilter dvFilter) get all attribute values of objects for the given list of attributes, ordered first by ordering of objects, then by prio of attributes and prio of values. By default does not return children of group-attributes, set includeGroupChildren to true in DataValueFilter, if wished otherwise.
WARNING: does not chekc- Parameters:
objects- mandatory, can be emptyattributes- optional, default is to return all configured type attribute values and all object attributes assigned to objects. When attributes are provided it is assumed that they are configured, unlessDataValueFilter.includeOnlyAllowed()is set to true.dvFilter- optional, if null the default filter is used- Returns:
- list of AttributeValues for the objects and attributes
-
getAttributeValuesByAssignment
public AttributeValues getAttributeValuesByAssignment(List<? extends ComplexEntity> objects, List<? extends IAttributeAssignment> assignments, DataValueFilter dvFilter) get all attribute values of objects for the given list of attributes, ordered first by ordering of objects, then by prio of attributes and prio of values. By default does not return children of group-attributes, set includeGroupChildren to true in DataValueFilter, if wished otherwise.
WARNING: does not chekc- Parameters:
objects- mandatory, can be empty. Must be of same typeassignments- list of IAttributeAssignment for type of objects. Mandatory, can be empty -> return empty list. NOTE: if the classes implementing IAttributeAssignment are not entities the attributes referenced must be managed!dvFilter- optional, if null the default filter is used- Returns:
- list of AttributeValues for the objects and attributes defined by the assignments
-
getAttributeValuesByCollection
public AttributeValues getAttributeValuesByCollection(ComplexEntity object, Collection collection, DataValueFilter dvFilter) Returns all AttributeValues of this entity that belong to given collection. For type attributes only returns configured, sorted by assignment prio, object attribute are returned sorted by prio ascending.- Parameters:
object- mandatorycollection- mandatorydvFilter- optional- Returns:
- AttributeValues
-
newAttributeValue
-
newAttributeValue
-
getPreviewAsset
- Parameters:
entity- Entity for which to get preview.- Returns:
- Preview image. Fallback to parent applies if entity does not define a preview itself. Might return
nullif no preview could be found.
-
getPreviewAssetsMap
Returns the assets used as default preview asset which is found by the following search: Get all type attributes from ComplexEntity's type that have an Asset-Datatype, ordered by prio. Take the first and try to get Asset in content locale or its master locale from DataValue.- Parameters:
entityList- mandatory, if empty return empty map.- Returns:
- Mapping of entities to their previews. Entities that do not have previews are not included in the mapping.
- Throws:
ApplicationException
-