atg.svc.repository.service
Class SessionService

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.SharedService
                  extended by atg.svc.repository.service.SessionService
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 SessionService
extends SharedService

Business methods for atg.svc.repository.beans.shared.KnowledgeSession objects. A KnowledgeSession is a problem solving session and it captures a history of the following events; search, browse, view answer


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String CURRENT_KNOWLEDGE_SESSION_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
SessionService()
           
 
Method Summary
 atg.repository.RepositoryItem addResearchSessionActivity(java.lang.String pTicketId, java.lang.String pKnowledgeSessionId, atg.userprofiling.Profile pProfile)
          Creates and saves a new researchSessionActivity repository item and adds the activity to the ticket.
 atg.repository.RepositoryItem addWebEscalationActivity(java.lang.String pTicketId, java.lang.String pKnowledgeSessionId, atg.userprofiling.Profile pProfile)
          Creates and saves a new webEscalationActivity repository item and adds the activity to the ticket.
 atg.svc.repository.beans.KnowledgeSession createKnowledgeSession()
          Generally you should use newKnowledgeSession instead.
 atg.svc.repository.beans.KnowledgeQueryPredicate createPredicateFromSearchContext(atg.svc.repository.beans.KnowledgeQueryPredicate pSearchPredicate)
          Copy an atg.svc.search.KnowledgeQueryPredicateImpl to a RJRepositoryBean so we can save the search query.
 ViewedAnswer createViewedAnswer()
          Creates a ViewedAnswer Repoistory object with the view date populated.
 ViewedAnswer createViewedAnswerBean()
          Creates a ViewedAnswer Bean object with the view date populated.
 void doSaveAnswer(java.lang.String pKnowledgeSessionId, java.lang.String pTicketId, atg.userprofiling.Profile pProfile, ViewedAnswer pAnswer)
          Adds a viewed answer to the current knowledge session and saves both the answer and the session.
 void doStartService()
          Start up the service...
 void doStopService()
           
protected  atg.svc.repository.beans.KnowledgeSession editSession(java.lang.String pSessionId)
           
 void endCurrentKnowledgeSession()
          Ends the knowledge session without starting a new one.
 atg.svc.repository.beans.KnowledgeSession findSessionByPrimaryKey(java.lang.String pSessionId)
          Finds a problem session by it's repository id.
 java.lang.String getApplicationName()
           
 java.lang.String getCurrentKnowledgeSessionId()
          Returns the KnowledgeSession id associated with the current window.
 atg.svc.agent.events.EventTools getEventTools()
           
 atg.svc.repository.beans.KnowledgeSession getMostRecentSession()
          Returns the latest knowledge session for the current user or null if no sessions found.
 atg.svc.repository.beans.KnowledgeSession getMostRecentSession(java.lang.String pProfileId)
          Returns the most recent knowledge session (including possibly the current session) for the specified user
 java.util.List getPagedSessions(int pStartingIndex, int pNumItems)
          Returns a page of knowledge sessions conducted by the current user.
 java.util.List getPagedSessions(java.lang.String pProfileId, int pStartingIndex, int pNumItems)
          Returns a page of knowledge sessions conducted by the specified user.
 ProfileService getProfileService()
           
 java.lang.String getResearchSessionActivityHeading()
           
 java.util.List getSessions()
          Returns a list of all sessions conducted by the current user
 java.util.List getSessions(java.lang.String pProfileId)
          Returns a list of all sessions conducted by the specified user
 SolutionScoringService getSolutionScoringService()
           
 StateHolderService getStateHolderService()
           
 atg.svc.ticketing.TicketHolder getTicketHolder()
           
 java.lang.String getTicketHolderNucleusPath()
           
 atg.ticketing.TicketingManager getTicketingManager()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 UserOptionsService getUserOptionsService()
           
 ViewedAnswerService getViewedAnswerService()
           
 boolean hasCurrentKnowledgeSession()
          Returns true if the current window has a KnowledgeSession associated with it.
