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

public abstract class AspectAttributeWrite<T extends ComplexEntity> extends AspectAttributeRead<T>
  • Constructor Details

    • AspectAttributeWrite

      public AspectAttributeWrite()
  • Method Details

    • valueCopy

      public void valueCopy(EntityToAttribute toCopy, ComplexEntity target) throws ApplicationException
      Throws:
      ApplicationException
    • dataValueSetCopy

      public DataValueSet dataValueSetCopy(DataValueSet toCopy, ComplexEntity target) throws ApplicationException
      Throws:
      ApplicationException
    • copy

      public List<Attribute> copy(T entity, ComplexEntity source) throws ApplicationException
      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 - mandatory
      attributes - 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 - mandatory
      attribute - mandatory
      byCollection - mandatory
      decreaseOrder - 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 object
      decreaseOrder - move up if true, otherwise down
      Throws:
      UserException
    • valueSetOrder

      public void valueSetOrder(EntityToAttribute toChange, int targetPrioValue) throws UserException
      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 object
      targetPrioValue - 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 as EntityToAttributePrio, otherwise the prio is store in the assignments (EntityToAttribute.
      Parameters:
      complexEntity - mandatory
      attribute - 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 attributes
      IndexOutOfBoundsException - if targetPrio is not a valid index of list
      UserException
    • 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 - mandatory
      collection - 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 values
      key - mandatory, must be a valid key of a standardValue of this attribute
      locale - optional, default is content locale
      Returns:
      the DataValueSet
      Throws:
      EntityNotFoundException - if no standardValues of this attribute exists with this key
    • dataValueGetFromKey

      public DataValue dataValueGetFromKey(String key) throws EntityNotFoundException
      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

      public void remove(ComplexEntity complexEntity, Attribute attribute) throws UserException
      remove all assignments of this attribute to complex entity including values
      Parameters:
      complexEntity - mandatory
      attribute - mandatory
      Throws:
      UserException
    • remove

      public void remove(ComplexEntity complexEntity, List<Attribute> attributes) throws UserException
      Remove all assignments of given attributes (the EntityToAttributes) to the entities including possibly existing attribute values. Always deletes EntityToAttribute assignment, even for OAs!
      Parameters:
      complexEntity - mandatory. Entity from which to remove assignments
      attributes - 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 - mandatory
      dataValueTO - 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, use AspectAttribute.DataValueHandler#setMultiValues(List) for that! This method always appends multivalues at the end of list of existing values!
      Parameters:
      complexEntity - mandatory
      toList - 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

      public void valueRemove(DataValue dataValue)
      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 - mandatory
      attributes - mandatory
      Throws:
      ApplicationException
    • valueRemoveInLocale

      public void valueRemoveInLocale(EntityToAttribute e2a, Locale locale) throws UserException
      Throws:
      UserException
    • valuesAllRemove

      public void valuesAllRemove(EntityToAttribute e2a) throws UserException
      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

      public List<Attribute> multiIndexingGetAttributes(List<? extends ComplexTypeEntity> objectTypeList)
      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 - mandatory
      attribute - mandatory
      dataValueTOs - mandatory
      action - 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 - mandatory
      attribute - mandatory
      territory - optional
      Throws:
      ApplicationException
    • toggleAttributeInheritance

      public void toggleAttributeInheritance(ComplexEntity entity, Attribute attribute, boolean disable)
      Removes or returns given attribute from or to display of inherited attributes of this entity.
      Parameters:
      entity - mandatory
      attribute - mandatory
      disable -