Class ItemExpressionTranslator
java.lang.Object
de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
de.hybris.platform.impex.jalo.translators.SingleValueTranslator
de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator
- Direct Known Subclasses:
AlternativeExpressionTranslator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
ConstructorsConstructorDescriptionItemExpressionTranslator(ComposedType targetType, List<AbstractDescriptor.ColumnParams> itemPatternList) -
Method Summary
Modifier and TypeMethodDescriptionprotected de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElementaddValuePath(List<AttributeDescriptor> path, AtomicValueTranslator trans, Map modifiers, boolean isAlternative) protected ItemExpressionTranslator.ExpressionQuerybuildQuery(ComposedType targetType, List<AbstractDescriptor.ColumnParams> itemPatternList) protected voidcheckResolvableAttribute(HeaderDescriptor header, AttributeDescriptor attributeDescriptor) convertAllToJalo(Item forItem, List<ItemExpressionTranslator> translators, List<String> expressions) convertAllToJalo(List<ItemExpressionTranslator> translators, List<String> expressions, int queryChunkSize) protected ObjectconvertToJalo(String valueExpr, Item forItem) Converts a non-null and non-empty string into a jalo attribute value.protected StringconvertToString(Object value) Converts a non-null jalo attribute value into its string representation.protected voidcreateAtomicAttributeSubTranslator(AttributeDescriptor attributeDescriptor, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) protected voidcreateDocumentIDSubTranslator(AttributeDescriptor attributeDescriptor, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative, String documentID) protected voidcreateItemAttributeSubTranslator(String qualifier, ComposedType attrType, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) protected Stringprotected voidcreateRelationAttributeSubTranslator(RelationDescriptor relationDescriptor, StringBuilder stringBuilder, ComposedType relatedType, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) protected ComposedTypecreateSubTranslator(StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) Translates a single item reference expression.protected List<de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternElement>cutOff(List<de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternElement> original, int cutPosition) protected Stringprotected ObjectReturning default translation in case a default value was specified for each item path expression.protected LanguagegetLanguageByIsoCode(de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElement patternElement) protected ComposedTypegetMostSpecific(ComposedType baseType, Set<ComposedType> types) protected ItemExpressionTranslator.ExpressionQuerygetQuery()protected ComposedTypevoidinit(StandardColumnDescriptor columnDescriptor) Called once per header creation to allow configuring this translator using column modifiers etc.protected static StringinserIsNullIfNecessary(String queryBody, Map<String, Object> valuesIncludingNull) protected booleanisLocalizedAndLanguageModifierIsSet(de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElement patternElement) mergeDefaultValues(List<String> parsedValues) protected static voidprotected AttributeDescriptorresolveAttribute(ComposedType type, AbstractDescriptor.ColumnParams patternElement) Tries to find the matching attribute descriptor for a given expression pattern element.search(List<ItemExpressionTranslator> translators2query, List<Map<String, Object>> values2query, List<String> expressions2query, int queryChunkSize) searchCombined(List<ItemExpressionTranslator> translators, List<Map<String, Object>> valueMaps, List<String> valueExpressions) searchInChunks(List<ItemExpressionTranslator> translators2query, List<Map<String, Object>> values2query, List<String> expressions2query, int chunkSize) protected ObjectsearchItem(Map values, String valueExpr) Executes actual resolving of a given reference pattern by issuing a flexible search query.protected Stringvoidvalidate(StandardColumnDescriptor columnDescriptor) Validates the value translator once per header creation.Methods inherited from class de.hybris.platform.impex.jalo.translators.SingleValueTranslator
exportValue, importValue, isEmptyMethods inherited from class de.hybris.platform.impex.jalo.translators.AbstractValueTranslator
clearStatus, createTranslator, createTranslator, createTranslator, debug, error, getColumnDescriptor, getFlexibleSearch, info, isDebugEnabled, isInfoEnabled, setEmpty, setError, warn, wasEmpty, wasUnresolved
-
Constructor Details
-
ItemExpressionTranslator
public ItemExpressionTranslator(ComposedType targetType, List<AbstractDescriptor.ColumnParams> itemPatternList) throws HeaderValidationException - Throws:
HeaderValidationException
-
-
Method Details
-
init
Description copied from class:AbstractValueTranslatorCalled once per header creation to allow configuring this translator using column modifiers etc.- Overrides:
initin classAbstractValueTranslator- Parameters:
columnDescriptor- descriptor where the value to translate belongs to
-
getQuery
-
getTargetType
-
createNewTableAlias
-
buildQuery
protected ItemExpressionTranslator.ExpressionQuery buildQuery(ComposedType targetType, List<AbstractDescriptor.ColumnParams> itemPatternList) throws HeaderValidationException - Throws:
HeaderValidationException
-
getMostSpecific
protected ComposedType getMostSpecific(ComposedType baseType, Set<ComposedType> types) throws HeaderValidationException - Throws:
HeaderValidationException
-
resolveAttribute
protected AttributeDescriptor resolveAttribute(ComposedType type, AbstractDescriptor.ColumnParams patternElement) throws HeaderValidationException Tries to find the matching attribute descriptor for a given expression pattern element. This method supports the following syntax:( {itemtype} '.' )? {qualifier}In case a explicite item type is specified it must be the same or subtype of the actual attribute type which encloses this expression.
- Parameters:
type- the attribute type which encloses this expressionpatternElement- the expression to reference the enclosing attribute value- Throws:
HeaderValidationException
-
addValuePath
protected de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElement addValuePath(List<AttributeDescriptor> path, AtomicValueTranslator trans, Map modifiers, boolean isAlternative) -
cutOff
-
createSubTranslator
protected ComposedType createSubTranslator(StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) throws HeaderValidationException Translates a single item reference expression.- Parameters:
stringBuilder-type-patternElement-qualifierPath-isAlternative-- Returns:
- in case the expression describes a subtype of the expected attribute type it returns this subtype, null otherwise
- Throws:
HeaderValidationException
-
getDocumentIDFromItemPattern
protected String getDocumentIDFromItemPattern(AbstractDescriptor.ColumnParams pattern) throws HeaderValidationException - Throws:
HeaderValidationException
-
createRelationAttributeSubTranslator
protected void createRelationAttributeSubTranslator(RelationDescriptor relationDescriptor, StringBuilder stringBuilder, ComposedType relatedType, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) throws HeaderValidationException - Throws:
HeaderValidationException
-
createItemAttributeSubTranslator
protected void createItemAttributeSubTranslator(String qualifier, ComposedType attrType, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) throws HeaderValidationException - Throws:
HeaderValidationException
-
createAtomicAttributeSubTranslator
protected void createAtomicAttributeSubTranslator(AttributeDescriptor attributeDescriptor, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative) throws HeaderValidationException - Throws:
HeaderValidationException
-
createDocumentIDSubTranslator
protected void createDocumentIDSubTranslator(AttributeDescriptor attributeDescriptor, StringBuilder stringBuilder, ComposedType type, AbstractDescriptor.ColumnParams patternElement, List<AttributeDescriptor> qualifierPath, String enclosingTableAlias, boolean isAlternative, String documentID) throws HeaderValidationException - Throws:
HeaderValidationException
-
validate
Description copied from class:AbstractValueTranslatorValidates the value translator once per header creation.- Overrides:
validatein classAbstractValueTranslator- Parameters:
columnDescriptor- descriptor where the value to translate belongs to- Throws:
HeaderValidationException- validation has thrown errors
-
checkResolvableAttribute
protected void checkResolvableAttribute(HeaderDescriptor header, AttributeDescriptor attributeDescriptor) throws HeaderValidationException - Throws:
HeaderValidationException
-
getFullDefaultValueMap
-
mergeDefaultValues
-
convertToString
Description copied from class:SingleValueTranslatorConverts a non-null jalo attribute value into its string representation.- Specified by:
convertToStringin classSingleValueTranslator- Parameters:
value- value to translate- Returns:
- translated value
-
toString
-
getLanguageByIsoCode
protected Language getLanguageByIsoCode(de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElement patternElement) -
isLocalizedAndLanguageModifierIsSet
protected boolean isLocalizedAndLanguageModifierIsSet(de.hybris.platform.impex.jalo.translators.ItemExpressionTranslator.ExportPatternEndElement patternElement) -
getEmptyValue
Returning default translation in case a default value was specified for each item path expression.Example:
INSERT ...; attrib( a1[ default=a],a2[default=b],a3[default=c] ); ...Here a actually empty
attribcolumn is translated into the equivalent of 'a:b:c' which were set as default value because each path expression ( a1, a2, a3 ) owns a default value. Otherwise the column would not be translatable- Overrides:
getEmptyValuein classSingleValueTranslator- Returns:
- used null value
-
searchItem
Executes actual resolving of a given reference pattern by issuing a flexible search query.- Parameters:
values-valueExpr-- Returns:
- Item
-
inserIsNullIfNecessary
-
mergeValues
-
convertAllToJalo
public static List<ItemExpressionTranslator.CombinedSearchResult> convertAllToJalo(Item forItem, List<ItemExpressionTranslator> translators, List<String> expressions) -
convertAllToJalo
public static List<ItemExpressionTranslator.CombinedSearchResult> convertAllToJalo(List<ItemExpressionTranslator> translators, List<String> expressions, int queryChunkSize) -
search
-
searchInChunks
-
searchCombined
-
convertToJalo
Description copied from class:SingleValueTranslatorConverts a non-null and non-empty string into a jalo attribute value.- Specified by:
convertToJaloin classSingleValueTranslator- Parameters:
valueExpr- string to translateforItem- item instance the translated value will be set to as attribute- Returns:
- Object translated value
-