Oracle Application Server Wireless Java API Reference
B10400-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,
                  "Okan.Alper@oracle.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, 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! Possible options are AFTERMAX_DEVICE and AFTERMAX_DISCARD
 AlertConditionValue[] getConditions()
          Returns an array of condition values for with the Subscription
 java.lang.String getDisplayName()
          Returns the display name
 int getEndHour()
          Returns the end hour for interval type subscriptiona
 int getEndMinute()
          Returns the end minute for this subscription (Used for interval type subscriptions)
 java.util.Calendar getExpirationDate()
          Returns the subscription expiration date
 AlertTimeFrequency getFrequency()
          Returns the frequency with which Subscription is scheduled to alert
 int getHour()
          Returns the hour for which the Susbscription is scheduled to 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 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 alert
 int getPriority()
          Returns the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION) return int priority
 java.util.Calendar getStartDate()
          Returns when this subscription will be activated
 DeviceAddress getSubscriptionDevice()
          Returns the device 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! Possible options are AFTERMAX_DEVICE and AFTERMAX_DISCARD
 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 the 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 alert case
 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 alert case 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 setFrequency(AlertTimeFrequency frequency)
          Sets the alert frequency.
 void setHour(int hour)
          Sets the hour of alert.
 void setInterval(int minute)
          Sets the alert sending interval 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 of alert.
 void setPriority(int priority)
          Sets the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION) param priority priority
 void setStartDate(java.util.Calendar startAt)
          Sets when this subscription will be activated
 void setSubscriptionDevice(DeviceAddress deviceAddress)
          Sets the device 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_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

AFTERMAX_DISCARD

public static final java.lang.String AFTERMAX_DISCARD
If maximum is reached, discard alerts
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

TYPEID

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

getId

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

getMapping

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

getLink

public Link getLink()
Returns the link that user has subscribed to
Returns:
Link

getUser

public User getUser()
Returns the user owning this subscription
Returns:
User panama user object

getInputParameters

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

getConditions

public AlertConditionValue[] getConditions()
Returns an array of condition values for with the Subscription
Returns:
AlertConditionValue[] condition values

getHour

public int getHour()
Returns the hour for which the Susbscription is scheduled to alert
Returns:
int hour

setHour

public void setHour(int hour)
             throws PanamaException
Sets the hour of alert.
PanamaException

getMinute

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

setMinute

public void setMinute(int minute)
               throws PanamaException
Sets the minute of alert.
PanamaException

getEndHour

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

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
PanamaException

getEndMinute

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

setEndMinute

public void setEndMinute(int minute)
                  throws PanamaException
Sets the end minute for this subscription (Used for interval type subscriptions)
PanamaException

getInterval

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

setInterval

public void setInterval(int minute)
                 throws PanamaException
Sets the alert sending interval between the start and end times
PanamaException

getSuspendStartDate

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

setSuspendStartDate

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

getSuspendEndDate

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

setSuspendEndDate

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

setSubscriptionDevice

public void setSubscriptionDevice(DeviceAddress deviceAddress)
                           throws PanamaException
Sets the device that will receive this alert
PanamaException

getSubscriptionDevice

public DeviceAddress getSubscriptionDevice()
                                    throws PanamaException
Returns the device that will receive this alert
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!
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
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:
String alternative type
PanamaException

setAlternativeDevice

public void setAlternativeDevice(DeviceAddress deviceAddress)
                          throws PanamaException
Sets the alternative device for sending alerts when max is reached.
PanamaException

getAlternativeDevice

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

removeAlternativeDevice

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

getPriority

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

setPriority

public void setPriority(int priority)
                 throws PanamaException
Sets the priority for this subscription (NOT IMPLEMENTED IN THIS VERSION) param priority priority
PanamaException

getFrequency

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

setFrequency

public void setFrequency(AlertTimeFrequency frequency)
                  throws PanamaException
Sets the alert frequency. Regenerates the alert for the specified time frequency
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
PanamaException

setCondition

public void setCondition(AlertInputParamValue[] params,
AlertConditionValue[] conds,
                         java.util.Calendar expireAt,
                         java.util.Calendar startAt)
                  throws PanamaException
Sets the condition with the start/expiration date set
Parameters:
params - Array of parameter values
conds - Array of condition values
expireAt - a Calendar object for subscription expiration date, if null means never expired
startAt - a Calendar object for subscription start date, if null means start immediately
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 alert case
Parameters:
params - Array of parameter values
conds - Array of condition values
hour - the hour of next alert
endhr - the end hour for interval based alerts (-1 if not applicable)
endmin - the end minute for interval based alerts (-1 if not applicable)
intervl - the interval for interval based alerts in minutes (-1 if not applicable)
frequency - the AlertFrequency of next alert
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 alert case with the start/expiration date set
Parameters:
params - Array of parameter values
conds - Array of condition values
hour - the hour of next alert
endhr - the end hour for interval based alerts (-1 if not applicable)
endmin - the end minute for interval based alerts (-1 if not applicable)
intervl - the interval for interval based alerts in minutes (-1 if not applicable)
frequency - the AlertFrequency of next alert
expireAt - a Calendar object for subscription expiration date, if null means never expires
startAt - a Calendar object for subscription start date, if null means start immediately
Throws:
PanamaException - when set condition fails

setLocationCondition

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

getLocationCondition

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

isArmed

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

getStartDate

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

setStartDate

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

getExpirationDate

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

setExpirationDate

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

getDisplayName

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

setDisplayName

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

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.
PanamaException
BillingException

Oracle Application Server Wireless Java API Reference
B10400-01

Copyright © 2003 Oracle Corporation. All Rights Reserved.