Interface CampaignCodeService<P extends CampaignCode>

  • All Superinterfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    All Known Implementing Classes:
    DefaultCampaignCodeService

    public interface CampaignCodeService<P extends CampaignCode>
    extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
    Base service API for CampaignCode. Backed by a CampaignCodeRepository.
    Author:
    Chad Harchar (charchar)
    • Method Detail

      • findByCampaignId

        @NonNull
        org.springframework.data.domain.Page<P> findByCampaignId​(@NonNull
                                                                 String campaignId,
                                                                 @Nullable
                                                                 cz.jirutka.rsql.parser.ast.Node filters,
                                                                 @Nullable
                                                                 org.springframework.data.domain.Pageable page,
                                                                 @NonNull
                                                                 Class<P> payload,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      • readAllByCode

        @NonNull
        List<P> readAllByCode​(@NonNull
                              String code,
                              @Nullable
                              com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Finds all of the CampaignCodes by code.
        Parameters:
        code - Code to match
        context - Additional sandbox and multitenant state data
        Returns:
        all of the @link CampaignCode CampaignCodes} by code
      • saveAll

        List<com.broadleafcommerce.data.tracking.core.Trackable> saveAll​(List<P> businessInstances,
                                                                         com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      • persistCodesAndReturnNumber

        int persistCodesAndReturnNumber​(CodeGenerator info,
                                        Set<String> currentCodeSet,
                                        Class<P> payloadType,
                                        com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • persistCodesAndReturn

        List<P> persistCodesAndReturn​(CodeGenerator info,
                                      Set<String> currentCodeSet,
                                      Class<P> payloadType,
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      • readAllByCampaignId

        Stream<P> readAllByCampaignId​(String campaignId,
                                      @Nullable
                                      cz.jirutka.rsql.parser.ast.Node filters,
                                      @Nullable
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Reads the campaign codes for the specified campaign id matching the given filters.
        Parameters:
        campaignId - the campaign id
        filters - additional filters to apply in the query
        context - Request context information around sandbox and multitenant state
        Returns:
        the campaign codes for the specified campaign id matching the given filters
      • findExistingByCodesIncludeExpiredForCampaignId

        List<P> findExistingByCodesIncludeExpiredForCampaignId​(Set<String> codes,
                                                               String campaignId,
                                                               Instant endAfterDate,
                                                               @Nullable
                                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Search all non-expired campaign codes or expired but belonging to the specified campaignId. This is useful to validate that the campaign codes can be added or updated. NOTE: This method is used during import of CampaignCode and because different DBs has a different limitation on how many entries can be in "in" statement please make sure that the property "broadleaf.dataimport.processor.batch-size" not exited this limitation.
        Parameters:
        codes - The set of codes to match
        campaignId - the campaign id
        endAfterDate - Date after which code should be active
        context - Request context information around sandbox and multitenant state
        Returns:
        all CampaignCodes by CampaignCode.getCode() that are also active or belonging to the specified campaignId
        See Also:
        CampaignCodeImportBatchHandler
      • findAllDuplicatesForCodesInCampaign

        List<P> findAllDuplicatesForCodesInCampaign​(@NonNull
                                                    @NonNull String campaignId,
                                                    @Nullable
                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Finds all duplicates CampaignCodes by Campaign.getId(). Typically, this will be used to check for duplicate campaign codes of campaign.
        Parameters:
        campaignId - the campaign id
        context - Request context information around sandbox and multitenant state
        Returns:
        all duplicates CampaignCodes by CampaignCode.getId()
      • findAllUnassignedByGeneratorId

        default List<P> findAllUnassignedByGeneratorId​(@NonNull
                                                       @NonNull String generatorId,
                                                       @Nullable
                                                       com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Finds all the unassigned CampaignCodes by CampaignCode.getGeneratorId().
        Parameters:
        generatorId - the id of the code generator that these codes were generated from
        context - Request context information around sandbox and multitenant state
        Returns:
        all the unassigned CampaignCodes by CampaignCode.getGeneratorId()
      • findAllByGeneratorIdAndAssigned

        List<P> findAllByGeneratorIdAndAssigned​(@NonNull
                                                @NonNull String generatorId,
                                                boolean isAssigned,
                                                @Nullable
                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Parameters:
        generatorId - the id of the code generator that these codes were generated from
        isAssigned - whether the campaign codes are assigned
        context - Request context information around sandbox and multitenant state
        Returns:
        all the unassigned CampaignCodes by CampaignCode.getGeneratorId()