Oracle Application Server Wireless Java API Reference
B14043-01


oracle.panama.mobilealert
Interface ServiceAlertSubscription

All Superinterfaces:
BillingContext, ModelObject, XMLObject

public interface ServiceAlertSubscription
extends ModelObject, BillingContext

This interface defines user subscription information.

For time based subscriptions, users can specify a spefic time of the day (i.e. hour:minute), or start/end time and an interval to receive multiple alerts. In this case, user will receive notification messages every n minutes (specified with the setInterval(int) method) between hour:minute and endhour:endminute.

 Sample Usage:
        //Locate the master notification service
        MasterAlertService mAS = s.lookupMobileMasterAlertService("StockNotification");
        //Locate the stock trade master service
        MasterService masterService =
                  s.lookupMasterService("/master/examples/StockTradeMasterService");
        //Locate the stock trade link
        Link link = s.lookupLink("/Examples/StockTradeLink");
        //Locate the user
        User user = s.lookupUser("orcladmin");

        //Locate primary and alternative device addresses
        DeviceAddress addr1 = s.lookupDeviceAddress(DeliveryType.SMS, "1234567890");
        DeviceAddress addr2 = s.lookupDeviceAddress(DeliveryType.EMAIL,
                  "John.Doe@xyz.com");

        //Create a subscription for orcladmin on the stock trade link
        ServiceAlertSubscription sub = mAS.addUserAlertSubscription(user, link);

        //Set the data feed input parameter (ticker) to ORCL
        AlertInputParamValue[] paramVals = sub.getInputParameters();
        paramVals[0].setValue("ORCL");

        //Set triggering condition values: price:30 and change: 12
        AlertConditionValue[] conVals = sub.getConditions();
        conVals[0].setValue("30"); //price
        conVals[1].setValue("12"); //change

        //Set frequency to daily, receive notifications on weekdays
        AlertTimeFrequency freq = AlertTimeFrequencyImpl.getAlertTimeFrequencys()[0];

        //Activate the notification tomorrow
        Calendar startDate = Calendar.getInstance();
        startDate.add(Calendar.DATE, 1);

        //User will be subscribed for 365 days
        Calendar expirationDate = Calendar.getInstance();
        expirationDate.add(Calendar.DATE, 366);

        //User will be going on vacation 30 days from now,
        //so deactivate them temporarily in that period for 10 days
        Calendar blackoutStartDate = Calendar.getInstance();
        blackoutStartDate.add(Calendar.DATE, 30);
        Calendar blackoutEndDate = Calendar.getInstance();
        blackoutEndDate.add(Calendar.DATE, 40);

        //Create location condition for monitoring myself for getting into a region with id 18191.
        LocationPrivacyDomain lbDomain = new LocationPrivacyDomain(masterService);
        LBCondition lbCondition = f.createLBCondition(LBCondition.MODE_REPEAT,
                    expirationDate, user, lbDomain);
        lbCondition.addCriteria("orcladmin", "user", "IN", 18191);

        //Set data and time predicates for this subscription.
        //This notification will evaluate the conditions starting at 8:00 a.m. till 1:30pm
        //every 45 minutes, on every weekday (Monday-Friday).
        sub.setCondition(paramVals, conVals, 8, 0, 13, 30, 45, freq,
                     expirationDate, startDate);
        //Set the location condition
        sub.setLocationCondition(lbCondition);

        //Set the primary device that notifications will be send to
        sub.setSubscriptionDevice(addr1);
        //When the max. number of notifications is reached,
        //send the notifications to the alternative device
        sub.setAlternativeType(ServiceAlertSubscription.AFTERMAX_DEVICE);
        //Set the secondary device as alternative device
        sub.setAlternativeDevice(addr2);

        //Set blackout periods, activation/deactivation information
        sub.setSuspendStartDate(blackoutStartDate);
        sub.setSuspendEndDate(blackoutStartDate);
        sub.setStartDate(startDate);
        sub.setExpirationDate(expirationDate);

        //save the subscription
        sub.save();
 

