|
Oracle Application Server Wireless Java API Reference B14043-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); //or mas = s.lookupMobileMasterAlertService(6476); //or mas = s.lookupMobileMasterAlertService("StockNotification"); } 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
, MobileAlertSubscriberFilter
, 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. |
MAlertServiceMapping |
createQNMapping(MasterService masterService, java.lang.String url, boolean sharedContent) Creates a mapping object for this master alert in quick notification mode. |
MAlertServiceMapping |
createTemplateMapping(MasterService masterService) Creates a mapping object for this master alert and the given master service with the default message template. |
void |
delete() Deletes the master alert service. |
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 that can be used for mapping alert parameters to service parameters. |
ServiceAlertSubscription[] |
getSubscriptions(User user, Link link, java.util.Map inputParameters) Returns all user alert subscriptions for any combination of given parameters. |
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. |
void |
removeUserAlertSubscription(ServiceAlertSubscription sub) Removes the specified subscription object for this master alert. |
void |
resumeAllUserAlertSubscriptions(User user, Link link) Resume all user alert subscriptions for the given user and link. |
void |
resumeUserAlertSubscription(ServiceAlertSubscription sub) Resumes this alert for the given subscription object. |
void |
save() Commits the changes to the database. |
void |
setConditionRelationType(java.lang.String conditionType) Sets the condition relation type. |
void |
setDescription(java.lang.String desc) Sets the description for the Master Alert Service. |
void |
setFormattedXMLTemplate(java.lang.String messageTemplate) Sets the formatted xml template for this master service. |
void |
setTimeBasedType(boolean strict) Set/Unset time based type to strictly time-based. |
void |
suspendAllUserAlertSubscriptions(User user, Link link) Suspends all user alert subscriptions for the given user and link. |
void |
suspendUserAlertSubscription(ServiceAlertSubscription sub) Suspends this alert for the given subscription object. |
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 RELATION_AND
public static final java.lang.String RELATION_OR
public static final int TYPEID
public static final java.lang.String TYPENAME
Method Detail |
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 valuePanamaException
- the exception thrown when addition failedpublic void addFilteringHookClassName(java.lang.String filteringHookClassName) throws PanamaException
filteringHookClassName
- the class name for the hook.PanamaException
- exception thrown when addition failedMobileAlertSubscriberFilter
public ServiceAlertSubscription addUserAlertSubscription(User user, Link link) throws PanamaException
user
- User objectlink
- Link objectPanamaException
- the exception when this operation failsServiceAlertSubscription
public MAlertServiceMapping createMapping(MasterService service, java.lang.String name) throws PanamaException
service
- MasterService object that this mapping is created forname
- String name for this mapping objectPanamaException
- the exception if the MAlertServiceMapping can not be created.MAlertServiceMapping
public MAlertServiceMapping createQNMapping(MasterService masterService, java.lang.String url, boolean sharedContent) throws PanamaException
masterService
- MasterService object that this mapping is created forurl
- The url that this master service is going to invoke, for template based mapping pass null.sharedContent
- Should the master service be invoked in mass invocation modePanamaException
- the exception if the MAlertServiceMapping can not be created.public MAlertServiceMapping createTemplateMapping(MasterService masterService) throws PanamaException
masterService
- MasterService object that this mapping is created forPanamaException
- the exception if the MAlertServiceMapping can not be created.public void delete()
save()
call for committing the delete.delete
in interface ModelObject
public void enableLocationBaseAlert(boolean enabled) throws PanamaException
enabled
- set to true to enable, false to disablePanamaException
- Exception when enabling failedpublic void enableTimeBaseAlert(boolean enabled) throws PanamaException
enabled
- set to true to enable, false to disablePanamaException
- Exception when enabling failedpublic AlertConditionMeta[] getConditionDefinitions() throws PanamaException
PanamaException
- the exception thrown when method failspublic java.lang.String getConditionRelationType() throws PanamaException
PanamaException
- exception thrown when setting condition type failpublic DataFeeder getDataFeeder()
public java.lang.String getDescription()
public java.lang.String[] getFilteringHookClassNames() throws PanamaException
PanamaException
- the exception when this operation failspublic java.lang.String getFormattedXMLTemplate() throws PanamaException
PanamaException
- the exception when this operation failspublic long getId()
getId
in interface ModelObject
public AlertInputParamMeta[] getInputParameters() throws PanamaException
PanamaException
- the exception when this operation failspublic MAlertServiceMapping getMapping(MasterService mService)
mService
- MasterService object that needs to be queriedpublic MAlertServiceMapping[] getMappings()
public java.lang.String getName()
getName
in interface ModelObject
public AlertParameterMeta[] getParameters() throws PanamaException
PanamaException
- the exception thrown when method failspublic ServiceAlertSubscription[] getSubscriptions(User user, Link link, java.util.Map inputParameters) throws PanamaException
Sample usage: MasterAlertService mAS = s.lookupMobileMasterAlertService("TestMasterAlertService"); Link link = s.lookupLink(4006); User user = s.lookupUser("orcladmin"); ServiceAlertSubscription[] tmpList = null; // returns all subscriptions for this master notification tmpList = mAS.getSubscriptions(null, null, null); // returns all subscriptions of orcladmin for this master notification tmpList = mAS.getSubscriptions(user, null, null); // returns all subscriptions of orcladmin for the given link for this master notification tmpList = mAS.getSubscriptions(user, link, null); Map inputParams = new HashMap(); inputParams.put("ticker", "ORCL"); // returns all subscriptions of orcladmin for the given link for ticker input parameter value: ORCL tmpList = mAS.getSubscriptions(user, link, inputParams);
link
- the Link object, passing null returns subscriptions for all linksuser
- the User object, passing null returns subscriptions for all usersinputParameters
- name value pair for input parameters, passing null returns subscriptions for all input parametersPanamaException
- the exception when this operation failspublic boolean getTimeBasedType() throws PanamaException
PanamaException
- exception thrown when getting time based type failpublic ServiceAlertSubscription[] getUserAlertSubscriptions(User user, Link link) throws PanamaException
user
- User objectlink
- Link objectPanamaException
- the exception when this operation failspublic boolean isLocationBaseEnabled()
public boolean isTimeBaseEnabled()
public ServiceAlertSubscription lookupUserAlertSubscription(long subscriptionId) throws PanamaException
subscriptionId
- the id of the subscriptionPanamaException
- the exception if the ServiceAlertSubscription can not be found.public void removeCondition(AlertConditionMeta condition) throws PanamaException
condition
- AlertConditionMeta condition object to removePanamaException
- exception thrown when remove condition failedpublic void removeFilteringHookClassName(java.lang.String filteringHookClassName) throws PanamaException
filteringHookClassName
- the filtering hook class name to remove.PanamaException
- exception thrown when remove failedpublic void removeMapping(MAlertServiceMapping mapping) throws PanamaException
save()
call for committing the removal.mapping
- The mapping that needs to be removedPanamaException
- the exception if the MAlertServiceMapping can not be removed.public void removeUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation failspublic void resumeAllUserAlertSubscriptions(User user, Link link) throws PanamaException
user
- the User objectlink
- the Link objectPanamaException
public void resumeUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation failspublic void save() throws PanamaException
MAlertServiceMapping
, AlertChainParamMeta
, AlertInputParamMeta
, AlertConditionMeta
.PanamaException
- the exception when commit 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 void setDescription(java.lang.String desc)
desc
- Descriptionpublic void setFormattedXMLTemplate(java.lang.String messageTemplate) 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>
messageTemplate
- the String contaning the formatted xmlPanamaException
- Exception thrown when the specified template is not a valid mobile xml or xhtml document and or any other error occurspublic void setTimeBasedType(boolean strict) throws PanamaException
strict
- time based type (true for strictly time based)PanamaException
- exception thrown when setting time based type failpublic void suspendAllUserAlertSubscriptions(User user, Link link) throws PanamaException
user
- the User objectlink
- the Link objectPanamaException
public void suspendUserAlertSubscription(ServiceAlertSubscription sub) throws PanamaException
sub
- the ServiceAlertSubscription objectPanamaException
- the exception when this operation fails
|
Oracle Application Server Wireless Java API Reference B14043-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |