atg.targeting
Class DynamicContentGroup

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.targeting.DynamicContentGroup
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, RepositoryItemGroup, atg.targeting.PCCEditableComponent, atg.targeting.RepositoryItemGroupTargeter, atg.targeting.RepositoryTargeter, java.util.EventListener
Direct Known Subclasses:
DynamicProfileGroup, IndexedItemsGroup

public class DynamicContentGroup
extends GenericService
implements RepositoryItemGroup, atg.targeting.PCCEditableComponent, atg.targeting.RepositoryTargeter, atg.targeting.RepositoryItemGroupTargeter

This implementation of RepositoryItemGroup exists primarily for use with the Dynamo Personalization Control Center (aka PCC, the business user's interface to targeting in the Dynamo 4 personalization system).

It is like RuleBasedRepositoryItemGroup in that it defines a group of items relative to a rule based repository and targeter, but it encapsulates all required information within a single class and a single properties file, so that it's easy for the user interface to manage instances of these groups.

To keep the UI manageable, DynamicContentItemGroups generally specify a restricted subset of rules that are easy to parse and easy to display and edit in a graphical user interface. This restriction is enforced only at the GUI level, not in item group implementation, but if you construct a DynamicContentItemGroup by hand whose rules don't fit the expected pattern, the UI will be unable to cope with it. Caveat emptor.

See Also:
RepositoryItemGroup, RuleBasedRepositoryItemGroup

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  atg.targeting.RuleBasedRepositoryItemGroup mGroup
          The RuleBasedRepositoryItemGroup that implements group logic
protected  Repository mRepository
          The repository from which to select items
protected  java.lang.String mRepositoryViewName
          The name of the repository view from which to select items
protected  java.lang.String mRules
          Definitions of the ruleset that defines this group
protected  StringList mRuleStrings
          Array of strings representing an anglicized version of the rules
protected  java.util.Map<java.lang.String,atg.targeting.RuleBasedRepositoryItemGroup> mSiteContentGroups
          Map of site override item groups
protected  java.util.Map mSiteRules
          Map of site override rule strings
protected  TargetingSourceMap mTargetingSourceMap
          An optional TargetingSourceMap
protected  boolean mUseNucleusNameResolver
          If true, and if no TargetingSourceMap value is provided, use Nucleus for a name resolver for Nucleus components used in rules
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
DynamicContentGroup()
           
 
Method Summary
 atg.targeting.RuleBasedRepositoryItemGroup buildGroup(Repository pRepository, java.lang.String pRepositoryViewName, java.lang.String pRules)
          Build a RuleBasedRepositoryItemGroup from a rule specification.
static atg.nucleus.ConfigurationState createGroupConfiguration()
          Return a configuration object describing a new, uninitialized instance of DynamicContentGroup.
 void doStartService()
          Start this group service.
 void doStopService()
          Stop this group service.
 int getGroupCount()
          Get the count of members of this group.
 atg.targeting.RuleBasedRepositoryItemGroup getGroupDefinition()
           
 RepositoryItem[] getGroupMembers()
          Get the members of this group.
 java.lang.String getGroupName()
          Get the name of this group
 Query getGroupQuery()
          Return the group query object.
 ApplicationLogging getLogger()
          Get the object that performs application logging on our behalf.
 Repository getRepository()
          Get the repository for which a group is being defined
 RepositoryView getRepositoryView()
          Get the repositoryView named by repositoryViewName
 java.lang.String getRepositoryViewName()
          Get the name of the repository view for which a group is being defined
 NameResolver getRuleNameResolver()
          Get the name resolver to use to resolve references to Nucleus components used in the rules.
 java.lang.String getRules()
          Get the rules used to define this group.
 StringList getRuleStrings()
          Get the StringList representing the rules used by this targeter.
 atg.targeting.RuleBasedRepositoryItemGroup getSiteGroupDefinition(java.lang.String pSiteId)
           
 java.util.Map getSiteRules()
          Gets a map of the site override rules.
 TargetingSourceMap getSourceMap()
          An optional TargetingSourceMap component to use to resolve references to any Nucleus components used in the rules.
 boolean getUseNucleusNameResolver()
          If true, use this component's Nucleus as a name resolver when no TargetingSourceMap component is set in the 'sourceMap' property.
 boolean isGroupMember(RepositoryItem pItem)
          Return true if pItem is a member of this group.
 boolean isLoggingDebug()
          This method returns whether or not an debug log event should be broadcast.
 boolean isLoggingError()
          This method returns whether or not an error log event should be broadcast.
 boolean isLoggingInfo()
          This method returns whether or not an info log event should be broadcast.
 boolean isLoggingWarning()
          This method returns whether or not an warning log event should be broadcast.
 void logDebug(java.lang.String pMessage)
          Logs an debug event with the specified message
 void logDebug(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an debug event with the specified message and Throwable
 void logDebug(java.lang.Throwable pThrowable)
          Logs an debug event with the specified Throwable
 void logError(java.lang.String pMessage)
          Logs an error event with the specified message
 void logError(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an error event with the specified message and Throwable
 void logError(java.lang.Throwable pThrowable)
          Logs an error event with the specified Throwable
 void logInfo(java.lang.String pMessage)
          Logs an info event with the specified message
 void logInfo(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an info event with the specified message and Throwable
 void logInfo(java.lang.Throwable pThrowable)
          Logs an info event with the specified Throwable
 void logWarning(java.lang.String pMessage)
          Logs an warning event with the specified message
 void logWarning(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Logs an warning event with the specified message and Throwable
 void logWarning(java.lang.Throwable pThrowable)
          Logs an warning event with the specified Throwable
 void setLogger(ApplicationLogging pLogger)
          Set the object that performs application logging on our behalf.
 void setLoggingDebug(boolean pLogging)
          Sets whether or not debug log events should be logged.
 void setLoggingError(boolean pLogging)
          Sets whether or not error log events should be logged.
 void setLoggingInfo(boolean pLogging)
          Sets whether or not info log events should be logged.
 void setLoggingWarning(boolean pLogging)
          Sets whether or not warning log events should be logged.
 void setRepository(Repository pRepository)
          Set the repository for which a group is being defined
 void setRepositoryViewName(java.lang.String pRepositoryViewName)
          Set the name of the repository view for which a group is being defined
 void setRules(java.lang.String pRules)
          Set the rules used to define this group.
 void setRuleStrings(StringList pRuleStrings)
          Set the StringList representing the rules used by this targeter.
 void setSiteRules(java.util.Map pSiteRules)
          Sets the map of site override rules.
 void setSourceMap(TargetingSourceMap pTargetingSourceMap)
          An optional TargetingSourceMap component to use to resolve references to any Nucleus components used in the rules.
 void setUseNucleusNameResolver(boolean pUseNucleusNameResolver)
          Set to true to use this component's Nucleus as a name resolver when no TargetingSourceMap component is set in the 'sourceMap' property.
 void start()
          Prepare this group for use.
 void stop()
          Mark this group inactive and clear its internal group object.
protected  void updateGroup(boolean pCreate)
          Rebuild the internal group object.
protected  void zapGroup()
          Zap the internal group object to indicate that this object needs to be reinitialized.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingTrace, isRunning, logTrace, logTrace, logTrace, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingTrace, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mRepository

protected Repository mRepository
The repository from which to select items


mRepositoryViewName

protected java.lang.String mRepositoryViewName
The name of the repository view from which to select items


mRules

protected java.lang.String mRules
Definitions of the ruleset that defines this group


mRuleStrings

protected StringList mRuleStrings
Array of strings representing an anglicized version of the rules


mGroup

protected atg.targeting.RuleBasedRepositoryItemGroup mGroup
The RuleBasedRepositoryItemGroup that implements group logic


mUseNucleusNameResolver

protected boolean mUseNucleusNameResolver
If true, and if no TargetingSourceMap value is provided, use Nucleus for a name resolver for Nucleus components used in rules


mTargetingSourceMap

protected TargetingSourceMap mTargetingSourceMap
An optional TargetingSourceMap


mSiteRules

protected java.util.Map mSiteRules
Map of site override rule strings


mSiteContentGroups

protected java.util.Map<java.lang.String,atg.targeting.RuleBasedRepositoryItemGroup> mSiteContentGroups
Map of site override item groups

Constructor Detail

DynamicContentGroup

public DynamicContentGroup()
Method Detail

getGroupDefinition

public atg.targeting.RuleBasedRepositoryItemGroup getGroupDefinition()

getSiteGroupDefinition

public atg.targeting.RuleBasedRepositoryItemGroup getSiteGroupDefinition(java.lang.String pSiteId)

setRepository

public void setRepository(Repository pRepository)
                   throws atg.targeting.TargetingException
Set the repository for which a group is being defined

Throws:
atg.targeting.TargetingException

getRepository

public Repository getRepository()
Get the repository for which a group is being defined

Specified by:
getRepository in interface atg.targeting.RepositoryTargeter

setRepositoryViewName

public void setRepositoryViewName(java.lang.String pRepositoryViewName)
                           throws atg.targeting.TargetingException
Set the name of the repository view for which a group is being defined

Throws:
atg.targeting.TargetingException

getRepositoryViewName

public java.lang.String getRepositoryViewName()
Get the name of the repository view for which a group is being defined

Specified by:
getRepositoryViewName in interface RepositoryItemGroup

getRepositoryView

public RepositoryView getRepositoryView()
                                 throws RepositoryException
Get the repositoryView named by repositoryViewName

Specified by:
getRepositoryView in interface atg.targeting.RepositoryTargeter
Throws:
RepositoryException

getRuleNameResolver

public NameResolver getRuleNameResolver()
Get the name resolver to use to resolve references to Nucleus components used in the rules. If the 'sourceMap' property has been specified, then this will return that component's name resolver. If 'sourceMap' is null and if 'useNucleusNameResolver' is true, then return this component's nucleus. Otherwise will return null.

Returns:
a name resolver or null

setRules

public void setRules(java.lang.String pRules)
              throws atg.targeting.TargetingException
Set the rules used to define this group.

Parameters:
pRules - The rules that define this group, including the <ruleset> and </ruleset> tags.

This ruleset must not include sorting directives.

Throws:
atg.targeting.TargetingException

getRules

public java.lang.String getRules()
Get the rules used to define this group.


getSiteRules

public java.util.Map getSiteRules()
Gets a map of the site override rules. The key is a comma separated list of site ids. The value is the rule string.

Returns:
the siteRules

setSiteRules

public void setSiteRules(java.util.Map pSiteRules)
                  throws atg.targeting.TargetingException
Sets the map of site override rules. The key is a comma separated list of site ids. The value is the rule string.

Parameters:
pSiteRules - the siteRules to set
Throws:
TargetingException

setRuleStrings

public void setRuleStrings(StringList pRuleStrings)
Set the StringList representing the rules used by this targeter. Used to store an anglicized version of the rules for display, printing, etc.


getRuleStrings

public StringList getRuleStrings()
Get the StringList representing the rules used by this targeter.


setUseNucleusNameResolver

public void setUseNucleusNameResolver(boolean pUseNucleusNameResolver)
Set to true to use this component's Nucleus as a name resolver when no TargetingSourceMap component is set in the 'sourceMap' property. Using a name resolver allows Nucleus component properties to be used in targeting rules.

Parameters:
pUseNucleusNameResolver - True to use nucleus if no TargetingSourceMap is provided

getUseNucleusNameResolver

public boolean getUseNucleusNameResolver()
If true, use this component's Nucleus as a name resolver when no TargetingSourceMap component is set in the 'sourceMap' property. Using a name resolver allows Nucleus component properties to be used in targeting rules.

Returns:
true to use nucleus if no TargetingSourceMap is provided

setSourceMap

public void setSourceMap(TargetingSourceMap pTargetingSourceMap)
An optional TargetingSourceMap component to use to resolve references to any Nucleus components used in the rules.

Parameters:
pTargetingSourceMap - a targeting source map or null

getSourceMap

public TargetingSourceMap getSourceMap()
An optional TargetingSourceMap component to use to resolve references to any Nucleus components used in the rules.

Returns:
a source map component or null

setLogger

public void setLogger(ApplicationLogging pLogger)
Set the object that performs application logging on our behalf. If null, the service will perform its own logging.


getLogger

public ApplicationLogging getLogger()
Get the object that performs application logging on our behalf.


getGroupMembers

public RepositoryItem[] getGroupMembers()
Get the members of this group.

Specified by:
getGroupMembers in interface RepositoryItemGroup

getGroupCount

public int getGroupCount()
                  throws RepositoryException
Get the count of members of this group.

Specified by:
getGroupCount in interface RepositoryItemGroup
Throws:
RepositoryException

getGroupQuery

public Query getGroupQuery()
                    throws RepositoryException
Return the group query object.

Specified by:
getGroupQuery in interface RepositoryItemGroup
Throws:
RepositoryException

getGroupName

public java.lang.String getGroupName()
Get the name of this group

Specified by:
getGroupName in interface RepositoryItemGroup

isGroupMember

public boolean isGroupMember(RepositoryItem pItem)
Return true if pItem is a member of this group.

Specified by:
isGroupMember in interface RepositoryItemGroup

doStartService

public void doStartService()
                    throws ServiceException
Start this group service.

Overrides:
doStartService in class GenericService
Throws:
ServiceException - if the Service had a problem starting up

doStopService

public void doStopService()
Stop this group service.

Overrides:
doStopService in class GenericService

start

public void start()
           throws atg.targeting.TargetingException
Prepare this group for use. This method is called by doStartService to perform any generic initialization required by this service. Any initialization that depends on this object actually being a Nucleus component should be done directly in doStartService.

Throws:
TargetingException - if the object had a problem starting up

stop

public void stop()
Mark this group inactive and clear its internal group object.


updateGroup

protected void updateGroup(boolean pCreate)
                    throws atg.targeting.TargetingException
Rebuild the internal group object. Updates mGroup to point to a new object.

Throws:
atg.targeting.TargetingException

zapGroup

protected void zapGroup()
Zap the internal group object to indicate that this object needs to be reinitialized.


buildGroup

public atg.targeting.RuleBasedRepositoryItemGroup buildGroup(Repository pRepository,
                                                             java.lang.String pRepositoryViewName,
                                                             java.lang.String pRules)
                                                      throws atg.targeting.TargetingException
Build a RuleBasedRepositoryItemGroup from a rule specification.

Parameters:
pRepository - The repository for which this group is being defined.
pRepositoryViewName - The repository view for which this group is being defined.
pName - The name of the new group.
pRules - A string specifying a single ruleset. This ruleset must not not include sorting directives.
Returns:
A new RuleBasedRepositoryItemGroup. If no rules are specified, a null object is returned.
Throws:
TargetingException - if anything goes wrong when creating the group. In cases where the error involved unparseable rule specifications or other ruleset-related problems, the rootCause of the TargetingException will contain the original exception.

isLoggingInfo

public boolean isLoggingInfo()
Description copied from class: GenericService
This method returns whether or not an info log event should be broadcast.

Specified by:
isLoggingInfo in interface ApplicationLogging
Overrides:
isLoggingInfo in class GenericService
Returns:
boolean true if info log events should be logged
false if info log events should not be logged

setLoggingInfo

public void setLoggingInfo(boolean pLogging)
Description copied from class: GenericService
Sets whether or not info log events should be logged.

Specified by:
setLoggingInfo in interface ApplicationLogging
Overrides:
setLoggingInfo in class GenericService

isLoggingWarning

public boolean isLoggingWarning()
Description copied from class: GenericService
This method returns whether or not an warning log event should be broadcast.

Specified by:
isLoggingWarning in interface ApplicationLogging
Overrides:
isLoggingWarning in class GenericService
Returns:
boolean true if warning log events should be logged
false if warning log events should not be logged

setLoggingWarning

public void setLoggingWarning(boolean pLogging)
Description copied from class: GenericService
Sets whether or not warning log events should be logged.

Specified by:
setLoggingWarning in interface ApplicationLogging
Overrides:
setLoggingWarning in class GenericService

isLoggingError

public boolean isLoggingError()
Description copied from class: GenericService
This method returns whether or not an error log event should be broadcast.

Specified by:
isLoggingError in interface ApplicationLogging
Overrides:
isLoggingError in class GenericService
Returns:
boolean true if error log events should be logged
false if error log events should not be logged

setLoggingError

public void setLoggingError(boolean pLogging)
Description copied from class: GenericService
Sets whether or not error log events should be logged.

Specified by:
setLoggingError in interface ApplicationLogging
Overrides:
setLoggingError in class GenericService

isLoggingDebug

public boolean isLoggingDebug()
Description copied from class: GenericService
This method returns whether or not an debug log event should be broadcast.

Specified by:
isLoggingDebug in interface ApplicationLogging
Overrides:
isLoggingDebug in class GenericService
Returns:
boolean true if debug log events should be logged
false if debug log events should not be logged

setLoggingDebug

public void setLoggingDebug(boolean pLogging)
Description copied from class: GenericService
Sets whether or not debug log events should be logged.

Specified by:
setLoggingDebug in interface ApplicationLogging
Overrides:
setLoggingDebug in class GenericService

logInfo

public void logInfo(java.lang.String pMessage)
Description copied from class: GenericService
Logs an info event with the specified message

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class GenericService

logInfo

public void logInfo(java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an info event with the specified Throwable

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class GenericService

logInfo

public void logInfo(java.lang.String pMessage,
                    java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an info event with the specified message and Throwable

Specified by:
logInfo in interface ApplicationLogging
Overrides:
logInfo in class GenericService

logWarning

public void logWarning(java.lang.String pMessage)
Description copied from class: GenericService
Logs an warning event with the specified message

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class GenericService

logWarning

public void logWarning(java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an warning event with the specified Throwable

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class GenericService

logWarning

public void logWarning(java.lang.String pMessage,
                       java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an warning event with the specified message and Throwable

Specified by:
logWarning in interface ApplicationLogging
Overrides:
logWarning in class GenericService

logError

public void logError(java.lang.String pMessage)
Description copied from class: GenericService
Logs an error event with the specified message

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class GenericService

logError

public void logError(java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an error event with the specified Throwable

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class GenericService

logError

public void logError(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an error event with the specified message and Throwable

Specified by:
logError in interface ApplicationLogging
Overrides:
logError in class GenericService

logDebug

public void logDebug(java.lang.String pMessage)
Description copied from class: GenericService
Logs an debug event with the specified message

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class GenericService

logDebug

public void logDebug(java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an debug event with the specified Throwable

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class GenericService

logDebug

public void logDebug(java.lang.String pMessage,
                     java.lang.Throwable pThrowable)
Description copied from class: GenericService
Logs an debug event with the specified message and Throwable

Specified by:
logDebug in interface ApplicationLogging
Overrides:
logDebug in class GenericService

createGroupConfiguration

public static atg.nucleus.ConfigurationState createGroupConfiguration()
                                                               throws java.beans.IntrospectionException
Return a configuration object describing a new, uninitialized instance of DynamicContentGroup. At the very least, the name and repository properties of the configuration must be set before the group is editable. In addition, the repositoryView property may need to be set if the group selects content from any view other than the default.

Throws:
java.beans.IntrospectionException - If any error occurs while creating the configuration.