public class VendorSandboxPropagationHandler extends Object implements PropagationHandler
PropagationHandler
capable of propagating vendor catalog
(catalogs related to a vendor instance via the vendorRef property) changes into a promotion
sandbox state in an associated application. The intent is for the application administrator(s) to
review incoming changes before accepting and exposing those changes to the application storefront
customers. This is a common use case for marketplace style applications whose product catalog is
curated by a number of independent vendors.Modifier and Type | Field and Description |
---|---|
static int |
PROMOTION_TRACKING_LEVEL |
static int |
SORT_ORDER |
Constructor and Description |
---|
VendorSandboxPropagationHandler(CommonCatalogService<? extends Catalog> catalogService,
CommonApplicationService<? extends Application> applicationService,
DomainMapperManager mapperManager,
CrudEntityHelper helper,
SandboxPropagationProperties propagationProperties,
org.modelmapper.ModelMapper cloneMapper,
List<ChangeTransformer> changeTransformers,
TrackableDomainMapperMemberSupport domainMapperMemberSupport,
WorkflowMapper workflowMapper,
CommonMarketplaceApplicationCatalogRepository<Trackable> applicationCatalogRepository) |
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(Trackable incoming,
String incomingCatalog,
String parentCatalog,
Trackable candidate,
OperationType changeType)
Is this handler capable of handling the propagation process given the contextual information.
|
int |
getOrder() |
protected String |
getUniversalMarketplaceVendorSandboxId(Catalog parentVendorCatalog,
Catalog childMarketplaceCatalog)
For each marketplace application that a vendor contributes to, we should target a single,
consistent "universal" sandbox for that vendor in which to propagate changes.
|
protected String |
getUniversalMarketplaceVendorSandboxName(Catalog parentVendorCatalog,
Catalog childMarketplaceCatalog)
Create a name befitting the "universal" marketplace vendor sandbox described in
getUniversalMarketplaceVendorSandboxId(Catalog, Catalog) . |
Trackable |
handleCreate(Trackable incoming,
String incomingCatalog,
String parentCatalog,
String propagationId,
TrackableRepository<Trackable> repository) |
Trackable |
handleDelete(Trackable incoming,
String incomingCatalog,
String parentCatalog,
String propagationId,
Trackable candidate,
TrackableRepository<Trackable> repository) |
Trackable |
handleUpdate(Trackable incoming,
String incomingCatalog,
String parentCatalog,
String propagationId,
Trackable candidate,
TrackableRepository<Trackable> repository) |
void |
setAuditUtility(BasicAuditUtility auditUtility) |
public static final int PROMOTION_TRACKING_LEVEL
public static final int SORT_ORDER
public VendorSandboxPropagationHandler(CommonCatalogService<? extends Catalog> catalogService, CommonApplicationService<? extends Application> applicationService, DomainMapperManager mapperManager, CrudEntityHelper helper, SandboxPropagationProperties propagationProperties, org.modelmapper.ModelMapper cloneMapper, List<ChangeTransformer> changeTransformers, TrackableDomainMapperMemberSupport domainMapperMemberSupport, WorkflowMapper workflowMapper, CommonMarketplaceApplicationCatalogRepository<Trackable> applicationCatalogRepository)
public boolean canHandle(Trackable incoming, String incomingCatalog, String parentCatalog, @Nullable Trackable candidate, OperationType changeType)
PropagationHandler
canHandle
in interface PropagationHandler
incoming
- The Trackable instance that contains the change information to propagateincomingCatalog
- The current catalog in which the propagation is occuringparentCatalog
- The parent catalog up one levelcandidate
- The candidate, if available, representing a catalog override already
existing in the incomingCatalog.changeType
- The type of change requested. See OperationType
.public Trackable handleDelete(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, @Nullable Trackable candidate, TrackableRepository<Trackable> repository)
handleDelete
in interface PropagationAware
public Trackable handleCreate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, TrackableRepository<Trackable> repository)
handleCreate
in interface PropagationAware
public Trackable handleUpdate(Trackable incoming, String incomingCatalog, String parentCatalog, String propagationId, @Nullable Trackable candidate, TrackableRepository<Trackable> repository)
handleUpdate
in interface PropagationAware
public int getOrder()
getOrder
in interface PropagationHandler
getOrder
in interface org.springframework.core.Ordered
protected String getUniversalMarketplaceVendorSandboxId(Catalog parentVendorCatalog, Catalog childMarketplaceCatalog)
The sandbox service will only create a provided sandbox if it does not already exist by a given ID, so we can rely on it to only ever create the sandbox once if given the same ID.
This means we must produce a predictable, consistent ID for the provided inputs, and thus we cannot simply use a randomly generated value. The default implementation will first build a string with the format "{vendorRef}-{marketplaceApplicationId}", then return the hex string representing its MD5 hash.
parentVendorCatalog
- the parent vendor catalog in which the deployment occurred and
whose changes are being propagatedchildMarketplaceCatalog
- a child catalog of the parent vendor catalog which is in a
marketplace application. This is the catalog to which changes are being propagated.getUniversalMarketplaceVendorSandboxName(Catalog, Catalog)
protected String getUniversalMarketplaceVendorSandboxName(Catalog parentVendorCatalog, Catalog childMarketplaceCatalog)
getUniversalMarketplaceVendorSandboxId(Catalog, Catalog)
.
The default implementation will return a string of the format "{vendorRef}-{marketplaceApplicationName}", truncated to a reasonable length if necessary.
parentVendorCatalog
- the parent vendor catalog in which the deployment occurred and
whose changes are being propagatedchildMarketplaceCatalog
- a child catalog of the parent vendor catalog which is in a
marketplace application. This is the catalog to which changes are being propagated.getUniversalMarketplaceVendorSandboxId(Catalog, Catalog)
@Autowired public void setAuditUtility(@Nullable BasicAuditUtility auditUtility)
Copyright © 2021. All rights reserved.