Intellicus Enterprise Reporting and Business Insights 19.0

Schedules

0 views June 28, 2020 0

Scheduling of reports is very helpful for better utilization of server and printer resources. Reports that take longer to run can be scheduled to save your time.

Report that needs processing of large volume of data and need server and printer resources for long time can be scheduled to be generated over the weekend when load on servers would be relatively low. By scheduling a report, it can be sent to multiple deliverables at a time, which is otherwise not possible.

Get the list of scheduled jobs

This Java API is used to get the list of All Scheduled Jobs.

This program:

  1. Returns list of report schedules for a selected report.
  2. Report schedule list can be filtered for ReportId and UserId

Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/ GetScheduleJobList.java for sample code of this use case.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a Scheduler Manager class object. This is the controller class for all operations related to scheduler. The class provides methods which acts as an interface for sending diffrent requests related to Scheduler to report engine from the jsps.

SchedulerManager schdMgr            =            new SchedulerManager();

  1. Set the filter values corresponding to respective fields for getting filtered list of Scheduled Jobs.

// Create a Filter class Object
Filter filterObj = new Filter(); 
// set filter for private schedule jobs
filterObj.setFilterField(Enums.Filters.ScheduledJob.ISPUBLIC, false);		  
// set filter for dedicated(Non-shared) schedule jobs
filterObj.setFilterField(Enums.Filters.ScheduledJob.ISSHARED, false);		  
//Set the ReportId filter for getting all report schedules for this Report
String reportId	= "93F21A40-01DD-DFFC-C874-A7E30A27A127";
filterObj.setFilterField(Enums.Filters.ScheduledJob.REPORTID,reportId);
String userID	= "HostUser";
filterObj.setFilterField(Enums.Filters.ScheduledJob.USERID,userID);		   
//Set the orgId filter for getting list of report schedules of a user of this organization only
String orgId	= "HostOrg";
filterObj.setFilterField(Enums.Filters.ScheduledJob.ORGID,orgId);

 

  1. Get the Scheduled Job List based on filter applied.

Method: getScheduledJobList

public java.util.ArrayList getScheduledJobList(Filter filterObj, UserInfo userInfo) throws SchedulerException

This method returns the scheduleJobList in ArrayList containing HashMap as each element for each row. The HashMap contains the details required for showing the list like the schedule job name, schedule job id etc. as name value pair.

Parameters:

  • Filter: May take below fields

i.e.

Enums.Filters.ScheduledJob.ISPUBLIC

Enums.Filters.ScheduledJob.ISSHARED

Enums.Filters.ScheduledJob.REPORTID

Enums.Filters.ScheduledJob.ORGID

Enums.Filters.ScheduledJob.SCHEDULE

Enums.Filters.ScheduledJob.USERID

Enums.Filters.ScheduledJob.BATCHID

  • UserInfo: The userInfo object for authorization.

// This will return array of Scheduled Jobs list from the Intellicus Repository

ArrayList jobList = schdMgr.getScheduledJobList(filterObj, requestorUserInfo);

Create a Schedule Job

This Java API is used to create Scheduled Job that runs only once at a given time.

This program

  1. Sets business parameters required to execute the report.
  2. Creates a report delivery task.
  3. Creates a ScheduleJob using 2).

Refer to

  1. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateDailyReportScheduleWithAllDeliveryOptions.java
  2. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateDailyReportScheduleWithEmailDelivery.java
  3. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateMonthlyReportSchedule.java
  4. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateNewSchedule.java
  5. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateOnceReportSchedule.java
  6. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/CreateNewTask.java
  7. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/DeleteScheduleJob.java
  8. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/GetHistory.java
  9. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/GetHistoryAndDetail.java
  10. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/GetScheduleJobList.java
  11. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/GetTaskParameters.java
  12. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/RunNowScheduleJob.java
  13. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/RunOnceScheduleJob.java
  14. <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/ScheduleReportlist.java

for sample code of this use case.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a SchedulerManager class object. This is the controller class for all operations related to scheduler. The class provides methods acting as an interface for sending diffrent requests related to Scheduler to report engine from the jsps.

SchedulerManager schdMgr            =            new SchedulerManager();

  1. Create an instance of Task and set its various properties.

