Package mc.core.domain.generic
Class DataValueTO
java.lang.Object
mc.core.domain.generic.DataValueTO
- All Implemented Interfaces:
Serializable
container to transfer attribute value data for save from GUI clients or import channel. Use appropriate set-Methods
to set data in DataValueTO. Use method
AspectAttributeWrite.valueSet(mc.core.model.base.ComplexEntity, DataValueTO) or
AspectAttributeWrite.valuesSet(mc.core.model.base.ComplexEntity, List) to pass DataValueTO(s) to backend for save.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumtype of action to perform for attributes during multi indexingAspectAttributeWrite.multiIndexingSetValues(mc.core.model.base.ComplexEntity, Attribute, List, AttributeAction).static enum -
Constructor Summary
ConstructorsConstructorDescriptionDataValueTO(Attribute attribute) Constructor to create a DataValueTO.DataValueTO(Attribute attribute, DataMap map) Constructor to create a DataValueTO from data in given map (e.g. -
Method Summary
Modifier and TypeMethodDescriptionchanged()Optimization: Call to mark this DataValueTO as changed.longlonglongReturn value of entityToAttribute-id if set, default 0.booleanbooleanremoveDataValue(long dataValueId) Mark a DataValue to be deletedremoveE2A(long entityToAttributeId) Mark an EntityToAttribute to be deleted with all its DataValuesremoveText(long dataValueId, Locale locale) For locale dependent DataValues: DVAsset mark to be deleted if it has the locale.setAssetText(String assetText) DVAsset: Set an additional text for asset like image caption, legend etc.setAssetValue(long assetId, long localeId) DVAsset: set asset value for given locale.setAssetValue(Asset asset) DVAsset: set asset value for locale independent DVAsset, otherwise for content locale.setBooleanValue(Boolean value) DVBoolean: set Boolean valuesetCurrency(long currencyId) DVPrice set currency for pricelist independent valuesetCurrency(Currency currency) DVPrice set currency for pricelist independent valuesetDataValueSet(long dvSetId) Set the id of the DataValueSet if > 0, needed for setting enumerated values and editing standard/sample/default values of attribute.setDataValueSet(Object dataValueSetKey) Set key (internalDescription, id or display) of DataValueSet for setting an enumerated value.setDataValueSet(DataValueSet dvSet) Set the id of the DataValueSet if > 0, needed for setting enumerated values and editing standard/sample/default values of attribute.setDateValue(Calendar cal) DVDate: set valuesetEntityToAttribute(long id) Set the entityToAttribute-id to signal that one specific value of a multivalue attribute should be edited.Set the entityToAttribute to signal that one specific value of a multivalue attribute should be edited.setEnumValue(Object dataValueSetKey) Same assetDataValueSet(Object).setInternalDescription(String intDescr) Set the internalDescription of a dataValueSet when editing standard values of an attribute.setLocale(long localeId) For locale dependent DataValues( DVText, DVAsset), set locale if other than content localeFor locale dependent DataValues( DVText, DVAsset), set locale if other than content localesetNumericValue(Double numValue) DVNumeric: set valuesetNumericValue(Double numValue, long unitId) DVNumeric: set value with unitsetNumericValue(Double numValue, Unit unit) DVNumeric: set value with unitsetParameter(DataMap paramMap) set additional parameter for e2a.setPatternValues(List<Object> values) DVPattern: set all values (not the blanks) in the right order, list must contain a null element if a single value is not set.setPricelist(long pricelistId) DVPrice set pricelist for pricelist dependent valuesetPricelist(Pricelist pricelist) DVPrice set pricelist for pricelist dependent valuesetPriceValue(Double price) DVPrice set price valuesetPrio(int iPrio) Set the prio of entityToAttribute that determines sort order of this attribute value within list of values of different attributes for this entity.setPrioSet(int iPrio) Set prio of a dataValueSet for sort standard value onlysetPrioValue(int iPrioValue) Set prio for e2a that determines ordering within values of the same attribute.setReadonly(boolean readOnly) Set a dataValueSet to read only.setTerritory(long territoryId) Set territoryId for this attribute value (e2a), attribute must be territory dependent.setTerritory(Territory territory) Set territory for this attribute value (e2a), attribute must be territory dependent.setTextValue(String text) DVText: Set text value for locale independent value, otherwise for content localesetTextValue(String text, long localeId) setTextValue(String text, Locale locale) DVText: Set text value for locale dependent value in given locale.setTextValueTO(TextValueTO textValueTO) DVText: only relevant for text poolsetValidFrom(Calendar calValidFrom) Set valid-from-date for this attribute value (e2a).setValidUntil(Calendar calValidUntil) Set valid-until-date for this attribute value (e2a).setValueType(DataValueSet.ValueType valType) Usually not needed to be set (is determined from DataValueHandler), only for differentiating between SAMPLE and DEFAULT values for attributeGet copy of the internal data maptoString()
-
Constructor Details
-
DataValueTO
Constructor to create a DataValueTO from data in given map (e.g. created from RI-request). Map must contain key-value-pairs using as keys the enumDataValueTO.Key. Entities as values are stored by their id. For creating a DataValueTO programmatically constructorDataValueTO(Attribute)should be preferred, using set-Methods to set data.- Parameters:
attribute- for which a value should be set. mandatorymap- containing the data for the DataValueTO, mandatory.
-
DataValueTO
Constructor to create a DataValueTO.- Parameters:
attribute- for which a value should be set. mandatory
-
-
Method Details
-
getAttribute
-
changed
Optimization: Call to mark this DataValueTO as changed. This flag should be evaluated prior to calling a save-Method in AttributeAspect, to filter DataValueTOs where data has not changed. If no possibility exists to compare new data to old data do not call. Flag is ignored in save procedure.- Returns:
- this for fluent API
-
isChanged
public boolean isChanged()- Returns:
- value of DataValueTO's flag
changed.
-
toDataMap
Get copy of the internal data map -
setEntityToAttribute
Set the entityToAttribute-id to signal that one specific value of a multivalue attribute should be edited. The e2a-id must be the id of an existing e2a for this attribute and entity.- Parameters:
id-- Returns:
- this for fluent API
-
setEntityToAttribute
Set the entityToAttribute to signal that one specific value of a multivalue attribute should be edited. The e2a must be an existing e2a for this attribute and entity. Equivalent to callingsetEntityToAttribute(long)withe2a.getId().- Parameters:
e2a- mandatory- Returns:
- this for fluent API
-
getEntityToAttributeId
public long getEntityToAttributeId()Return value of entityToAttribute-id if set, default 0.- Returns:
- long
-
setValidFrom
Set valid-from-date for this attribute value (e2a).- Parameters:
calValidFrom- optional, ignored if null- Returns:
- this for fluent API
-
setValidUntil
Set valid-until-date for this attribute value (e2a).- Parameters:
calValidUntil- optional, ignored if null- Returns:
- this for fluent API
-
setTerritory
Set territoryId for this attribute value (e2a), attribute must be territory dependent.- Parameters:
territoryId- must be valid id of an existing territory for territory dependent attributes- Returns:
- this for fluent API
-
setTerritory
Set territory for this attribute value (e2a), attribute must be territory dependent. Equivalent to calling methodsetTerritory(long)withterritory.getId().- Parameters:
territory- mandatory- Returns:
- this for fluent API
-
setPrio
Set the prio of entityToAttribute that determines sort order of this attribute value within list of values of different attributes for this entity. No check with prio of other entityToAttributes is done upon save. Also for multivalue attributes all e2as for same attribute should have same prio, this must be taken care of by the caller. UseAspectAttributeWrite.changeOrder(mc.core.model.base.ComplexEntity, Attribute, boolean, boolean)to create consistent values for prios of e2as that takes into account multivalues as well.- Parameters:
iPrio- int- Returns:
- this for fluent API
-
setPrioValue
Set prio for e2a that determines ordering within values of the same attribute. No check with prioValue of other entityToAttributes for same attribute is done upon save, use methodAspectAttributeWrite.valueChangeOrder(EntityToAttribute, boolean)for consistent ordering of values.- Parameters:
iPrioValue- int- Returns:
- this for fluent API
-
setParameter
set additional parameter for e2a. existing values are deleted if key is in map and value is null. NOTE: this is a convenience method for setting additional parameter values together with the data for respective dataValue in one step. parameter are only stored if any data for value is set in TO (textValue, numericValue ...). for setting parameter independently from data value useAspectAttributeRead.parameter()API.- Parameters:
paramMap- map with key/value pairs. if value is not serializable it will be converted to String. if value is null respective parameter is deleted if exists- Returns:
- this for fluent API
-
getDataValueId
public long getDataValueId()- Returns:
- the id of the corresponding datavalue if set. Only needed for remove, use
removeDataValue(long)to set.
-
getInternalDescription
- Returns:
- parameter internalDescription from map
-
setDataValueSet
Set the id of the DataValueSet if > 0, needed for setting enumerated values and editing standard/sample/default values of attribute.- Parameters:
dvSetId- should be a valid id of a standard value of this attribute, ignored if <= 0- Returns:
- this for fluent API
-
setDataValueSet
Set the id of the DataValueSet if > 0, needed for setting enumerated values and editing standard/sample/default values of attribute. Same as callingsetDataValueSet(long)withdvSet.getId().- Parameters:
dvSet- should be a valid id of a standard value of this attribute, ignored if <= 0- Returns:
- this for fluent API
-
setDataValueSet
Set key (internalDescription, id or display) of DataValueSet for setting an enumerated value.- Parameters:
dataValueSetKey-- Returns:
- this for fluent API
-
setEnumValue
Same assetDataValueSet(Object). for backwards compatibility- Parameters:
dataValueSetKey-- Returns:
- this for fluent API
-
getDataValueSetId
public long getDataValueSetId()- Returns:
- value for key "dataValueSet" from map as id
-
getDataValueSetKey
- Returns:
- value for key "dataValueSet" from map if not empty, otherwise the value for key "internalDescription"
-
setValueType
Usually not needed to be set (is determined from DataValueHandler), only for differentiating between SAMPLE and DEFAULT values for attribute -
setInternalDescription
Set the internalDescription of a dataValueSet when editing standard values of an attribute. Not for selecting a standard value as value for an entity, usesetEnumValue(String)) for this.- Parameters:
intDescr-- Returns:
- this for fluent API
-
setPrioSet
Set prio of a dataValueSet for sort standard value only -
setReadonly
Set a dataValueSet to read only. Not used to date, only relevant for proposal values.- Parameters:
readOnly-- Returns:
- this for fluent API
-
setAssetValue
DVAsset: set asset value for given locale.- Parameters:
assetId- should be valid id of existing assetlocaleId- optional, ignored if 0- Returns:
-
setAssetValue
DVAsset: set asset value for locale independent DVAsset, otherwise for content locale.- Parameters:
asset- mandatory- Returns:
- this for fluent API
-
setAssetText
DVAsset: Set an additional text for asset like image caption, legend etc. NOT USED. -
setBooleanValue
DVBoolean: set Boolean value- Parameters:
value- optional, use setBooleanValue(null) to specify noChoice withDTBoolean.isAllowNoChoice()- Returns:
- this for fluent API
-
setTextValue
DVText: Set text value for locale independent value, otherwise for content locale- Parameters:
text- ignored if null or empty. Whitespace will be removed from start and end of given text.- Returns:
- this for fluent API
-
setTextValue
DVText: Set text value for locale dependent value in given locale. For locale independent value locale is ignored.- Parameters:
text- ignored if null or empty. Whitespace will be removed from start and end of given text.locale- mandatory- Returns:
- this for fluent API
-
setTextValue
- Parameters:
text- ignored if null or empty. Whitespace will be removed from start and end of given text.localeId- ignored if 0- Returns:
- this for fluent API
- See Also:
-
setTextValueTO
DVText: only relevant for text pool- Parameters:
textValueTO- ignored if null- Returns:
- this for fluent API
-
getTextValueTO
-
setLocale
For locale dependent DataValues( DVText, DVAsset), set locale if other than content locale- Parameters:
locale- mandatory- Returns:
- this for fluent API
-
setLocale
For locale dependent DataValues( DVText, DVAsset), set locale if other than content locale- Parameters:
localeId- ignored it 0- Returns:
- this for fluent API
-
setDateValue
DVDate: set value- Parameters:
cal-- Returns:
- this for fluent API
-
setNumericValue
DVNumeric: set value- Parameters:
numValue-- Returns:
- this for fluent API
-
setNumericValue
DVNumeric: set value with unit- Parameters:
numValue-unitId- , ignored if 0- Returns:
- this for fluent API
-
setNumericValue
DVNumeric: set value with unit- Parameters:
numValue-unit- optional- Returns:
- this for fluent API
-
setPriceValue
DVPrice set price value- Parameters:
price-- Returns:
- this for fluent API
-
setPricelist
DVPrice set pricelist for pricelist dependent value- Parameters:
pricelist- mandatory- Returns:
- this for fluent API
-
setPricelist
DVPrice set pricelist for pricelist dependent value- Parameters:
pricelistId- ignored if 0- Returns:
- this for fluent API
-
setCurrency
DVPrice set currency for pricelist independent value- Parameters:
currency- mandatory- Returns:
- this for fluent API
-
setCurrency
DVPrice set currency for pricelist independent value- Parameters:
currencyId- ignored if 0- Returns:
- this for fluent API
-
setPatternValues
DVPattern: set all values (not the blanks) in the right order, list must contain a null element if a single value is not set. To date a value object can be a String or a Long (unitId) or null which must correspond to the place in the pattern. For blanks the value list does not need to contain a value.- Parameters:
values- mandatory
-
isToRemove
public boolean isToRemove() -
removeDataValue
Mark a DataValue to be deleted- Parameters:
dataValueId- mandatory, must be the valid id of an existing dataValue for this attribute and entity- Returns:
- this for fluent API
-
removeText
For locale dependent DataValues: DVAsset mark to be deleted if it has the locale. DVText: remove text in locale- Parameters:
dataValueId- mandatory, must be the valid id of an existing dataValue for this attribute and entity- Returns:
- this for fluent API
-
removeE2A
Mark an EntityToAttribute to be deleted with all its DataValues- Parameters:
entityToAttributeId- mandatory, must be the valid id of an existing e2a for this attribute and entity- Returns:
- this for fluent API
-
toString
-