Interface CodeGeneratorService<P extends CodeGenerator>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
All Known Implementing Classes:
DefaultCodeGeneratorService

public interface CodeGeneratorService<P extends CodeGenerator> extends com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
Base service API for com.broadleafcommerce.promotion.campaign.domain.CodeGenerator. Backed by a com.broadleafcommerce.promotion.campaign.repository.CodeGeneratorRepository.
Author:
Chad Harchar (charchar)
  • Method Summary

    Modifier and Type
    Method
    Description
    createWithoutPersistenceNotification(P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Creates a CodeGenerator without the persistence notification.
    org.springframework.data.domain.Page<P>
    findByCampaignId(String campaignId, org.springframework.data.domain.Pageable page, Class<P> payload, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    readByCampaignIdAndVoucherCodeGenerator(String campaignId, boolean isVoucherCodeGenerator, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Finds an active CodeGenerator that is for the given campaign id and is for voucher offers.
    updateQuietly(String id, P updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    An alternative to CrudEntityHelper.update(String, Object, ContextInfo, TrackableRepository) that does not call CrudEntityHelper.notify(Trackable, ContextInfo, NotificationStateRepository).

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
  • Method Details

    • findByCampaignId

      @NonNull org.springframework.data.domain.Page<P> findByCampaignId(@NonNull String campaignId, @Nullable org.springframework.data.domain.Pageable page, @NonNull Class<P> payload, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • readByCampaignIdAndVoucherCodeGenerator

      Optional<P> readByCampaignIdAndVoucherCodeGenerator(String campaignId, boolean isVoucherCodeGenerator, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds an active CodeGenerator that is for the given campaign id and is for voucher offers.
      Parameters:
      campaignId - the campaign id that the code generator is for
      isVoucherCodeGenerator - whether this code generator is for voucher offers
      context - context information surrounding sandboxing and multi tenant state
      Returns:
      an active code generator that is for the given campaign id and is for voucher offers
    • updateQuietly

      P updateQuietly(@NonNull String id, @NonNull P updateRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      An alternative to CrudEntityHelper.update(String, Object, ContextInfo, TrackableRepository) that does not call CrudEntityHelper.notify(Trackable, ContextInfo, NotificationStateRepository).
      Parameters:
      id - the context id of the CodeGenerator to update
      updateRequest - the CodeGenerator instance containing the new values to patch onto the existing instance
      context - context surrounding sandboxing and multitenant state
      Returns:
      the fully updated instance
      Throws:
      com.broadleafcommerce.common.error.validation.ValidationException - if the updated instance failed validation
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if a managed instance corresponding to the given id could not be found
    • createWithoutPersistenceNotification

      P createWithoutPersistenceNotification(P businessInstance, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Creates a CodeGenerator without the persistence notification. This is used when you want to manually generate the CampaignCodes instead of going through the CodeGenerationPersistenceHandler.
      Parameters:
      businessInstance - the instance of CodeGenerator
      context - context surrounding sandboxing and multitenant state
      Returns:
      the created instance of CodeGenerator