org.jasig.portlet.notice.service
Class DemoNotificationService

java.lang.Object
  extended by org.jasig.portlet.notice.service.AbstractNotificationService
      extended by org.jasig.portlet.notice.service.DemoNotificationService
All Implemented Interfaces:
INotificationService

public class DemoNotificationService
extends AbstractNotificationService

This is a simple demo service provider. It reads data from a file and returns it.


Constructor Summary
DemoNotificationService()
           
 
Method Summary
 NotificationResponse fetchNotificationsFromSource(javax.portlet.PortletRequest req)
          Retrieves all available service requests for requester
 String getName()
          Returns the name of the service.
 NotificationResponse readFromFile(String filename)
          De-serialize the given JSON formatted file back into a object.
 void setFilename(String filename)
          Set the filename of the demo data.
 boolean writeToFile(NotificationResponse request, String filename)
          Serialize the given instance to JSON data and write it to a file.
 
Methods inherited from class org.jasig.portlet.notice.service.AbstractNotificationService
getNotifications, refreshNotifications
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DemoNotificationService

public DemoNotificationService()
Method Detail

getName

public String getName()
Returns the name of the service.

Returns:
String.

setFilename

public void setFilename(String filename)
Set the filename of the demo data.

Parameters:
filename - is the demo filename.

fetchNotificationsFromSource

public NotificationResponse fetchNotificationsFromSource(javax.portlet.PortletRequest req)
                                                  throws NotificationServiceException
Retrieves all available service requests for requester

Parameters:
partyNumber -
username -
Returns:
List of service requests or an empty list
Throws:
NotificationServiceException

writeToFile

public boolean writeToFile(NotificationResponse request,
                           String filename)
Serialize the given instance to JSON data and write it to a file.

Parameters:
request - is the NotificationRequest instance to be serialized to a file.
filename - is the path and name of the file to be written.
Returns:
boolean, false if the data write fails.

readFromFile

public NotificationResponse readFromFile(String filename)
De-serialize the given JSON formatted file back into a object.

Parameters:
filename - is the path and name of the file to be read.
Returns:
NotificationRequest, null if the de-serialization fails.


Copyright © 2012 Jasig. All Rights Reserved.