Interface CustomizedCampaignCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>

  • Type Parameters:
    D - The type of the persistent version of CampaignCode for a specific data store implementation
    All Known Subinterfaces:
    CampaignCodeRepository<D>, JpaCampaignCodeRepository<D>
    All Known Implementing Classes:
    JpaCustomizedCampaignCodeRepository

    public interface CustomizedCampaignCodeRepository<D extends com.broadleafcommerce.data.tracking.core.Trackable>
    Provides advanced functionality for CampaignCodes that require manually implemented queries rather than through Spring Data.
    Author:
    Nathan Moore (nathandmoore)
    • Method Detail

      • findByContextId

        @Policy(operationTypes=READ)
        Optional<D> findByContextId​(String contextId,
                                    @Nullable
                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Finds a code by ID.
        Parameters:
        contextId - The ID to match
        contextInfo - Request context information around sandbox and multitenant state
        Returns:
        The code by ID, or Optional.empty() if none.
      • findAllDuplicatesForCodesInCampaign

        @Policy(operationTypes=READ)
        List<D> 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()
      • findExistingByCodesIncludeExpiredForCampaignId

        @Policy(operationTypes=READ)
        List<D> findExistingByCodesIncludeExpiredForCampaignId​(Set<String> codes,
                                                               String campaignId,
                                                               @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
        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
      • readAllByCampaignId

        @Policy(operationTypes=READ)
        Stream<D> 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