Field Summary
static java.lang.String AFTERMAX_DEVICE
If maximum is reached, send it to another device
static java.lang.String AFTERMAX_DISCARD
If maximum is reached, discard alerts
static java.lang.String AFTERMAX_PILEUP
If maximum is reached, pile alerts for retrieval through some other means (NOT IMPLEMENTED IN THIS RELEASE).
static int TYPEID
The typeid of the subscription object
static java.lang.String TYPENAME
The typename of the Subscription XML object

Fields inherited from interface oracle.wireless.billing.BillingContext
ALERT_COMPONENT, MESSAGING_COMPONENT, PROVISIONING_COMPONENT, PUSH_COMPONENT, RUNTIME_COMPONENT

Method Summary
DeviceAddress getAlternativeDevice()
Returns the alternative device for sending alerts when max is reached.
java.lang.String getAlternativeType()
Returns what alert engine will do if max number of alerts is reached.
AlertConditionValue[] getConditions()
Returns an array of condition values for this subscription
java.lang.String getDisplayName()
Returns the display name
int getEndHour()
Returns the end hour for interval type subscriptions
int getEndMinute()
Returns the end minute for this subscription (Used for interval type subscriptions)
java.util.Calendar getExpirationDate()
Returns the subscription expiration date
java.lang.String getExternalUId()
Returns external system user id, used for billing purposes!
AlertTimeFrequency getFrequency()
Returns the frequency with which Subscription is scheduled to alert
int getHour()
Returns the hour for which the susbscription is scheduled to receive an alert
long getId()
Returns the subscription id.
AlertInputParamValue[] getInputParameters()
Returns an array of input param values for this subscription
int getInterval()
Returns the alert sending interval in minutes between the start and end times
Link getLink()
Returns the link that user has subscribed to.
LBCondition getLocationCondition()
Returns the location condition for this subscription
MAlertServiceMapping getMapping()
Returns the mapping definition for this subscription.
int getMinute()
Returns the minute for which the Susbscription is scheduled to receive alert
int getPriority()
Returns the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION)
java.util.Calendar getStartDate()
Returns when this subscription will be activated
DeviceAddress getSubscriptionDevice()
Returns the device address that will receive this alert
java.util.Calendar getSuspendEndDate()
Returns the suspend end date for this alert
java.util.Calendar getSuspendStartDate()
Returns the suspend start date for this alert
User getUser()
Returns the user owning this subscription.
boolean isArmed()
Returns if the subscription is active or suspended.
void removeAlternativeDevice()
Removes the alternative device
void removeSubscriptionDevice()
Removes the device that will receive this alert, alerts will be sent to the default device if removed!
void save()
Commits any changes to the database.
void setAlternativeDevice(DeviceAddress deviceAddress)
Sets the alternative device for sending alerts when max is reached.
void setAlternativeType(java.lang.String type)
Sets what alert engine should do if max number of alerts is reached.
void setCondition(AlertInputParamValue[] params, AlertConditionValue[] conds)
Sets the condition
void setCondition(AlertInputParamValue[] params, AlertConditionValue[] conds, java.util.Calendar expireAt, java.util.Calendar startAt)
Sets the condition with start/expiration date set
void setCondition(AlertInputParamValue[] params, AlertConditionValue[] conds, int hour, int minute, int endhr, int endmin, int intervl, AlertTimeFrequency frequency)
Sets the condition for time based alerts
void setCondition(AlertInputParamValue[] params, AlertConditionValue[] conds, int hour, int minute, int endhr, int endmin, int intervl, AlertTimeFrequency frequency, java.util.Calendar expireAt, java.util.Calendar startAt)
Sets the condition for time based alerts with the start/expiration date set
void setDisplayName(java.lang.String aDisplayName)
Sets the display name
void setEndHour(int hour)
Sets the end hour for this subscription (Used by interval type subscriptions)
void setEndMinute(int minute)
Sets the end minute for this subscription (Used for interval type subscriptions)
void setExpirationDate(java.util.Calendar expireAt)
Sets the subscription expiration date
void setExternalUId(java.lang.String xUID)
Sets external system user id, used for billing purposes!
void setFrequency(AlertTimeFrequency frequency)
Sets the alert frequency.
void setHour(int hour)
Sets the hour for which the susbscription is scheduled to receive an alert
void setInterval(int minute)
Sets the alert sending interval in minutes between the start and end times
void setLocationCondition(LBCondition lbCondition)
Sets the location condition for location based alerts
void setMinute(int minute)
Sets the minute for which the Susbscription is scheduled to receive alert
void setPriority(int priority)
Sets the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION)
void setStartDate(java.util.Calendar startAt)
Sets when this subscription will be activated
void setSubscriptionDevice(DeviceAddress deviceAddress)
Sets the device address that will receive this alert
void setSuspendEndDate(java.util.Calendar suspendExpireOn)
Sets the suspend end date for this alert
void setSuspendStartDate(java.util.Calendar suspendOn)
Sets the suspend start date for this alert

