Class OfferHelper
java.lang.Object
com.day.cq.analytics.testandtarget.util.OfferHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMbox location property namestatic final StringAccount-Reference property namestatic final StringThird-Party property namestatic final StringCampaign resource typestatic final StringExperience resource typestatic final StringOffer proxy resource typestatic final StringOffer resource type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PagegetCampaign(Page page) Returns a page with resource type 'cq/personalization/components/campaignpage' ornull.static StringgetCampaignName(String path) Returns a campaign name based on a repository path, following the same rules asgetOfferName(String)static longgetOfferId(Page offerPage) Returns the offer id from Targetstatic longgetOfferId(Page offerPage, WCMMode wcmMode) Returns the id of the offer set by Target.static StringgetOfferLocation(Page offerPage, WCMMode wcmMode) Returns the offer location as it should be sent to Adobe Targetstatic StringgetOfferLocation(Page offerPage, WCMMode wcmMode, String ambitName) Returns the offer location as it should be sent to Adobe Targetstatic StringgetOfferName(Page offerPage, WCMMode wcmMode) Returns the offer name based on this offer's location.static StringgetOfferName(Page offerPage, WCMMode wcmMode, String ambitName) Returns the offer name based on this offer's location.static StringgetOfferName(String path) Returns an Offer name constructed by concatenating the path and replacing slashes (/) with dashes (-).static StringgetThirdPartyCampaignId(Node contentResourceNode) Returns the third party id for a campaign page's resource nodestatic StringgetThirdPartyID(Node node) Returns the third party ID of a Node if property exists, otherwise one is generated in Timestamp format.static voidsetConfigurationPath(String path, Page page) Saves the configuration reference to the campaign pagestatic voidsetThirdPartyID(Node node, String operation, String thirdpartyid) Saves or deletes the third party ID property in the providedNodeaccording to the executed operation.
-
Field Details
-
PN_THIRDPARTYID
Third-Party property name- See Also:
-
RT_CAMPAIGN
Campaign resource type- See Also:
-
RT_EXPERIENCE
Experience resource type- See Also:
-
RT_TEASER
Offer resource type- See Also:
-
RT_OFFER_PROXY
Offer proxy resource type- See Also:
-
PN_TESTANDTARGETCONFIG
Account-Reference property name- See Also:
-
PN_LOCATION
Mbox location property name- See Also:
-
-
Constructor Details
-
OfferHelper
public OfferHelper()
-
-
Method Details
-
getOfferName
Returns an Offer name constructed by concatenating the path and replacing slashes (/) with dashes (-).- Parameters:
path- path- Returns:
- offername constructed by path
-
getOfferName
Returns the offer name based on this offer's location. If this offer doesn't have a location then this method callsgetOfferName(String)- Parameters:
offerPage- the offer pagewcmMode- the WCM mode. This is required to determine the offer location- Returns:
- the offer name
-
getOfferName
Returns the offer name based on this offer's location. If this offer doesn't have a location then this method callsgetOfferName(String)- Parameters:
offerPage- the offer pagewcmMode- the WCM mode. This is required to determine the offer locationambitName- the name of the ambit that this offer is part of.- Returns:
- the offer name, following this pattern - {location-name}--{wcm mode}-{ambit-name}-{experience name}-{offer page name}.
If the WCM mode is
WCMMode.DISABLEDthen it's ommited. If the ambit name isPersonalizationConstants.AMBIT_DEFAULT_NAMEthen it's omitted.
-
getCampaignName
Returns a campaign name based on a repository path, following the same rules asgetOfferName(String)- Parameters:
path- path- Returns:
- the campaign name
-
setThirdPartyID
public static void setThirdPartyID(Node node, String operation, String thirdpartyid) throws RepositoryException Saves or deletes the third party ID property in the providedNodeaccording to the executed operation.- Parameters:
node-Nodeoperation- operationthirdpartyid- thirdpartyid- Throws:
RepositoryException-RepositoryException
-
getThirdPartyID
Returns the third party ID of a Node if property exists, otherwise one is generated in Timestamp format.- Parameters:
node- Offer node- Returns:
- Third-Party ID
- Throws:
RepositoryException-RepositoryException
-
getThirdPartyCampaignId
Returns the third party id for a campaign page's resource node- Parameters:
contentResourceNode-Nodeof pages contentresourcenode- Returns:
- the third party id
- Throws:
RepositoryException-RepositoryException
-
setConfigurationPath
Saves the configuration reference to the campaign page- Parameters:
path- Configuration pathpage- Current offer page- Throws:
RepositoryException- in case an error occurs when node property is set
-
getCampaign
Returns a page with resource type 'cq/personalization/components/campaignpage' ornull. The method walks ascending up the hierarchy until a page with the corresponding resource type is found.- Parameters:
page- Page with resource type 'cq/personalization/components/campaignpage' or initially provided page.- Returns:
- page with campaignpage resourcetype or
null
-
getOfferLocation
Returns the offer location as it should be sent to Adobe Target- Parameters:
offerPage- The offer page from CQwcmMode- The mode for which the location is calculated . Used to create different locations for author and publish environments- Returns:
- the offer location or "* display mbox *" if no location property is found in the offerPage
-
getOfferLocation
Returns the offer location as it should be sent to Adobe Target- Parameters:
offerPage- The offer page from CQwcmMode- The mode for which the location is calculated . Used to create different locations for author and publish environmentsambitName- the name of the MSM ambit that this offer is part of- Returns:
- the offer location or "* display mbox *" if no location property is found in the offerPage
-
getOfferId
Returns the offer id from Target- Parameters:
offerPage- the offer page from CQ- Returns:
- a value of type long representing the Id, or 0 if the id is not present.
-
getOfferId
Returns the id of the offer set by Target. The id is one of the two *externalId properties of the offer page- Parameters:
offerPage- the offer page from AEMwcmMode- theWCMMode. If theWCMModeisWCMMode.EDITthen the id value is read from the cq:authorExternalId property, otherwise the value of the cq:publishExternalId property is returned- Returns:
- a value of type long representing the Id, or 0 if the id is not present.
-