<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
|
Oracle Application Server Wireless Java API Reference B10400-01 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface exposes the master alert service features
There are three major types of Master Alerts:
Master Alert does not necessarily need to be based on only one of the above. The same Master Alert can be based on one or more. Possible combinations can be listed as follows:
For every event generated, notification engine derives a list of users who are interested in this event. In some cases, notification designer may need to apply some additional logic to manipulate this list. For this, a class file has to be provided that implements the interface MobileAlertSubscriberFilter
interface.
Sample usage: MetaLocator m = MetaLocator.getInstance(); ModelFactory f = m.getModelFactory(); ModelServices s = m.getModelServices(); //Locate the data feed that will be used by this notification DataFeeder df = s.lookupDataFeeder("StockFeed") //Create a master notification with timebase enabled. //Note that, new master notification interface is oracle.panama.mobilealert.MasterAlertService MasterAlertService mAS = null; mAS = f.createMobileMasterAlertService("StockNotification", true, "Stock Master Notification", df); //Set the condition relation type to "AND" mAS.setConditionRelationType(MasterAlertService.RELATION_AND); //Set time based typed to strictly time based mAS.setTimeBasedType(true); //Enable Location based support mAS.enableLocationBaseAlert(true); StringBuffer msgTemplate = new StringBuffer("<?xml version = \"1.0\" encoding = \"UTF-8\" standalone=\"yes\" ?>"); msgTemplate.append("<SimpleResult><SimpleContainer>"); msgTemplate.append("<SimpleText>Stock alert for [&symbol;] price is [&price;]"); msgTemplate.append("</SimpleText>?); msgTemplate.append("</SimpleContainer></SimpleResult>"); //Provide the default message template //that can be used with default notification master service mAS.setFormattedXMLTemplate(msgTemplate.toString()); //add conditions with default valuesto this notifications, i.e. if "price > 10 " AlertConditionType cType1 = s.getMobileAlertConditionTypeByName("GT"); FeedMetaData fmdPrice = df.getOutputParameter("price"); mAS.addConditionDefinition("PriceMax", fmdPrice, cType1, "23"); AlertConditionType cType2 = s.getMobileAlertConditionTypeByName("GT"); FeedMetaData fmdChange = df.getOutputParameter("Change"); mAS.addConditionDefinition("ChangeMax", fmdChange, cType2, "10"); //Notification object does not use the persistent store/wireless caching //Any create/update operation has to be committed with the save mAS.save();
Sample for locating master alerts. try { MasterAlertService mas = new MasterAlertServiceImpl(6476); } catch (Exception pe) { System.out.println(pe.toString()); }
Sample for adding mapping. MasterService service = s.lookupMasterService(245); MAlertServiceMapping map = mas.createMapping(service, "STOCKALERT_TRADINGSERVICE"); AlertChainParamMeta chainParam = map.addChainParameter(mas.getInputParameters()[0], service.getInputArguments().getArgument("TICKER")) map.setInvocationType(MAlertServiceMapping.MASS_INVOKE); map.save(); //apply changes to the repository mas.save(); //perform an actual commit
Sample usage example for adding service subscriptions.
Link link = s.lookupLink(245); ServiceAlertSubscription sub = mas.addUserAlertSubscription(user, link); sub.setHour(12); sub.setMinute(30); ................. -> Other sets sub.save();
DataFeeder
, FeedMetaData
, ModelObject
, LBCondition
, ServiceAlertSubscription
Field Summary | |
static java.lang.String |
RELATION_AND Relation type AND between triggering conditions |
static java.lang.String |
RELATION_OR Relation type OR between triggering conditions |
static int |
TYPEID The typeid of the master alert object |
static java.lang.String |
TYPENAME The typename of the master alert object |
Method Summary | |
AlertConditionMeta |
addConditionDefinition(java.lang.String name, FeedMetaData param, AlertConditionType type, java.lang.String defaultValue) Adds a new condition to this master alert service |
void |
addFilteringHookClassName(java.lang.String filteringHookClassName) Adds a filtering hook class name. |
ServiceAlertSubscription |
addUserAlertSubscription(User user, Link link) Add/Create a new subscription object for this master alert. |
MAlertServiceMapping |
createMapping(MasterService service, java.lang.String name) Creates a mapping object for this master alert and the given master service. The returned MAlertServiceMapping can be used to fill in the details for this mapping. |
MAlertServiceMapping |
createTemplateMapping(MasterService masterService) Creates a mapping object for this master alert and the given master service with the default message template. This call will perform all necessary operatins such as: filling in the master service URL argument with the built-in URL that will process this message and creating the parameter mapping. |
void |
delete() Deletes the master alert service This method call has to be followed by a save() call for committing the delete. |
void |
enableLocationBaseAlert(boolean enabled) Enables/Disables location base |
void |
enableTimeBaseAlert(boolean enabled) Enables/Disables time base |
AlertConditionMeta[] |
getConditionDefinitions() Returns the condition meta data |
java.lang.String |
getConditionRelationType() Returns the condition relation type |
DataFeeder |
getDataFeeder() Returns the data feeder object used by this master alert |
java.lang.String |
getDescription() Returns the description of the master alert |
java.lang.String[] |
getFilteringHookClassNames() Returns filtering hook class names |
java.lang.String |
getFormattedXMLTemplate() Returns the formatted xml template |
long |
getId() Returns the Master Alert id |
AlertInputParamMeta[] |
getInputParameters() Returns the input parameter meta data |
MAlertServiceMapping |
getMapping(MasterService mService) Returns the first mapping object for the given master service |
MAlertServiceMapping[] |
getMappings() Returns all mapping objects for this master alert |
java.lang.String |
getName() Returns the master alert name |
AlertParameterMeta[] |
getParameters() Returns the merged input + output parameters meta data For mapping alert parameters to service parameters, this method can be used to get a merged list |
boolean |
getTimeBasedType() Returns the time based type |
ServiceAlertSubscription[] |
getUserAlertSubscriptions(User user, Link link) Returns all user alert subscriptions for the given user and link |
boolean |
isLocationBaseEnabled() Checks if location base is enabled |
boolean |
isTimeBaseEnabled() Checks if time base is enabled |
ServiceAlertSubscription |
lookupUserAlertSubscription(long subscriptionId) Lookup a subscription object |
void |
removeCondition(AlertConditionMeta condition) Removes the condition for the master alert |
void |
removeFilteringHookClassName(java.lang.String filteringHookClassName) Removes the filtering hook class name |
void |
removeMapping(MAlertServiceMapping mapping) Removes the specified mapping object for this master alert. This method call has to be followed by a save() call for committing the removal. |
void |
removeUserAlertSubscription(ServiceAlertSubscription sub) Removes the specified subscription object for this master alert. This method commits immediately! This commit is independent from MasterAlertService.save() and will not affect any other master alert transaction. |
void |
resumeAllUserAlertSubscriptions(User user, Link link) Resume all user alert subscriptions for the given user and link. This method commits immediately! This commit is independent from MasterAlertService.save() and will not affect any other master alert transaction. |
void |
resumeUserAlertSubscription(ServiceAlertSubscription sub) Resumes this alert for the given subscription object This method commits immediately! This commit is independent from MasterAlertService.save() and will not affect any other master alert transaction. |
void |
save() Commits the changes to the database. |
void |
setConditionRelationType(java.lang.String conditionType) Set the condition relation type. |
void |
setDescription(java.lang.String desc) Sets description for the Master Alert Service Note that this description will be used as the notification message subject if relevant. |
void |
setFormattedXMLTemplate(java.lang.String simpleResultXml) Sets the formatted xml template for this master service. |
void |
setTimeBasedType(boolean strict) Set/Unset time based type to strictly time-based Time-based notifications can be used in conjunction with value based predicates. |
void |
suspendAllUserAlertSubscriptions(User user, Link link) Suspends all user alert subscriptions for the given user and link. This method commits immediately! This commit is independent from MasterAlertService.save() and will not affect any other master alert transaction. |
void |
suspendUserAlertSubscription(ServiceAlertSubscription sub) Suspends this alert for the given subscription object. This method commits immediately! This commit is independent from MasterAlertService.save() and will not affect any other master alert transaction. |
Methods inherited from interface oracle.panama.model.ModelObject |
getCreatedDate, getLastModifiedDate, getTypeId, getTypeName, isSystem, setName, setSystem, undoAll |
Methods inherited from interface oracle.panama.model.XMLObject |
setXML, toXML |
Field Detail |
public static final java.lang.String TYPENAME
public static final int TYPEID
public static final java.lang.String RELATION_AND
public static final java.lang.String RELATION_OR
Method Detail |
public long getId()
getId
in interface ModelObject
public java.lang.String getName()
getName
in interface ModelObject
public java.lang.String getFormattedXMLTemplate()
public void setFormattedXMLTemplate(java.lang.String simpleResultXml) throws PanamaException
<?xml version = "1.0" encoding = "UTF-8" standalone="yes" ?> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTitle>OracleAS Wireless</SimpleTitle> <SimpleTextItem>Sample Notification: price: &price; and change: &change; for stock: &sym;</SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult>
simpleResultXml
- the String contaning the formatted xmlPanamaException
- Exception thrown when the specified template is not a valid mobile xml document and or any other error occurspublic java.lang.String[] getFilteringHookClassNames()
public void addFilteringHookClassName(java.lang.String filteringHookClassName) throws PanamaException
filteringHookClassName
- the class namePanamaException
- exception thrown when addition failedMobileAlertSubscriberFilter
public void removeFilteringHookClassName(java.lang.String filteringHookClassName) throws PanamaException
filteringHookClassName
- the filtering hook class namePanamaException
- exception thrown when remove failedpublic boolean isTimeBaseEnabled()
public void enableTimeBaseAlert(boolean enabled) throws PanamaException
enabled
- set to true to enable, false to disablePanamaException
- Exception when enabling failedpublic boolean isLocationBaseEnabled()
public void enableLocationBaseAlert(boolean enabled) throws PanamaException
enabled
- set to true to enable, false to disablePanamaException
- Exception when enabling failedpublic AlertInputParamMeta[] getInputParameters()
public AlertParameterMeta[] getParameters()
public AlertConditionMeta[] getConditionDefinitions()
public AlertConditionMeta addConditionDefinition(java.lang.String name, FeedMetaData param, AlertConditionType type, java.lang.String defaultValue) throws PanamaException
name
- Name of the conditionparam
- FeedMetaData object for the parametertype
- AlertConditionType the alert condition typedefaultValue
- String containing the default valuePaanamaException
- the exception thrown when addition failedPanamaException
public DataFeeder getDataFeeder()
public void removeCondition(AlertConditionMeta condition) throws PanamaException
condition
- AlertConditionMeta condition object to removePanamaException
- exception thrown when remove condition failedpublic void setConditionRelationType(java.lang.String conditionType) throws PanamaException
conditionType
- condition type for this master alert. RELATION_AND and RELATION_OR are defined in this interface to specify valid condition types.PanamaException
- exception thrown when setting condition type failpublic java.lang.String getConditionRelationType() throws PanamaException
PanamaException
- exception thrown when setting condition type failpublic void setTimeBasedType(boolean strict) throws PanamaException
strict
- time based type (true for strictly time based)PanamaException
- exception thrown when setting time based type failpublic boolean getTimeBasedType() throws PanamaException
PanamaException
- exception thrown when getting time based type failpublic void save() throws PanamaException
MAlertServiceMapping
, AlertChainParamMeta
, AlertInputParamMeta
, AlertConditionMeta
PanamaException
- the exception when commit failedpublic void delete()
save()
call for committing the delete.delete
in interface ModelObject
public void setDescription(java.lang.String desc)
desc
- The descriptionpublic java.lang.String getDescription()
public ServiceAlertSubscription[] getUserAlertSubscriptions(User user, Link link)
user
- the User objectlink
- the Link objectpublic void suspendAllUserAlertSubscriptions(User user, Link link) throws PanamaException
user
- the User objectlink
- the Link objectPanamaException
public void resumeAllUserAlertSubscriptions(User user, Link link) throws PanamaException
user
- the User objectlink
- the Link objectPanamaException
public ServiceAlertSubscription addUserAlertSubscription(User user, Link link) throws PanamaException
user
- User objectlink
- Link objectPanamaException
- the exception when this operation failsServiceAlertSubscription
public void removeUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation failspublic void suspendUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation failspublic void resumeUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation failspublic ServiceAlertSubscription lookupUserAlertSubscription(long subscriptionId) throws PanamaException
PanamaException
- the exception if the ServiceAlertSubscription can not be found.public MAlertServiceMapping createMapping(MasterService service, java.lang.String name) throws PanamaException
service
- MasterService object that this mapping is created forPanamaException
- the exception if the MAlertServiceMapping can not be created.MAlertServiceMapping
public void removeMapping(MAlertServiceMapping mapping) throws PanamaException
save()
call for committing the removal.PanamaException
- the exception if the MAlertServiceMapping can not be removed.public MAlertServiceMapping createTemplateMapping(MasterService masterService) throws PanamaException
PanamaException
- the exception if the MAlertServiceMapping can not be created.public MAlertServiceMapping[] getMappings()
public MAlertServiceMapping getMapping(MasterService mService)
|
Oracle Application Server Wireless Java API Reference B10400-01 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |