atg.svc.repository.service
Class SiteService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.svc.repository.service.BaseService
              extended by atg.svc.repository.service.KnowledgeBaseService
                  extended by atg.svc.repository.service.SiteService
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class SiteService
extends KnowledgeBaseService

Business methods for editing/reading/saving sites and site options.


Nested Class Summary
protected  class SiteService.LazyOptionsMap
          A Map for SiteOptions that waits until get() or containsKey() is called to load the SiteOption value into the Map.
 
Field Summary
static java.lang.String ANS_OPTION
           
static java.lang.String CLASS_VERSION
           
static java.lang.String COMMA
           
static java.lang.String NUMBER_OF_MATCHING_STATEMENTS_RETURNED
           
static java.lang.String PER_ANS_OPTION
           
static java.lang.String WHOLE_FIELD_OPTION
           
 
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
SiteService()
           
 
Method Summary
 java.util.Collection findAllOptions()
           
protected  atg.svc.repository.beans.SiteOption findOption(java.lang.String pName)
          Gets a site option by the site id and option name.
 atg.svc.repository.beans.SiteOption findSiteOptionByName(java.lang.String pName)
          Finds a SiteOption by the given name.
 java.lang.String[] getArrayValue(java.lang.String pName)
          Gets a Site option as a list of values.
 boolean getBooleanValue(java.lang.String pName)
          Gets a site option by name.
 java.lang.String getEmailSolutionLandingPageOption()
          Gets the name of the admin option that holds the landing page URL for emailing solution links.
 java.lang.String getEmailSolutionLandingPageURL(java.util.Map pParams)
          Gets the fully qualified URL for the document landing page with the given parameters attached as query parameters.
 int getIntegerValue(java.lang.String pName)
          Gets a site option by name.
 boolean getIsEmailSolutionLandingPageConfigured()
          Returns true if the document landing page option is not empty.
 java.util.Map getOptions()
          Returns a Map that can be used to edit site options.
 atg.svc.repository.service.util.OptionUtils getOptionUtils()
          Gets the common options utilities component.
 java.lang.String getSearchEnvironmentName(java.lang.String pSearchSiteName)
           
 java.lang.String getSearchSiteName(java.lang.String pSearchSiteName)
           
 atg.svc.repository.beans.Site getSite()
          Gets a site based on the id set in the siteId property.
 atg.svc.repository.beans.Site getSiteById(java.lang.String pSiteId)
          Gets a site by id.
 atg.svc.repository.beans.Site getSiteByName(java.lang.String pSiteId)
          This method just creates a new bean and return the site object with the site name.
 SiteConfiguration getSiteConfiguration()
          Returns the siteConfiguration.
 java.lang.String getStringValue(atg.svc.repository.beans.SiteOption pOption)
          Gets the string value of the given site option.
 java.lang.String getStringValue(java.lang.String pName)
          Gets a site option by site and name.
protected  void restoreDefaultValue(atg.svc.repository.beans.SiteOption pOption)
          Restores the default value of the given option.
 void restoreDefaultValues(java.lang.String[] pOptionNames)
          Restores the default options for the given set of site option names.
 void saveOptions(java.util.Collection pSiteOptions)
          Saves a Collection of user options.
 void saveOptions(java.util.Map pSiteOptions)
          Saves a Map of user options.
 void setEmailSolutionLandingPageOption(java.lang.String pEmailSolutionLandingPageOption)
          Sets the name of the admin option that holds the landing page URL for emailing solution links.
 void setOptionUtils(atg.svc.repository.service.util.OptionUtils pOptionUtils)
          Set the common options utilities component.
 void setSiteConfiguration(SiteConfiguration pSiteConfiguration)
          Sets the siteConfiguration.
 
Methods inherited from class atg.svc.repository.service.KnowledgeBaseService
getKnowledgeHomesFactory, getOptionBeanHomes, getOptionRepositoryHomes, getServiceSegmentBeanHomes, getServiceSegmentRepositoryHomes, getSolutionBeanHomes, getSolutionRepositoryHomes, getUserOptionBeanHomes, getUserOptionRepositoryHomes, setKnowledgeHomesFactory
 
Methods inherited from class atg.svc.repository.service.BaseService
getRepositoryService, getToday, setRepositoryService
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, 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 final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

NUMBER_OF_MATCHING_STATEMENTS_RETURNED

public static final java.lang.String NUMBER_OF_MATCHING_STATEMENTS_RETURNED
See Also:
Constant Field Values

ANS_OPTION

public static final java.lang.String ANS_OPTION
See Also:
Constant Field Values

COMMA

public static final java.lang.String COMMA
See Also:
Constant Field Values

WHOLE_FIELD_OPTION

public static final java.lang.String WHOLE_FIELD_OPTION
See Also:
Constant Field Values

PER_ANS_OPTION

public static final java.lang.String PER_ANS_OPTION
See Also:
Constant Field Values
Constructor Detail

SiteService

public SiteService()
Method Detail

getSiteConfiguration

public SiteConfiguration getSiteConfiguration()
Returns the siteConfiguration.

Returns:
siteConfiguration

setSiteConfiguration

public void setSiteConfiguration(SiteConfiguration pSiteConfiguration)
Sets the siteConfiguration.

Parameters:
pSiteConfiguration -

getOptionUtils

public atg.svc.repository.service.util.OptionUtils getOptionUtils()
Gets the common options utilities component. This is configured in the nucleus component properties file.

Returns:
The common options utilities component.

setOptionUtils

public void setOptionUtils(atg.svc.repository.service.util.OptionUtils pOptionUtils)
Set the common options utilities component. This is configured in the nucleus component properties file.

Parameters:
pOptionUtils - The common options utilities component.

getEmailSolutionLandingPageOption

public java.lang.String getEmailSolutionLandingPageOption()
Gets the name of the admin option that holds the landing page URL for emailing solution links.

Returns:
The name of the admin option that holds the landing page URL for emailing solution links.

setEmailSolutionLandingPageOption

public void setEmailSolutionLandingPageOption(java.lang.String pEmailSolutionLandingPageOption)
Sets the name of the admin option that holds the landing page URL for emailing solution links.

Parameters:
pEmailSolutionLandingPageOption - The name of the admin option that holds the landing page URL for emailing solution links.

getSite

public atg.svc.repository.beans.Site getSite()
                                      throws ObjectNotFoundException
Gets a site based on the id set in the siteId property.

Returns:
A Site.
Throws:
ObjectNotFoundException - If the site is not found.

getSiteByName

public atg.svc.repository.beans.Site getSiteByName(java.lang.String pSiteId)
                                            throws ObjectNotFoundException
This method just creates a new bean and return the site object with the site name. Gets a site by Name .

Parameters:
pSiteId - The site with the given id.
Returns:
A Site.
Throws:
ObjectNotFoundException - If the site is not found.

getSiteById

public atg.svc.repository.beans.Site getSiteById(java.lang.String pSiteId)
                                          throws ObjectNotFoundException
Gets a site by id.

Parameters:
pSiteId - The site with the given id.
Returns:
A Site.
Throws:
ObjectNotFoundException - If the site is not found.

getSearchEnvironmentName

public java.lang.String getSearchEnvironmentName(java.lang.String pSearchSiteName)

getSearchSiteName

public java.lang.String getSearchSiteName(java.lang.String pSearchSiteName)

getOptions

public java.util.Map getOptions()
Returns a Map that can be used to edit site options. The map is a wrapper around an EditableSiteOptionsMap that lazy-loads editable SiteOption objects into the Map on a call to the get method on the HashMap.

Returns:
A Map of all editable site options keyed by the option name.

saveOptions

public void saveOptions(java.util.Map pSiteOptions)
                 throws PersistenceException
Saves a Map of user options. If an option is new it will be created. If it exists it will be updated.