protected  void internalProcessUpdate(KnowledgeSessionUpdate pUpdate)
          Actually update the knoweldge session.
 boolean isAgentModule()
           
 boolean isQueueInSeparateThread()
          Whether to queue in a separate thread.
 java.lang.String newKnowledgeSession()
          Starts a new knowledge session.
 KnowledgeSessionUpdate nextQueuedKnowledgeSessionUpdate()
          Return the next queued item changed.
 void resumeKnowledgeSession(java.lang.String pKnowledgeSessionId)
          Resumes an existing knowledge session.
 void resumeKnowledgeSession(java.lang.String pKnowledgeSessionId, boolean pEndCurrentSession)
          Resumes an existing knowledge session.
 void saveAnswer(ViewedAnswer pAnswer)
          Adds a viewed answer to the current knowledge session and saves both the answer and the session.
 void saveBrowseQuery(atg.svc.search.KnowledgeQueryContext pContext)
          Creates a new browse query, adds the query to the problem session and saves both the query and the session.
 void saveSearchQuery(atg.svc.search.KnowledgeQueryContext pContext)
          Creates a new query, adds the query to the problem session and saves both the query and the session.
 void setAgentModule(boolean pAgentModule)
           
 void setApplicationName(java.lang.String pApplicationName)
           
 void setEventTools(atg.svc.agent.events.EventTools pEventTools)
           
 void setProfileService(ProfileService pProfileService)
           
 void setQueueInSeparateThread(boolean pQueueInSeparateThread)
          Whether to queue incrementing the view/use/hotuse count in a separate thread.
 void setResearchSessionActivityHeading(java.lang.String pResearchSessionActivityHeading)
           
 void setSolutionScoringService(SolutionScoringService pSolutionScoringService)
           
 void setStateHolderService(StateHolderService pStateHolderService)
           
 void setTicketHolderNucleusPath(java.lang.String pTicketHolderNucleusPath)
           
 void setTicketingManager(atg.ticketing.TicketingManager pTicketingManager)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 void setUserOptionsService(UserOptionsService pUserOptionsService)
           
 void setViewedAnswerService(ViewedAnswerService pViewedAnswerService)
           
 
Methods inherited from class atg.svc.repository.service.SharedService
getServiceSharedBeanHomes, getServiceSharedBeanHomesName, getServiceSharedRepositoryHomes, getServiceSharedRepositoryHomesName, setServiceSharedBeanHomesName, setServiceSharedRepositoryHomesName
 
Methods inherited from class atg.svc.repository.service.BaseService
getRepositoryService, getToday, setRepositoryService
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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
Class version string

See Also:
Constant Field Values

CURRENT_KNOWLEDGE_SESSION_KEY

public static java.lang.String CURRENT_KNOWLEDGE_SESSION_KEY
Constructor Detail

SessionService

public SessionService()
Method Detail

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)

getSolutionScoringService

public SolutionScoringService getSolutionScoringService()

setSolutionScoringService

public void setSolutionScoringService(SolutionScoringService pSolutionScoringService)

getUserOptionsService

public UserOptionsService getUserOptionsService()

setUserOptionsService

public void setUserOptionsService(UserOptionsService pUserOptionsService)

getEventTools

public atg.svc.agent.events.EventTools getEventTools()

setEventTools

public void setEventTools(atg.svc.agent.events.EventTools pEventTools)

getStateHolderService

public StateHolderService getStateHolderService()

setStateHolderService

public void setStateHolderService(StateHolderService pStateHolderService)

getProfileService

public ProfileService getProfileService()

setProfileService

public void setProfileService(ProfileService pProfileService)

getTicketingManager

public atg.ticketing.TicketingManager getTicketingManager()

setTicketingManager

public void setTicketingManager(atg.ticketing.TicketingManager pTicketingManager)

getViewedAnswerService

public ViewedAnswerService getViewedAnswerService()

setViewedAnswerService

public void setViewedAnswerService(ViewedAnswerService pViewedAnswerService)

getApplicationName

public java.lang.String getApplicationName()

setApplicationName

public void setApplicationName(java.lang.String pApplicationName)

getResearchSessionActivityHeading

public java.lang.String getResearchSessionActivityHeading()

setResearchSessionActivityHeading

public void setResearchSessionActivityHeading(java.lang.String pResearchSessionActivityHeading)

isAgentModule

public boolean isAgentModule()

setAgentModule

public void setAgentModule(boolean pAgentModule)

getTicketHolderNucleusPath

public java.lang.String getTicketHolderNucleusPath()

setTicketHolderNucleusPath

public void setTicketHolderNucleusPath(java.lang.String pTicketHolderNucleusPath)

getTicketHolder

public atg.svc.ticketing.TicketHolder getTicketHolder()

setQueueInSeparateThread

public void setQueueInSeparateThread(boolean pQueueInSeparateThread)
Whether to queue incrementing the view/use/hotuse count in a separate thread.


isQueueInSeparateThread

public boolean isQueueInSeparateThread()
Whether to queue in a separate thread.


nextQueuedKnowledgeSessionUpdate

public KnowledgeSessionUpdate nextQueuedKnowledgeSessionUpdate()
Return the next queued item changed.


doStartService

public void doStartService()
                    throws atg.nucleus.ServiceException
Start up the service...

Overrides:
doStartService in class atg.nucleus.GenericService
Throws:
atg.nucleus.ServiceException

doStopService

public void doStopService()
                   throws atg.nucleus.ServiceException
Overrides:
doStopService in class atg.nucleus.GenericService
Throws:
atg.nucleus.ServiceException

findSessionByPrimaryKey

public atg.svc.repository.beans.KnowledgeSession findSessionByPrimaryKey(java.lang.String pSessionId)
                                                                  throws ObjectNotFoundException
Finds a problem session by it's repository id.

Parameters:
pSessionId - The repository id.
Returns:
The KnowledgeSession ReposImpl
Throws:
ObjectNotFoundException - If the id is not found.

editSession

protected atg.svc.repository.beans.KnowledgeSession editSession(java.lang.String pSessionId)
                                                         throws ObjectNotFoundException
Throws:
ObjectNotFoundException

hasCurrentKnowledgeSession

public boolean hasCurrentKnowledgeSession()
                                   throws java.lang.Exception
Returns true if the current window has a KnowledgeSession associated with it.

Throws:
java.lang.Exception

getCurrentKnowledgeSessionId

public java.lang.String getCurrentKnowledgeSessionId()
                                              throws javax.ejb.CreateException,
                                                     ObjectNotFoundException,
                                                     PersistenceException
Returns the KnowledgeSession id associated with the current window. If no KnowledgeSession is associated with the current window, starts a new KnowledgeSession and stores the id in the current windows WindowState.

Returns:
KnowledgeSession id for the current window.
Throws:
javax.ejb.CreateException
ObjectNotFoundException
PersistenceException

endCurrentKnowledgeSession

public void endCurrentKnowledgeSession()
                                throws ObjectNotFoundException,
                                       PersistenceException,
                                       java.lang.Exception
Ends the knowledge session without starting a new one. Call this on logout to track the end of the last session.

Throws:
ObjectNotFoundException - If the save fails.
PersistenceException - If the save fails.
java.lang.Exception

newKnowledgeSession

public java.lang.String newKnowledgeSession()
                                     throws ObjectNotFoundException,
                                            PersistenceException,
                                            javax.ejb.CreateException
Starts a new knowledge session. If a KnowledgeSession is currently associated with this window, ends that knowledge session, starts a new knowledge session and stores the new KnowledgeSession in the WindowState.

Returns:
KnowledgeSession id for the new knowledge session.
Throws:
PersistenceException
ObjectNotFoundException
javax.ejb.CreateException
TransactionException

resumeKnowledgeSession

public void resumeKnowledgeSession(java.lang.String pKnowledgeSessionId)
                            throws ObjectNotFoundException
Resumes an existing knowledge session. If a KnowledgeSession is currently associated with this window, ends that knowledge session and resumes the previous knowledge session and stores the new KnowledgeSession in the WindowState.

Parameters:
pKnowledgeSessionId - id for the knowledge session we want to resume.
Throws:
ObjectNotFoundException

resumeKnowledgeSession

public void resumeKnowledgeSession(java.lang.String pKnowledgeSessionId,
                                   boolean pEndCurrentSession)
                            throws ObjectNotFoundException
Resumes an existing knowledge session. If a KnowledgeSession is currently associated with this window, ends that knowledge session and resumes the previous knowledge session and stores the new KnowledgeSession in the WindowState.

