Package mc.core.domain.base.aspect
Class AspectAttributeWrite<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>
mc.core.domain.base.aspect.AspectAttributeWrite<T>
- Direct Known Subclasses:
AspectAttribute
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddList(ComplexEntity complexEntity, List<Attribute> attributes, boolean sortByCollection) assign list of attributes to complex entity adding it to end of list of existing assignments relative to collection or to attribute type.voidattributeRestoreOrderDefault(ComplexEntity complexEntity, Collection collection) remove manual sorting for all attributes for this entity, optionally only attributes of given collectionvoidattributeSetOrder(ComplexEntity complexEntity, int targetPrio, Attribute attribute, List<Attribute> attributes) Moves attribute in given list to target prio (prios start with 1) and/or stores sort order according to list of attributes.voidchangeOrder(ComplexEntity complexEntity, Attribute attribute, boolean byCollection, boolean decreaseOrder) object attributes: change order by moving given attribute up or down in list of assigned attributes of same collectioncopy(T entity, ComplexEntity source) copyForList(List<T> targetEntityList, ComplexEntity source) copy all attributes of source entity that are configured by type of each entity with values to each entity of list.load DataValue from key, only id as key supported.dataValueSetCopy(DataValueSet toCopy, ComplexEntity target) multiIndexingGetAttributes(List<? extends ComplexTypeEntity> objectTypeList) returns the complete list of type attributes for all given objectTypes.multiIndexingGetAttributes(List<? extends ComplexTypeEntity> objectTypeList, boolean includeReadOnly) returns the complete list of type attributes for all given objectTypes.voidmultiIndexingSetValues(ComplexEntity complexEntity, Attribute attribute, List<DataValueTO> dataValueTOs, DataValueTO.AttributeAction action) update, add value or delete values for given attribute and entity, depending on given AttributeAction and Data in DataValueTOs.voidmultiIndexingValuesDelete(ComplexEntity object, Attribute attribute, Territory territory) Deletes value in content locale (or the value if locale independent) if not mandatoryvoidremove(ComplexEntity complexEntity, List<Attribute> attributes) Remove all assignments of given attributes (theEntityToAttributes) to the entities including possibly existing attribute values.voidremove(ComplexEntity complexEntity, Attribute attribute) remove all assignments of this attribute to complex entity including valuesstandardValueGetFromKey(Attribute attribute, Object key, Locale locale) tries to find a standardValue of given attribute by its key which could be the id of the DataValueSet or its internalDescription or the displayString of the dataValue in locale if given otherwise contentLocalevoidtoggleAttributeInheritance(ComplexEntity entity, Attribute attribute, boolean disable) Removes or returns given attribute from or to display of inherited attributes of this entity.voidvalueChangeOrder(EntityToAttribute toChange, boolean decreaseOrder) change ordering of values represented by EntityToAttributes of multivalued attributevoidvalueCopy(EntityToAttribute toCopy, ComplexEntity target) voidvalueRemove(ComplexEntity complexEntity, Attribute attribute, DataValue dataValue) removes given dataValue from the attribute values of complexEntity.voidvalueRemove(DataValue dataValue) deletes given dataValue taking care of any assignments according to rules described here:valueRemove(ComplexEntity, Attribute, DataValue).voidvalueRemoveInLocale(EntityToAttribute e2a, Locale locale) voidvaluesAllRemove(ComplexEntity complexEntity, List<Attribute> attributes) removes all values of the given attributes that are assigned to this complex entity.voidremoves all values of this entity to attribute assignment.voidvalueSet(ComplexEntity complexEntity, DataValueTO dataValueTO) set data from given DataValueTO as attribute value for given entity.voidvalueSetOrder(EntityToAttribute toChange, int targetPrioValue) change ordering of values represented by EntityToAttributes of multiple value attribute to target prio
IMPORTANT (MC-21786): after DB model changes - no DVSets more, prio value be changed only pro language(!)
for language dependent assetsvoidvaluesSet(ComplexEntity complexEntity, List<DataValueTO> toList) Set data from given DataValueTOs as attribute values for given entity.Methods inherited from class mc.core.domain.base.aspect.AspectAttributeRead
getAttributeValueByAttribute, getAttributeValuesByAssignment, getAttributeValuesByAttributes, getAttributeValuesByAttributes, getAttributeValuesByCollection, getAttributeValuesBySubType, getAttributeValuesBySubType, getAttributeValuesByType, getAttributeValuesByTypes, getAttributeValuesByTypes, getPreviewAsset, getPreviewAssetsMap, getTypeAttributesBySubType, isAllowed, newAttributeValue, newAttributeValue, parameter
-
Constructor Details
-
AspectAttributeWrite
public AspectAttributeWrite()
-
-
Method Details
-
valueCopy
- Throws:
ApplicationException
-
dataValueSetCopy
public DataValueSet dataValueSetCopy(DataValueSet toCopy, ComplexEntity target) throws ApplicationException - Throws:
ApplicationException
-
copy
- Throws:
ApplicationException
-
copyForList
public Map<T,Set<Attribute>> copyForList(List<T> targetEntityList, ComplexEntity source) throws ApplicationException copy all attributes of source entity that are configured by type of each entity with values to each entity of list. If an entity has no type no attributes are copied.- Parameters:
targetEntityList- list of ComplexEntity, mandatory, entities onto which the attributes should be copied.source- ComplexEntity, mandatory- Returns:
- Map<T, Set
> a map that has for each entity a set of attributes that could not be copied, because they are not configured by the entity's type - Throws:
ApplicationException
-
addList
public void addList(ComplexEntity complexEntity, List<Attribute> attributes, boolean sortByCollection) throws ApplicationException assign list of attributes to complex entity adding it to end of list of existing assignments relative to collection or to attribute type.- Parameters:
complexEntity- mandatoryattributes- mandatory, can be of different collections. If empty return. Existing and duplicates are filtered.sortByCollection- if true sorting is relative to the respective collection(s) of the attributes, otherwise to attribute type(s).- Throws:
ApplicationException
-
changeOrder
public void changeOrder(ComplexEntity complexEntity, Attribute attribute, boolean byCollection, boolean decreaseOrder) throws ApplicationException object attributes: change order by moving given attribute up or down in list of assigned attributes of same collection- Parameters:
complexEntity- mandatoryattribute- mandatorybyCollection- mandatorydecreaseOrder- if true moves attribute up in list, otherwise down- Throws:
ApplicationException
-
valueChangeOrder
public void valueChangeOrder(EntityToAttribute toChange, boolean decreaseOrder) throws UserException change ordering of values represented by EntityToAttributes of multivalued attribute- Parameters:
toChange- EntityToAttribute to be moved to a different place in list of EntityToAttributes of same attribute and objectdecreaseOrder- move up if true, otherwise down- Throws:
UserException
-
valueSetOrder
change ordering of values represented by EntityToAttributes of multiple value attribute to target prio
IMPORTANT (MC-21786): after DB model changes - no DVSets more, prio value be changed only pro language(!)
for language dependent assets- Parameters:
toChange- EntityToAttribute to be moved to a different place in list of EntityToAttributes of same attribute and objecttargetPrioValue- move to target position- Throws:
UserException
-
attributeSetOrder
public void attributeSetOrder(ComplexEntity complexEntity, int targetPrio, Attribute attribute, List<Attribute> attributes) throws UserException Moves attribute in given list to target prio (prios start with 1) and/or stores sort order according to list of attributes. If list of attributes is given and it contains attributes for which the entity has no assignment (inherited attributes) the sort order is stored asEntityToAttributePrio, otherwise the prio is store in the assignments (EntityToAttribute.- Parameters:
complexEntity- mandatoryattribute- optional. if null, list of attributes must be given. In this case EntityToAttributePrios are created for the sort order given by the list of attributes.attributes- optional, if given must be the complete list of attributes to be ordered. Given attribute must be present in the list.targetPrio- must be a valid position of given list, starting with 1- Throws:
IllegalArgumentException- if given attribute is not a member of list of attributesIndexOutOfBoundsException- if targetPrio is not a valid index of listUserException
-
attributeRestoreOrderDefault
public void attributeRestoreOrderDefault(ComplexEntity complexEntity, Collection collection) throws UserException remove manual sorting for all attributes for this entity, optionally only attributes of given collection- Parameters:
entity- mandatorycollection- optional- Throws:
UserException
-
standardValueGetFromKey
public DataValueSet standardValueGetFromKey(Attribute attribute, Object key, Locale locale) throws EntityNotFoundException tries to find a standardValue of given attribute by its key which could be the id of the DataValueSet or its internalDescription or the displayString of the dataValue in locale if given otherwise contentLocale- Parameters:
attribute- mandatory, must have standard/proposal valueskey- mandatory, must be a valid key of a standardValue of this attributelocale- optional, default is content locale- Returns:
- the DataValueSet
- Throws:
EntityNotFoundException- if no standardValues of this attribute exists with this key
-
dataValueGetFromKey
load DataValue from key, only id as key supported.- Parameters:
key- mandatory- Returns:
- the DataValue
- Throws:
EntityNotFoundException- if no DataValue exists with this id
-
remove
remove all assignments of this attribute to complex entity including values- Parameters:
complexEntity- mandatoryattribute- mandatory- Throws:
UserException
-
remove
Remove all assignments of given attributes (theEntityToAttributes) to the entities including possibly existing attribute values. Always deletes EntityToAttribute assignment, even for OAs!- Parameters:
complexEntity- mandatory. Entity from which to remove assignmentsattributes- mandatory. Attribute for which to remove assignments- Throws:
UserException- missing permissions or wrong state.
-
valueSet
public void valueSet(ComplexEntity complexEntity, DataValueTO dataValueTO) throws ApplicationException set data from given DataValueTO as attribute value for given entity. The DataValueTO must have the attribute set in addition to data matching the datatype of the attribute.- Parameters:
complexEntity- mandatorydataValueTO- mandatory- Throws:
ApplicationException
-
valuesSet
public void valuesSet(ComplexEntity complexEntity, List<DataValueTO> toList) throws ApplicationException Set data from given DataValueTOs as attribute values for given entity. Each DataValueTO must have the attribute set in addition to data matching the datatype of the attribute, the values can be for different attributes.
NOTE: do not use to overwrite an existing set of multivalues, useAspectAttribute.DataValueHandler#setMultiValues(List)for that! This method always appends multivalues at the end of list of existing values!- Parameters:
complexEntity- mandatorytoList- mandatory, must not contain null elements. If list is empty nothing happens- Throws:
ApplicationException
-
valueRemove
public void valueRemove(ComplexEntity complexEntity, Attribute attribute, DataValue dataValue) throws UserException removes given dataValue from the attribute values of complexEntity. Also removes the dataValueSet if the dataValue is the last and attribute is not enumeration. If attribute is config attribute and if DataValueSet is deleted, deletes also the EntityToAttribute. For object attributes in this case leaves the entityToAttribute to handle inherited values. If attribute is enumeration only removes the DataValueSet from EntityToAttribute which will be deleted if config attribute- Throws:
UserException
-
valueRemove
deletes given dataValue taking care of any assignments according to rules described here:valueRemove(ComplexEntity, Attribute, DataValue). Does not call set modified on entities or reportChangeValue.- Parameters:
dataValue- mandatory
-
valuesAllRemove
public void valuesAllRemove(ComplexEntity complexEntity, List<Attribute> attributes) throws ApplicationException removes all values of the given attributes that are assigned to this complex entity. Also removes the assignments for config attributes, assignments are left for object attributes. Calls set modified on entity- Parameters:
complexEntity- mandatoryattributes- mandatory- Throws:
ApplicationException
-
valueRemoveInLocale
- Throws:
UserException
-
valuesAllRemove
removes all values of this entity to attribute assignment. Also removes the assignment for config attributes, assignment is left for object attributes. Calls set modified on entity- Parameters:
e2a- mandatory- Throws:
UserException
-
multiIndexingGetAttributes
returns the complete list of type attributes for all given objectTypes.
Excluded are: no values (textbausteine), asset metadata, attributes for DVAsset or DVPrice
Excluded also system, archived and read only attributes.- Parameters:
objectTypeList- mandatory- Returns:
-
multiIndexingGetAttributes
public List<Attribute> multiIndexingGetAttributes(List<? extends ComplexTypeEntity> objectTypeList, boolean includeReadOnly) returns the complete list of type attributes for all given objectTypes.
Excluded are: no values (textbausteine), asset metadata, attributes for DVAsset or DVPrice
Excluded also system, archived and read only attributes obly if @param includeReadOnly == false- Parameters:
objectTypeList- mandatory- Returns:
-
multiIndexingSetValues
public void multiIndexingSetValues(ComplexEntity complexEntity, Attribute attribute, List<DataValueTO> dataValueTOs, DataValueTO.AttributeAction action) throws ApplicationException update, add value or delete values for given attribute and entity, depending on given AttributeAction and Data in DataValueTOs. EntityToAttribute-related data in DataValueTOs is ignored- Parameters:
complexEntity- mandatoryattribute- mandatorydataValueTOs- mandatoryaction- mandatory- Throws:
ApplicationException
-
multiIndexingValuesDelete
public void multiIndexingValuesDelete(ComplexEntity object, Attribute attribute, Territory territory) throws ApplicationException Deletes value in content locale (or the value if locale independent) if not mandatory- Parameters:
object- mandatoryattribute- mandatoryterritory- optional- Throws:
ApplicationException
-
toggleAttributeInheritance
Removes or returns given attribute from or to display of inherited attributes of this entity.- Parameters:
entity- mandatoryattribute- mandatorydisable-
-