atg.droplet.multisite
Class SiteGroupsDroplet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.droplet.multisite.SiteGroupsDroplet
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet

@Service(requiredProperties={"siteGroupManager","siteManager"})
public class SiteGroupsDroplet
extends DynamoServlet

This droplet returns site groups and optional un-grouped sites.

The includeUngroupedSites property value determines whether to return un-grouped sites or not. If the includeUngroupedSites property value is true, un-grouped sites are included in the output parameter;Otherwise it is not included in output parameter/s.

This droplet takes two input parameters. The two input parameter names are SITE_TYPE and SHAREABLE_TYPE_ID. You could pass in input parameters or configure them in the properties files. The input parameters or properties configurations are optional. The input parameters and its corresponding properties are as follows:

Based on the input parameters SITE_TYPE and SHAREABLE_TYPE_ID or its corresponding configured values, site groups and un-grouped sites are returned.

The complete description of SiteGroupsDroplet parameters is as follows:

siteType
This is an optional input parameter. If the parameter is not provided, the siteType property value is used.
shareableTypeId
This is an optional input parameter. If the parameter is not provided, the shareableTypeId property value is used.
output
This oparam parameter is rendered once.
siteGroups
This output map parameter contains SiteGroup as the key and sites as the value.
This map is created in filterSitesInSiteGroups(Collection, String).
ungroupedSites
This output parameter contains un-grouped sites. This un-grouped sites are filtered using filterSites(Collection, String) method.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static ParameterName INCLUDE_ACTIVE_SITES
          ParameterName for includeActiveSites
protected  boolean mIncludeActiveSites
          IncludeActiveSites
protected  boolean mIncludeUngroupedSites
           
protected  java.lang.String mShareableTypeId
          ShareableTypeId
protected  SiteGroupManager mSiteGroupManager
          SiteGroupManager
protected  SiteManager mSiteManager
          SiteManager
protected  java.lang.String mSiteType
           
static ParameterName OUTPUT
          ParameterName for output
static ParameterName SHAREABLE_TYPE_ID
          Parameter name for shareableTypeId
static java.lang.String SITE_GROUPS_PROP_NAME
          Parameter name for site
static ParameterName SITE_TYPE
          ParameterName for siteId
static java.lang.String UNGROUPED_SITES_PROP_NAME
          Parameter name for site
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
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
SiteGroupsDroplet()
           
 
Method Summary
protected  java.util.Collection<Site> filterSites(java.util.Collection<Site> pSites, java.lang.String pSiteType)
          This method returns sites with desired site type pSiteType.
protected  java.util.Map<SiteGroup,java.util.Collection<Site>> filterSitesInSiteGroups(java.util.Collection<SiteGroup> pSiteGroups, java.lang.String pSiteType)
          This method filters sites in each site group.
 java.lang.String getShareableTypeId()
           
 SiteGroupManager getSiteGroupManager()
          Returns the SiteGroupManager.
protected  java.util.Collection<SiteGroup> getSiteGroups(java.lang.String pShareableTypeId, java.lang.String pSiteType)
          This method calls the SiteGroupManager.getSiteGroups(String, String) and returns the site groups.
 SiteManager getSiteManager()
          Returns the SiteManager.
 java.lang.String getSiteType()
          Returns the siteType
protected  java.util.Collection<Site> getUngroupedSites(java.util.Collection<SiteGroup> pSiteGroups, java.lang.String pSiteType)
          This method calls SiteGroupManager.getSitesNotInGroups(Collection, String) and returns the un-grouped sites.
 boolean isIncludeActiveSites()
          Returns the includeActiveSites parameter, determining whether only active sites are retrieved
 boolean isIncludeUngroupedSites()
          Returns the includeUngroupedSites
 void service(DynamoHttpServletRequest pReq, DynamoHttpServletResponse pRes)
          This method serves site groups and un-grouped sites in the output oparam.
 void setIncludeActiveSites(boolean pIncludeActiveSites)
          Sets the includeActiveSites parameter, determining whether only active site are retrieved
 void setIncludeUngroupedSites(boolean pIncludeUngroupedSites)
          Sets the includeUngroupedSites
 void setShareableTypeId(java.lang.String pShareableTypeId)
           
 void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
          Sets the SiteGroupManager
 void setSiteManager(SiteManager pSiteManager)
          Sets the SiteManager
 void setSiteType(java.lang.String pSiteType)
          Sets the siteType
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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


SITE_TYPE

public static final ParameterName SITE_TYPE
ParameterName for siteId


SHAREABLE_TYPE_ID

public static final ParameterName SHAREABLE_TYPE_ID
Parameter name for shareableTypeId


INCLUDE_ACTIVE_SITES

public static final ParameterName INCLUDE_ACTIVE_SITES
ParameterName for includeActiveSites


OUTPUT

public static final ParameterName OUTPUT
ParameterName for output


SITE_GROUPS_PROP_NAME

public static final java.lang.String SITE_GROUPS_PROP_NAME
Parameter name for site

See Also:
Constant Field Values

UNGROUPED_SITES_PROP_NAME

public static final java.lang.String UNGROUPED_SITES_PROP_NAME
Parameter name for site

See Also:
Constant Field Values

mSiteGroupManager

protected SiteGroupManager mSiteGroupManager
SiteGroupManager


mShareableTypeId

protected java.lang.String mShareableTypeId
ShareableTypeId


mSiteType

protected java.lang.String mSiteType

