atg.search.routing.command.search
Class ViewDocumentRequest

java.lang.Object
  extended by atg.search.routing.command.SearchXMLObject
      extended by atg.search.routing.command.SearchEngineRequestImpl
          extended by atg.search.routing.command.search.SearchRequest
              extended by atg.search.routing.command.search.ViewDocumentRequest
All Implemented Interfaces:
atg.search.routing.command.SearchEngineRequest, java.io.Serializable

public class ViewDocumentRequest
extends SearchRequest

The ViewDocument request retrieves a document, document information, or a full item inspection using DocumentContextInfo String, the doc's URL, or a property-value pair. In the case of item inspection (when return is set to ViewDocumentRequest.Return.INSPECT), the only populated properties will be ViewDocumentRequest.Response.getItemInspect() and ViewDocumentRequest.Response.getReturn(). Everything else will be null.

Required: Document; one of DocContextId (set automatically when Document is provided with DocContextId) setDocContextId(java.lang.String), URL (set automatically when Document is provided with URL and doc context is null) setURL(java.lang.String), or Property and PropertyValue setProperty(java.lang.String) and setPropertyValue(java.lang.String). Alternatively, you may call setURL(java.lang.String) The DocContextId must come from a live result: Do not use this when the information is old, since it may be out of date; use the URL instead.

Optional: everything else

See Also:
Serialized Form

Nested Class Summary
static class ViewDocumentRequest.Response
          Response type for the ViewDocumentRequest
static class ViewDocumentRequest.Return
          The Return type determines what the ViewDocument request returns.
static class ViewDocumentRequest.Section
          HTML section type enumeration.
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.search.routing.command.search.SearchRequest
BROWSE, CACHEABLE, CATEGORIZE, DEBUG, EMPTY_ARRAY, ENV, ID, INSPECT, LIST_PROPERTY_ALLOWED, LISTABLE_PROPERTIES, LOCAL_MERGE, LOCAL_MERGE_DEBUG, LOG_THIS_REQUEST, mDebug, mListableProperties, mListPropertyAllowed, mLocalMergeDebugEnabled, mLocalMergeDebugReady, mLocalMergeEnabled, mMergeSettings, mMultiPartitionSearch, mRequestIdentifier, MsInNs, mSleepTimeMs, mTargets, mTimeLimitMs, MULTI_PARTITION, MULTI_SEARCH_SESSION, mVersion, QUERY, RESP_FORM, SAVE_REQUEST, SIMILARDOCS, SITE_CONSTR, SITE_ID, SLEEP_TIME_MS, STRUCTQUERY, TAGS, TIME, TIME_LIMIT_MS, TREEQUERY, TYPEAHEAD, VERSION, VIC
 
Constructor Summary
ViewDocumentRequest()
           
 
Method Summary
 void addSection(ViewDocumentRequest.Section section)
          Adds a section.
protected static ViewDocumentRequest fromXml(atg.search.routing.utils.SearchMessageParser xml)
           
protected  void getAttributeXML(java.lang.StringBuilder buf)
           
protected  void getBodyXML(java.lang.StringBuilder buf)
           
 java.lang.String getDocContextId()
          Returns the document identifier plus highlight regions
 Document getDocument()
          Returns the document that is to be viewed
 DocumentSetConstraint getDocumentSetConstraints()
          Returns document set constraints
 java.lang.String getInput()
          Returns the original user input
 ParserOptions getParserOptions()
          Returns text processing options
 java.lang.String getProperty()
          Returns the property half of the property-value pair used to retrieve a document
 java.lang.String getPropertyValue()
          Returns the value half of the property-value pair used to retrieve a document
 DocumentSetConstraint getRefineConstraints()
          Returns refinement constraints
 int getRequestId()
          This identifies the type of request, one of SearchRequest.QUERY, SearchRequest.BROWSE, etc.
 ViewDocumentRequest.Return getReturn()
          Returns the return type of the request
 java.util.List getSections()
          Returns a list of ViewDocumentRequest.Sections
 java.lang.String getURL()
          Returns the URL used to retrieve a document to view
 boolean isDecodeOnly()
          Indicates whether the response from the request should only be decoded, not parsed.
 boolean isKeepingXml()
          ViewDocument requests always preserve the XML.
protected  SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
          Override to provide search response processing (parsing, generally).
 void setDocContextId(java.lang.String docContextId)
          Sets Document identifier plus highlight regions
 void setDocument(Document document)
          This Document must come from the original response; it is required, and it must have a contentId.
 void setDocumentSetConstraints(DocumentSetConstraint documentSetConstraints)
          Sets document set constraints
 void setInput(java.lang.String input)
          Sets the original user input
 void setKeepingXml(boolean pKeepingXml)
          ViewDocument requests always preserve the XML.
 void setParserOptions(ParserOptions parserOptions)
          Sets text processing options
 void setProperty(java.lang.String property)
          Instead of a document identifier (contextID), a property-value pair can be used to retrieve a document to view.
 void setPropertyValue(java.lang.String propertyValue)
          Sets the value of property to use for retrieval
 void setRefineConstraints(DocumentSetConstraint pRefineConstraints)
          Sets refinement constraints
 void setReturn(ViewDocumentRequest.Return pReturn)
          Besides returning the source content of an item (with the document type), the ViewDocument request can return the highlight information instead, for situations where the application is rendering the source content outside of ATG Search.
 void setSections(java.util.List sections)
          Controls which HTML document sections are retrieved
 void setURL(java.lang.String URL)
          Sets the URL used to retrieve a document to view.