Parameters:
pKnowledgeSessionId - id for the knowledge session we want to resume.
pEndCurrentSession - - if we know that the current knowledge session was created in this transaction, we should skip calling endSession since the knowledge session will have been rolled back.
Throws:
ObjectNotFoundException

createKnowledgeSession

public atg.svc.repository.beans.KnowledgeSession createKnowledgeSession()
                                                                 throws javax.ejb.CreateException
Generally you should use newKnowledgeSession instead. This is only used by eServer Migration to create a knowledge session and populate the user and date in the knowledge session.

Returns:
a new KnowledgeSession repository impl that hasn't been written to the database yet.
Throws:
javax.ejb.CreateException

createViewedAnswer

public ViewedAnswer createViewedAnswer()
                                throws javax.ejb.CreateException
Creates a ViewedAnswer Repoistory object with the view date populated. Populate the answer object with your answer and then call saveAnswer to add the query to your session and to commit the answer.

Throws:
javax.ejb.CreateException - If the create fails.

createViewedAnswerBean

public ViewedAnswer createViewedAnswerBean()
                                    throws javax.ejb.CreateException
Creates a ViewedAnswer Bean object with the view date populated. Populate the answer object with your answer and then call saveAnswer to add the query to your session and to commit the answer.

Throws:
javax.ejb.CreateException - If the create fails.

saveAnswer

public void saveAnswer(ViewedAnswer pAnswer)
                throws ObjectNotFoundException,
                       PersistenceException,
                       TransactionException,
                       javax.ejb.CreateException,
                       java.lang.Exception
Adds a viewed answer to the current knowledge session and saves both the answer and the session. When using this form of saveViewedAnswer, call createViewedAnswer() first which create a transient ViewedAnswer object. Then populate the answer with answer text, cluster name, contextId and URL.

Parameters:
pAnswer -
Throws:
ObjectNotFoundException - If the answer or session isn't found.
PersistenceException - If the save fails.
javax.ejb.CreateException
TransactionException
java.lang.Exception
See Also:
createAnswer(), ViewedAnswer

getSessions

public java.util.List getSessions()
Returns a list of all sessions conducted by the current user

See Also:
getSessions(String)

getSessions

public java.util.List getSessions(java.lang.String pProfileId)
Returns a list of all sessions conducted by the specified user

Parameters:
pProfileId - profile id of the user to retrieve sessions for.
Returns:
a List of KnowledgeSession objects listed from most recent to least recent

getPagedSessions

public java.util.List getPagedSessions(int pStartingIndex,
                                       int pNumItems)
Returns a page of knowledge sessions conducted by the current user.

Parameters:
pStartingIndex - - index of the first session to include (ordinal is zero based)
pNumItems - - maximum number of sessions to return in this page.
See Also:
#getSessions(String,int,int)

getPagedSessions

public java.util.List getPagedSessions(java.lang.String pProfileId,
                                       int pStartingIndex,
                                       int pNumItems)
Returns a page of knowledge sessions conducted by the specified user.

Parameters:
pProfileId - profile id of the user to retrieve sessions for.
pStartingIndex - - index of the first session to include (ordinal is zero based)
pNumItems - - maximum number of sessions to return in this page.
Returns:
a List of KnowledgeSession objects listed from most recent to least recent

getMostRecentSession

public atg.svc.repository.beans.KnowledgeSession getMostRecentSession()
Returns the latest knowledge session for the current user or null if no sessions found.

See Also:
#getMostRecentSession(Profile)

getMostRecentSession

public atg.svc.repository.beans.KnowledgeSession getMostRecentSession(java.lang.String pProfileId)
Returns the most recent knowledge session (including possibly the current session) for the specified user

Parameters:
pProfileId - profile id of user to retrieve sessions for.
Returns:
The current or most recent KnowledgeSession. Returns null if user has never participated in a session.

addResearchSessionActivity

public atg.repository.RepositoryItem addResearchSessionActivity(java.lang.String pTicketId,
                                                                java.lang.String pKnowledgeSessionId,
                                                                atg.userprofiling.Profile pProfile)
                                                         throws atg.ticketing.TicketingException
Creates and saves a new researchSessionActivity repository item and adds the activity to the ticket.

