To programatically decode the DataStream
property of a document, select Custom (Fire a Decode Event)
for the Search Results Content Handling
or Detail Content Handling
builder inputs in the Portal Document Manager Access builder.
Then, add an Event Handler builder to your model to handle the builderNameSearchResultsDecodeEvent
event or just the builderNameDetailDecodeEvent
event. These events are automatically declared by the Portal Document Manager builder when you configure the builder to use custom decode events.
Typically, your custom decode event handler delegates the actual decoding process to a Method builder or LJO, passing the following event inputs:
The com.ibm.content.model.Base for the document. By default, it is passed as Object to avoid JAR dependencies for WebSphere® Portlet Factory Designer. Typically, your model does not need to interact with this object unless your custom decode method must use values stored in other properties of the object. contentPropertyName (String)
If you need to access the Base object, copy contentapi.jar from wps_root/shared/app/contentLib and emf.jar from was_root/lib into your project and add them to your classpath. Then, typecast the contentModelBaseObject to com.ibm.content.model.Base.
Name of the DataStream property (for example, data) that is being decoded.contentInputStream (java.io.InputStream)
The stream of bytes that represents the DataStream property that you are decoding (for example, the contents of the data property of CollaborativeDocument). xmlElementName (String)
XML element name for the property being decoded as it was declared in the XML schema defining the XML representation of the contentModelBaseObject. searchResultsXml or detailXml (IXml)
XML for the current document or folder. Typically, after you decode the stream of bytes from the contentInputStream, add an element and the decoded content to the XML. The following code example demonstrates adding an element name as it exists in the schema (so it will be picked up by the Data Page builder and displayed in your application). Then, add the decoded content.
String decodedContent = ... ; // Var that holds your decoded content
IXml contentElement = searchResultsXML.addChildElement( xmlElementName );
contentElement.addCDATASection( decodedContent );
Parent topic: Portal Document Manager Access builder: wpf7