Task task		=	new Task();
String batch_Name = Task_Once;
task.setBatchName(batch_Name);
String rep_Id = 93F21A40-01DD-DFFC-C874-A7E30A27A127;
task.setReportID(rep_Id);
task.setReportFormat(InteraConstants.ReportFormats.PDF);
task.setIsPublic(false);
task.setIsShared(false);

 

  1. Set the Delivery Options for Task and related properties.
     
    For E-mail

    task.setDeliveryOperationType(com.intellica.client.common.Enums.Batch.DispatchOperationTypes.EMAIL);
    // get EmailProperty object for setting Email attributes
    EMailProperty  eMailProp	=	task.getEMailProperty();
    
    String mail_To = HostUser@HostOrg.com;
    String mail_Sub = Mail Subject goes here;
    String mailMsg = Dear User, Please find  <%Report_Name%>  attached;
    
    eMailProp.setMailAttach(true);
    eMailProp.setMailTO(mail_To);
    eMailProp.setMailSUB(mail_Sub);
    eMailProp.setMailMSG(mailMsg);
    

     
    For FTP

    Part of Sample Code implementing FTP Delivery Option:

    task.setDeliveryOperationType(com.intellica.client.common.Enums.Batch.DispatchOperationTypes.FTP);

    String serverName = “ftp.intellicus.com”;

    String username = “upload”;

    String password = “download”;

    String folderName = “transferbin”;

    String fileName = “MyFile”;

    // get FTPProperty object for setting Email attributes

    FTPProperty ftpProp = task.getFTPProperty();

    ftpProp.setServerName(serverName);

    ftpProp.setUserName(username);

    ftpProp.setPassword(password);

    ftpProp.setFolderName(folderName);

    ftpProp.setFileName(fileName);

    For Publish Report

    Part of Sample Code implementing Publish Delivery Option:

    task.setDeliveryOperationType(com.intellica.client.common.Enums.Batch.DispatchOperationTypes.PUBLISH);
    
    //get PublishProperty object for setting publish attributes for //the task
    PublishProperty publishProp = task.getPublishProperty();
    
    String fileName = Shared_Publish1;				
    //setter method for saveFileName member variable. 
    publishProp.setSaveFileName(fileName);
    
    //setter method for isPublic member variable.
    publishProp.setIsPublic(true);	//True : Set the Published 								//Report as Public
    
    //setter method for periodType member variable.
    //Enums.Batch.PeriodType.ENDPERIOD : valid upto end of Day, Hour, //Month, Week, Year.
    //For ENDPERIOD, call setEndPeriod to set the value to Day, Hour, //Month, Week, Year.
    //Enums.Batch.PeriodType.EXPIRYDATE : valid upto a particular //date
    //For EXPIRYDATE, call setPublishValidUptoFixedDate to set the //end Date.
    //Enums.Batch.PeriodType.INTERVALPERIOD : valid upto fixed //interval 
    //For INTERVALPERIOD, call setIntervalValue and then set the //value for Interval Period.
    publishProp.setPeriodType(Enums.Batch.PeriodType.ENDPERIOD);
    			
    //setter method for endPeriod member variable when Period Type is //set to ENDPERIOD
    //It sets the endPeriod value to either Hour/Day/Week/MonthYear. 
    publishProp.setEndPeriod(com.intellica.client.common.Enums.Batch.EndPeriod.YEAR);
    

     
    For Print Report

    Part of Sample Code implementing Publish Delivery Option:

    task.setDeliveryOperationType(com.intellica.client.common.Enums.Batch.DispatchOperationTypes.PRINT);

    //This class holds PrintProperty for Task.

    //All the variables are used for making a print request.

    PrintProperty printProp = task.getPrintProperty();

    int printCopies = 1;

    String printerName = “Microsoft XPS Document Writer”;

    //Number of copies to be printed

    printProp.setPrintCopies(1);

    //Printer name that is used for printing

    printProp.setPrinterName(printerName);

    //Set the number of pages to be printed

    printProp.setPrintPageRange(“All”);

  2. Create schedule for the Scheduled Job and set its Frequency Type
  • Daily Freequency Type

To Set Frequency type as Daily

Enums.Schedule.FrequencyTypes.DAILY

Schedule schedule             =            new Schedule();

schedule.setFrequencyType(Enums.Schedule.FrequencyTypes.DAILY);

  • Monthly Freequency Type

To Set Frequency type as Monthly

