1 /** 2 * Copyright 2010 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the 5 * "License"); you may not use this file except in compliance with the 6 * License. You may obtain a copy of the License at 7 * 8 * http://www.osedu.org/licenses/ECL-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, 11 * software distributed under the License is distributed on an "AS IS" 12 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 13 * or implied. See the License for the specific language governing 14 * permissions and limitations under the License. 15 */ 16 17 package org.kuali.student.r2.common.messages.service; 18 19 import java.util.List; 20 21 import org.kuali.student.r2.common.dto.ContextInfo; 22 import org.kuali.student.r2.common.dto.LocaleInfo; 23 import org.kuali.student.r2.common.dto.StatusInfo; 24 25 import org.kuali.student.r2.common.exceptions.DoesNotExistException; 26 import org.kuali.student.r2.common.exceptions.InvalidParameterException; 27 import org.kuali.student.r2.common.exceptions.MissingParameterException; 28 import org.kuali.student.r2.common.exceptions.OperationFailedException; 29 import org.kuali.student.r2.common.exceptions.PermissionDeniedException; 30 import org.kuali.student.r2.common.exceptions.ReadOnlyException; 31 import org.kuali.student.r2.common.exceptions.VersionMismatchException; 32 33 import org.kuali.student.r2.common.messages.dto.MessageInfo; 34 import org.kuali.student.r2.common.util.constants.MessageServiceConstants; 35 36 import javax.jws.WebParam; 37 import javax.jws.WebService; 38 import javax.jws.soap.SOAPBinding; 39 import org.kuali.student.r2.common.dto.ValidationResultInfo; 40 import org.kuali.student.r2.common.exceptions.DataValidationErrorException; 41 42 /** 43 * The Message Service allows for the creation and management of 44 * messages. 45 * 46 * @version 1.0 47 * @author Kuali Student Services Team 48 */ 49 50 @WebService(name = "MessageService", targetNamespace = MessageServiceConstants.NAMESPACE) 51 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) 52 public interface MessageService { 53 54 /** 55 * Retrieves the list of locales supported by this service. 56 * 57 * @param contextInfo information containing the principalId and 58 * locale information about the caller of service operation 59 * @return a list of locales supported by this service 60 * @throws InvalidParameterException contextInfo is not valid 61 * @throws MissingParameterException contextInfo is missing or null 62 * @throws OperationFailedException unable to complete request 63 * @throws PermissionDeniedException an authorization failure occurred 64 */ 65 public List<LocaleInfo> getLocales(@WebParam(name = "contextInfo") ContextInfo contextInfo) 66 throws InvalidParameterException, 67 MissingParameterException, 68 OperationFailedException, 69 PermissionDeniedException; 70 71 /** 72 * Retrieves the list of message group keys known by the service 73 * 74 * @param contextInfo information containing the principalId and 75 * locale information about the caller of service operation 76 * @return a list of message group keys 77 * @throws InvalidParameterException contextInfo is not valid 78 * @throws MissingParameterException contextInfo is missing or null 79 * @throws OperationFailedException unable to complete request 80 * @throws PermissionDeniedException an authorization failure occurred 81 */ 82 public List<String> getMessageGroupKeys(@WebParam(name = "contextInfo") ContextInfo contextInfo) 83 throws InvalidParameterException, 84 MissingParameterException, 85 OperationFailedException, 86 PermissionDeniedException; 87 88 /** 89 * Retrieves message information. 90 * 91 * @param localeInfo the locale information 92 * @param messageGroupKey an identifier for the message group to 93 * which the message belongs 94 * @param messageKey the identifier for the requested message 95 * @param contextInfo information containing the principalId and 96 * locale information about the caller of service operation 97 * @return the requested message 98 * @throws DoesNotExistException messageGroupKey or messageKey is 99 * not found 100 * @throws InvalidParameterException contextInfo is not valid 101 * @throws MissingParameterException localeInfo, messageGroupKey, 102 * messageKey, or contextInfo is missing or null 103 * @throws OperationFailedException unable to complete request 104 * @throws PermissionDeniedException an authorization failure occurred 105 */ 106 public MessageInfo getMessage(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 107 @WebParam(name = "messageGroupKey") String messageGroupKey, 108 @WebParam(name = "messageKey") String messageKey, 109 @WebParam(name = "contextInfo") ContextInfo contextInfo) 110 throws DoesNotExistException, 111 InvalidParameterException, 112 MissingParameterException, 113 OperationFailedException, 114 PermissionDeniedException; 115 116 117 118 /** 119 * Retrieves a list of Messages from a list of Message keys. 120 * The returned list may be in any order and if duplicates keys are supplied, a unique set may or may not be returned 121 * 122 * @param messageKeys a list of Message keys 123 * @param contextInfo information containing the principalId and 124 * locale information about the caller of service operation 125 * @return a list of MessageInfo 126 * @throws DoesNotExistException an MessageKey in the list was not found 127 * @throws InvalidParameterException context is not valid 128 * @throws MissingParameterException MessageKeys, a key in MessageKeys, or contextInfo is missing or null 129 * @throws OperationFailedException unable to complete request 130 * @throws PermissionDeniedException an authorization failure occurred 131 */ 132 public List<MessageInfo> getMessagesByKeys(@WebParam(name = "messageKeys") List<String> messageKeys,@WebParam(name = "contextInfo")ContextInfo contextInfo) 133 throws DoesNotExistException, 134 InvalidParameterException, 135 MissingParameterException, 136 OperationFailedException, 137 PermissionDeniedException; 138 139 /** 140 * Retrieve messages associated with a locale and group. 141 * 142 * @param localeInfo the locale information 143 * @param messageGroupKey an identifier for the message group to 144 * which the messages belong 145 * @param contextInfo information containing the principalId and 146 * locale information about the caller of service operation 147 * @return a list of Messages 148 * @throws DoesNotExistException messageGroupKey is not found 149 * @throws InvalidParameterException loacleInfo or contextInfo is 150 * not valid 151 * @throws MissingParameterException localeInfo, messageGroupKey, 152 * or contextInfo is missing or null 153 * @throws OperationFailedException unable to complete request 154 * @throws PermissionDeniedException an authorization failure occurred 155 */ 156 public List<MessageInfo> getMessagesByGroup(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 157 @WebParam(name = "messageGroupKey") String messageGroupKey, 158 @WebParam(name = "contextInfo") ContextInfo contextInfo) 159 throws DoesNotExistException, 160 InvalidParameterException, 161 MissingParameterException, 162 OperationFailedException, 163 PermissionDeniedException; 164 165 /** 166 * Retrieve messages associated with a locale from a specified 167 * list of groups. 168 * 169 * @param localeInfo the locale information 170 * @param messageGroupKeys a list of identifiers for the message 171 * groups 172 * @param contextInfo information containing the principalId and 173 * locale information about the caller of service operation 174 * @return the list of Messages belonging to the list of message groups 175 * @throws DoesNotExistException localeInfo or a messageGroupKey 176 * in messageGroupKeys is not found 177 * @throws InvalidParameterException localeInfo or contextInfo is 178 * not valid 179 * @throws MissingParameterException localeInfo, messageGroupKeys, 180 * a messageGroupKey in messagegroupKey, or contextInfo is 181 * missing or null 182 * @throws OperationFailedException unable to complete request 183 * @throws PermissionDeniedException an authorization failure occurred 184 */ 185 public List<MessageInfo> getMessagesByGroups(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 186 @WebParam(name = "messageGroupKeys") List<String> messageGroupKeys, 187 @WebParam(name = "contextInfo") ContextInfo contextInfo) 188 throws DoesNotExistException, 189 InvalidParameterException, 190 MissingParameterException, 191 OperationFailedException, 192 PermissionDeniedException; 193 194 /** 195 * Validates a message. 196 * 197 * Depending on the value of validationType, this validation could 198 * be limited to tests on just the current object and its directly 199 * contained subobjects or expanded to perform all tests related 200 * to this object. If an identifier is present for the message and 201 * a record is found for that identifier, the validation checks if 202 * the message can be shifted to the new values. If a record 203 * cannot be found for the identifier, it is assumed that the 204 * record does not exist and as such, the checks performed will be 205 * much shallower, typically mimicking those performed by setting 206 * the validationType to the current object. This is a slightly 207 * different pattern from the standard validation as the caller 208 * provides the identifier in the create statement instead of the 209 * server assigning an identifier. 210 * 211 * @param validationTypeKey Identifier of the extent of validation 212 * @param messageInfo The message information to be tested. 213 * @return Results from performing the validation 214 * @throws DoesNotExistException validationTypeKey not found 215 * @throws InvalidParameterException invalid validationTypeKey, messageInfo 216 * @throws MissingParameterException missing validationTypeKey, messageInfo 217 * @throws OperationFailedException unable to complete request 218 */ 219 public List<ValidationResultInfo> validateMessage(@WebParam(name = "validationTypeKey") String validationTypeKey, 220 @WebParam(name = "messageInfo") MessageInfo messageInfo, 221 @WebParam(name = "contextInfo") ContextInfo contextInfo) 222 throws DoesNotExistException, 223 InvalidParameterException, 224 MissingParameterException, 225 OperationFailedException; 226 227 /** 228 * Create a new message for a locale and group. 229 * 230 * @param localeInfo the locale information 231 * @param messageGroupKey an identifier for the message group 232 * @param messageKey an identifier for the message within the group 233 * @param messageInfo the message information to be added 234 * @param contextInfo information containing the principalId and 235 * locale information about the caller of service operation 236 * @return the status of the operation. This must always be true. 237 * @throws DataValidationErrorException One or more values invalid for this 238 * operation 239 * @throws DoesNotExistException messageGroupKey is not found 240 * @throws InvalidParameterException localeInfo or contetInfo is 241 * not valid 242 * @throws MissingParameterException localeInfo, messageGroupKey, 243 * or contextInfo is missing or null 244 * @throws OperationFailedException unable to complete request 245 * @throws PermissionDeniedException an authorization failure occurred 246 * @throws ReadOnlyException 247 */ 248 249 public StatusInfo createMessage(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 250 @WebParam(name = "messageGroupKey") String messageGroupKey, 251 @WebParam(name = "messageKey") String messageKey, 252 @WebParam(name = "messageInfo") MessageInfo messageInfo, 253 @WebParam(name = "contextInfo") ContextInfo contextInfo) 254 throws DataValidationErrorException, 255 DoesNotExistException, 256 InvalidParameterException, 257 MissingParameterException, 258 OperationFailedException, 259 PermissionDeniedException; 260 261 /** 262 * Update message associated with a locale and group. 263 * 264 * @param localeInfo the locale information 265 * @param messageGroupKey an identifier for the message group to 266 * which the messages belong 267 * @param messageKey the indentifier for the message 268 * @param messageInfo the message information to be updated 269 * @param contextInfo information containing the principalId and 270 * locale information about the caller of service operation 271 * @return message information 272 * @throws DoesNotExistException messageKey is not found 273 * @throws DataValidationErrorException if invalid data 274 * @throws InvalidParameterException localeInfo, messageInfo, or 275 * contextInfo is not valid 276 * @throws MissingParameterException localeInfo, messageKey, messageInfo, 277 * or contextInfo is missing or null 278 * @throws OperationFailedException unable to complete request 279 * @throws PermissionDeniedException an authorization failure occurred 280 * @throws ReadOnlyException an attempt at supplying information 281 * designated as read only 282 * @throws VersionMismatchException an optimistic locking failure 283 * or the action was attempted on an out of date version 284 */ 285 public MessageInfo updateMessage(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 286 @WebParam(name = "messageGroupKey") String messageGroupKey, 287 @WebParam(name = "messageKey") String messageKey, 288 @WebParam(name = "messageInfo") MessageInfo messageInfo, 289 @WebParam(name = "contextInfo") ContextInfo contextInfo) 290 throws DataValidationErrorException, 291 DoesNotExistException, 292 InvalidParameterException, 293 MissingParameterException, 294 OperationFailedException, 295 PermissionDeniedException, 296 ReadOnlyException, 297 VersionMismatchException; 298 299 /** 300 * Deletes the message associated with a locale and group for a 301 * message key 302 * 303 * @param localeInfo the locale information 304 * @param messageGroupKey an identifier for the message group to 305 * which the messages belong 306 * @param messageKey an identifier for the Message to be deleted 307 * @param contextInfo information containing the principalId and 308 * information about the caller of service operation 309 * @return the status of the operation. This must always be true. 310 * @throws DoesNotExistException messageKey not found for locale 311 * @throws InvalidParameterException localeInfo or contextInfo is 312 * not valid 313 * @throws MissingParameterException localeInfo, messageKey, or 314 * contextInfo is missing or null 315 * @throws OperationFailedException unable to complete request 316 * @throws PermissionDeniedException an authorization failure occurred 317 */ 318 public StatusInfo deleteMessage(@WebParam(name = "localeInfo") LocaleInfo localeInfo, 319 @WebParam(name = "messageGroupKey") String messageGroupKey, 320 @WebParam(name = "messageKey") String messageKey, 321 @WebParam(name = "contextInfo") ContextInfo contextInfo) 322 throws DoesNotExistException, 323 InvalidParameterException, 324 MissingParameterException, 325 OperationFailedException, 326 PermissionDeniedException; 327 }