static ViewDocumentRequest valueOf(java.lang.String pRequestXml)
          Constructs a new view request from xml.
 
Methods inherited from class atg.search.routing.command.search.SearchRequest
doMerge, fillDynamicTargets, fillDynamicTargetSpecifier, fromXml, getAllAttributeXML, getAllBodyXML, getAssociatedRequestIdentifier, getContentLabels, getContentLabelsArray, getDebug, getDynamicTargetSpecifier, getExcludeLogicalPartitionNames, getLastResponse, getListableProperties, getListablePropertiesString, getLogicalPartitionNames, getLogicalPartitionsArray, getMaximumResults, getMergeSettings, getPreviousRequestChainToken, getRequestAttribute, getRequestAttributes, getRequestChainToken, getRequestIdentifier, getRequestTag, getRequestTime, getRespForm, getSearchEnvironmentName, getSearchTargetNames, getSiteConstraints, getSiteId, getSleepTimeMs, getTargetType, getTimeLimitMs, getUserAgent, getVersion, isCacheable, isGeneratingXml, isListPropertyAllowed, isLocalMergeDebugEnabled, isLocalMergeDebugReady, isLocalMergeEnabled, isMultiPartitionSearch, isMultiSearchSession, isPagingRequest, isSaveRequest, merge, processResponse, setAssociatedRequestIdentifier, setCacheable, setContentLabels, setContentLabelsArray, setContentLabelsString, setDebug, setDynamicTargetSpecifier, setExcludeLogicalPartitionNames, setGeneratingXml, setLastResponse, setListableProperties, setListablePropertiesString, setListPropertyAllowed, setLocalMergeDebugEnabled, setLocalMergeDebugReady, setLocalMergeEnabled, setLogicalPartitionNames, setLogicalPartitionsArray, setMaximumResults, setMergeSettings, setMultiPartitionSearch, setMultiSearchSession, setPagingRequest, setPhysicalPartitionId, setPreviousRequestChainToken, setRequestAttribute, setRequestAttributes, setRequestChainToken, setRequestIdentifier, setRequestTime, setRespForm, setSaveRequest, setSearchEnvironmentName, setSiteConstraints, setSiteId, setSleepTimeMs, setTargetType, setTimeLimitMs, setUserAgent, setVersion
 
Methods inherited from class atg.search.routing.command.SearchEngineRequestImpl
encodeMapData, isFiringSearchEvents, isKeepingResponseData, isLoggingThisRequest, setFiringSearchEvents, setKeepingResponseData, setLoggingThisRequest
 
Methods inherited from class atg.search.routing.command.SearchXMLObject
appendComplexXml, appendOptionalAttr, appendOptionalElem, appendOptionalElem, appendOptionalElem, appendOptionalValue, appendRequiredAttr, appendRequiredElem, appendRequiredElem, appendRequiredValue, getDefaultXmlBytes, getParentXMLObject, getXmlPath, isPrintedFirstChild, setParentXMLObject, setPrintedFirstChild, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface atg.search.routing.command.SearchEngineRequest
toXML
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string

Constructor Detail

ViewDocumentRequest

public ViewDocumentRequest()
Method Detail

setKeepingXml

public void setKeepingXml(boolean pKeepingXml)
ViewDocument requests always preserve the XML. This cannot be disabled

Overrides:
setKeepingXml in class SearchRequest
Parameters:
pKeepingXml - ignored
See Also:
SearchEngineCommandResponse.getSearchEngineResponse(), SearchEngineResponse.getXmlResponse(), SearchEngineResponse.getXmlResponseDecoded()

isKeepingXml

public boolean isKeepingXml()
ViewDocument requests always preserve the XML. This cannot be disabled

Overrides:
isKeepingXml in class SearchRequest
Returns:
true. Always

getDocument

public Document getDocument()
Returns the document that is to be viewed

Returns:
the document that is to be viewed

setDocument

public void setDocument(Document document)
This Document must come from the original response; it is required, and it must have a contentId. If the Document has either DocContextId (getContextInfo) or URL and if the command's values (and property/propertyVal) are null, the command will use them. This happens at xml-generation time, not when this method is called.

Parameters:
document - the original document object, the one that is to be viewed
See Also:
Document.getContentId(), Document.getUrl(), Document.getContextInfo()

getInput

public java.lang.String getInput()
Returns the original user input

Returns:
the original user input

setInput

public void setInput(java.lang.String input)
Sets the original user input

Parameters:
input - original user input

getParserOptions

public ParserOptions getParserOptions()
Returns text processing options

Returns:
text processing options

getDocContextId

public java.lang.String getDocContextId()
Returns the document identifier plus highlight regions

Returns:
Document identifier plus highlight regions

setDocContextId