Parameters:
pTicketId - - Ticket to add the research activity to.
pKnowledgeSessionId - - The id of the KnowledgeSession associated with this research session (a.k.a. knowledge session)
pProfile - - Specifies the user profile who performed the activity.
Returns:
A repository item for the newly created researchSessionActivity
Throws:
atg.ticketing.TicketingException

addWebEscalationActivity

public atg.repository.RepositoryItem addWebEscalationActivity(java.lang.String pTicketId,
                                                              java.lang.String pKnowledgeSessionId,
                                                              atg.userprofiling.Profile pProfile)
                                                       throws atg.ticketing.TicketingException,
                                                              ObjectNotFoundException,
                                                              PersistenceException
Creates and saves a new webEscalationActivity repository item and adds the activity to the ticket. If you wish to add custom data to the activity, call setPropertyValue() on the returned repository item and then save the repository item.

Parameters:
pTicketId - - Ticket to add the research activity to.
pKnowledgeSessionId - - The id of the KnowledgeSession associated with this research session (a.k.a. knowledge session)
pProfile - - Specifies the user profile who performed the activity.
Returns:
A repository item for the newly created researchSessionActivity
Throws:
atg.ticketing.TicketingException
PersistenceException
ObjectNotFoundException

saveBrowseQuery

public void saveBrowseQuery(atg.svc.search.KnowledgeQueryContext pContext)
                     throws java.lang.Exception
Creates a new browse query, adds the query to the problem session and saves both the query and the session. A QueryPredicate is a query constraint such as topic, solution attribute, last modify date, document type, etc.

Parameters:
pContext - The browse query context to create the browse KnowledgeQuery from.
Throws:
ObjectNotFoundException - If the query or session isn't found.
PersistenceException - If the save fails.
TransactionException
java.lang.Exception
See Also:
createQuery(), atg.svc.repository.beans.Query, atg.svc.repository.beans.QueryPredicate

saveSearchQuery

public void saveSearchQuery(atg.svc.search.KnowledgeQueryContext pContext)
                     throws javax.ejb.CreateException,
                            ObjectNotFoundException,
                            PersistenceException,
                            TransactionException,
                            java.lang.Exception
Creates a new query, adds the query to the problem session and saves both the query and the session. A QueryPredicate is a query constraint such as topic, solution attribute, last modify date, document type, etc.

Parameters:
pSearchTextValues - Input search text - empty or null list if this is a browse
pContext - The search query context to create the search KnowledgeQuery from.
Throws:
ObjectNotFoundException - If the query or session isn't found.
PersistenceException - If the save fails.
TransactionException
javax.ejb.CreateException
java.lang.Exception
See Also:
createQuery(), atg.svc.repository.beans.Query, atg.svc.repository.beans.QueryPredicate

createPredicateFromSearchContext

public atg.svc.repository.beans.KnowledgeQueryPredicate createPredicateFromSearchContext(atg.svc.repository.beans.KnowledgeQueryPredicate pSearchPredicate)
                                                                                  throws javax.ejb.CreateException
Copy an atg.svc.search.KnowledgeQueryPredicateImpl to a RJRepositoryBean so we can save the search query. Called from SearchService on a search to save a search query.

Parameters:
pSearchPredicate - A KnowledgeQueryPredicateImpl that implements the KnowledgeQueryPredicate interface.
Returns:
A RJRepositoryBean object that can be passed into saveQuery.
Throws:
javax.ejb.CreateException

internalProcessUpdate

protected void internalProcessUpdate(KnowledgeSessionUpdate pUpdate)
Actually update the knoweldge session.


doSaveAnswer

public void doSaveAnswer(java.lang.String pKnowledgeSessionId,
                         java.lang.String pTicketId,
                         atg.userprofiling.Profile pProfile,
                         ViewedAnswer pAnswer)
                  throws java.lang.Exception
Adds a viewed answer to the current knowledge session and saves both the answer and the session. When using this form of saveViewedAnswer, call createViewedAnswer() first which create a transient ViewedAnswer object. Then populate the answer with answer text, cluster name, contextId and URL.

Parameters:
pAnswer -
Throws:
ObjectNotFoundException - If the answer or session isn't found.
PersistenceException - If the save fails.
javax.ejb.CreateException
TransactionException
java.lang.Exception
See Also:
createAnswer(), ViewedAnswer