Parameters:
pSiteOptions - The map of user options as SiteOption beans.
Throws:
PersistenceException - If the save fails.

saveOptions

public void saveOptions(java.util.Collection pSiteOptions)
                 throws PersistenceException
Saves a Collection of user options. If an option is new it will be created. If it exists it will be updated.

Parameters:
pSiteOptions - The collection of user options as SiteOption beans.
Throws:
PersistenceException - If the save fails.

restoreDefaultValues

public void restoreDefaultValues(java.lang.String[] pOptionNames)
                          throws ObjectNotFoundException
Restores the default options for the given set of site option names. This is done deleting the site options that had been previously created (if any).

Throws:
ObjectNotFoundException

restoreDefaultValue

protected void restoreDefaultValue(atg.svc.repository.beans.SiteOption pOption)
Restores the default value of the given option.

Parameters:
pOption - The option to restore the default value on.

getBooleanValue

public boolean getBooleanValue(java.lang.String pName)
                        throws ObjectNotFoundException
Gets a site option by name.

Parameters:
pName - The name of option to find.
Returns:
A boolean representation of the value.
Throws:
ObjectNotFoundException - If the default option is not found for the given name.

getIntegerValue

public int getIntegerValue(java.lang.String pName)
                    throws ObjectNotFoundException
Gets a site option by name.

Parameters:
pName - The name of option to find.
Returns:
A int representation of the value.
Throws:
ObjectNotFoundException - If the default option is not found for the given name.

getStringValue

public java.lang.String getStringValue(java.lang.String pName)
                                throws ObjectNotFoundException
Gets a site option by site and name. If the site option does not have a value the default value is returned.

Parameters:
pName - The name of option to find.
Returns:
A string representation of the value.
Throws:
ObjectNotFoundException - If the SiteOption is not found by the given name.

getStringValue

public java.lang.String getStringValue(atg.svc.repository.beans.SiteOption pOption)
Gets the string value of the given site option. If there is no value then the value becomes the default value.

Parameters:
pOption - The SiteOption to get the value from.
Returns:
The string value of the option.

getArrayValue

public java.lang.String[] getArrayValue(java.lang.String pName)
                                 throws ObjectNotFoundException
Gets a Site option as a list of values. The values are separated by the string specified in the valueSeparator configuration property.

Parameters:
pName - The name of the option.
Returns:
The list of values for the site option.
Throws:
ObjectNotFoundException

findSiteOptionByName

public atg.svc.repository.beans.SiteOption findSiteOptionByName(java.lang.String pName)
                                                         throws ObjectNotFoundException
Finds a SiteOption by the given name.

Parameters:
pName - The name of the SiteOption to find.
Returns:
The SiteOption.
Throws:
ObjectNotFoundException - If the SiteOption was not found.

findOption

protected atg.svc.repository.beans.SiteOption findOption(java.lang.String pName)
                                                  throws ObjectNotFoundException
Gets a site option by the site id and option name.

Parameters:
pName - The name of the option.
Returns:
The SiteOption.
Throws:
ObjectNotFoundException - If the SiteOption is not found.

findAllOptions

public java.util.Collection findAllOptions()

getEmailSolutionLandingPageURL

public java.lang.String getEmailSolutionLandingPageURL(java.util.Map pParams)
                                                throws ObjectNotFoundException
Gets the fully qualified URL for the document landing page with the given parameters attached as query parameters.

Parameters:
pParams - The map of query parameters where the key is the parameter name and the value the parameter value.
Returns:
The fully qualified URL string.
Throws:
ObjectNotFoundException - If the admin option for the document landing page URL is not found in the repository.

getIsEmailSolutionLandingPageConfigured

public boolean getIsEmailSolutionLandingPageConfigured()
                                                throws ObjectNotFoundException
Returns true if the document landing page option is not empty.

Returns:
True if the solution landing page option is not empty.
Throws:
ObjectNotFoundException - If the admin option for the document landing page URL is not found in the repository.