mIncludeUngroupedSites

protected boolean mIncludeUngroupedSites

mSiteManager

protected SiteManager mSiteManager
SiteManager


mIncludeActiveSites

protected boolean mIncludeActiveSites
IncludeActiveSites

Constructor Detail

SiteGroupsDroplet

public SiteGroupsDroplet()
Method Detail

getSiteGroupManager

public SiteGroupManager getSiteGroupManager()
Returns the SiteGroupManager.

Returns:
the siteGroupManager

setSiteGroupManager

public void setSiteGroupManager(SiteGroupManager pSiteGroupManager)
Sets the SiteGroupManager

Parameters:
pSiteGroupManager - the siteGroupManager to set

getShareableTypeId

public java.lang.String getShareableTypeId()
Returns:
the mShareableTypeId

setShareableTypeId

public void setShareableTypeId(java.lang.String pShareableTypeId)
Parameters:
mShareableTypeId - the mShareableTypeId to set

getSiteType

public java.lang.String getSiteType()
Returns the siteType

Returns:
the siteType

setSiteType

public void setSiteType(java.lang.String pSiteType)
Sets the siteType

Parameters:
pSiteType - the siteType to set

isIncludeUngroupedSites

public boolean isIncludeUngroupedSites()
Returns the includeUngroupedSites

The default value for this property is true.

Returns:
the includeUngroupedSites

setIncludeUngroupedSites

public void setIncludeUngroupedSites(boolean pIncludeUngroupedSites)
Sets the includeUngroupedSites

The default value for this property is true.

Parameters:
pIncludeUngroupedSites - the includeUngroupedSites to set

setSiteManager

public void setSiteManager(SiteManager pSiteManager)
Sets the SiteManager

Parameters:
pSiteManager - the siteManager to set

getSiteManager

public SiteManager getSiteManager()
Returns the SiteManager.

Returns:
the siteManager

isIncludeActiveSites

public boolean isIncludeActiveSites()
Returns the includeActiveSites parameter, determining whether only active sites are retrieved

The default value for this property is false.

Returns:
the includeActiveSites

setIncludeActiveSites

public void setIncludeActiveSites(boolean pIncludeActiveSites)
Sets the includeActiveSites parameter, determining whether only active site are retrieved

The default value for this property is false.

Parameters:
pIncludeActiveSites - the includeActiveSites to set

service

public void service(DynamoHttpServletRequest pReq,
                    DynamoHttpServletResponse pRes)
             throws javax.servlet.ServletException,
                    java.io.IOException
This method serves site groups and un-grouped sites in the output oparam.

First this method obtains input parameters. If the input parameter is not passed in, then configured value is used. Then this method calls getSiteGroups(String, String) and getUngroupedSites(Collection, String) to get the site groups and un-grouped sites. After getting the above values, this method calls filterSitesInSiteGroups(Collection, String) to filter the sites in the site groups and filterSites(Collection, String) to filter the un-grouped sites.

The un-grouped sites output parameter is optional. You can configure this droplet to serve "ungroupedSites" output parameter. If includeUngroupedSites property value is true, then the un-grouped sites will be included as output parameter. The includeUngroupedSites property value is true by default.

Overrides:
service in class DynamoServlet
Parameters:
pReq - The request
pRes - The response
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
DynamoServlet.service(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), getSiteGroups(String, String), getUngroupedSites(Collection, String), filterSitesInSiteGroups(Collection, String), filterSites(Collection, String)

getSiteGroups

protected java.util.Collection<SiteGroup> getSiteGroups(java.lang.String pShareableTypeId,
                                                        java.lang.String pSiteType)
This method calls the SiteGroupManager.getSiteGroups(String, String) and returns the site groups.

Parameters:
pSiteType -
pShareableTypeId -
Returns:
See Also:
SiteGroupManager.getSiteGroups(String, String)

getUngroupedSites

protected java.util.Collection<Site> getUngroupedSites(java.util.Collection<SiteGroup> pSiteGroups,
                                                       java.lang.String pSiteType)
This method calls SiteGroupManager.getSitesNotInGroups(Collection, String) and returns the un-grouped sites. If a site does not belong to a site group, then it is called as an un-grouped site.

Parameters:
pSiteGroups -
pSiteType -
Returns:
See Also:
SiteGroupManager.getSitesNotInGroups(Collection, String)

filterSitesInSiteGroups

protected java.util.Map<SiteGroup,java.util.Collection<Site>> filterSitesInSiteGroups(java.util.Collection<SiteGroup> pSiteGroups,
                                                                                      java.lang.String pSiteType)
This method filters sites in each site group.

This method iterates through pSiteGroups and calls filterSites(Collection, String). If the filterSites(Collection, String) comes back with at least one valid site, then that site group and sites are added to the map. Once all valid sites are added for each site group, the resultant map is returned back.

Parameters:
pSiteGroups -
pSiteType -
Returns:
See Also:
filterSites(Collection, String)

filterSites

protected java.util.Collection<Site> filterSites(java.util.Collection<Site> pSites,
                                                 java.lang.String pSiteType)
This method returns sites with desired site type pSiteType.

If the site type is empty, then this method returns pSites. If the pSiteType is not empty, then iterates all sites and check to see if the site contains the desired site type. If the site contains the desired site type, then that site is included in the returned site collection.

Parameters:
pSites -
pSiteType -
Returns:
the desired site type's sites.
See Also:
SiteManager.getSiteTypePropertyName()