|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.svc.repository.service.BaseService
atg.svc.repository.service.SharedService
atg.svc.repository.service.RecommendedAnswerService
public class RecommendedAnswerService
Business methods for RecommendedAnswer
objects.
A RecommendedAnswer is an file or solution-based answer to an issue. There are two
types of recommended answers: contextual answers and non-contextual answers.
Document
associated with an SvcSearchResult
A non-contextual answer simply captures enough information to display the document or answer
again without highlighting. For a solution, this simply is the solution id
For a non-solution document, we must also must capture the url and contextId
(TODO: Confirm this is the right information to retrieve a non-solution non view-in-context document
from ATG Search.)
Recommended answers are captured in one of two scenarios:#findByTicket(String pTicketId)
to locate
the recommended answers associated with a ticket.
Here's an example of how to create and save a new recommended answer
atg.svc.search.service.RecommendedAnswerService recommendedAnswerService = getRecommendedAnswerService();
atg.svc.search.service.SearchService searchService = getSearchService();
SvcSearchResults results = searchService.search(searchContext);
SvcSearchResult result = (SvcSearchResult)results.getResults()[0];
Response esResult = result.getESResult();
RecommendedAnswer recAnswer = recommendedAnswerService.createRecommendedAnswer();
recAnswer.setContextId(esResult.getContextId());
recAnswer.setTitle(esResult.getTitle());
recAnswer.setExcerpt(esResult.getExcerpt());
recAnswer.setUrl(esResult.getUrl());
if (result instanceof SolutionSearchResult) {
SolutionSearchResult solutionResult = (SolutionSearchResult)result;
recAnswer.setDocType(RecommendedAnswerDocType.getSolution());
recAnswer.setSolutionId(solutionResult.getSolutionId());
} else if (ItemFormatConstraint.PDF == docType) {
recAnswer.setDocType(RecommendedAnswerDocType.getPDFDocument());
} else {
recAnswer.setDocType(RecommendedAnswerDocType.getDocument());
}
recommendedAnswerService.saveRecommendedAnswer(recAnswer);
Now let's update the recommended answer - in this case changing the state from to rejected.
RecommendedAnswer updateAnswer = recommendedAnswerService.editRecommendedAnswer(recAnswer.getId());
updateAnswer.setState(RecommendedAnswerState.getRejected());
recommendedAnswerService.saveRecommendedAnswer(updateAnswer);
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
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 | |
---|---|
RecommendedAnswerService()
|
Method Summary | |
---|---|
atg.svc.repository.beans.RecommendedAnswer |
createRecommendedAnswer()
Creates a RecommendedAnswer with the create date, modifiedDate, createdBy and modifiedBy populated and an initial state of Suggested. |
void |
deleteRecommendedAnswer(java.lang.String pRecommendedAnswerId)
Deletes a RecommendedAnswer. |
atg.svc.repository.beans.RecommendedAnswer |
editRecommendedAnswer(java.lang.String pRecommendedAnswerId)
Gets an editable version of a RecommendedAnswer given the id. |
atg.svc.repository.beans.RecommendedAnswer |
findRecommendedAnswerById(java.lang.String pRecommendedAnswerId)
Finds a recommended answer by it's repository id. |
java.util.Collection |
findRecommendedAnswerByTicket(java.lang.String pTicketId)
Returns the collection of recommended answers associated with the given ticket id. |
atg.svc.repository.beans.RecommendedAnswer |
findRecommendedAnswerByTicketAndDocument(java.lang.String pTicketId,
java.lang.String pDocUrl)
Returns the RecommendedAnswer associated with the given docId and ticket id |
atg.svc.repository.beans.RecommendedAnswer |
findRecommendedAnswerByTicketAndSolution(java.lang.String pTicketId,
java.lang.String pSolutionId)
Returns the RecommendedAnswer associated with the given solution id and ticket id |
java.util.Collection |
findRecommendedAnswersByDocument(java.lang.String pDocId)
Returns the collection of recommended answers associated with the given docId Return collection is ordered by createDate from newest to oldest |
java.util.Collection |
findRecommendedAnswersByDocumentSince(java.lang.String pDocUrl,
java.util.Date pSince,
atg.svc.repository.beans.RecommendedAnswerState pState)
Returns the collection of recommended answers associated with the given document url that were created since pCreateDate and match pState. |
java.util.Collection |
findRecommendedAnswersBySolution(java.lang.String pSolutionId)
Returns the collection of recommended answers associated with the given solution id Return collection is ordered by modifyDate from newest to oldest |
java.util.Collection |
findRecommendedAnswersBySolutionSince(java.lang.String pSolutionId,
java.util.Date pSince,
atg.svc.repository.beans.RecommendedAnswerState pState)
Returns the collection of recommended answers associated with the given solution that were created since pCreateDate and match pState. |
java.util.Collection |
findRecommendedAnswersBySolutionWithPaging(java.lang.String pSolutionId,
int pStartIdx,
int pCount)
Returns one page of the recommended answers associated with the given solution id. |
atg.svc.agent.events.EventTools |
getEventTools()
|
int |
getRecommendedAnswersCountBySolution(java.lang.String pSolutionId)
Returns the number of recommended answers associated with the given solution id Return collection is ordered by modifyDate from newest to oldest |
SessionService |
getSessionService()
|
SolutionScoringService |
getSolutionScoringService()
|
SolutionService |
getSolutionService()
|
atg.svc.ticketing.TicketHolder |
getTicketHolder()
|
java.lang.String |
getTicketHolderNucleusPath()
|
SolutionService |
getVersionedSolutionService()
|
java.lang.String |
saveRecommendedAnswer(atg.svc.repository.beans.RecommendedAnswer pRecommendedAnswer,
boolean pRecordSession)
Persists a recommended answer |
void |
setEventTools(atg.svc.agent.events.EventTools pEventTools)
|
void |
setSessionService(SessionService pSessionService)
|
void |
setSolutionScoringService(SolutionScoringService pSolutionScoringService)
|
void |
setSolutionService(SolutionService pSolutionService)
|
void |
setTicketHolderNucleusPath(java.lang.String pTicketHolderNucleusPath)
|
void |
setVersionedSolutionService(SolutionService pVersionedSolutionService)
|
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, 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 |
---|
public static final java.lang.String CLASS_VERSION
Constructor Detail |
---|
public RecommendedAnswerService()
Method Detail |
---|
public SolutionScoringService getSolutionScoringService()
public void setSolutionScoringService(SolutionScoringService pSolutionScoringService)
public atg.svc.agent.events.EventTools getEventTools()
public void setEventTools(atg.svc.agent.events.EventTools pEventTools)
public SolutionService getSolutionService()
public void setSolutionService(SolutionService pSolutionService)
public SolutionService getVersionedSolutionService()
public void setVersionedSolutionService(SolutionService pVersionedSolutionService)
public SessionService getSessionService()
public void setSessionService(SessionService pSessionService)
public java.lang.String getTicketHolderNucleusPath()
public void setTicketHolderNucleusPath(java.lang.String pTicketHolderNucleusPath)
public atg.svc.ticketing.TicketHolder getTicketHolder()
public atg.svc.repository.beans.RecommendedAnswer findRecommendedAnswerById(java.lang.String pRecommendedAnswerId) throws ObjectNotFoundException
pRecommendedAnswerId
- The repository id.
ObjectNotFoundException
- If the id is not found.public java.util.Collection findRecommendedAnswerByTicket(java.lang.String pTicketId) throws ObjectNotFoundException
pTicketId
- The repository id of the ticket
RecommendedAnswer
associated with the ticket.
ObjectNotFoundException
public java.util.Collection findRecommendedAnswersByDocument(java.lang.String pDocId) throws ObjectNotFoundException
pDocId
- The solution id or document url that uniquely identifies the solution/document
RecommendedAnswer
ObjectNotFoundException
public java.util.Collection findRecommendedAnswersBySolution(java.lang.String pSolutionId) throws ObjectNotFoundException
pSolutionId
- The solution repository id
RecommendedAnswer
ObjectNotFoundException
public java.util.Collection findRecommendedAnswersBySolutionWithPaging(java.lang.String pSolutionId, int pStartIdx, int pCount) throws ObjectNotFoundException
pSolutionId
- The solution repository idpStartIdx
- The offset into the list of recommended answers linked to the given solution (zero-based)pCount
- The number of recommended answers to return
RecommendedAnswer
ObjectNotFoundException
public int getRecommendedAnswersCountBySolution(java.lang.String pSolutionId) throws ObjectNotFoundException, javax.ejb.FinderException
pSolutionId
- The solution repository id
RecommendedAnswer
ObjectNotFoundException
javax.ejb.FinderException
public atg.svc.repository.beans.RecommendedAnswer findRecommendedAnswerByTicketAndDocument(java.lang.String pTicketId, java.lang.String pDocUrl) throws ObjectNotFoundException
pTicketId
- Repository id of the ticket. If you want to lookup by external ticket id, get the ATG ticket first and use it's repository id.pDocUrl
- The document url.
RecommendedAnswer
ObjectNotFoundException
public atg.svc.repository.beans.RecommendedAnswer findRecommendedAnswerByTicketAndSolution(java.lang.String pTicketId, java.lang.String pSolutionId) throws ObjectNotFoundException
pTicketId
- Repository id of the ticket. If you want to lookup by external ticket id, get the ATG ticket first and use it's repository id.pSolutionId
- The solution repository id.
RecommendedAnswer
ObjectNotFoundException
public java.util.Collection findRecommendedAnswersByDocumentSince(java.lang.String pDocUrl, java.util.Date pSince, atg.svc.repository.beans.RecommendedAnswerState pState)
pDocUrl
- The document url that uniquely identifies the documentpSince
- RecommendedAnswer was created since this datepState
- Suggested, helpful or rejected
RecommendedAnswer
associated with the ticket.public java.util.Collection findRecommendedAnswersBySolutionSince(java.lang.String pSolutionId, java.util.Date pSince, atg.svc.repository.beans.RecommendedAnswerState pState)
pSolutionId
- The solution id that uniquely identifies the solutionpSince
- RecommendedAnswer was created since this datepState
- Suggested, helpful or rejected
RecommendedAnswer
associated with the ticket.public atg.svc.repository.beans.RecommendedAnswer createRecommendedAnswer() throws javax.ejb.CreateException
javax.ejb.CreateException
- If the create fails.public atg.svc.repository.beans.RecommendedAnswer editRecommendedAnswer(java.lang.String pRecommendedAnswerId) throws ObjectNotFoundException
pRecommendedAnswerId
- Repository id of the recommended answer
ObjectNotFoundException
public java.lang.String saveRecommendedAnswer(atg.svc.repository.beans.RecommendedAnswer pRecommendedAnswer, boolean pRecordSession) throws javax.ejb.CreateException, ObjectNotFoundException, PersistenceException, atg.search.client.SearchClientException
pRecommendedAnswer
- Repository bean returned from either createRecommendedAnswer or editRecommendedAnswerpRecordSession
- - Should we record this in the knowledge session
ObjectNotFoundException
PersistenceException
javax.ejb.CreateException
atg.search.client.SearchClientException
public void deleteRecommendedAnswer(java.lang.String pRecommendedAnswerId) throws ObjectNotFoundException, PersistenceException
pRecommendedAnswerId
- Repository id of a RecommendedAnswer
ObjectNotFoundException
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |