Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9239

Re: Publication Source Documents

$
0
0

Hi ,

 

Refer to the sample code provided below to list all the documents included in a publication using java SDK:

<%@ page import="com.businessobjects.sdk.plugin.desktop.publication.*,   
com.crystaldecisions.sdk.occa.infostore.*,  
 com.crystaldecisions.sdk.framework.*,   
com.crystaldecisions.sdk.plugin.CeKind,
java.util.*"
%><%          // Retrieve the logon information (this was entered on the index.html page).    String userName = "username";    String password = "password";    String cmsName = "localhost:6400";    String authType = "secEnterprise";    String publicationName = "test_pub";
%><%        ISessionMgr boSessionMgr = null;    IEnterpriseSession boEnterpriseSession = null;               // Initialize the Session Manager by getting it from the Crystal Enterprise class's          // getSessionMgr function.          boSessionMgr = CrystalEnterprise.getSessionMgr();            // Logon to the Session Manager to create a new BOE session.  Pass in the user name, password,          // the CMS name, and the authentication type.          boEnterpriseSession = boSessionMgr.logon(userName, password, cmsName, authType);
%><%          // Business Objects Declarations.    IInfoStore boInfoStore = null;    IInfoObjects boPublicationInfoObjects = null;    IInfoObject boPublicationInfoObject = null;    IPublicationEventHandlers boPublicationEventHandlers = null;    IPublicationEventHandler boPublicationEventHandler = null;    IPublicationEventHandlerInfo boPublicationEventHandlerInfo = null;  
try 
{    
//Retrieve the InfoStore object.    
boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");        
 // Retrieve the desired publication.    
boPublicationInfoObjects = boInfoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND = '" + CeKind.PUBLICATION + "' AND SI_NAME = '" + publicationName + "' AND SI_INSTANCE = 0");    
boPublicationInfoObject = (IInfoObject) boPublicationInfoObjects.get(0);         
// Cast the publication infoObject to IPublication.    
IPublication boPublication = (IPublication)boPublicationInfoObject; 
out.println("<b>Publication Name: </b>" + boPublicationInfoObject.getTitle() +"<br><br>");  
Collection collection= boPublication.getDocuments();
Iterator iterator = collection.iterator();     
out.println("<b>SourceDocument Info </b><br><br>");      while (iterator.hasNext()){
Object data = iterator.next();
String data1=(String)data.toString();
IInfoObjects sourceobjects= (IInfoObjects)boInfoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID="+ data);
IInfoObject sourceobject=  (IInfoObject)sourceobjects.get(0);          out.println("<b> Report Name: </b>" + sourceobject.getTitle() + "<br>");          out.println("<b> Report CUID: </b>" + sourceobject.getCUID()+ "<br><br>");      }
boPublicationEventHandlers = boPublication.getPublicationEventHandlers();
boPublicationEventHandler = boPublicationEventHandlers.getPublicationEventHandler(CePropertyID.SI_ON_READ_RECIPIENTS);   // Trigger when publication reads the list of recipients   
boPublicationEventHandlerInfo  = (IPublicationEventHandlerInfo)boPublicationEventHandler.get(0);
IInfoObjects dynamicdocinfos = boInfoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID="+boPublicationEventHandlerInfo.getDynamicDataDocumentID());
IInfoObject  dynamicdocinfo= (IInfoObject) dynamicdocinfos.get(0);
out.println("<b>Dynamic Recipients Document Info </b><br><br>");
out.println("<b> Report Name: </b>" + dynamicdocinfo.getTitle() + "<br>");
out.println("<b> Report Kind: </b>" + dynamicdocinfo.getKind() + "<br>");
out.println("<b>Report CUID: </b>" + dynamicdocinfo.getCUID() + "<br><br>");  
} catch (Exception ex) {                      out.println(ex);            } finally {                    // Ensure clean-up of the Enterprise session.                if(boEnterpriseSession != null) {                  try {                      boEnterpriseSession.logoff();                  } catch(Exception e_ignore_in_cleanup) {}              }           }
%>

 

The above jsp sample will display the details of source document(s) and dynamic recipient document included in a crystal report.

 

Hope it helps.

 

Regards,

Anchal


Viewing all articles
Browse latest Browse all 9239

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>