ibi.broker.api.data.schedule
Class Alert

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

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

 The Alert class represents the information needed to set up an Alert Schedule 
 in ReportCaster. Alerts can only be scheduled if a specially formatted Alert FOCUS Executable has been
 created as a Standard Report in Managed Reporting. The Alert FOCUS Executable in Managed Reporting
 will contain code determining the conditions of the alert. This code can be a query that
 tests for certain data conditions, or that checks for the existance of a file. If the conditions 
 are met the alert will fire. When ReportCaster schedules an Alert, it will check the conditions
 of the Alert based upon the frequency of the designated schedule.  Only when the Alert returns true does
 the schedule run. This Alert class includes functionality to determine
 whether the Alert has been triggered and the ability to define 
 how an Alert should be reset after it is triggered.
 
 The code below illustrates the usage of the Alert class. It is taken from the samples
 packaged with the product.

 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 +  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 S07_Add_Alert 
 {

        public S07_Add_Alert(String[] arg) throws Exception
        {
                //   Example of arg
                //   scheduleDescription #group1stkg1e app/alerttes execid execpass
                
                  
          //    Example of Report source
          //    
          //    -* Created by Alert Wizard
          //    -* version 1.0
          //    -* start of the test report
          //    -* Created by Report Assistant
          //    -* HTML Tool
          //    -* Created by Report Assistant
          //    -* FF Line do not change this line! Field Name
          //    -* FF Line do not change this line! Alias
          //    -* FF Line do not change this line! Format
          //    -* FF Line do not change this line! Segment
          //    -SET &CURTIME = HHMMSS(TIME);
          //    -SET &MNT = EDIT(&CURTIME,'$$$$9$$$');
          //    -* End Report Assistant
          //    -* end of the test report
          //    -* start of the test
          //    -IF &MNT GT 5 GOTO ALERTEXIT;
          //    -* end of the test
          //    -* start of the output report
          //    -* Created by Report Assistant
          //    -* HTML Tool
          //    -* Created by Report Assistant
          //    -* FF Line do not change this line! Field Name
          //    -* FF Line do not change this line! Alias
          //    -* FF Line do not change this line! Format
          //    -* FF Line do not change this line! Segment
          //    TABLE FILE CAR
          //    SUM CAR.COMP.CAR
          //    CAR.ORIGIN.COUNTRY
          //    ON TABLE SET HTMLCSS ON
          //    ON TABLE NOTOTAL
          //    END
          //    -* End Report Assistant
          //    -* end of the output report
          //    -* start of the options
          //    -* TWO_WAY_EMAIL=
          //    -* TWO_WAY_EMAILDOMAIN=
          //    -* TWO_WAY_EMAILDESCRIPTION=
          //    -* TWO_WAY_EMAILFOLDER=
          //    -* end of the options
          //    -ALERTEXIT
          //    -* End Alert Wizard
                        
                String scheduleDescription = arg[0];
                String folderHREF = arg[1];
                String procedureHREF = arg[2];
                String execId = arg[3];
                String execPassword = arg[4];
                
                String domainHREF = "untitled/untitled.htm";
                
                // 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);
                
                //set distribution to library
                StorageLibrary distribution = new StorageLibrary();
                schedule.setDistribution(distribution);
                
                //create task
                TaskStandardReport task = new TaskStandardReport();
                task.setProcedureName(procedureHREF);
                task.setDomainHREF(domainHREF);
                task.setFolderHREF(folderHREF);
                task.setExecId(execId);
                task.setExecPassword(execPassword);

                //create TimeInfoMinute
                TimeInfoMinute timeInfo = new TimeInfoMinute();
                GregorianCalendar startTime = new GregorianCalendar();
                timeInfo.setStartTime(startTime);
                GregorianCalendar endTime = new GregorianCalendar();
                endTime.add(Calendar.MINUTE, 30);
                timeInfo.setEndTime(endTime);
                timeInfo.setFrequency(1);
                timeInfo.setMonday(true);
                timeInfo.setTuesday(true);
                timeInfo.setWednesday(true);
                timeInfo.setThursday(true);
                timeInfo.setFriday(true);
                timeInfo.setSaturday(true);
                timeInfo.setSunday(true);
                schedule.setTimeInfo(timeInfo);
                
                // Create alert
                Alert alert = new Alert();
                task.setAlert(alert);
                task.setAlertEnabled(true);
                schedule.setTaskList(new Task[]{task});
                
                //subscribe schedule
                manager.addSchedule(schedule);
        }
        
        public static void main(String[] arg)
        {
                S07_Add_Alert sampl = null;
                if(arg.length < 5) {
                         menu();
                         return;
                }
                try
                {
                        System.out.println("\n******* " + S07_Add_Alert.class.getName() + " *****************");
                        sampl = new S07_Add_Alert(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 " + S07_Add_Alert.class.getName() + " <scheduleDescription> <folderHREF> <procedureHREF> <execId> <execPassword>");       
        }
}
 

See Also:
Serialized Form

Field Summary
static java.lang.String AUTO
          String identifier for Alert reset period (reset type) of AUTO.
static java.lang.String CONTINUE
          String identifier for Alert reset period (reset type) of CONTINUE.
static java.lang.String DAY
          String identifier for Alert reset period (reset type) of a DAY.
static java.lang.String HOUR
          String identifier for Alert reset period (reset type) of a HOUR.
static java.lang.String MINUTE
          String identifier for Alert reset period (reset type) of a MINUTE.
static java.lang.String MONTH
          String identifier for Alert reset period (reset type) of a MONTH.
static java.lang.String TERMINATE
          String identifier for Alert reset period (reset type) of TERMINATE.
static java.lang.String WEEK
          String identifier for Alert reset period (reset type) of a WEEK.
static java.lang.String YEAR
          String identifier for Alert reset period (reset type) of a YEAR.
 
Constructor Summary
Alert()
           
 
Method Summary
 int getResetInterval()
          Obtains the time interval (delay) between when an alert schedule is run upon being triggered and when it is reactivated.
 java.lang.String getResetType()
          Obtains reset type for an alert in the form of a String Constant.
 boolean isTriggered()
          Obtains a boolean signifying whether or not the alert has been triggered.
 boolean isTwoWayEmailAttached()
          Obtains a boolean signifying whether or not the alert has an attached Two-Way Email message.
 void setResetInterval(int resetInterval)
          Assigns the time interval (delay) between when an alert schedule is run upon being triggered and when it is reactivated.
 void setResetType(java.lang.String resetType)
          Assigns the reset type for an alert in the form of a String Constant.
 void setTriggered(boolean triggered)
          Assigns a Boolean signifying whether or not the alert has been triggered.
 void setTwoWayEmailAttached(boolean twoWayEmailAttached)
          Assigns a boolean signifying whether or not the alert has an attached Two-Way Email message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINUTE

public static final java.lang.String MINUTE
String identifier for Alert reset period (reset type) of a MINUTE.

See Also:
Constant Field Values

HOUR

public static final java.lang.String HOUR
String identifier for Alert reset period (reset type) of a HOUR.

See Also:
Constant Field Values

DAY

public static final java.lang.String DAY
String identifier for Alert reset period (reset type) of a DAY.

See Also:
Constant Field Values

WEEK

public static final java.lang.String WEEK
String identifier for Alert reset period (reset type) of a WEEK.

See Also:
Constant Field Values

MONTH

public static final java.lang.String MONTH
String identifier for Alert reset period (reset type) of a MONTH.

See Also:
Constant Field Values

YEAR

public static final java.lang.String YEAR
String identifier for Alert reset period (reset type) of a YEAR.

See Also:
Constant Field Values

CONTINUE

public static final java.lang.String CONTINUE
String identifier for Alert reset period (reset type) of CONTINUE.

See Also:
Constant Field Values

AUTO

public static final java.lang.String AUTO
String identifier for Alert reset period (reset type) of AUTO.

See Also:
Constant Field Values

TERMINATE

public static final java.lang.String TERMINATE
String identifier for Alert reset period (reset type) of TERMINATE.

See Also:
Constant Field Values
Constructor Detail

Alert

public Alert()
Method Detail

getResetInterval

public int getResetInterval()
Obtains the time interval (delay) between when an alert schedule is run upon being triggered and when it is reactivated. The actual time period is based on the reset type. For example if the reset type is HOUR, a specified reset interval of 3 would represent a 3 hour delay.

Returns:
The reset interval as an integer.
See Also:
setResetInterval(int resetInterval)

setResetInterval

public void setResetInterval(int resetInterval)
Assigns the time interval (delay) between when an alert schedule is run upon being triggered and when it is reactivated. The actual time period is based on the reset type. For example if the reset type is HOUR, a specified reset interval of 3 would represent a 3 hour delay.

Parameters:
resetInterval - A reference to the reset interval.
See Also:
getResetInterval()

getResetType

public java.lang.String getResetType()
Obtains reset type for an alert in the form of a String Constant. The default reset type is AUTO. The String constants that can be returned are:
 MINUTE
 HOUR
 DAY
 WEEK
 MONTH
 YEAR
 CONTINUE
 AUTO
 TERMINATE
         

Returns:
Returns the resetType.
See Also:
MINUTE, HOUR, DAY, WEEK, MONTH, YEAR, CONTINUE, AUTO, TERMINATE, setResetType(String resetType)

setResetType

public void setResetType(java.lang.String resetType)
Assigns the reset type for an alert in the form of a String Constant. The default reset type is AUTO. The String constants that can be assigned are:
 MINUTE
 HOUR
 DAY
 WEEK
 MONTH
 YEAR
 CONTINUE
 AUTO
 TERMINATE
         

Parameters:
resetType - A String constant indicating the reset type.
See Also:
MINUTE, HOUR, DAY, WEEK, MONTH, YEAR, CONTINUE, AUTO, TERMINATE, getResetType()

isTriggered

public boolean isTriggered()
Obtains a boolean signifying whether or not the alert has been triggered. If the alert has been set off, the flag value is TRUE. If not, the value is FALSE.

Returns:
The value of the alert triggered flag as a boolean.
See Also:
setTriggered(boolean triggered)

setTriggered

public void setTriggered(boolean triggered)
Assigns a Boolean signifying whether or not the alert has been triggered. If the alert has been set off, the flag value is TRUE. If not, the value is FALSE.

Parameters:
triggered - A boolean indicating whether the alert has been triggered.
See Also:
isTriggered()

isTwoWayEmailAttached

public boolean isTwoWayEmailAttached()
Obtains a boolean signifying whether or not the alert has an attached Two-Way Email message. If the Two-Way Email is attached, the flag value is TRUE. If not, the value is FALSE.

Returns:
A boolean indicating whether a TwoWayEmail is attached.
See Also:
setTwoWayEmailAttached(boolean twoWayEmailAttached)

setTwoWayEmailAttached

public void setTwoWayEmailAttached(boolean twoWayEmailAttached)
Assigns a boolean signifying whether or not the alert has an attached Two-Way Email message. If the Two-Way Email is attached, the flag value is TRUE. If not, the value is FALSE.

Parameters:
twoWayEmailAttached - A boolean indicating whether a TwoWayEmail is attached.
See Also:
isTwoWayEmailAttached()


Copyright © 2006 Information Builders, Incorporated.