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 forCampaignCode. Backed by aCampaignCodeRepository.- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<P>findAllByGeneratorIdAndAssigned(@NonNull String generatorId, boolean isAssigned, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)List<P>findAllDuplicatesForCodesInCampaign(@NonNull String campaignId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Finds all duplicatesCampaignCodesbyCampaign.getId().default List<P>findAllUnassignedByGeneratorId(@NonNull String generatorId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Finds all the unassignedCampaignCodesbyCampaignCode.getGeneratorId().org.springframework.data.domain.Page<P>findByCampaignId(String campaignId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, Class<P> payload, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)List<P>findExistingByCodesIncludeExpiredForCampaignId(Set<String> codes, String campaignId, Instant endAfterDate, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Search all non-expired campaign codes or expired but belonging to the specified campaignId.List<P>persistCodesAndReturn(CodeGenerator info, Set<String> currentCodeSet, Class<P> payloadType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)intpersistCodesAndReturnNumber(CodeGenerator info, Set<String> currentCodeSet, Class<P> payloadType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Stream<P>readAllByCampaignId(String campaignId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Reads the campaign codes for the specified campaign id matching the given filters.List<P>readAllByCode(String code, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)Finds all of theCampaignCodesbycode.List<com.broadleafcommerce.data.tracking.core.Trackable>saveAll(List<P> businessInstances, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)-
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 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 theCampaignCodesbycode.- Parameters:
code- Code to matchcontext- 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 idfilters- additional filters to apply in the querycontext- 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 ofCampaignCodeand 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 matchcampaignId- the campaign idendAfterDate- Date after which code should be activecontext- Request context information around sandbox and multitenant state- Returns:
- all
CampaignCodesbyCampaignCode.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 duplicatesCampaignCodesbyCampaign.getId(). Typically, this will be used to check for duplicate campaign codes of campaign.- Parameters:
campaignId- the campaign idcontext- Request context information around sandbox and multitenant state- Returns:
- all duplicates
CampaignCodesbyCampaignCode.getId()
-
findAllUnassignedByGeneratorId
default List<P> findAllUnassignedByGeneratorId(@NonNull @NonNull String generatorId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Finds all the unassignedCampaignCodesbyCampaignCode.getGeneratorId().- Parameters:
generatorId- the id of the code generator that these codes were generated fromcontext- Request context information around sandbox and multitenant state- Returns:
- all the unassigned
CampaignCodesbyCampaignCode.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 fromisAssigned- whether the campaign codes are assignedcontext- Request context information around sandbox and multitenant state- Returns:
- all the unassigned
CampaignCodesbyCampaignCode.getGeneratorId()
-
-