|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.websphere.personalization.RuleTrigger
public class RuleTrigger
This class is used to trigger a Personalization rule.
Typically this class makes Resources available through an indexed Content property. RuleTrigger will initialize the triggering method, using the RequestContext it obtains from the PersonalizationContext. The Personalization Context is always used as the target object when triggering Personalization Rules.
To execute a Segment Group called "mySegGroup" with a UUID of "d61d9ccb-8982-48c8-99cb-bf2aeb3b416a"in a WCM Library called "RulesHolder" in a JSP in Portal, the following series of calls would be issued.
RuleTrigger ruleTrigger = new RuleTrigger(); ruleTrigger.setRequest(portletRequest); ruleTrigger.setRuleId("$[lib]d61d9ccb-8982-48c8-99cb-bf2aeb3b416a"); Object[] winingSegments = ruleTrigger.trigger();
ContentSpot
,
Serialized FormField Summary | |
---|---|
protected Query |
additionalQuery
|
protected java.lang.String |
asOfDate
|
protected boolean |
audit
|
protected java.lang.String |
campaignName
|
protected static com.ibm.websphere.personalization.campaigns.CampaignsFinder |
CAMPAIGNS_FINDER
|
protected com.ibm.websphere.personalization.rules.PznOrderComparator |
categorizationOrder
|
protected java.lang.Object[] |
content
|
protected java.lang.String |
contentSpotUuid
|
static java.lang.String |
COPYRIGHT
|
protected static RuleExit |
defaultRuleExit
|
protected java.lang.String |
displayName
|
static boolean |
includeRuntimeResultsInPreview
|
protected java.lang.String |
limit
|
protected java.lang.String |
name
|
protected javax.servlet.http.HttpServletRequest |
req
deprecated |
protected RequestContext |
requestContext
|
protected java.lang.String |
resourceCollectionName
|
protected RuleExit |
ruleExit
|
protected java.lang.String |
ruleJSON
|
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping |
ruleMapping
|
protected java.util.List |
ruleMappingsList
|
protected java.lang.String |
ruleName
|
protected java.lang.String |
ruleUuid
|
protected java.lang.String |
scopeId
|
protected boolean |
showErrors
|
protected java.lang.String |
startIndex
|
boolean |
useCascadingCampaigns
|
Constructor Summary | |
---|---|
RuleTrigger()
|
Method Summary | |
---|---|
static void |
addContentResourceCollectionName(java.lang.String collectionName,
java.lang.String ruleName,
RequestContext requestContext)
. |
protected java.lang.String |
dateUsed()
Determines the date being used. |
protected void |
findRule()
|
boolean |
getAllItemsCached()
|
boolean |
getAudit()
Used to obtain the property which governs the collection of audit information |
int |
getCachedItems()
|
protected com.ibm.websphere.personalization.campaigns.Campaign |
getCampaign(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns,
java.lang.String campaignName)
|
protected int |
getCampaignIndex(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns,
java.lang.String campaignName)
|
java.lang.String |
getCampaignName()
|
protected com.ibm.websphere.personalization.campaigns.Campaign[] |
getCampaigns()
This method returns a prioritized Array of active campaigns for this session. |
java.lang.String |
getClassification(int which)
Deprecated. - use getProfile |
java.lang.String[] |
getClassifications()
Deprecated. - Use getProfiles |
java.lang.Object[] |
getContent()
Deprecated. |
java.lang.Object |
getContent(int which)
Deprecated. |
java.lang.String |
getContentResourceCollectionName()
Returns the name of the resource collection used by the rule executed in this content spot. |
static java.lang.String |
getContentResourceCollectionName(java.lang.String ruleName,
RequestContext requestContext)
Returns the resource collection referenced by a rule that returns content from the request attribute keyed by the ruleName. |
java.lang.String |
getContentSpotId()
|
java.lang.String |
getContentSpotName()
|
RequestContext |
getContext()
Return the PersonalizationContext. |
java.lang.String |
getDisplayName()
Should be overriden by sub-classes to provide a name for instances of the RuleTrigger type. |
int |
getFirstPageRetrieved()
|
java.lang.String[] |
getIds(java.lang.String resourceCollection)
Deprecated. Warning: this call does not scale. |
int |
getMaxAvailableItems()
|
java.lang.String |
getPreviewAnchorTag()
|
java.lang.String |
getPreviewAnchorTag(javax.servlet.http.HttpServletResponse response)
|
java.lang.String |
getProfile(int which)
Provides access to the indexed profile property. |
java.lang.String[] |
getProfiles()
Returns the full set of applicable profiles in an array. |
Resource |
getResource(java.lang.String id,
java.lang.String resourceCollection)
Deprecated. |
java.lang.String |
getRuleId()
|
java.lang.String |
getRuleJSON()
|
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping |
getRuleMapping()
|
java.lang.String |
getRuleName()
|
java.lang.Object[] |
getRuleResults()
Returns the full set of content. |
java.lang.Object |
getRuleResults(int which)
Used to obtain the indexed content object identified by which . |
protected java.lang.String |
getScopeId()
|
boolean |
getShowError()
Used to obtain the property which governs whether errors should be propagated or consumed. |
protected java.lang.String |
idOfUser()
Determines the user being used. |
boolean |
isClassifiedAs(java.lang.String c)
Deprecated. |
boolean |
isProfiledAs(java.lang.String profile)
Checks if the current user matches the given profile |
boolean |
isProfiledAsAll(java.lang.String[] profileNames)
Checks if the Current user matches all of a list of profiles |
boolean |
isProfiledAsAny(java.lang.String[] profileNames)
Checks if the Current user matches any of a list of profiles |
boolean |
isUsingCascadingCampaigns()
Returns the useCascadingCampaigns. |
static void |
resetContext(RequestContext context)
Removes any information stored by the RuleTrigger on the context. |
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping |
selectRule(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns,
java.util.List ruleMappings)
This method selects the winning rule. |
void |
setAsOfDate(java.lang.String s)
The date to be used in retrieving rules and in evalutating time based conditions. |
void |
setAudit(boolean se)
Deprecated. Audit function is deprecated |
protected void |
setCampaignName(java.lang.String campaignName)
|
void |
setCategorization(java.lang.String propertyName,
boolean isDynamic,
boolean isAscending)
Request that an ordering be imposed on the content spot the next time trigger() is called. |
void |
setContentResourceCollectionName(java.lang.String resourceCollectionName)
Save the name of the resource collection used by the rule executed in this content spot. |
void |
setContentSpotId(java.lang.String contentSpotId)
|
void |
setContentSpotName(java.lang.String contentSpotName)
|
void |
setContext(RequestContext context)
Set the PersonalizationContext. |
void |
setDisplayName(java.lang.String displayName)
|
void |
setLimit(java.lang.String s)
The maximum number of content objects to retrieve. |
void |
setName(java.lang.String displayName)
Deprecated. Use setDisplayName, setContentSpotName, or setRuleName instead. |
void |
setRequest(javax.servlet.http.HttpServletRequest sr)
Invoked by the jsp/servlet/portlet to give us the servlet request so that we can obtain the RequestContext |
void |
setRequest(java.lang.Object o)
|
void |
setRequest(PznPortletRequestObjectInterface proi)
Invoked by the personalization application to give us the surrogate servlet request so that we can obtain the RequestContext |
void |
setRequest(PznRequestObjectInterface roi)
Invoked by the personalization application to give us the surrogate servlet request so that we can obtain the RequestContext |
void |
setRuleExit(RuleExit ruleExit)
|
void |
setRuleId(java.lang.String ruleId)
|
void |
setRuleJSON(java.lang.String ruleJson)
|
void |
setRuleMapping(com.ibm.websphere.personalization.campaigns.web.RuleMapping ruleMapping)
|
void |
setRuleName(java.lang.String ruleName)
|
void |
setShowError(boolean se)
Used to set the property which governs whether errors should be propagated or consumed. |
void |
setStartIndex(java.lang.String s)
The index to start with. |
void |
setUseCascadingCampaigns(boolean useCascadingCampaigns)
Sets the useCascadingCampaigns. |
void |
trigger()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
protected RuleExit ruleExit
protected Query additionalQuery
protected static RuleExit defaultRuleExit
public static boolean includeRuntimeResultsInPreview
public boolean useCascadingCampaigns
protected java.lang.String scopeId
protected static final com.ibm.websphere.personalization.campaigns.CampaignsFinder CAMPAIGNS_FINDER
protected java.lang.String resourceCollectionName
protected com.ibm.websphere.personalization.rules.PznOrderComparator categorizationOrder
protected java.lang.String displayName
protected java.lang.String campaignName
protected java.util.List ruleMappingsList
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping ruleMapping
protected java.lang.String ruleName
protected java.lang.String ruleJSON
protected java.lang.String ruleUuid
protected java.lang.String contentSpotUuid
protected java.lang.Object[] content
protected java.lang.String name
protected java.lang.String asOfDate
protected java.lang.String startIndex
protected boolean showErrors
protected boolean audit
protected java.lang.String limit
protected RequestContext requestContext
protected javax.servlet.http.HttpServletRequest req
Constructor Detail |
---|
public RuleTrigger()
Method Detail |
---|
public java.lang.String getCampaignName()
protected void setCampaignName(java.lang.String campaignName)
public void setRuleMapping(com.ibm.websphere.personalization.campaigns.web.RuleMapping ruleMapping)
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping getRuleMapping()
public java.lang.String getRuleName()
public void setRuleName(java.lang.String ruleName)
public java.lang.String getRuleJSON()
public void setRuleJSON(java.lang.String ruleJson)
public java.lang.String getRuleId()
public void setRuleId(java.lang.String ruleId)
public java.lang.String getDisplayName()
public void setDisplayName(java.lang.String displayName)
public java.lang.String getContentSpotName()
public void setContentSpotName(java.lang.String contentSpotName)
public void setName(java.lang.String displayName)
contentSpotName
- the name of the content spot represented by this RuleTriggerpublic java.lang.String getContentSpotId()
public void setContentSpotId(java.lang.String contentSpotId)
public static void resetContext(RequestContext context)
context
- protected java.lang.String dateUsed()
public boolean getAudit()
public java.lang.String getContentResourceCollectionName() throws java.lang.Throwable
java.lang.Throwable
public void setContentResourceCollectionName(java.lang.String resourceCollectionName)
resourceCollectionName
- The name of the resource collection referenced by the rulepublic void setCategorization(java.lang.String propertyName, boolean isDynamic, boolean isAscending)
propertyName
- The property to categorize byisDynamic
- Whether this property has a fixed getter like get*() or is only available through the
get(String) methodisAscending
- The sort is in ascending order if true and in descending order if falsepublic java.lang.String getClassification(int which) throws java.lang.ArrayIndexOutOfBoundsException
classification
property.
Invokes the trigger point if this hasn't been done yet.
which
- The index of the applicable classification that is desired.
which
.
java.lang.ArrayIndexOutOfBoundsException
public java.lang.String[] getClassifications()
public java.lang.String getProfile(int which) throws java.lang.Throwable
profile
property.
Invokes the rule if this hasn't been done yet.
which
- The index of the applicable profile that is desired.
which
.
java.lang.Throwable
public java.lang.String[] getProfiles() throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object[] getContent()
public java.lang.Object getContent(int which)
which
.
Overridden to cast the returned content Object to a particular type.
which
- The index of the content object that is desired.
n
is determined by which
.
java.lang.ArrayIndexOutOfBoundsException
- thrown when which
does
not refer to a valid index of content. Typically used by the jsp to know that there
are no more content objects to querypublic java.lang.Object[] getRuleResults() throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object getRuleResults(int which) throws java.lang.Throwable
which
.
Overridden to cast the returned content Object to a particular type.
which
- The index of the content object that is desired.
n
is determined by which
.
java.lang.Throwable
public java.lang.String getPreviewAnchorTag() throws java.lang.Throwable
java.lang.Throwable
public java.lang.String getPreviewAnchorTag(javax.servlet.http.HttpServletResponse response) throws java.lang.Throwable
java.lang.Throwable
protected com.ibm.websphere.personalization.campaigns.web.RuleMapping selectRule(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns, java.util.List ruleMappings)
protected void findRule()
public void setRuleExit(RuleExit ruleExit)
public boolean getShowError()
protected com.ibm.websphere.personalization.campaigns.Campaign[] getCampaigns()
protected java.lang.String getScopeId()
protected com.ibm.websphere.personalization.campaigns.Campaign getCampaign(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns, java.lang.String campaignName)
protected int getCampaignIndex(com.ibm.websphere.personalization.campaigns.Campaign[] campaigns, java.lang.String campaignName)
protected java.lang.String idOfUser()
public boolean isClassifiedAs(java.lang.String c) throws java.lang.Throwable
c
- The classification that's being asked about.
c
is in the set of applicable
classifications.
java.lang.Throwable
public boolean isProfiledAs(java.lang.String profile) throws java.lang.Throwable
profile
- The profile that's being asked about.
profile
is in the set of profiles returned
java.lang.Throwable
public boolean isProfiledAsAll(java.lang.String[] profileNames) throws java.lang.Throwable
profileNames
- String[ ] - the names of the profiles to match against
java.lang.Throwable
public boolean isProfiledAsAny(java.lang.String[] profileNames) throws java.lang.Throwable
profileNames
- String[ ] - the names of the profiles to match against
java.lang.Throwable
public void setAsOfDate(java.lang.String s)
s
- String representing the date to be used when evaluating
time-based conditions. Format is YYYY-MM-DDpublic void setAudit(boolean se)
public void setContext(RequestContext context)
context
- PersonalizationContextpublic RequestContext getContext()
public void setLimit(java.lang.String s)
s
- Maximum number of content objects to retrieve.public void setRequest(PznRequestObjectInterface roi)
roi
- com.ibm.websphere.personalization.PznRequestObjectInterfacepublic void setRequest(PznPortletRequestObjectInterface proi)
proi
- com.ibm.websphere.personalization.PznPortletRequestObjectInterfacepublic void setRequest(javax.servlet.http.HttpServletRequest sr)
sr
- javax.servlet.http.HttpServletRequestpublic void setRequest(java.lang.Object o)
public void setShowError(boolean se)
public void setStartIndex(java.lang.String s)
public int getFirstPageRetrieved()
public int getCachedItems()
public boolean getAllItemsCached()
public int getMaxAvailableItems() throws java.lang.Throwable
java.lang.Throwable
public void trigger() throws java.lang.Throwable
java.lang.Throwable
public static java.lang.String getContentResourceCollectionName(java.lang.String ruleName, RequestContext requestContext)
ruleName
- The name of the rule that is returning content and references a resource collection.requestContext
- The context where the referenced collection names are stored.
public static void addContentResourceCollectionName(java.lang.String collectionName, java.lang.String ruleName, RequestContext requestContext)
ruleName
- The name of the rule that is returning content and references a resource collection.collectionName
- The name of the collection referenced by the rulerequestContext
- The context where the referenced collection names are stored.public boolean isUsingCascadingCampaigns()
public void setUseCascadingCampaigns(boolean useCascadingCampaigns)
useCascadingCampaigns
- The useCascadingCampaigns to setpublic java.lang.String[] getIds(java.lang.String resourceCollection) throws java.lang.Exception
java.lang.Exception
public Resource getResource(java.lang.String id, java.lang.String resourceCollection)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |