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 forCodeGenerator
. Backed by aCodeGeneratorRepository
.- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description P
createWithoutPersistenceNotification(P businessInstance, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Creates aCodeGenerator
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)
Optional<P>
readByCampaignIdAndVoucherCodeGenerator(String campaignId, boolean isVoucherCodeGenerator, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Finds an activeCodeGenerator
that is for the given campaign id and is for voucher offers.P
updateQuietly(String id, P updateRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
An alternative toCrudEntityHelper.update(String, Object, ContextInfo, TrackableRepository)
that does not callCrudEntityHelper.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 Detail
-
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 activeCodeGenerator
that is for the given campaign id and is for voucher offers.- Parameters:
campaignId
- the campaign id that the code generator is forisVoucherCodeGenerator
- whether this code generator is for voucher offerscontext
- 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 toCrudEntityHelper.update(String, Object, ContextInfo, TrackableRepository)
that does not callCrudEntityHelper.notify(Trackable, ContextInfo, NotificationStateRepository)
.- Parameters:
id
- the context id of theCodeGenerator
to updateupdateRequest
- theCodeGenerator
instance containing the new values to patch onto the existing instancecontext
- context surrounding sandboxing and multitenant state- Returns:
- the fully updated instance
- Throws:
com.broadleafcommerce.common.error.validation.ValidationException
- if the updated instance failed validationcom.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 aCodeGenerator
without the persistence notification. This is used when you want to manually generate theCampaignCodes
instead of going through theCodeGenerationPersistenceHandler
.- Parameters:
businessInstance
- the instance ofCodeGenerator
context
- context surrounding sandboxing and multitenant state- Returns:
- the created instance of
CodeGenerator
-
-