org.jasig.portlet.notice.response
Class NotificationResponse

java.lang.Object
  extended by org.jasig.portlet.notice.response.NotificationResponse
All Implemented Interfaces:
Serializable

public class NotificationResponse
extends Object
implements Serializable

This class contains all the categories and errors retrieved by an INotificationService. It is also used to aggregate all the NotificationResponses from various services into a single NotificationResponse. The data from the overall NotificationResponse instance is returned to the portlet to be rendered.

See Also:
Serialized Form

Constructor Summary
NotificationResponse()
           
NotificationResponse(List<NotificationCategory> categories, List<NotificationError> errors)
           
 
Method Summary
 void addCategories(List<NotificationCategory> newCategories)
          Insert the given categories and their entries into the any existing categories of the same title.
 void addErrors(List<NotificationError> newErrors)
           
 void addResponseData(NotificationResponse response)
          Extract the category and error data from the given response and add it to this instance's data.
 void clearCategories()
           
 void clearErrors()
           
 void filterErrors(Set<Integer> filterErrors)
           
static NotificationResponse fromJson(String data)
          Write the instance data to a JSON data file.
 List<NotificationCategory> getCategories()
           
 List<NotificationError> getErrors()
           
 void setCategories(List<NotificationCategory> categories)
           
 void setErrors(List<NotificationError> errors)
           
 void setSource(String source)
          Set the source of the data.
 String toJson()
          Write the instance data to a JSON data String.
static String toJson(NotificationResponse request)
          Write the instance data to a JSON data String.
 Map<String,Object> toMap()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotificationResponse

public NotificationResponse()

NotificationResponse

public NotificationResponse(List<NotificationCategory> categories,
                            List<NotificationError> errors)
Method Detail

setSource

public void setSource(String source)
Set the source of the data. This method will iterate through the data and set the source value for the entries and error (if any).

Parameters:
source - is the source of the data.

toJson

public String toJson()
Write the instance data to a JSON data String.

Returns:
String, null if the data is invalid.

toJson

public static String toJson(NotificationResponse request)
Write the instance data to a JSON data String.

Returns:
String, null if the data is invalid.

fromJson

public static NotificationResponse fromJson(String data)
Write the instance data to a JSON data file.

Parameters:
data - the JSON data string.
Returns:
NotificationRequest, null if the JSON data is invalid.

toMap

public Map<String,Object> toMap()

addResponseData

public void addResponseData(NotificationResponse response)
Extract the category and error data from the given response and add it to this instance's data.

Parameters:
response - the source of data

getCategories

public List<NotificationCategory> getCategories()

setCategories

public void setCategories(List<NotificationCategory> categories)

addCategories

public void addCategories(List<NotificationCategory> newCategories)
Insert the given categories and their entries into the any existing categories of the same title. If a category doesn't match an existing one, add it to the list.

Parameters:
newCategories - collection of new categories and their entries.

clearCategories

public void clearCategories()

getErrors

public List<NotificationError> getErrors()

setErrors

public void setErrors(List<NotificationError> errors)

addErrors

public void addErrors(List<NotificationError> newErrors)

filterErrors

public void filterErrors(Set<Integer> filterErrors)

clearErrors

public void clearErrors()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Jasig. All Rights Reserved.