Class DefaultMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
java.lang.Object
com.broadleafcommerce.tenant.service.DefaultMarketplaceApplicationCatalogService<P>
- Type Parameters:
P
- The projection type
- All Implemented Interfaces:
MarketplaceApplicationCatalogService<P>
public class DefaultMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
extends Object
implements MarketplaceApplicationCatalogService<P>
Default version of
MarketplaceApplicationCatalogService
-
Constructor Summary
ConstructorDescriptionDefaultMarketplaceApplicationCatalogService
(MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper rsqlHelper, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, MarketplaceApplicationCatalogValidator validator, CatalogService<Catalog> catalogService) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Create an instance of an entity based on a business instance containing relevant property values.void
Perform a delete operation on the entity identified by the context id.protected CatalogService<Catalog>
protected MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable>
void
hydrate
(@NonNull Collection<P> applicationCatalogs, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates fields on each of the givenapplicationCatalogs
instances such asMarketplaceApplicationCatalog.getHydratedCatalog()
.hydrate
(P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates fields on the givenapplicationCatalog
instance such asMarketplaceApplicationCatalog.getHydratedCatalog()
.Find the marketplace catalog by idorg.springframework.data.domain.Page<P>
readAll
(cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all the marketplace to catalog associations.readByCatalog
(String catalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all the marketplace to catalog associations for a specific catalog.readByCatalogAndApplication
(String catalog, String application, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find the association between a specific catalog and application.readByVendorRef
(String vendorRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Find all the marketplace to catalog associations for a specific vendor.replace
(String id, P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Replace a single, narrowed instance of an entity based on a business instance containing relevant property values.update
(String id, P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Update a single, narrowed instance of an entity based on a business instance containing relevant property values.protected void
validateApplicationCatalogForCreate
(String applicationId, MarketplaceApplicationCatalog applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to create aMarketplaceApplicationCatalog
instance based on the context of the current application and the type of catalog requested.protected void
validateApplicationCatalogForDelete
(String applicationId, String applicationCatalogId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to delete aMarketplaceApplicationCatalog
instance based on the context of the current application.protected void
validateApplicationCatalogForReplace
(String applicationId, String id, MarketplaceApplicationCatalog replacement, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to update aMarketplaceApplicationCatalog
instance.
-
Constructor Details
-
DefaultMarketplaceApplicationCatalogService
public DefaultMarketplaceApplicationCatalogService(MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> filterParser, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper rsqlHelper, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, MarketplaceApplicationCatalogValidator validator, CatalogService<Catalog> catalogService)
-
-
Method Details
-
readAll
public org.springframework.data.domain.Page<P> readAll(@Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Find all the marketplace to catalog associations.- Specified by:
readAll
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
filters
- additional filters to apply in the query, can be nullpage
- the requested page of results from the databasecontextInfo
- context information surrounding the sandboxing and multitenant state. If this is an application context, results will only include entities associated to that application.- Returns:
- all of the
MarketplaceApplicationCatalog
instances that were found
-
read
public P read(String id, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Find the marketplace catalog by id- Specified by:
read
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
id
- The contextId for theMarketplaceApplicationCatalog
contextInfo
- context information surrounding the sandboxing and multitenant state. If this is an application context, results will only include entities associated to that application.- Returns:
- The
MarketplaceApplicationCatalog
instance
-
create
public P create(P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Create an instance of an entity based on a business instance containing relevant property values.- Specified by:
create
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
applicationCatalog
- The business domain instance.contextInfo
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The new entity instance in the form of a business type instance.
-
update
public P update(String id, P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Update a single, narrowed instance of an entity based on a business instance containing relevant property values. SeeTrackableRepository
for more information on entity persistence behavior in light of sandboxing and multitenant concerns.- Specified by:
update
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.applicationCatalog
- The payload type that domain class should be converted tocontextInfo
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The updated, narrowed entity instance in the form of a payload instance, or
EntityMissingException
if not available.
-
replace
public P replace(String id, P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Replace a single, narrowed instance of an entity based on a business instance containing relevant property values.- Specified by:
replace
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.applicationCatalog
- The payload type that domain class should be converted to.contextInfo
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.- Returns:
- The replaced, narrowed entity instance in the form of a payload instance, or
EntityMissingException
if not available.
-
hydrate
public P hydrate(@NonNull P applicationCatalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Hydrates fields on the givenapplicationCatalog
instance such asMarketplaceApplicationCatalog.getHydratedCatalog()
.If referenced entities cannot be found, the hydrated fields will remain null.
- Specified by:
hydrate
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
applicationCatalog
- the instance whose hydrated fields should be setcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the given
applicationCatalog
instance after hydrating fields
-
hydrate
public void hydrate(@NonNull @NonNull Collection<P> applicationCatalogs, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Hydrates fields on each of the givenapplicationCatalogs
instances such asMarketplaceApplicationCatalog.getHydratedCatalog()
.If referenced entities cannot be found, the hydrated fields will remain null.
- Specified by:
hydrate
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
applicationCatalogs
- the instances whose hydrated fields should be set. Can be empty, but can never benull
.contextInfo
- context information surrounding sandboxing and multitenant state
-
delete
public void delete(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Perform a delete operation on the entity identified by the context id. This could result in an archival, or a raw delete, depending on the result of processing throughDomainMapper.deleteMap(Object, ContextInfo)
.- Specified by:
delete
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
id
- The context id for the entity. This is the id by which the business recognizes the item.contextInfo
- Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.
-
readByCatalog
@NonNull public List<P> readByCatalog(String catalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Find all the marketplace to catalog associations for a specific catalog.This method does not perform any application-discrimination.
- Specified by:
readByCatalog
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
catalog
- The vendor catalog to checkcontextInfo
- context information surrounding the sandboxing and multitenant state- Returns:
- The marketplace to catalog associations
-
readByVendorRef
@NonNull public List<P> readByVendorRef(String vendorRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Find all the marketplace to catalog associations for a specific vendor.This method does not perform any application-discrimination.
- Specified by:
readByVendorRef
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
vendorRef
- the vendor ref to find marketplace-catalog associations forcontextInfo
- context information around multitenant state- Returns:
- the marketplace-catalog associations
-
readByCatalogAndApplication
public Optional<P> readByCatalogAndApplication(String catalog, String application, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogService
Find the association between a specific catalog and application.This method does not perform any application-discrimination.
- Specified by:
readByCatalogAndApplication
in interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
- Parameters:
catalog
- the ID of the catalog to find the association for. MatchesMarketplaceApplicationCatalog.getCatalog()
application
- the ID of the application to find the association for. MatchesMarketplaceApplicationCatalog.getApplication()
contextInfo
- context information around sandboxing and multitenant state- Returns:
- an
Optional
containing the relationship if found,Optional.empty()
otherwise
-
validateApplicationCatalogForCreate
protected void validateApplicationCatalogForCreate(@Nullable String applicationId, MarketplaceApplicationCatalog applicationCatalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to create aMarketplaceApplicationCatalog
instance based on the context of the current application and the type of catalog requested.- Parameters:
applicationId
- The contextual applicationapplicationCatalog
- The application catalog to validatecontextInfo
- The current request context information- Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if there was an error with the givenapplicationCatalog
-
validateApplicationCatalogForDelete
protected void validateApplicationCatalogForDelete(@Nullable String applicationId, String applicationCatalogId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to delete aMarketplaceApplicationCatalog
instance based on the context of the current application.- Parameters:
applicationId
- The contextual applicationapplicationCatalogId
- The application catalog to validatecontextInfo
- The current request context information
-
validateApplicationCatalogForReplace
protected void validateApplicationCatalogForReplace(@Nullable String applicationId, String id, MarketplaceApplicationCatalog replacement, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to update aMarketplaceApplicationCatalog
instance.- Parameters:
applicationId
- The contextual applicationid
- The id of the item to updatereplacement
- The requested updatecontextInfo
- The current request context information- Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if there was an error with the givenapplicationCatalog
-
getRepository
@NonNull protected MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository() -
getCatalogService
-