Methods inherited from interface oracle.panama.model.ModelObject
delete, getCreatedDate, getLastModifiedDate, getName, getTypeId, getTypeName, isSystem, setName, setSystem, undoAll

Methods inherited from interface oracle.panama.model.XMLObject
setXML, toXML

Field Detail

AFTERMAX_DEVICE

public static final java.lang.String AFTERMAX_DEVICE
If maximum is reached, send it to another device
See Also:
Constant Field Values

AFTERMAX_DISCARD

public static final java.lang.String AFTERMAX_DISCARD
If maximum is reached, discard alerts
See Also:
Constant Field Values

AFTERMAX_PILEUP

public static final java.lang.String AFTERMAX_PILEUP
If maximum is reached, pile alerts for retrieval through some other means (NOT IMPLEMENTED IN THIS RELEASE).
See Also:
Constant Field Values

TYPEID

public static final int TYPEID
The typeid of the subscription object
See Also:
Constant Field Values

TYPENAME

public static final java.lang.String TYPENAME
The typename of the Subscription XML object
See Also:
Constant Field Values

Method Detail

getAlternativeDevice

public DeviceAddress getAlternativeDevice()
                                   throws PanamaException
Returns the alternative device for sending alerts when max is reached.
Returns:
Alternative device address
Throws:
PanamaException

getAlternativeType

public java.lang.String getAlternativeType()
                                    throws PanamaException
Returns what alert engine will do if max number of alerts is reached. Possible options are AFTERMAX_DEVICE and AFTERMAX_DISCARD
Returns:
Alternative type
Throws:
PanamaException

getConditions

public AlertConditionValue[] getConditions()
Returns an array of condition values for this subscription
Returns:
Array of condition values

getDisplayName

public java.lang.String getDisplayName()
Returns the display name
Returns:
Display name

getEndHour

public int getEndHour()
Returns the end hour for interval type subscriptions
Returns:
end hour

getEndMinute

public int getEndMinute()
Returns the end minute for this subscription (Used for interval type subscriptions)
Returns:
minute minute of the end time

getExpirationDate

public java.util.Calendar getExpirationDate()
Returns the subscription expiration date
Returns:
null--never expires OR a calendar object

getExternalUId

public java.lang.String getExternalUId()
Returns external system user id, used for billing purposes!
Returns:
String external user id

getFrequency

public AlertTimeFrequency getFrequency()
Returns the frequency with which Subscription is scheduled to alert
Returns:
Alert time frequency

getHour

public int getHour()
Returns the hour for which the susbscription is scheduled to receive an alert
Returns:
hour

getId

public long getId()
Returns the subscription id.
Specified by:
getId in interface ModelObject
Returns:
Subscription id

getInputParameters

public AlertInputParamValue[] getInputParameters()
Returns an array of input param values for this subscription
Returns:
Array of input parameter value objects

getInterval

