Class CorrelationIdUtil
java.lang.Object
com.broadleafcommerce.common.dataimport.util.CorrelationIdUtil
By default, this detects correlation id values that ends with () and optionally tokenized by |
for columns that can contain multiple correlation ids
- Author:
- Phillip Verheyden (phillipuniverse)
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncorrelationIdsFor
(Map<String, String> resolvedRow) parseCorrelationIds
(String value) Given a column that can contain correlation id references, returns only the correlation id(s) that are within the column.parseCorrelationIds
(String value, String multiValuedSeparator) Given a column that can contain correlation id references, returns only the correlation id(s) that are within the column.static String
populateCorrelationIds
(String value, String multiValuedSeparator, UnaryOperator<String> correlationIdToIdentifierResolver) Replaces the contents ofvalue
with the appropriate value from the result ofcorrelationIdToIdentifierResolver
.static String
populateCorrelationIds
(String value, UnaryOperator<String> correlationIdToIdentifierResolver) Replaces the contents ofvalue
with the appropriate value from the result ofcorrelationIdToIdentifierResolver
.replaceWithMappedCorrelationIds
(Map<String, String> row, UnaryOperator<String> correlationIdToIdentifierResolver)
-
Field Details
-
DEFAULT_MULTIVALUE_SEPARATOR
- See Also:
-
CORRELATIONID_REGEX
-
CORRELATIONID_POSTFIX
- See Also:
-
-
Method Details
-
parseCorrelationIds
Given a column that can contain correlation id references, returns only the correlation id(s) that are within the column. If there are no correlation ids this will return an empty list. If there is a mix of values (in the case of multiple values embedded within
value
) this will only return the discovered correlation ids from those values.- Parameters:
value
- potentially contains correlation ids. Allows muliple values separated byDEFAULT_MULTIVALUE_SEPARATOR
- Returns:
- the correlation ids within the column
- See Also:
-
parseCorrelationIds
public static List<String> parseCorrelationIds(@Nullable String value, @Nullable String multiValuedSeparator) Given a column that can contain correlation id references, returns only the correlation id(s) that are within the column. If there are no correlation ids this will return an empty list. If there is a mix of values (in the case of multiple values embedded withinvalue
) this will only return the discovered correlation ids from those values.- Parameters:
value
- potentially contains correlation idsmultiValuedSeparator
- optional separator column that can split the givenvalue
for multiple values. Ifnull
, defaults toDEFAULT_MULTIVALUE_SEPARATOR
- Returns:
- the correlation ids within the column
-
correlationIdsFor
-
replaceWithMappedCorrelationIds
-
populateCorrelationIds
@Nullable public static String populateCorrelationIds(@Nullable String value, UnaryOperator<String> correlationIdToIdentifierResolver) Replaces the contents ofvalue
with the appropriate value from the result ofcorrelationIdToIdentifierResolver
. This is flexible enough to only perform the operation if there are correlation ids to begin with contained withvalue
and those correlationIds have corresponding non-null results from thecorrelationIdToIdentifierResolver
.- Parameters:
value
- what should be inspected and potentially replacedcorrelationIdToIdentifierResolver
- given a correlationId, can resolve a resource tier id- Returns:
value
replaced with the the parsed correlation ids. Ifvalue
is null, this will also return null. If there are no correlation ids withinvalue
, the original is returned unchanged.
-
populateCorrelationIds
@Nullable public static String populateCorrelationIds(@Nullable String value, @Nullable String multiValuedSeparator, UnaryOperator<String> correlationIdToIdentifierResolver) Replaces the contents ofvalue
with the appropriate value from the result ofcorrelationIdToIdentifierResolver
. This is flexible enough to only perform the operation if there are correlation ids to begin with contained withvalue
and those correlationIds have corresponding non-null results from thecorrelationIdToIdentifierResolver
.- Parameters:
value
- what should be inspected and potentially replacedmultiValuedSeparator
- ifvalue
could contain multiple entries this is the separation between themcorrelationIdToIdentifierResolver
- given a correlationId, can resolve a resource tier id- Returns:
value
replaced with the the parsed correlation ids. Ifvalue
is null, this will also return null. If there are no correlation ids withinvalue
, the original is returned unchanged.
-