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
ConstructorsConstructorDescriptionDefaultMarketplaceApplicationCatalogService(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.voidPerform a delete operation on the entity identified by the context id.protected CatalogService<Catalog>protected MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable>voidhydrate(@NonNull Collection<P> applicationCatalogs, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates fields on each of the givenapplicationCatalogsinstances such asMarketplaceApplicationCatalog.getHydratedCatalog().hydrate(P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Hydrates fields on the givenapplicationCataloginstance 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 voidvalidateApplicationCatalogForCreate(String applicationId, MarketplaceApplicationCatalog applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to create aMarketplaceApplicationCataloginstance based on the context of the current application and the type of catalog requested.protected voidvalidateApplicationCatalogForDelete(String applicationId, String applicationCatalogId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to delete aMarketplaceApplicationCataloginstance based on the context of the current application.protected voidvalidateApplicationCatalogForReplace(String applicationId, String id, MarketplaceApplicationCatalog replacement, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates a request to update aMarketplaceApplicationCataloginstance.
-
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:MarketplaceApplicationCatalogServiceFind all the marketplace to catalog associations.- Specified by:
readAllin 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
MarketplaceApplicationCataloginstances that were found
-
read
public P read(String id, @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogServiceFind the marketplace catalog by id- Specified by:
readin interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>- Parameters:
id- The contextId for theMarketplaceApplicationCatalogcontextInfo- 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
MarketplaceApplicationCataloginstance
-
create
public P create(P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogServiceCreate an instance of an entity based on a business instance containing relevant property values.- Specified by:
createin 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:MarketplaceApplicationCatalogServiceUpdate a single, narrowed instance of an entity based on a business instance containing relevant property values. SeeTrackableRepositoryfor more information on entity persistence behavior in light of sandboxing and multitenant concerns.- Specified by:
updatein 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
EntityMissingExceptionif not available.
-
replace
public P replace(String id, P applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogServiceReplace a single, narrowed instance of an entity based on a business instance containing relevant property values.- Specified by:
replacein 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
EntityMissingExceptionif not available.
-
hydrate
public P hydrate(@NonNull P applicationCatalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:MarketplaceApplicationCatalogServiceHydrates fields on the givenapplicationCataloginstance such asMarketplaceApplicationCatalog.getHydratedCatalog().If referenced entities cannot be found, the hydrated fields will remain null.
- Specified by:
hydratein interfaceMarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>- Parameters:
applicationCatalog- the instance whose hydrated fields should be setcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- the given
applicationCataloginstance 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:MarketplaceApplicationCatalogServiceHydrates fields on each of the givenapplicationCatalogsinstances such asMarketplaceApplicationCatalog.getHydratedCatalog().If referenced entities cannot be found, the hydrated fields will remain null.
- Specified by:
hydratein 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:MarketplaceApplicationCatalogServicePerform 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:
deletein 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:MarketplaceApplicationCatalogServiceFind all the marketplace to catalog associations for a specific catalog.This method does not perform any application-discrimination.
- Specified by:
readByCatalogin 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:MarketplaceApplicationCatalogServiceFind all the marketplace to catalog associations for a specific vendor.This method does not perform any application-discrimination.
- Specified by:
readByVendorRefin 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:MarketplaceApplicationCatalogServiceFind the association between a specific catalog and application.This method does not perform any application-discrimination.
- Specified by:
readByCatalogAndApplicationin 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
Optionalcontaining 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 aMarketplaceApplicationCataloginstance 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 aMarketplaceApplicationCataloginstance 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 aMarketplaceApplicationCataloginstance.- 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
-