public int getInterval()
Returns the alert sending interval in minutes between the start and end times
Returns:
interval in minutes

getLink

public Link getLink()
Returns the link that user has subscribed to.
Returns:
link object that this subscription is created on.

getLocationCondition

public LBCondition getLocationCondition()
Returns the location condition for this subscription
Returns:
Location condition object

getMapping

public MAlertServiceMapping getMapping()
Returns the mapping definition for this subscription.
Returns:
Mapping definition object

getMinute

public int getMinute()
Returns the minute for which the Susbscription is scheduled to receive alert
Returns:
Minute

getPriority

public int getPriority()
                throws PanamaException
Returns the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION)
Returns:
Priority
Throws:
PanamaException

getStartDate

public java.util.Calendar getStartDate()
Returns when this subscription will be activated
Returns:
Start date for this subscription (null if not applicable)

getSubscriptionDevice

public DeviceAddress getSubscriptionDevice()
                                    throws PanamaException
Returns the device address that will receive this alert
Returns:
Address of the device
Throws:
PanamaException

getSuspendEndDate

public java.util.Calendar getSuspendEndDate()
Returns the suspend end date for this alert
Returns:
date to end suspending this alert

getSuspendStartDate

public java.util.Calendar getSuspendStartDate()
Returns the suspend start date for this alert
Returns:
Date to start suspending this alert

getUser

public User getUser()
Returns the user owning this subscription.
Returns:
iAS Wireless user object

isArmed

public boolean isArmed()
Returns if the subscription is active or suspended.
Returns:
true if it is active

removeAlternativeDevice

public void removeAlternativeDevice()
                             throws PanamaException
Removes the alternative device
Throws:
PanamaException

removeSubscriptionDevice

public void removeSubscriptionDevice()
                              throws PanamaException
Removes the device that will receive this alert, alerts will be sent to the default device if removed!
Throws:
PanamaException

save

public void save()
          throws PanamaException,
                 BillingException
Commits any changes to the database. Any update/create transaction must be ended with a save() The caching framework is not used!
Throws:
PanamaException
BillingException

setAlternativeDevice

public void setAlternativeDevice(DeviceAddress deviceAddress)
                          throws PanamaException
Sets the alternative device for sending alerts when max is reached.
Parameters:
deviceAddress - Alternative device address
Throws:
PanamaException

setAlternativeType

public void setAlternativeType(java.lang.String type)
                        throws PanamaException
Sets what alert engine should do if max number of alerts is reached. Possible options are AFTERMAX_DEVICE and AFTERMAX_DISCARD
Parameters:
type - Alternative type
Throws:
PanamaException

setCondition

public void setCondition(AlertInputParamValue[] params,
                         AlertConditionValue[] conds)
                  throws PanamaException
Sets the condition
Parameters:
params - Array of parameter values
conds - Array of condition values
Throws:
PanamaException

setCondition

public void setCondition(AlertInputParamValue[] params,
                         AlertConditionValue[] conds,
                         java.util.Calendar expireAt,
                         java.util.Calendar startAt)
                  throws PanamaException
Sets the condition with start/expiration date set
Parameters:
params - Array of parameter values
conds - Array of condition values
expireAt - a Calendar object for subscription expiration date, null means never expires
startAt - a Calendar object for subscription start date, if null starts immediately
Throws:
PanamaException

setCondition

public void setCondition(AlertInputParamValue[] params,
                         AlertConditionValue[] conds,
                         int hour,
                         int minute,
                         int endhr,
                         int endmin,
                         int intervl,
                         AlertTimeFrequency frequency)
                  throws PanamaException
Sets the condition for time based alerts
Parameters:
params - Array of parameter values
conds - Array of condition values
hour - Hour of next alert
minute - Minute of next alert
endhr - End hour for interval based alerts (-1 if not applicable)
endmin - End minute for interval based alerts (-1 if not applicable)
intervl - Interval in minutes for interval based alerts(-1 if not applicable)
frequency - AlertFrequency
Throws:
PanamaException - when setCondition fails

