Class MarketingMessagesEndpoint
java.lang.Object
com.broadleafcommerce.promotion.offer.web.endpoint.MarketingMessagesEndpoint
@FrameworkRestController
@FrameworkMapping
@DataRouteByExample(MarketingMessage.class)
public class MarketingMessagesEndpoint
extends Object
MarketingMessage
is a subresource of Offer
, so most of these endpoints fall under
the same base URL as OffersEndpoint
.- Author:
- Nathan Moore (nathanmoore)., Samarth Dhruva (samarthd)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMarketingMessagesEndpoint
(MarketingMessageService<MarketingMessage> marketingMessageService, OfferService<Offer> offerService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService) -
Method Summary
Modifier and TypeMethodDescriptionprotected Offer
assertOfferExistsAndReturn
(String offerContextId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
assertParentOfferOfMessageIsCorrect
(String expectedParentOfferId, MarketingMessage message) createMessage
(String offerid, MarketingMessage marketingMessage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) void
deleteMessage
(String offerId, String messageId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected MarketingMessageService<MarketingMessage>
protected OfferService<Offer>
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>
org.springframework.data.domain.Page<MarketingMessage>
readAllMessages
(List<String> offerIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) Reads all of the activeMarketingMessages
with options for paging and filtering byOffer.id
.org.springframework.data.domain.Page<MarketingMessage>
readAllMessagesForOffer
(String offerId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) readMessageById
(String offerId, String messageId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) com.broadleafcommerce.translation.service.dto.TranslationsPayload
replaceAllMarketingMessageTranslations
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String offerId, String messageId, Locale locale, com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest) replaceMessage
(String offerId, String messageId, MarketingMessage marketingMessage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) updateMessage
(String offerId, String messageId, MarketingMessage marketingMessage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Field Details
-
BASE_URI
- See Also:
-
-
Constructor Details
-
MarketingMessagesEndpoint
public MarketingMessagesEndpoint(MarketingMessageService<MarketingMessage> marketingMessageService, OfferService<Offer> offerService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService)
-
-
Method Details
-
readAllMessages
@FrameworkGetMapping("/marketing-messages") @Policy(permissionRoots="OFFER") public org.springframework.data.domain.Page<MarketingMessage> readAllMessages(@RequestParam(value="offerIds",required=false) List<String> offerIds, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) Reads all of the activeMarketingMessages
with options for paging and filtering byOffer.id
.- Parameters:
offerIds
- List ofOffer IDs
by which to filtercontextInfo
- context information related to multitenancy. Often used to validate visibility and mutability of persistence operations for a catalog.page
-Pageable
for limiting the result set- Returns:
- All of the active
MarketingMessages
-
readAllMessagesForOffer
@FrameworkGetMapping("/offers/{offerId}/marketing-messages") @Policy(permissionRoots="OFFER") public org.springframework.data.domain.Page<MarketingMessage> readAllMessagesForOffer(@PathVariable("offerId") String offerId, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters) -
readMessageById
@FrameworkGetMapping("/offers/{offerId}/marketing-messages/{id}") @Policy(permissionRoots="OFFER") public MarketingMessage readMessageById(@PathVariable("offerId") String offerId, @PathVariable("id") String messageId, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
createMessage
@FrameworkPostMapping("/offers/{offerId}/marketing-messages") @Policy(permissionRoots="OFFER") public MarketingMessage createMessage(@PathVariable("offerId") String offerid, @RequestBody MarketingMessage marketingMessage, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
updateMessage
@FrameworkPatchMapping("/offers/{offerId}/marketing-messages/{id}") @Policy(permissionRoots="OFFER") public MarketingMessage updateMessage(@PathVariable("offerId") String offerId, @PathVariable("id") String messageId, @RequestBody MarketingMessage marketingMessage, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
replaceMessage
@FrameworkPutMapping("/offers/{offerId}/marketing-messages/{id}") @Policy(permissionRoots="OFFER") public MarketingMessage replaceMessage(@PathVariable("offerId") String offerId, @PathVariable("id") String messageId, @RequestBody MarketingMessage marketingMessage, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
replaceAllMarketingMessageTranslations
@FrameworkPutMapping(value="/offers/{offerId}/marketing-messages/{id}/translations/{locale}", consumes="application/json") @Policy(permissionRoots="OFFER") public com.broadleafcommerce.translation.service.dto.TranslationsPayload replaceAllMarketingMessageTranslations(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("offerId") String offerId, @PathVariable("id") String messageId, @PathVariable("locale") Locale locale, @RequestBody com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest) -
deleteMessage
@FrameworkDeleteMapping("/offers/{offerId}/marketing-messages/{id}") @Policy(permissionRoots="OFFER") public void deleteMessage(@PathVariable("offerId") String offerId, @PathVariable("id") String messageId, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
assertOfferExistsAndReturn
-
assertParentOfferOfMessageIsCorrect
protected void assertParentOfferOfMessageIsCorrect(String expectedParentOfferId, MarketingMessage message) -
getMarketingMessageService
-
getOfferService
-
getTranslationEntityService
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationEntityService()
-