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>
  • 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 interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      filters - additional filters to apply in the query, can be null
      page - the requested page of results from the database
      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:
      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 interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      id - The contextId for the MarketplaceApplicationCatalog
      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 interface MarketplaceApplicationCatalogService<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. See TrackableRepository for more information on entity persistence behavior in light of sandboxing and multitenant concerns.
      Specified by:
      update in interface MarketplaceApplicationCatalogService<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 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 interface MarketplaceApplicationCatalogService<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 given applicationCatalog instance such as MarketplaceApplicationCatalog.getHydratedCatalog().

      If referenced entities cannot be found, the hydrated fields will remain null.

      Specified by:
      hydrate in interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      applicationCatalog - the instance whose hydrated fields should be set
      contextInfo - 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 given applicationCatalogs instances such as MarketplaceApplicationCatalog.getHydratedCatalog().

      If referenced entities cannot be found, the hydrated fields will remain null.

      Specified by:
      hydrate in interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      applicationCatalogs - the instances whose hydrated fields should be set. Can be empty, but can never be null.
      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 through DomainMapper.deleteMap(Object, ContextInfo).
      Specified by:
      delete in interface MarketplaceApplicationCatalogService<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 interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      catalog - The vendor catalog to check
      contextInfo - 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 interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      vendorRef - the vendor ref to find marketplace-catalog associations for
      contextInfo - 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 interface MarketplaceApplicationCatalogService<P extends MarketplaceApplicationCatalog>
      Parameters:
      catalog - the ID of the catalog to find the association for. Matches MarketplaceApplicationCatalog.getCatalog()
      application - the ID of the application to find the association for. Matches MarketplaceApplicationCatalog.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 a MarketplaceApplicationCatalog instance based on the context of the current application and the type of catalog requested.
      Parameters:
      applicationId - The contextual application
      applicationCatalog - The application catalog to validate
      contextInfo - The current request context information
      Throws:
      com.broadleafcommerce.common.error.validation.ValidationException - if there was an error with the given applicationCatalog
    • validateApplicationCatalogForDelete

      protected void validateApplicationCatalogForDelete(@Nullable String applicationId, String applicationCatalogId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Validates a request to delete a MarketplaceApplicationCatalog instance based on the context of the current application.
      Parameters:
      applicationId - The contextual application
      applicationCatalogId - The application catalog to validate
      contextInfo - 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 a MarketplaceApplicationCatalog instance.
      Parameters:
      applicationId - The contextual application
      id - The id of the item to update
      replacement - The requested update
      contextInfo - The current request context information
      Throws:
      com.broadleafcommerce.common.error.validation.ValidationException - if there was an error with the given applicationCatalog
    • getRepository

      @NonNull protected MarketplaceApplicationCatalogRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
    • getCatalogService

      @NonNull protected CatalogService<Catalog> getCatalogService()