ibi.broker.api.data.schedule
Class Schedule

java.lang.Object
  extended by ibi.broker.api.data.schedule.Schedule
All Implemented Interfaces:
java.io.Serializable

public class Schedule
extends java.lang.Object
implements java.io.Serializable

Encapsulates the process of scheduling reports for distribution by ReportCaster. Each schedule object is represented by a unique identifier called a scheduleID and is comprised of objects including Destination, Distribution, TimeInfo and Task. These represent the components of the schedule. The code example below shows an implementation of the Schedule class. It is taken from the coding samples packaged with the product in the samples directory.


 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 +  Copyright (c) 2004 Information Builders, Inc. All  Rights Reserved.     +
 +                                                                          +
 +  Information Builders offers sample API programs as a heuristic device.  +
 +  They are not intended, as is, for production use. Licensed users are    +
 +  welcome to alter and extend these samples and deploy them in other      +
 +  environments, or alternate configurations, as they see fit.             +
 +  Information Builders will support the documented functionality of       +
 +  its API classes and methods. However, Information Builders is not       +
 +  responsible for functionality or behavior of products built with        +
 +  its API unless the documented behavior of its discrete classes and      +
 +  methods is different than the actual results.                           +
 +                                                                          +
 +  Redistributions of IBI source code and documentation must be within     +
 +  the scope of the Information Builders Software License Agreement.       +
 +                                                                          +
 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   

 public class S02_Add_Email 
{
        public S02_Add_Email(String[] arg) throws Exception
        {
                //   Example of arg
                //   scheduleDescription car execid execpass xxx@ibi.com
                // 
                //Example of Report source
                //TABLE FILE CAR
                //PRINT CAR WHERE  
                //COUNTRY EQ 'ENGLAND'
                //END
                

                String scheduleDescription = arg[0];
                String fexFileName = arg[1];
                String execId = arg[2];
                String execPassword = arg[3];
                String emailAddress = arg[4];
                
                // Create ScheduleManager
                ScheduleManager manager = Util.createCasterConnection().getScheduleManager();
                
                //create object schedule with default values from config file
                Schedule schedule = manager.createScheduleInstanceDefault();
                
                //set description
                schedule.setDescription(scheduleDescription);
                
                //create destination
                Destination destination = new Destination();
                destination.setType(Destination.SINGLE_ADDRESS);
                destination.setSingleAddress(emailAddress);
                
                //set distribution to email - not absolutely necessary using a default schedule instance
                DistributionEmail distribution = (DistributionEmail)schedule.getDistribution();
                
    distribution.setDestination(destination);
    distribution.setInlineMessage("inLineMessage");
    distribution.setInlineTaskIndex(0);
    distribution.setMailFrom("mailFrom");
    distribution.setMailReplyAddress("mailReplyAddress");
    distribution.setMailServerName("mailserver");
    distribution.setMailSubject("subject");
    schedule.setDistribution(distribution);
                
                //create task
                TaskWFServerProcedure task = new TaskWFServerProcedure();
                task.setProcedureName(fexFileName);
                task.setReportName("Report for " + fexFileName);
                task.setExecId(execId);
                task.setExecPassword(execPassword);
                schedule.setTaskList(new Task[]{task});
                
                //subscribe schedule
                manager.addSchedule(schedule);
        }
        public static void main(String[] arg)
        {
                S02_Add_Email sampl = null;
                if(arg.length < 5) {
                         menu();
                         return;
                }
                try
                {
                        System.out.println("\n******* " + S02_Add_Email.class.getName() + " *****************");
                        sampl = new S02_Add_Email(arg);
                        System.out.println("\n" + sampl.getClass().getName() + " OK");
                }
                catch(Exception ce)
                {
                        ce.printStackTrace();
                        System.out.println(sampl.getClass().getName() + " FAIL");
                }       
        }
        private static void menu()
        {
                System.out.println("Usage: java " + S02_Add_Email.class.getName() + " <scheduleDescription> <fexFileName> <execId> <execPassword> <emailAddress>");       
        }
}
 

See Also:
Serialized Form

Field Summary
static int TRACE_DEFAULT
           
static int TRACE_NONE
           
static int TRACE_SCHEDULE
           