public void setDocContextId(java.lang.String docContextId)
Sets Document identifier plus highlight regions

Parameters:
docContextId - Document identifier plus highlight regions

getURL

public java.lang.String getURL()
Returns the URL used to retrieve a document to view

Returns:
URL used to retrieve a document to view

setURL

public void setURL(java.lang.String URL)
Sets the URL used to retrieve a document to view. Instead of a document identifier (setDocContextId(java.lang.String)), a simple URL can be used to retrieve a document.

Parameters:
URL - Instead of a document identifier (setDocContextId(java.lang.String)), a simple URL can be used to retrieve a document

getProperty

public java.lang.String getProperty()
Returns the property half of the property-value pair used to retrieve a document

Returns:
The property half of the property-value pair used to retrieve a document

setProperty

public void setProperty(java.lang.String property)
Instead of a document identifier (contextID), a property-value pair can be used to retrieve a document to view. The property MUST be an indexed property.

Parameters:
property - the property
See Also:
setPropertyValue(String)

getPropertyValue

public java.lang.String getPropertyValue()
Returns the value half of the property-value pair used to retrieve a document

Returns:
The value half of the property-value pair used to retrieve a document

setPropertyValue

public void setPropertyValue(java.lang.String propertyValue)
Sets the value of property to use for retrieval

Parameters:
propertyValue - Value of property to use for retrieval
See Also:
setProperty(String)

getReturn

public ViewDocumentRequest.Return getReturn()
Returns the return type of the request

Returns:
return type

setReturn

public void setReturn(ViewDocumentRequest.Return pReturn)
Besides returning the source content of an item (with the document type), the ViewDocument request can return the highlight information instead, for situations where the application is rendering the source content outside of ATG Search. See ViewDocumentRequest.Return for details.

Parameters:
pReturn - the return type

getSections

public java.util.List getSections()
Returns a list of ViewDocumentRequest.Sections

Returns:
List of ViewDocumentRequest.Section

setSections

public void setSections(java.util.List sections)
Controls which HTML document sections are retrieved

Parameters:
sections - List of ViewDocumentRequest.Section

addSection

public void addSection(ViewDocumentRequest.Section section)
Adds a section.

Parameters:
section - a ViewDocumentRequest.Section to add to the list
See Also:
setSections(java.util.List)

setParserOptions

public void setParserOptions(ParserOptions parserOptions)
Sets text processing options

Parameters:
parserOptions - text processing options

getDocumentSetConstraints

public DocumentSetConstraint getDocumentSetConstraints()
Returns document set constraints

Returns:
document set constraints

setDocumentSetConstraints

public void setDocumentSetConstraints(DocumentSetConstraint documentSetConstraints)
Sets document set constraints

Parameters:
documentSetConstraints - document set constraints

getRefineConstraints

public DocumentSetConstraint getRefineConstraints()
Returns refinement constraints

Returns:
refinement constraints

setRefineConstraints

public void setRefineConstraints(DocumentSetConstraint pRefineConstraints)
Sets refinement constraints

Parameters:
pRefineConstraints - refinement constraints

getAttributeXML

protected void getAttributeXML(java.lang.StringBuilder buf)
                        throws atg.search.routing.command.IncompleteCommandException
Overrides:
getAttributeXML in class atg.search.routing.command.SearchXMLObject
Throws:
atg.search.routing.command.IncompleteCommandException

getBodyXML

protected void getBodyXML(java.lang.StringBuilder buf)
                   throws atg.search.routing.command.IncompleteCommandException
Overrides:
getBodyXML in class atg.search.routing.command.SearchXMLObject
Throws:
atg.search.routing.command.IncompleteCommandException

getRequestId

public int getRequestId()
Description copied from class: SearchRequest
This identifies the type of request, one of SearchRequest.QUERY, SearchRequest.BROWSE, etc.

Specified by:
getRequestId in class SearchRequest
Returns:
one of the request constants defined by this class

isDecodeOnly

public boolean isDecodeOnly()
Indicates whether the response from the request should only be decoded, not parsed. VIC for return = null or = ViewDocumentRequest.Return.DOCUMENT means the response should not be parsed. Document responses are usually crappy HTML.

Overrides:
isDecodeOnly in class SearchRequest
Returns:
whether the response from the request should only be decoded, not parsed

processSearchResponse

protected SearchResponse processSearchResponse(atg.search.routing.command.SearchEngineResponse response)
                                        throws atg.search.routing.command.RoutingCommandException
Description copied from class: SearchRequest
Override to provide search response processing (parsing, generally). Returns null by default.

Overrides:
processSearchResponse in class SearchRequest
Parameters:
response - the engine response
Returns:
null by default
Throws:
atg.search.routing.command.RoutingCommandException
See Also:
SearchRequest.processResponse(atg.search.routing.command.SearchEngineResponse)

valueOf

public static ViewDocumentRequest valueOf(java.lang.String pRequestXml)
Constructs a new view request from xml.

Parameters:
pRequestXml - view request xml
Returns:
a new instance

fromXml

protected static ViewDocumentRequest fromXml(atg.search.routing.utils.SearchMessageParser xml)