This document provides a way get the failed instance information using the BusinessObjects Enterprise Platform Java SDKs.
For more scripts and information on how to run these scripts refer to the blog avaiable here:
shawn.penner/blog/2013/06/04/scripts-and-samples
Below is the Java Server Pages (JSP) sample
Notes:
•You would need to change the userName, password, cmsName to the values specific to your enterprise server in the provided sample code.
Get Failed Instance Information |
---|
<%@ page import="com.crystaldecisions.sdk.plugin.desktop.program.*, com.crystaldecisions.sdk.framework.*, com.crystaldecisions.sdk.occa.infostore.*, com.crystaldecisions.sdk.exception.*, java.io.FileWriter, java.io.IOException, com.crystaldecisions.sdk.occa.report.lib.PropertyBag, com.crystaldecisions.sdk.properties.IProperties, com.crystaldecisions.sdk.properties.IProperty, java.util.*" %> <% String user = "Administrator"; String password = "<Administrator-Password>"; String cmsName = "<CMS-NAME>"; String cmsAuthType = "secEnterprise"; String starttime=null; String endtime=null; String retriesAttempted=null; IEnterpriseSession es=null; try { String statusCheck=null; String typeCheck=null; es = CrystalEnterprise.getSessionMgr().logon( user, password, cmsName, cmsAuthType); IInfoStore iStore = (IInfoStore) es.getService("", "InfoStore"); IInfoObjects infoobjects = iStore .query("SELECT * from CI_INFOOBJECTS WHERE si_instance=1 and si_schedule_status=3"); for(int i=0;i<infoobjects.size();i++) { IInfoObject infoobject=(IInfoObject) infoobjects.get(i); ISchedulingInfo schedInfo=infoobject.getSchedulingInfo(); int instanceID=infoobject.getID(); String instanceName=infoobject.getTitle(); String errorMsg=schedInfo.getErrorMessage(); out.println("<b>Instance ID :</b>"+instanceID+"<br>"); out.println("<b>Instance Name :</b>"+instanceName+"<br>"); int type=schedInfo.getType(); out.println("<br><b> Type of the report :</b><br>"); switch(type) { case CeScheduleType.ONCE: typeCheck="ONCE"; out.println(typeCheck); break; case CeScheduleType.HOURLY: //Job has failed. typeCheck="HOURLY"; out.println(typeCheck); break; case CeScheduleType.DAILY: //Job is paused. typeCheck="DAILY"; out.println(typeCheck); break; case CeScheduleType.WEEKLY: //Job is pending. typeCheck="WEEKLY"; out.println(typeCheck); break; case CeScheduleType.MONTHLY: //Job is running. typeCheck="MONTHLY"; out.println(typeCheck); break; case CeScheduleType.NTH_DAY: typeCheck="NTH_DAY"; out.println(typeCheck); break; case CeScheduleType.FIRST_MONDAY: //Job has failed. typeCheck="FIRST_MONDAY"; out.println(typeCheck); break; case CeScheduleType.LAST_DAY: //Job is paused. typeCheck="LAST_DAY"; out.println(typeCheck); break; case CeScheduleType.CALENDAR: //Job is pending. typeCheck="CALENDAR"; out.println(typeCheck); break; case CeScheduleType.CALENDAR_TEMPLATE: //Job is running. typeCheck="CALENDAR_TEMPLATE"; out.println(typeCheck); break; } IProperties instanceProperties=(IProperties)infoobject.properties(); IProperty instanceProperty=instanceProperties.getProperty("SI_STARTTIME"); if(instanceProperty != null) { starttime=instanceProperty.getValue().toString(); out.println("<br><b>Instance Start Time :</b>"+starttime+"<br>"); } IProperties instanceProperties1=(IProperties)infoobject.properties(); IProperty instanceProperty1=instanceProperties1.getProperty("SI_ENDTIME"); if(instanceProperty1 != null) { endtime=instanceProperty1.getValue().toString(); out.println("<br><b>Instance End Time :</b>"+endtime+"<br>"); } IProperties instanceProperties2=(IProperties)infoobject.getSchedulingInfo().properties(); IProperty instanceProperty2=instanceProperties2.getProperty("SI_RETRIES_ATTEMPTED"); if(instanceProperty2 != null) { retriesAttempted=instanceProperty2.getValue().toString(); out.println("<br><b>Retries Attemted :</b>"+retriesAttempted+"<br>"); } out.println("<b>Error Message :</b>"+errorMsg+"<br>"); out.println("<br>====================================================================<br>"); } } catch(SDKException e) { out.println(e.getMessage()); } finally { es.logoff(); } %> |