Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member184471
Active Participant
Publication is a process that collects many reports (Crystal Reports or WebIntelligence + External Documents), personalizes and distributes them to a mass audience. An overview of the publication functionality can be found in my previous blog: Introduction into the SAP BusinessObject Intelligence Platform Publication
While publications are very powerful in itself; sometimes they still don’t provide all the functionality that our customers are looking for.  This is where publication extensions come into place. Publication extensions let you customize the publication process by writing custom java code. For example, you can use a pre-delivery publication extension to password protect your publication artifacts before delivery. Or you can use a post-delivery publication extension to store the publication artifacts in an additional destination that is currently not supported by the BI platform.
There are two types of publication extensions:
  • Post-processing (pre-delivery) plugins, which allow you to add processing logic after publication contents have been personalized.
  • Distribution complete (post-delivery) plugins, which allow you to add processing logic after publication contents have been delivered.
    
In this blog I will give you an overview about the different types of publication extensions and how to create, deploy, and invoke them programmatically. I will focus primarily on post-processing (pre-delivery)  plugin as they are slightly more powerful than distribution complete (post-delivery) plugins, but a lot of the concepts are similar.
 

Building and deploying custom post-processing (pre-delivery) publication extensions

In order to build a publication extension, you must include pub_common.jar in your class path in addition to the standard SAP BusinessObjects Business Intelligence platform SDK libraries. This file is located by default in <Enterprise Dir>\java\lib. If you are creating a post-processing plugin and you are using the PostProcessingPluginHelper class, then you have to also include pub_processing.jar in your class path. This library is located in the same directory as the pub_common.jar.
A custom post-processing plugin consists of a Java class that implements the  com.businessobjects.publisher.postprocessing.IPublicationPostProcessingPlugin interface. This interface contains two methods, which must be implemented by the plugin class:
MethodDescription
handle
This method is invoked one time for each destination and scope. It must return an IInfoObjects collection containing the artifacts created by the plugin that will be delivered to the recipients associated with the current destination and scope. The parameter is a com.businessobjects.publisher.postprocessing.IPublicationPostProcessingContext object, which contains information about the context, including the current scope and destination, and any parameters that were used to invoke the plugin.
getTargetDestinations
This method must return a collection of com.businessobjects.publisher.postprocessing.PluginTargetDestination representing the destinations for which the plugin will be invoked.
The com.businessobjects.publisher.postprocessing.IPublicationPostProcessingContext contains information about the context, including the current scope and destination, and any parameters that were used to invoke the plugin.  Below is a list of the methods that  can be used in post-processing plugins.
MethodDescription
getAdminLogAdapter()This method returns a logger that can be used to log information during post-processing
getDestination()This method returns the current destination.
getDocuments()This method returns the static documents and schedulable document artifacts for the current scope and destination.
getEnterpriseSession()This method returns the session associated with the current user.
getInfoStore()This method returns an InfoStore object that can be used to query the BusinessObjects Enterprise repository.
getOptions()This method returns the generic parameter value, that was passed in through the CMC UI.
getPluginArtifacts()This method returns all artifacts that have been generated during the publishing process.
getPublication()This method returns the publication that invoked this plugin.
getScopeFilter(IInfoObject doc)This method returns IScopeFilter object that can be used to obtain personalization information
getScopeID()This method returns the ID of the current scope.
getTempDirectory()This method returns the path of the directory on the processing server that is used by BusinessObjects Enterprise for storing temporary files.

The com.businessobjects.publisher.postprocessing.PostProcessingPluginHelper provides several static methods that can be used in post-processing plugins. For example, to add new artifacts, use createInfoObject method. The following code creates a text file info object.

ITxt textInfoObject = (ITxt) PostProcessingPluginHelper.createInfoObject(context, ITxt.PROGID, "text/plain", null, null);

For detailed information on IPublicationPostProcessingPlugin, IPublicationPostProcessingContext, PluginTargetDestination, and PostProcessingPluginHelper, see the SAP BusinessObjects Business Intelligence Platform Java API Reference .

 

An example publication extension is posted at this blog post: Sample Publication Extension: Deliver shortcut to a BI platform folder based on personalization . This post processing publication extension creates a shortcut of the publication artifact in a folder based on the personalization. For example if you personalize on Country and have a folder for USA and Canada, then a shortcut for the publication artifact filtered to USA will be created in a USA folder, and a shortcut for the Canada document will be created in a Canada folder.  

After the publication extension is built into a jar file, it needs to be deployed in the publication extensions directory. The default location of this directory is <Enterprise Dir>\java\lib\publishingPlugins. Once the extension was added, you have to restart the Adaptive Processing Server.

Adding a publication extensions to a publication

A publication extension can be added to a publication either programmatically or from the Central Management Console (CMC). The BI launch pad application does not allow you to specify publication extensions for a publication through the UI.

At this point it is assumed that you have already deployed the publication extension as described above on all computers that run the Adaptive Processing Server.

 

Below are the steps to add a publication extension via the CMC:

  1. Double-click a publication to open it. The "Properties" dialog box appears.
  2. Expand Additional Options, and click Publication Extension.
  3. In the Publication Extension Name box, type a name for the extension.
  4. In the Class Name box, type the fully qualified class name for the extension.
  5. (Optional) In the Parameter box, type a serialized string that your extension requires. What the parameter is would depend on how the extension was designed.
  6. To use the extension after processing but before delivery, above the Before Publication Delivery list, click the Add button. The extension is added to the Before Publication Delivery list.
  7. To use the extension after delivery, above the After Publication Delivery list, click the Add button. The extension is added to the After Publication Delivery list.
  8. Click Save.
  9. Repeat steps 2 to 8 for each extension you want to add.

To define the order in which to execute publication extensions, click Move Up or Move Down under the Before Publication Delivery list or the After Publication Delivery list.

14 Comments