1 /**
2 * Copyright 2005-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.ken.service;
17
18 import org.kuali.rice.core.api.util.xml.XmlException;
19 import org.kuali.rice.ken.bo.Notification;
20 import org.kuali.rice.ken.bo.NotificationResponse;
21 import org.xml.sax.SAXException;
22
23 import javax.xml.parsers.ParserConfigurationException;
24 import java.io.IOException;
25 import java.io.InputStream;
26
27 /**
28 * Notification Message Content service - handles parsing the notification XML message and also marshalling out BOs for the response.
29 * @see <a href="http://wiki.library.cornell.edu/wiki/display/notsys/Hi-Level+Service+Interface+Definitions#Hi-LevelServiceInterfaceDefinitions-NotificationMessageContentService">NotificationMessageContentService</a>
30 * @author Kuali Rice Team (rice.collab@kuali.org)
31 */
32 public interface NotificationMessageContentService {
33 /**
34 * Parses a Notification request message into business objects. Performs syntactic and semantic validation.
35 * This method takes an InputStream.
36 * @param stream request message stream
37 * @return Notification business object
38 * @throws SAXException
39 * @throws ParserConfigurationException
40 * @throws IOException
41 * @throws XmlException
42 */
43 public Notification parseNotificationRequestMessage(InputStream stream) throws IOException, XmlException;
44
45 /**
46 * Parses a Notification request message into business objects. Performs syntactic and semantic validation.
47 * This method takes a String of XML.
48 * @param notificationMessageAsXml
49 * @return
50 * @throws IOException
51 * @throws XmlException
52 */
53 public Notification parseNotificationRequestMessage(String notificationMessageAsXml) throws IOException, XmlException;
54
55 /**
56 * Generates a Notification response message
57 * @param response
58 * @return String XML representation of a Notification response object
59 */
60 public String generateNotificationResponseMessage(NotificationResponse response);
61
62 /**
63 * This method is responsible for marshalling out the passed in Notification object in and XML representation.
64 * @param notification
65 * @return String of XML.
66 */
67 public String generateNotificationMessage(Notification notification);
68
69 /**
70 * This method is responsible for marshalling out the passed in Notification object in and XML representation, with
71 * the addition of adding the specific recipient to the recipients list and removing the others.
72 * @param notification
73 * @param userRecipientId
74 * @return String of XML.
75 */
76 public String generateNotificationMessage(Notification notification, String userRecipientId);
77
78 /**
79 * This method parses out the serialized XML version of Notification BO and populates a Notification BO with it.
80 * @param xmlAsBytes
81 * @return Notification
82 * @throws Exception
83 */
84 public Notification parseSerializedNotificationXml(byte[] xmlAsBytes) throws Exception;
85 }