Class AspectAttribute.DVBaseHandler<T extends DataValue,V,H extends AspectAttribute<C>.DVBaseHandler<T,V,H>>

java.lang.Object
mc.core.domain.base.aspect.AspectAttribute.DVBaseHandler<T,V,H>
All Implemented Interfaces:
AspectAttribute.DataValueHandler<V>
Direct Known Subclasses:
AspectAttribute.DVAssetHandler, AspectAttribute.DVBooleanHandler, AspectAttribute.DVDateHandler, AspectAttribute.DVNumericHandler, AspectAttribute.DVPatternHandler, AspectAttribute.DVPriceHandler, AspectAttribute.DVTextHandler
Enclosing class:
AspectAttribute<C extends ComplexEntity>

public abstract class AspectAttribute.DVBaseHandler<T extends DataValue,V,H extends AspectAttribute<C>.DVBaseHandler<T,V,H>> extends Object implements AspectAttribute.DataValueHandler<V>
abstract base class for typeHrc. has strategy and (partial) state
  • Constructor Details

    • DVBaseHandler

      public DVBaseHandler(AspectAttribute<C>.mc.core.domain.base.aspect.AspectAttribute.DVStrategyBase strategy)
  • Method Details

    • setMultiValueSplitChars

      public H setMultiValueSplitChars(String splitChars)
      set the character(s) by which multiple values are separated in String. Default is the pipe char ('|'). Call prior to set/add value(s).
    • setTrimValues

      public H setTrimValues(boolean trimValues)
      Trim given String values. Default is true. Call prior to set/add value(s).
    • setRemoveEmptyValues

      public H setRemoveEmptyValues(boolean removeEmptyValues)
      call prior to set/add value(s). default is false. Results in removal of value(s) in given locale for this attribute. Only taken into account when using method setFromString(String) or setFromString(String, Locale), ignored when editing standard values etc. of attribute.
      NOTE: you must set the territory on territory dependent attributes otherwise the values of all territories will be deleted.
    • setMultiValueAppend

      public H setMultiValueAppend(boolean append)
      Set to true if new list of multiple values should be appended to existing list in given locale. Default is false, i.e a new list overwrites the existing list in given locale, also removing excess number of values. call prior to set/add value(s).
      Specified by:
      setMultiValueAppend in interface AspectAttribute.DataValueHandler<T extends DataValue>
    • setCreateStdValues

      public H setCreateStdValues(boolean create)
      Set to true if new standard values should be created for values not already existing. Default is false. Only for AV enum scenario, ignored for all others. Call prior to set/add value(s).
    • setValue

      public H setValue(V value) throws mc.core.system.validation.ValidationException
      set value (terminal operation). respect flags and state data set prior to this call
      Specified by:
      setValue in interface AspectAttribute.DataValueHandler<T extends DataValue>
      Throws:
      mc.core.system.validation.ValidationException
    • setValues

      public H setValues(List<V> values) throws mc.core.system.validation.ValidationException
      set list of values (terminal operation). respect flags and state data set prior to this call
      Specified by:
      setValues in interface AspectAttribute.DataValueHandler<T extends DataValue>
      Throws:
      mc.core.system.validation.ValidationException
    • setValue

      public H setValue(DataValueTO dataValueTO) throws mc.core.system.validation.ValidationException
      set value through DataValueTO data (terminal operation). respect flags and state data contained in DataValueTO or set prior to this call (DataValueTO preceeds).

      COMMON:

      remove value if DataValueTO.isToRemove(). assertions: not null, value matches attribute dataType

      SZENARIOS:

      AV value/AV enum: set value. DataValueTO.setEntityToAttribute(long) or DataValueTO.setDataValueSet(long) identifies existing value (mandatory for multivalue edit).

      PV: set preset value dependent on DataValueTO.setValueType(ValueType). assertions: not null, value matches attribute dataType

      Specified by:
      setValue in interface AspectAttribute.DataValueHandler<T extends DataValue>
      Throws:
      mc.core.system.validation.ValidationException
    • setValueTOs

      public H setValueTOs(List<DataValueTO> dataValueTOs) throws mc.core.system.validation.ValidationException
      Sets list of DataValueTOs together according to setting setMultiValueAppend(boolean). It is assumed that dataValues are of same locale and territory and validity if given. If a value is specified to be edited by setting e2aId this is ignored. Any special settings for text pool, e.g. correction or providing test set are ignored.
      Parameters:
      dataValueTOs - mandatory. If empty and removeEmptyValues is true remove values in content locale.
      Throws:
      mc.core.system.validation.ValidationException
      See Also:
      • #setValueTO(DataValueTO)
    • setMultiValues

      public H setMultiValues(List<DataValueTO> dataValueTOs) throws mc.core.system.validation.ValidationException
      same as setValueTOs(List) to keep existing API
      Throws:
      mc.core.system.validation.ValidationException
    • setLocale

      public H setLocale(Locale locale)
      set locale for locale dependent values (state). ignored for others (they always use UNDEFINED locale)
    • setTerritory

      public H setTerritory(Territory territory)
      set territory for territory dependent attributes (state). ignored for others
      Specified by:
      setTerritory in interface AspectAttribute.DataValueHandler<T extends DataValue>
    • setPrio

      public H setPrio(int prio)
      Expert: set prio for entityToAttribute. Only relevant when setting values for entityToAttributes, ignored for others. Only saved when calling one of the setValue-methods. WARNING: No check with prio of other entityToAttributes is done upon save. Since for multivalue attributes all e2as for same attribute should have same prio, this must be taken care of by the caller, otherwise risk of inconsistent data.
    • setPrioValue

      public H setPrioValue(int prioValue)
      Expert: set prioValue for entityToAttribute. Only relevant when setting values for entityToAttributes, ignored for others. Only saved when calling one of the setValue-methods. PrioValue starts with 1 and determines the sort order of multivalues.WARNING: No check with prio of other entityToAttributes is done upon save, risking inconsistend data if used incorrectly.
    • setFromString

      public H setFromString(String valueToParse) throws mc.core.system.validation.ValidationException
      split at multValueSplitToken (for multivalue). if singleValue, use the first
      Specified by:
      setFromString in interface AspectAttribute.DataValueHandler<T extends DataValue>
      Throws:
      mc.core.system.validation.ValidationException
    • setFromString

      public H setFromString(String valueToParse, Locale locale) throws mc.core.system.validation.ValidationException
      shortcut for dvh(...).setLocale( locale).setFromString( valueToParse) to keep existing API
      Specified by:
      setFromString in interface AspectAttribute.DataValueHandler<T extends DataValue>
      Throws:
      mc.core.system.validation.ValidationException
    • setEntityToAttribute

      public H setEntityToAttribute(EntityToAttribute e2a)
      SZENARIOS:

      AV value / AV enum: defines the entityToAttribute to set/add new value (if multivalue and/or territory). assertions: entityToAttribute corresponds to existing entityToAttribute of current entity and attribute.

      PV: ignored, not relevant

    • setDataValueSet

      public H setDataValueSet(DataValueSet dataValueSet) throws mc.core.system.validation.ValidationException
      SZENARIOS:

      AV value: defines the dvSet to set/add new value (if multivalue and/or territory). assertions: set is persistent, dvSet of current attribute values, type is EXCLUSIVE

      AV enum: set the dvSet as standard value. if multivalue, overwrite/append or currentE2A decide which e2a is used. asserts are: set is persistent, stdValue of current attribute, type is SHARED

      PV: defines the dvSet to set/add new value

      Throws:
      mc.core.system.validation.ValidationException
    • removeDataValueSet

      public H removeDataValueSet(DataValueSet dataValueSet)
      SZENARIOS:

      AV value: remove dvSet and delete with all dataValues (optionally delete e2a). assertions: dvSet is EXCLUSIVE and set of current object and attribute

      AV enum: remove SHARED dvSet from e2a (optionally delete e2a). assertions: dvSet is SHARED and set of current object and attribute

      PV: delete dvSet and all values. assertions: dvSet is preset type and set of current attribute

      Parameters:
      dataValueSet - mandatory
    • removeValue

      public H removeValue(T dataValue)
      SZENARIOS:

      AV value: delete value, remove and delete dvSet if last value (optionally delete e2a). assertions: value is value of EXCLUSIVE set, and value of current object and attribute

      AV enum: remove SHARED dvSet containing value from e2a (optionally delete e2a). assertions: dvSet is SHARED and set of current object and attribute

      PV: delete value, but not the dvSet. assertions: dvSet is preset type and set of current attribute

      Parameters:
      dataValue - mandatory
    • removeValue

      public H removeValue(DataValueTO dvTO)
    • setEnumValue

      public H setEnumValue(DataValueSet dataValueSet) throws mc.core.system.validation.ValidationException
      same as setDataValueSet(DataValueSet) to keep existing API
      Throws:
      mc.core.system.validation.ValidationException
    • removeEnumValue

      public H removeEnumValue(DataValueSet set)
      same as removeDataValueSet(DataValueSet) to keep existing API
    • toValueDisplay

      public String toValueDisplay(DataValueTO dvTO)
      create display for data contained in TO