setCondition

public void setCondition(AlertInputParamValue[] params,
                         AlertConditionValue[] conds,
                         int hour,
                         int minute,
                         int endhr,
                         int endmin,
                         int intervl,
                         AlertTimeFrequency frequency,
                         java.util.Calendar expireAt,
                         java.util.Calendar startAt)
                  throws PanamaException
Sets the condition for time based alerts with the start/expiration date set
Parameters:
params - Array of parameter values
conds - Array of condition values
hour - Hour of next alert
minute - Minute of next alert
endhr - End hour for interval based alerts (-1 if not applicable)
endmin - End minute for interval based alerts (-1 if not applicable)
intervl - Interval for interval based alerts in minutes (-1 if not applicable)
frequency - AlertFrequency
expireAt - A Calendar object for subscription expiration date, null means never expires
startAt - A Calendar object for subscription start date, null means start immediately
Throws:
PanamaException - when set condition fails

setDisplayName

public void setDisplayName(java.lang.String aDisplayName)
Sets the display name
Parameters:
aDisplayName - The display name of the subscription

setEndHour

public void setEndHour(int hour)
                throws PanamaException
Sets the end hour for this subscription (Used by interval type subscriptions)
Parameters:
hour - end hour of the end time
Throws:
PanamaException

setEndMinute

public void setEndMinute(int minute)
                  throws PanamaException
Sets the end minute for this subscription (Used for interval type subscriptions)
Parameters:
minute - end minute for the end time
Throws:
PanamaException

setExpirationDate

public void setExpirationDate(java.util.Calendar expireAt)
Sets the subscription expiration date
Parameters:
expireAt - expiration date

setExternalUId

public void setExternalUId(java.lang.String xUID)
Sets external system user id, used for billing purposes!
Parameters:
xUID - external user id

setFrequency

public void setFrequency(AlertTimeFrequency frequency)
                  throws PanamaException
Sets the alert frequency.
Parameters:
frequency - Alert frequency
Throws:
PanamaException

setHour

public void setHour(int hour)
             throws PanamaException
Sets the hour for which the susbscription is scheduled to receive an alert
Parameters:
hour - hour
Throws:
PanamaException

setInterval

public void setInterval(int minute)
                 throws PanamaException
Sets the alert sending interval in minutes between the start and end times
Parameters:
minute - interval in minutes
Throws:
PanamaException

setLocationCondition

public void setLocationCondition(LBCondition lbCondition)
                          throws PanamaException
Sets the location condition for location based alerts
Parameters:
lbCondition - location condition object
Throws:
PanamaException - when set location condition fails

setMinute

public void setMinute(int minute)
               throws PanamaException
Sets the minute for which the Susbscription is scheduled to receive alert
Parameters:
minute - minute
Throws:
PanamaException

setPriority

public void setPriority(int priority)
                 throws PanamaException
Sets the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION)
Parameters:
priority - Priority
Throws:
PanamaException

setStartDate

public void setStartDate(java.util.Calendar startAt)
Sets when this subscription will be activated
Parameters:
startAt - Start date for this subscription

setSubscriptionDevice

public void setSubscriptionDevice(DeviceAddress deviceAddress)
                           throws PanamaException
Sets the device address that will receive this alert
Parameters:
deviceAddress - address of the device
Throws:
PanamaException

setSuspendEndDate

public void setSuspendEndDate(java.util.Calendar suspendExpireOn)
                       throws PanamaException
Sets the suspend end date for this alert
Parameters:
suspendExpireOn - date to end suspending this alert
Throws:
PanamaException

setSuspendStartDate

public void setSuspendStartDate(java.util.Calendar suspendOn)
                         throws PanamaException
Sets the suspend start date for this alert
Parameters:
suspendOn - date to start suspending this alert
Throws:
PanamaException

Oracle Application Server Wireless Java API Reference
B14043-01


Copyright © 2004 Oracle Corporation. All Rights Reserved.