Enums.Schedule.FrequencyTypes.MONTHLY

Schedule schedule             =            new Schedule();

schedule.setFrequencyType(Enums.Schedule.FrequencyTypes.MONTHLY);

  • Weekly Freequency Type

To Set Frequency type as Weekly

Enums.Schedule.FrequencyTypes.WEEKLY

Schedule schedule             =            new Schedule();

schedule.setFrequencyType(Enums.Schedule.FrequencyTypes.WEEKLY);

  1. Create Scheduled Job and associate created Task and Schedule to this Scheduled Job.

//create a SCHEDULEDJOB

ScheduleJob        schdJob =            new ScheduleJob(task,schedule);

  1. Set Run Type for Scheduled Job

This is setter method for runType member variable.

public void setRunType(java.lang.String runType)

Enums.ScheduledJob.JobTypes.NOW

Enums.ScheduledJob.JobTypes. ONCE

Enums.ScheduledJob.JobTypes.RECUR

Parameters:

  • RunType: Takes String value.

Part of Sample code for “NOW” as Run-type:

ScheduleJob        schdJob               =            new ScheduleJob();

schdJob.setRunType(Enums.ScheduledJob.JobTypes.NOW);

Part of Sample code for “ONCE” as Run-type:

ScheduleJob        schdJob               =            new ScheduleJob();

schdJob.setRunType(Enums.ScheduledJob.JobTypes.ONCE);

schdJob.setOnceDate(“10/03/2007”);

schdJob.setOnceTime(“10:52:10”);

Part of Sample code for “RECUR” as Run-type:

ScheduleJob        schdJob               =            new ScheduleJob();

schdJob.setRunType(Enums.ScheduledJob.JobTypes.RECUR);

schdJob.setFrequencyType(Enums.Schedule.FrequencyTypes.DAILY);

schdJob.setAfterDays(2);

  1. Add the Scheduled Job in the Repository.

Method : addScheduleJob(schdJob,userInfo)

public void addScheduleJob( ScheduleJob scheduleJob, UserInfo userInfo)

throws SchedulerException

Adds ScheduleJob alongwith Schedule and Task depending on whether they are created Shared or Dedicated in the Intellicus Repository.

Parameters:

  • ScheduleJob: The ScheduleJob object.
  • UserInfo: The userInfo object for authorization.

schdMgr.addScheduleJob(schdJob,requestorUserInfo);

Delete Schedule Job

This Java API is used to delete dedicated scheduledJob selected from the list.

Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/DeleteScheduleJob.java for sample code of this use case.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a SchedulerManager class object. This is the controller class for all operations related to scheduler. The class provides methods which acts as an interface for sending diffrent requests related to Scheduler to report engine from the jsps.

SchedulerManager schdMgr            =            new SchedulerManager();

  1. Delete Scheduled Job with given scheduledJob Id.

 Method : deleteScheduledJob

public void deleteScheduledJob(java.lang.String jobID, UserInfo userInfo)

throws SchedulerException

This method deletes an existing ScheduledJob.

Parameters:

  • JobID: Takes a String value.
  • UserInfo: The userInfo object for authorization.

String schdJobId  =            “114016239210”;

schdMgr.deleteScheduledJob(schdJobId,requestorUserInfo);

Get the input parameter names and their values set at the task creation time.

This Java API is used to get the input Parameter names whose values are set at the Task Creation time.

Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/Schedules/GetTaskParameters.java for sample code of this use case.

This program:

  1. Prepare a scheduler manager object
  2. Get the task object for the specified task id
  3. Get the hash map of input parameter from the task object
  4. Get the input parameter names and their values set at the task creation time.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a SchedulerManager class object. This is the controller class for all operations related to scheduler. The class provides methods acting as an interface for sending different requests related to Scheduler to report engine from the jsps.

SchedulerManager schdMgr            =            new SchedulerManager();

  1. Get the Task instance for given Task Id whose input parameters are to be obtained.

String taskId         =            “1169627272589”;

Task taskObj        =            schdMgr.getTask(taskId, requestorUserInfo);

  1. Get the Input Parameters for this Task.

Method: getInputParamMap

public java.util.HashMap getInputParamMap()

getter method for inputParamMap member variable.

Returns:

inputParamMap as HashMap.

HashMap inputParamMap = taskObj.getInputParamMap();