static int TRACE_SCHEDULE_AND_REPORT
           
 
Constructor Summary
Schedule()
           
 
Method Summary
 java.lang.String getDescription()
          Obtains the text describing the job that is being scheduled.
 Distribution getDistribution()
          Obtains the Distribution object associated with this Schedule.
 Task getFirstTask()
           
 java.lang.String getId()
          Obtains the unique identifier to this schedule, also known as a scheduleID.
 java.util.Calendar getLastTimeExecuted()
           
 Notification getNotification()
          Obtains an instance of the Notification object associated with this Schedule.
 java.lang.String getOwner()
          Obtains the ReportCaster owner of this schedule, which is a ReportCaster userid.
 int getPriority()
          Obtains the priority level for the scheduled job.
 java.lang.String getStatusLastExecuted()
           
 Task[] getTaskList()
          Obtains an array of Task objects, with each Task object containing one report to be distributed as part of this schedule.
 TimeInfo getTimeInfo()
          Obtains the TimeInfo object associated with this schedule, which contains the frequency and time parameters indicating when and how often this schedule should run.
 int getTraceType()
          Returns the trace type setting, as an integer.
 boolean isActive()
          Obtains the state of the boolean flag indicating whether or not a scheduled distribution is active.
 boolean isCompressedReport()
          Returns the value of the compressedReport property.
 boolean isDeleteJobAfterRun()
          Obtains the state of the boolean flag indicating whether or not a schedule is deleted after running the job.
 void setActive(boolean active)
          Assigns the boolean flag indicating whether or not a scheduled distribution is active.
 void setCompressedReport(boolean b)
          Sets the value of the compressedReport property.
 void setDeleteJobAfterRun(boolean deleteJobAfterRun)
          Assigns a boolean flag indicating whether or not a schedule is deleted after running the job.
 void setDescription(java.lang.String description)
          Assigns the text describing the job that is being scheduled.
 void setDistribution(Distribution distribution)
          Assigns the Distribution object associated with this Schedule.
 void setFirstTask(Task task)
           
 void setId(java.lang.String id)
          Assigns a unique identifier to this schedule.
 void setLastTimeExecuted(java.util.Calendar lastTimeExecuted)
           
 void setNotification(Notification notification)
          Specifies the Notification object associated with this Schedule.
 void setOwner(java.lang.String owner)
          Assigns the owner of this schedule.
 void setPriority(int priority)
          Assigns the priority level for the scheduled job.
 void setStatusLastExecuted(java.lang.String statusLastExecuted)
           
 void setTaskList(Task[] taskList)
          Assigns an array of Task objects, with each Task object containing one report that is to be distributed as part of this schedule.
 void setTimeInfo(TimeInfo timeInfo)
          Assigns the TimeInfo object associated to this schedule, which contains the frequency and time parameters indicating when and how often this schedule should run.
 void setTraceType(int traceType)
          Assigns the trace type setting, as an integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE_DEFAULT

public static final int TRACE_DEFAULT
See Also:
Constant Field Values

TRACE_NONE

public static final int TRACE_NONE
See Also:
Constant Field Values

TRACE_SCHEDULE

public static final int TRACE_SCHEDULE
See Also:
Constant Field Values

TRACE_SCHEDULE_AND_REPORT

public static final int TRACE_SCHEDULE_AND_REPORT
See Also:
Constant Field Values
Constructor Detail

Schedule

public Schedule()
Method Detail

isActive

public boolean isActive()
Obtains the state of the boolean flag indicating whether or not a scheduled distribution is active. If TRUE, schedule is active. If FALSE, inactive.

Returns:
The state of the isActive flag as a boolean.
See Also:
setActive(boolean)

setActive

public void setActive(boolean active)
Assigns the boolean flag indicating whether or not a scheduled distribution is active. If TRUE, schedule is active. If FALSE, inactive.

Parameters:
active - Whether schedule active or not.
See Also:
isActive()

getTraceType

public int getTraceType()
Returns the trace type setting, as an integer. The allowable parameters for this constant are:

Returns:
The trace type setting, as an integer.
See Also:
setTraceType(int)

setTraceType

public void setTraceType(int traceType)
Assigns the trace type setting, as an integer. The allowable parameters for this constant are:

Parameters:
traceType - The trace type setting, as an integer.
See Also:
getTraceType()

isDeleteJobAfterRun

public boolean isDeleteJobAfterRun()
Obtains the state of the boolean flag indicating whether or not a schedule is deleted after running the job. If TRUE, the job is deleted after all tasks are complete. If FALSE, the job is not deleted after all tasks are complete.

Returns:
Returns the deleteJobAfterRun.
See Also:
setDeleteJobAfterRun(boolean)

setDeleteJobAfterRun

public void setDeleteJobAfterRun(boolean deleteJobAfterRun)
Assigns a boolean flag indicating whether or not a schedule is deleted after running the job. If TRUE, the job is deleted after all tasks are completed. If FALSE, the job is not deleted.

Parameters:
deleteJobAfterRun - The deleteJobAfterRun to set.
See Also:
isDeleteJobAfterRun()

getDescription

public java.lang.String getDescription()
Obtains the text describing the job that is being scheduled. This text needs to be unique for for each owner of a scheduled job. The maximum size of the description is 90 characters.

Returns:
The description as a text String.
See Also:
setDescription(String)

setDescription

public void setDescription(java.lang.String description)
Assigns the text describing the job that is being scheduled. This text needs to be unique for for each owner of a scheduled job. The maximum size of the description is 90 characters.

