Class CampaignEndpoint
java.lang.Object
com.broadleafcommerce.promotion.offer.web.endpoint.CampaignEndpoint
@FrameworkRestController
@FrameworkMapping("/campaigns")
@DataRouteByExample(Campaign.class)
public class CampaignEndpoint
extends Object
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected final CodeGenerationService
protected final CodeGeneratorService<CodeGenerator>
protected final OfferCodeService<OfferCode>
protected final CampaignService<Campaign>
-
Constructor Summary
ConstructorDescriptionCampaignEndpoint
(CampaignService<Campaign> service, OfferCodeService<OfferCode> offerCodeService, CodeGeneratorService<CodeGenerator> generatorService, CodeGenerationService generationService) -
Method Summary
Modifier and TypeMethodDescriptioncreateCampaign
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, Campaign req) createOfferCode
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, OfferCode req) void
deleteCampaign
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id) void
deleteCampaignCode
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, String codeId) protected Campaign
ensureCampaignExistsAndReturn
(@NonNull String campaignId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) generateCodes
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, CodeGenerator req) generateCodesForVouchers
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, VoucherCodeGenerationRequest voucherCodeGenerationReq) GenerateOfferCodes
based on the givenVoucherCodeGenerationRequest
.org.springframework.data.domain.Page<CodeGenerator>
generateCodesStatus
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, org.springframework.data.domain.Pageable page) generateCodeStatus
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, String generatorId) org.springframework.data.domain.Page<Campaign>
readAllCampaigns
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String query, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) readCampaignById
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String campaignId) readOfferCodeById
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, String codeId) org.springframework.data.domain.Page<OfferCode>
readOfferCodesByCampaign
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) replaceCampaign
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, Campaign req) replaceOfferCode
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, String codeId, OfferCode req) updateCampaign
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, Campaign req) updateOfferCode
(jakarta.servlet.http.HttpServletRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String id, String codeId, OfferCode req) protected void
validateOfferCodeForCampaign
(@NonNull String campaignId, @NonNull String codeId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
-
Field Details
-
BASE_URI
- See Also:
-
service
-
offerCodeService
-
generatorService
-
generationService
-
-
Constructor Details
-
CampaignEndpoint
public CampaignEndpoint(CampaignService<Campaign> service, OfferCodeService<OfferCode> offerCodeService, CodeGeneratorService<CodeGenerator> generatorService, CodeGenerationService generationService)
-
-
Method Details
-
readAllCampaigns
@FrameworkGetMapping @Policy(permissionRoots="CAMPAIGN") public org.springframework.data.domain.Page<Campaign> readAllCampaigns(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestParam(value="q",required=false) String query, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) -
readCampaignById
-
updateCampaign
@FrameworkPatchMapping(value="/{id}", consumes="application/json") @Policy(permissionRoots="CAMPAIGN") public Campaign updateCampaign(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody Campaign req) -
replaceCampaign
@FrameworkPutMapping(value="/{id}", consumes="application/json") @Policy(permissionRoots="CAMPAIGN") public Campaign replaceCampaign(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody Campaign req) -
createCampaign
-
deleteCampaign
@FrameworkDeleteMapping("/{id}") @Policy(permissionRoots="CAMPAIGN") public void deleteCampaign(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id) -
readOfferCodeById
@FrameworkGetMapping("/{id}/campaign-codes/{codeId}") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public OfferCode readOfferCodeById(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("codeId") String codeId) -
readOfferCodesByCampaign
@FrameworkGetMapping("/{id}/campaign-codes") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public org.springframework.data.domain.Page<OfferCode> readOfferCodesByCampaign(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) -
updateOfferCode
@FrameworkPatchMapping(value="/{id}/campaign-codes/{codeId}", consumes="application/json") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public OfferCode updateOfferCode(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("codeId") String codeId, @RequestBody OfferCode req) -
replaceOfferCode
@FrameworkPutMapping(value="/{id}/campaign-codes/{codeId}", consumes="application/json") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public OfferCode replaceOfferCode(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("codeId") String codeId, @RequestBody OfferCode req) -
createOfferCode
@FrameworkPostMapping(value="/{id}/campaign-codes", consumes="application/json") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public OfferCode createOfferCode(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody OfferCode req) -
deleteCampaignCode
@FrameworkDeleteMapping("/{id}/campaign-codes/{codeId}") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public void deleteCampaignCode(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("codeId") String codeId) -
generateCodes
@FrameworkPostMapping(value="/{id}/generate-codes", consumes="application/json") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public CodeGenerator generateCodes(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody CodeGenerator req) -
generateCodesForVouchers
@FrameworkPostMapping(value="/generate-voucher-codes", consumes="application/json") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public CodeGenerationResult generateCodesForVouchers(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestBody VoucherCodeGenerationRequest voucherCodeGenerationReq) GenerateOfferCodes
based on the givenVoucherCodeGenerationRequest
.This endpoint will generate and return
OfferCodes
in the same request, therefore this is only meant for small batches of code generations.- Parameters:
request
-HttpServletRequest
for the requestcontext
- context info for multitenant and sandbox conditionsvoucherCodeGenerationReq
- theVoucherCodeGenerationRequest
to generate the campaign codes off of- Returns:
- a
CodeGenerationResult
containing generatedOfferCodes
and errors based on the givenVoucherCodeGenerationRequest
-
generateCodesStatus
@FrameworkGetMapping("/{id}/generate-code-status") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public org.springframework.data.domain.Page<CodeGenerator> generateCodesStatus(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PageableDefault(size=50) org.springframework.data.domain.Pageable page) -
generateCodeStatus
@FrameworkGetMapping("/{id}/generate-code-status/{generatorId}") @Policy(permissionRoots={"CAMPAIGN","CAMPAIGN_CODE"}) public CodeGenerator generateCodeStatus(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("generatorId") String generatorId) -
validateOfferCodeForCampaign
-
ensureCampaignExistsAndReturn
-