Class CampaignEndpoint

java.lang.Object
com.broadleafcommerce.promotion.offer.web.endpoint.CampaignEndpoint

@FrameworkRestController @FrameworkMapping("/campaigns") @DataRouteByExample(Campaign.class) public class CampaignEndpoint extends Object
  • Field Details

  • Constructor Details

  • 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

      @FrameworkGetMapping("/{id}") @Policy(permissionRoots="CAMPAIGN") public Campaign readCampaignById(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String campaignId)
    • 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

      @FrameworkPostMapping(consumes="application/json") @Policy(permissionRoots="CAMPAIGN") public Campaign createCampaign(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestBody Campaign req)
    • 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)
      Generate OfferCodes based on the given VoucherCodeGenerationRequest.

      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 request
      context - context info for multitenant and sandbox conditions
      voucherCodeGenerationReq - the VoucherCodeGenerationRequest to generate the campaign codes off of
      Returns:
      a CodeGenerationResult containing generated OfferCodes and errors based on the given VoucherCodeGenerationRequest
    • 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

      protected void validateOfferCodeForCampaign(@NonNull @NonNull String campaignId, @NonNull @NonNull String codeId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • ensureCampaignExistsAndReturn

      protected Campaign ensureCampaignExistsAndReturn(@NonNull @NonNull String campaignId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)