Class RangeParserUtils
java.lang.Object
com.hybris.backoffice.excel.importing.parser.RangeParserUtils
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultValuesappendPrefixToDefaultValues(DefaultValues defaultValues, RangeParserUtils.RangeBounds range) static ParsedValuesappendPrefixToParsedValues(ParsedValues parsedValues, RangeParserUtils.RangeBounds range) static Stringconvert(String input, UnaryOperator<String> converter) Allows to convert given input with given converter.static StringdeleteFromPrefix(String input) Deletes "from$" from given inputstatic StringdeletePrefix(String input, String prefix) Deletes given prefix from given inputstatic DefaultValuesdeletePrefixFromDefaultValues(DefaultValues defaultValues, RangeParserUtils.RangeBounds range) static ImportParametersdeletePrefixFromImportParameters(ImportParameters importParameters, RangeParserUtils.RangeBounds rangeBounds) static ParsedValuesdeletePrefixFromParsedValues(ParsedValues parsedValues, RangeParserUtils.RangeBounds range) static StringdeleteToPrefix(String input) Deletes "to$" from given inputstatic ImportParametersgetSingleImportParameters(ExcelClassificationAttribute excelClassificationAttribute, ImportParameters importParameters, Map<String, String> params, RangeParserUtils.RangeBounds rangeBounds) Every range contains of FROM and TO values.parseRangePattern(String input) Parses input to pair of values - beginning of the range and end of the range.static StringprependFromPrefix(String input) Prepends "from$" to given input.static StringprependToPrefix(String input) Prepends "to$" to given input.splitByRangeSeparator(String input) Splits given input by ";".
-
Field Details
-
RANGE_DELIMITER
- See Also:
-
RANGE_PREFIX
- See Also:
-
RANGE_SUFFIX
- See Also:
-
RANGE_FROM_PREFIX
- See Also:
-
RANGE_TO_PREFIX
- See Also:
-
COMPLEX_TYPE_RANGE_FORMAT
- See Also:
-
SIMPLE_TYPE_RANGE_FORMAT
- See Also:
-
RANGE_PATTERN
e.g. RANGE[from;to]
-
-
Method Details
-
parseRangePattern
public static org.apache.commons.lang3.tuple.Pair<String,String> parseRangePattern(@Nonnull String input) throws ExcelParserException Parses input to pair of values - beginning of the range and end of the range. The input should be in format "RANGE["from";"to"]".
.e.g input "RANGE["from";"to"]" returnsPairwhich contains "from" and "to".- Parameters:
input- range raw value- Returns:
- pair which contains beginning and ending of the range. The
Pair.getLeft()returns "from" of the range andPair.getRight()returns "to" of the range. - Throws:
ExcelParserException- when input doesn't match toRANGE_PATTERN
-
splitByRangeSeparator
public static org.apache.commons.lang3.tuple.Pair<String,String> splitByRangeSeparator(@Nonnull String input) throws ExcelParserException - Parameters:
input- value to split- Returns:
- pair which contains beginning and ending of the range. The
Pair.getLeft()returns "from" of the range andPair.getRight()returns "to" of the range. - Throws:
ExcelParserException
-
prependFromPrefix
-
prependToPrefix
-
deleteFromPrefix
Deletes "from$" from given input- Parameters:
input- to modify- Returns:
- value without "from$"
-
deleteToPrefix
Deletes "to$" from given input- Parameters:
input- to modify- Returns:
- value without "to$"
-
deletePrefix
Deletes given prefix from given input- Parameters:
input- to modifyprefix- to remove- Returns:
- value without given prefix
-
deletePrefixFromImportParameters
public static ImportParameters deletePrefixFromImportParameters(ImportParameters importParameters, RangeParserUtils.RangeBounds rangeBounds) - Parameters:
importParameters- to modifyrangeBounds- allows to decide which prefix should be handled- Returns:
- value without given prefix
-
getSingleImportParameters
public static ImportParameters getSingleImportParameters(ExcelClassificationAttribute excelClassificationAttribute, ImportParameters importParameters, Map<String, String> params, RangeParserUtils.RangeBounds rangeBounds) Every range contains of FROM and TO values. This method allows to retrieveImportParametersfrom one of given bounds.- Parameters:
excelClassificationAttribute- it is necessary, because this method must check whether the type is complex or simple. If it's simple thenImportParameters.cellValuewill be completed with "rawValue".importParameters- to work onparams- to be put inImportParameters.parametersrangeBounds- allows to decide whether retrieve FROM or TO bound- Returns:
- importParameters of given bound
-
appendPrefixToParsedValues
public static ParsedValues appendPrefixToParsedValues(ParsedValues parsedValues, RangeParserUtils.RangeBounds range) - Parameters:
parsedValues- to modifyrange- allows to decide which prefix should be handled- Returns:
- value with given prefix
-
deletePrefixFromParsedValues
public static ParsedValues deletePrefixFromParsedValues(ParsedValues parsedValues, RangeParserUtils.RangeBounds range) - Parameters:
parsedValues- to modifyrange- allows to decide which prefix should be handled- Returns:
- value without given prefix
-
appendPrefixToDefaultValues
public static DefaultValues appendPrefixToDefaultValues(DefaultValues defaultValues, RangeParserUtils.RangeBounds range) - Parameters:
defaultValues- to modifyrange- allows to decide which prefix should be handled- Returns:
- value with given prefix
-
deletePrefixFromDefaultValues
public static DefaultValues deletePrefixFromDefaultValues(DefaultValues defaultValues, RangeParserUtils.RangeBounds range) - Parameters:
defaultValues- to modifyrange- allows to decide which prefix should be handled- Returns:
- value without given prefix
-
convert
Allows to convert given input with given converter. If input containsSelectedAttribute.REFERENCE_PATTERN_SEPARATORthen it is split using this separator and all of the subelements are converted and then merged.
E.g. input "a:b:c" and converter which appends "from$" then ""to$"a:"to$"b:"to$"c" will be returned- Parameters:
input- to modifyconverter- to use for conversion- Returns:
- converted input
-