Parameters:
description - The description to set.
See Also:
getDescription()

getDistribution

public Distribution getDistribution()
Obtains the Distribution object associated with this Schedule.

Returns:
Returns an instance of the distribution object.
See Also:
setDistribution(Distribution), Distribution

setDistribution

public void setDistribution(Distribution distribution)
Assigns the Distribution object associated with this Schedule.

Parameters:
distribution - The reference to the distribution to set.
See Also:
getDistribution()

getId

public java.lang.String getId()
Obtains the unique identifier to this schedule, also known as a scheduleID. This ID specifies a job uniquely across owners.

Returns:
The identifier as a String.
See Also:
setId(String)

setId

public void setId(java.lang.String id)
Assigns a unique identifier to this schedule. The developer/user should never manipulate this identifier. This method should be used to assign a scheduleID value for fetching data about an existing scheduule. If it is set by the user during schedule creation, ReportCaster will override that setting.

Parameters:
id - The id to set.
See Also:
getId()

getNotification

public Notification getNotification()
Obtains an instance of the Notification object associated with this Schedule.

Returns:
The reference to the Notification object.
See Also:
setNotification(Notification)

setNotification

public void setNotification(Notification notification)
Specifies the Notification object associated with this Schedule. If this isn't set, the default notification is never.

Parameters:
notification - The notification to set.
See Also:
getNotification()

getOwner

public java.lang.String getOwner()
Obtains the ReportCaster owner of this schedule, which is a ReportCaster userid. The maximum size of the owner is 48 characters.

Returns:
Returns a ReportCaster userid as a String.
See Also:
setOwner(String)

setOwner

public void setOwner(java.lang.String owner)
Assigns the owner of this schedule. The maximum size of the owner is 48 characters. The default owner will be the authenticated user.

Parameters:
owner - The owner as a String.
See Also:
getOwner()

getPriority

public int getPriority()
Obtains the priority level for the scheduled job. The value ranges from 1 (highest priority lowest priority) to 5 (lowest priority). The default priority is 3.

Returns:
Returns the priority as an Integer.
See Also:
setPriority(int)

setPriority

public void setPriority(int priority)
Assigns the priority level for the scheduled job. The value ranges from 1 (highest priority) to 5 (lowest priority). The default priority is 3.

Parameters:
priority - The priority to set.
See Also:
getPriority()

getTaskList

public Task[] getTaskList()
Obtains an array of Task objects, with each Task object containing one report to be distributed as part of this schedule. The order of the tasks in the array corresponds to the order the reports will be synchronously run and then distributed by the distribution server.

Returns:
Returns the taskList.
See Also:
setTaskList(Task[]), Task

setTaskList

public void setTaskList(Task[] taskList)
Assigns an array of Task objects, with each Task object containing one report that is to be distributed as part of this schedule. The order of the tasks in the array corresponds to the order the tasks will be synchronously run and then distributed by the distribution server.

Parameters:
taskList - The taskList to set.
See Also:
getTaskList(), Task

getTimeInfo

public TimeInfo getTimeInfo()
Obtains the TimeInfo object associated with this schedule, which contains the frequency and time parameters indicating when and how often this schedule should run.

Returns:
Returns a reference to the timeInfo object.
See Also:
setTimeInfo(TimeInfo), TimeInfo

setTimeInfo

public void setTimeInfo(TimeInfo timeInfo)
Assigns the TimeInfo object associated to this schedule, which contains the frequency and time parameters indicating when and how often this schedule should run.

Parameters:
timeInfo - The reference to the timeInfo object.
See Also:
getTimeInfo(), TimeInfo

isCompressedReport

public boolean isCompressedReport()
Returns the value of the compressedReport property. To verify compression, either turn traces on, or run your java program, then look at the .trc file for that job. You will find information on Report Original Length and Report Compressed Length, or query the BOTLIB table where the field REPORTSIZE shows the original size and the field LIBFIELD1 shows the compressed size.

Returns:
Returns the compressedReport.

setCompressedReport

public void setCompressedReport(boolean b)
Sets the value of the compressedReport property. To verify compression, either turn traces on, or run your java program, then look at the .trc file for that job. You will find information on Report Original Length and Report Compressed Length, or query the BOTLIB table where the field REPORTSIZE shows the original size and the field LIBFIELD1 shows the compressed size.

Parameters:
b - compressedReport The compressedReport to set.

getFirstTask

public Task getFirstTask()

setFirstTask

public void setFirstTask(Task task)

getLastTimeExecuted

public java.util.Calendar getLastTimeExecuted()

setLastTimeExecuted

public void setLastTimeExecuted(java.util.Calendar lastTimeExecuted)

getStatusLastExecuted

public java.lang.String getStatusLastExecuted()

setStatusLastExecuted

public void setStatusLastExecuted(java.lang.String statusLastExecuted)


Copyright © 2006 Information Builders, Incorporated.