|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibi.broker.api.data.schedule.Alert
public class Alert
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>");
}
}
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 |
---|
public static final java.lang.String MINUTE
public static final java.lang.String HOUR
public static final java.lang.String DAY
public static final java.lang.String WEEK
public static final java.lang.String MONTH
public static final java.lang.String YEAR
public static final java.lang.String CONTINUE
public static final java.lang.String AUTO
public static final java.lang.String TERMINATE
Constructor Detail |
---|
public Alert()
Method Detail |
---|
public int getResetInterval()
setResetInterval(int resetInterval)
public void setResetInterval(int resetInterval)
resetInterval
- A reference to the reset interval.getResetInterval()
public java.lang.String getResetType()
MINUTE HOUR DAY WEEK MONTH YEAR CONTINUE AUTO TERMINATE
MINUTE
,
HOUR
,
DAY
,
WEEK
,
MONTH
,
YEAR
,
CONTINUE
,
AUTO
,
TERMINATE
,
setResetType(String resetType)
public void setResetType(java.lang.String resetType)
MINUTE HOUR DAY WEEK MONTH YEAR CONTINUE AUTO TERMINATE
resetType
- A String constant indicating the reset type.MINUTE
,
HOUR
,
DAY
,
WEEK
,
MONTH
,
YEAR
,
CONTINUE
,
AUTO
,
TERMINATE
,
getResetType()
public boolean isTriggered()
setTriggered(boolean triggered)
public void setTriggered(boolean triggered)
triggered
- A boolean indicating whether the alert has been triggered.isTriggered()
public boolean isTwoWayEmailAttached()
setTwoWayEmailAttached(boolean twoWayEmailAttached)
public void setTwoWayEmailAttached(boolean twoWayEmailAttached)
twoWayEmailAttached
- A boolean indicating whether a TwoWayEmail is attached.isTwoWayEmailAttached()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |