Class SingleValueTranslator
- java.lang.Object
-
- de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
-
- de.hybris.platform.impex.jalo.translators.SingleValueTranslator
-
- Direct Known Subclasses:
ActiveDirectoryGroupCollectionTranslator.PrincipalGroupTranslator,AnonymousUserTranslator,AtomicValueTranslator,CampaignSourceRulesTranslator,ClassificationAttributeValueTranslator,DiscountValueTranslator,EClassAttributeTypeTranslator,EClassUnitTranslator,ETIMAttributeTypeTranslator,Europe1RowTranslator,ExtractUserGroupTranslator.UserGroupTranslator,ItemExpressionTranslator,ItemPKTranslator,ProductFeatureValueTranslator,ProfiClassAttributeTypeTranslator,PromotionPriceRowsTranslator.PriceRowTranslator,TaxValueTranslator
public abstract class SingleValueTranslator extends AbstractValueTranslator
Base class of all translator translating single attribute values.
-
-
Constructor Summary
Constructors Constructor Description SingleValueTranslator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.lang.ObjectconvertToJalo(java.lang.String expr, Item forItem)Converts a non-null and non-empty string into a jalo attribute value.protected abstract java.lang.StringconvertToString(java.lang.Object value)Converts a non-null jalo attribute value into its string representation.java.lang.StringexportValue(java.lang.Object value)Translates an attribute value for export usage.protected java.lang.ObjectgetEmptyValue()The representation of an empty value this translator uses.java.lang.ObjectimportValue(java.lang.String valueExpr, Item toItem)Translates a tokenized csv value for import usage.protected booleanisEmpty(java.lang.String expr)Checks whether an expression is empty.-
Methods inherited from class de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
clearStatus, createTranslator, createTranslator, createTranslator, debug, error, getColumnDescriptor, getFlexibleSearch, info, init, isDebugEnabled, isInfoEnabled, setEmpty, setError, validate, warn, wasEmpty, wasUnresolved
-
-
-
-
Method Detail
-
isEmpty
protected boolean isEmpty(java.lang.String expr)
Checks whether an expression is empty.- Parameters:
expr- expression to check- Returns:
- true if it is recognized as empty, false otherwise
-
getEmptyValue
protected java.lang.Object getEmptyValue()
The representation of an empty value this translator uses.- Returns:
- used null value
-
importValue
public final java.lang.Object importValue(java.lang.String valueExpr, Item toItem) throws JaloInvalidParameterExceptionDescription copied from class:AbstractValueTranslatorTranslates a tokenized csv value for import usage. This means that the result object must be a instance of the expected attribute type.- Specified by:
importValuein classAbstractValueTranslator- Parameters:
valueExpr- expression to translatetoItem- the target item in case it already exist, null otherwise (for partOf attributes!)- Returns:
- Object translated value
- Throws:
JaloInvalidParameterException- value can not be translated with this translator or is invalid
-
exportValue
public final java.lang.String exportValue(java.lang.Object value) throws JaloInvalidParameterExceptionDescription copied from class:AbstractValueTranslatorTranslates an attribute value for export usage. This means the attribute value must be transformed into a string which should be re-importable again.- Specified by:
exportValuein classAbstractValueTranslator- Parameters:
value- value to translate- Returns:
- String translated value
- Throws:
JaloInvalidParameterException- value can not be translated with this translator or is invalid
-
convertToJalo
protected abstract java.lang.Object convertToJalo(java.lang.String expr, Item forItem)Converts a non-null and non-empty string into a jalo attribute value.- Parameters:
expr- string to translateforItem- item instance the translated value will be set to as attribute- Returns:
- Object translated value
-
convertToString
protected abstract java.lang.String convertToString(java.lang.Object value)
Converts a non-null jalo attribute value into its string representation.- Parameters:
value- value to translate- Returns:
- translated value
-
-