Class DefaultAugmentationProvider
java.lang.Object
com.broadleafcommerce.metadata.core.service.DefaultAugmentationProvider
- All Implemented Interfaces:
AugmentationProvider
The primary provider for fetching and applying `Augmentation` domain on top of view container
metadata. This provider handles augmentation by applying the `Augmentation` in order of creation
and according to their `AugmentationChangeType` enum.
- Author:
- Nick Crum (ncrum)
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAugmentationProvider
(AugmentationService<Augmentation> augmentationService, List<AugmentationProcessor> augmentationProcessors, com.fasterxml.jackson.databind.ObjectMapper mapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyQueryBuilderAugmentations
(com.broadleafcommerce.metadata.dsl.core.Component<?> container, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Recursively applies augmentations to a container'sComponent.getComponents()
.augment
(com.broadleafcommerce.metadata.dsl.core.Component<?> container, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Augments the provided `ViewComponent` with additional properties.protected com.broadleafcommerce.metadata.dsl.core.Component<?>
augment
(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation) Augments the given component according to the given augmentation.protected boolean
augmentationApplied
(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation) protected void
augmentChildActions
(Map<String, com.broadleafcommerce.metadata.dsl.core.Action<?>> actions, Augmentation augmentation) protected void
augmentChildComponents
(Map<String, com.broadleafcommerce.metadata.dsl.core.Component<?>> components, Augmentation augmentation) protected com.broadleafcommerce.metadata.dsl.core.Field<?>
buildQueryBuilderField
(com.broadleafcommerce.metadata.dsl.core.extension.BuilderFieldSource<?> component, Augmentation augmentation, FieldAugmentationPayload payload) protected List<Augmentation>
getAugmentations
(String containerKey, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected FieldAugmentationPayload
getFieldAugmentationPayload
(Augmentation augmentation) protected List<Augmentation>
getQueryBuilderAugmentations
(String containerKey, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
processQueryBuilderAugmentation
(com.broadleafcommerce.metadata.dsl.core.Component<?> component, com.broadleafcommerce.metadata.dsl.core.extension.BuilderFieldSource<?> fieldSource, Augmentation augmentation) protected void
removeQueryBuilderField
(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation)
-
Field Details
-
TARGET_KEY_REGEX
- See Also:
-
-
Constructor Details
-
DefaultAugmentationProvider
public DefaultAugmentationProvider(AugmentationService<Augmentation> augmentationService, List<AugmentationProcessor> augmentationProcessors, com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Details
-
augment
public AugmentedContainer augment(com.broadleafcommerce.metadata.dsl.core.Component<?> container, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:AugmentationProvider
Augments the provided `ViewComponent` with additional properties.- Specified by:
augment
in interfaceAugmentationProvider
- Parameters:
container
- the view container component- Returns:
- the mutated `ViewComponent`
-
applyQueryBuilderAugmentations
protected void applyQueryBuilderAugmentations(com.broadleafcommerce.metadata.dsl.core.Component<?> container, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Recursively applies augmentations to a container'sComponent.getComponents()
. This only supports field components of typeFieldTypes.RULE_BUILDER
and notFieldTypes.QUERY_BUILDER
.- Parameters:
container
- The container componentcontextInfo
- Additional sandbox and multitenant info
-
getAugmentations
@NonNull protected List<Augmentation> getAugmentations(String containerKey, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getQueryBuilderAugmentations
@NonNull protected List<Augmentation> getQueryBuilderAugmentations(String containerKey, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
processQueryBuilderAugmentation
protected void processQueryBuilderAugmentation(com.broadleafcommerce.metadata.dsl.core.Component<?> component, com.broadleafcommerce.metadata.dsl.core.extension.BuilderFieldSource<?> fieldSource, Augmentation augmentation) -
removeQueryBuilderField
protected void removeQueryBuilderField(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation) -
buildQueryBuilderField
@NonNull protected com.broadleafcommerce.metadata.dsl.core.Field<?> buildQueryBuilderField(com.broadleafcommerce.metadata.dsl.core.extension.BuilderFieldSource<?> component, Augmentation augmentation, FieldAugmentationPayload payload) -
getFieldAugmentationPayload
-
augmentationApplied
protected boolean augmentationApplied(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation) -
augment
@Nullable protected com.broadleafcommerce.metadata.dsl.core.Component<?> augment(com.broadleafcommerce.metadata.dsl.core.Component<?> component, Augmentation augmentation) Augments the given component according to the given augmentation. This returns a new instance representing the augmented component, the original component passed in is unchanged- Parameters:
component
- the component to augmentaugmentation
- the definition of the changes to apply to the component- Returns:
- a new component representing how this component was changed. null for
AugmentationChangeType.REMOVE
-
augmentChildComponents
protected void augmentChildComponents(Map<String, com.broadleafcommerce.metadata.dsl.core.Component<?>> components, Augmentation augmentation) -
augmentChildActions
protected void augmentChildActions(Map<String, com.broadleafcommerce.metadata.dsl.core.Action<?>> actions, Augmentation augmentation)
-