| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| CourseRegistrationServiceAuthorizationDecorator |
|
| 0.0;0 |
| 1 | package org.kuali.student.enrollment.class2.courseregistration.service.decorators; | |
| 2 | ||
| 3 | import java.util.List; | |
| 4 | ||
| 5 | import org.kuali.rice.core.api.criteria.QueryByCriteria; | |
| 6 | import org.kuali.rice.kim.api.permission.PermissionService; | |
| 7 | import org.kuali.student.enrollment.courseoffering.dto.RegistrationGroupInfo; | |
| 8 | import org.kuali.student.enrollment.courseregistration.dto.ActivityRegistrationInfo; | |
| 9 | import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo; | |
| 10 | import org.kuali.student.enrollment.courseregistration.dto.RegistrationRequestInfo; | |
| 11 | import org.kuali.student.enrollment.courseregistration.dto.RegistrationRequestItemInfo; | |
| 12 | import org.kuali.student.enrollment.courseregistration.dto.RegistrationResponseInfo; | |
| 13 | import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationService; | |
| 14 | //import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationServiceDecorator; | |
| 15 | import org.kuali.student.enrollment.grading.dto.LoadInfo; | |
| 16 | import org.kuali.student.r2.common.dto.ContextInfo; | |
| 17 | import org.kuali.student.r2.common.dto.StatusInfo; | |
| 18 | import org.kuali.student.r2.common.dto.ValidationResultInfo; | |
| 19 | import org.kuali.student.r2.common.exceptions.AlreadyExistsException; | |
| 20 | import org.kuali.student.r2.common.exceptions.DataValidationErrorException; | |
| 21 | import org.kuali.student.r2.common.exceptions.DoesNotExistException; | |
| 22 | import org.kuali.student.r2.common.exceptions.InvalidParameterException; | |
| 23 | import org.kuali.student.r2.common.exceptions.MissingParameterException; | |
| 24 | import org.kuali.student.r2.common.exceptions.OperationFailedException; | |
| 25 | import org.kuali.student.r2.common.exceptions.PermissionDeniedException; | |
| 26 | import org.kuali.student.r2.common.exceptions.ReadOnlyException; | |
| 27 | import org.kuali.student.r2.common.exceptions.VersionMismatchException; | |
| 28 | import org.kuali.student.r2.common.infc.HoldsPermissionService; | |
| 29 | ||
| 30 | 0 | public class CourseRegistrationServiceAuthorizationDecorator { //extends CourseRegistrationServiceDecorator implements HoldsPermissionService{ |
| 31 | public static final String ENRLLMENT_NAMESPACE = "KS-ENROLL"; | |
| 32 | public static final String SERVICE_NAME = "CourseRegistrationService."; | |
| 33 | ||
| 34 | private PermissionService permissionService; | |
| 35 | ||
| 36 | /********** | |
| 37 | @Override | |
| 38 | public PermissionService getPermissionService() { | |
| 39 | return permissionService; | |
| 40 | } | |
| 41 | ||
| 42 | @Override | |
| 43 | public void setPermissionService(PermissionService permissionService) { | |
| 44 | this.permissionService = permissionService; | |
| 45 | } | |
| 46 | ||
| 47 | @Override | |
| 48 | public List<ValidationResultInfo> checkStudentEligibility(String studentId, ContextInfo context) | |
| 49 | throws DoesNotExistException, InvalidParameterException, | |
| 50 | MissingParameterException, OperationFailedException, | |
| 51 | PermissionDeniedException { | |
| 52 | if (null == context) { | |
| 53 | throw new MissingParameterException(); | |
| 54 | } | |
| 55 | | |
| 56 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "checkStudentEligibility", null)) { | |
| 57 | return getNextDecorator().checkStudentEligibility(studentId, context); | |
| 58 | } | |
| 59 | else { | |
| 60 | throw new PermissionDeniedException(); | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | @Override | |
| 65 | public List<ValidationResultInfo> checkStudentEligibilityForTerm( | |
| 66 | String studentId, String termId, ContextInfo context) | |
| 67 | throws InvalidParameterException, MissingParameterException, | |
| 68 | OperationFailedException, PermissionDeniedException { | |
| 69 | if (null == context) { | |
| 70 | throw new MissingParameterException(); | |
| 71 | } | |
| 72 | | |
| 73 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "checkStudentEligibilityForTerm", null)) { | |
| 74 | return getNextDecorator().checkStudentEligibilityForTerm(studentId, termId, context); | |
| 75 | } | |
| 76 | else { | |
| 77 | throw new PermissionDeniedException(); | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | ||
| 82 | @Override | |
| 83 | public List<ValidationResultInfo> checkStudentEligibiltyForCourseOffering( | |
| 84 | String studentId, String courseOfferingId, ContextInfo context) | |
| 85 | throws InvalidParameterException, MissingParameterException, | |
| 86 | OperationFailedException, PermissionDeniedException { | |
| 87 | if (null == context) { | |
| 88 | throw new MissingParameterException(); | |
| 89 | } | |
| 90 | | |
| 91 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "checkStudentEligibiltyForCourseOffering", null)) { | |
| 92 | return getNextDecorator().checkStudentEligibiltyForCourseOffering(studentId, courseOfferingId, context); | |
| 93 | } | |
| 94 | else { | |
| 95 | throw new PermissionDeniedException(); | |
| 96 | } | |
| 97 | } | |
| 98 | ||
| 99 | @Override | |
| 100 | public List<ValidationResultInfo> checkStudentEligibiltyForRegGroup( | |
| 101 | String studentId, String regGroupId, ContextInfo context) | |
| 102 | throws InvalidParameterException, MissingParameterException, | |
| 103 | OperationFailedException, PermissionDeniedException { | |
| 104 | if (null == context) { | |
| 105 | throw new MissingParameterException(); | |
| 106 | } | |
| 107 | | |
| 108 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "checkStudentEligibiltyForRegGroup", null)) { | |
| 109 | return getNextDecorator().checkStudentEligibiltyForRegGroup(studentId, regGroupId, context); | |
| 110 | } | |
| 111 | else { | |
| 112 | throw new PermissionDeniedException(); | |
| 113 | } | |
| 114 | } | |
| 115 | ||
| 116 | @Override | |
| 117 | public List<RegistrationGroupInfo> getEligibleRegGroupsForStudentInCourseOffering( | |
| 118 | String studentId, String courseOfferingId, ContextInfo context) | |
| 119 | throws InvalidParameterException, MissingParameterException, | |
| 120 | OperationFailedException, PermissionDeniedException { | |
| 121 | if (null == context) { | |
| 122 | throw new MissingParameterException(); | |
| 123 | } | |
| 124 | | |
| 125 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getEligibleRegGroupsForStudentInCourseOffering", null)) { | |
| 126 | return getNextDecorator().getEligibleRegGroupsForStudentInCourseOffering(studentId, courseOfferingId, context); | |
| 127 | } | |
| 128 | else { | |
| 129 | throw new PermissionDeniedException(); | |
| 130 | } | |
| 131 | } | |
| 132 | ||
| 133 | @Override | |
| 134 | public LoadInfo calculateCreditLoadForTerm(String studentId, | |
| 135 | String termId, ContextInfo context) | |
| 136 | throws InvalidParameterException, MissingParameterException, | |
| 137 | OperationFailedException, PermissionDeniedException { | |
| 138 | if (null == context) { | |
| 139 | throw new MissingParameterException(); | |
| 140 | } | |
| 141 | | |
| 142 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "calculateCreditLoadForTerm", null)) { | |
| 143 | return getNextDecorator().calculateCreditLoadForTerm(studentId, termId, context); | |
| 144 | } | |
| 145 | else { | |
| 146 | throw new PermissionDeniedException(); | |
| 147 | } | |
| 148 | } | |
| 149 | ||
| 150 | @Override | |
| 151 | public LoadInfo calculateCreditLoadForRegRequest(String studentId, | |
| 152 | RegRequestInfo regRequestInfo, ContextInfo context) | |
| 153 | throws InvalidParameterException, MissingParameterException, | |
| 154 | OperationFailedException, PermissionDeniedException { | |
| 155 | if (null == context) { | |
| 156 | throw new MissingParameterException(); | |
| 157 | } | |
| 158 | | |
| 159 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "calculateCreditLoadForRegRequest", null)) { | |
| 160 | return getNextDecorator().calculateCreditLoadForRegRequest(studentId, regRequestInfo, context); | |
| 161 | } | |
| 162 | else { | |
| 163 | throw new PermissionDeniedException(); | |
| 164 | } | |
| 165 | } | |
| 166 | ||
| 167 | @Override | |
| 168 | public Integer getAvailableSeatsForCourseOffering(String courseOfferingId, | |
| 169 | ContextInfo context) throws InvalidParameterException, | |
| 170 | MissingParameterException, OperationFailedException, | |
| 171 | PermissionDeniedException { | |
| 172 | if (null == context) { | |
| 173 | throw new MissingParameterException(); | |
| 174 | } | |
| 175 | | |
| 176 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getAvailableSeatsForCourseOffering", null)) { | |
| 177 | return getNextDecorator().getAvailableSeatsForCourseOffering(courseOfferingId, context); | |
| 178 | } | |
| 179 | else { | |
| 180 | throw new PermissionDeniedException(); | |
| 181 | } | |
| 182 | } | |
| 183 | ||
| 184 | @Override | |
| 185 | public Integer getAvailableSeatsForRegGroup(String regGroupId, | |
| 186 | ContextInfo context) throws InvalidParameterException, | |
| 187 | MissingParameterException, OperationFailedException, | |
| 188 | PermissionDeniedException { | |
| 189 | if (null == context) { | |
| 190 | throw new MissingParameterException(); | |
| 191 | } | |
| 192 | | |
| 193 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getAvailableSeatsForRegGroup", null)) { | |
| 194 | return getNextDecorator().getAvailableSeatsForRegGroup(regGroupId, context); | |
| 195 | } | |
| 196 | else { | |
| 197 | throw new PermissionDeniedException(); | |
| 198 | } | |
| 199 | } | |
| 200 | ||
| 201 | @Override | |
| 202 | public Integer getAvailableSeatsForStudentInRegGroup(String studentId, | |
| 203 | String regGroupId, ContextInfo context) | |
| 204 | throws InvalidParameterException, MissingParameterException, | |
| 205 | OperationFailedException, PermissionDeniedException { | |
| 206 | if (null == context) { | |
| 207 | throw new MissingParameterException(); | |
| 208 | } | |
| 209 | | |
| 210 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getAvailableSeatsForStudentInRegGroup", null)) { | |
| 211 | return getNextDecorator().getAvailableSeatsForStudentInRegGroup(studentId, regGroupId, context); | |
| 212 | } | |
| 213 | else { | |
| 214 | throw new PermissionDeniedException(); | |
| 215 | } | |
| 216 | } | |
| 217 | ||
| 218 | @Override | |
| 219 | public Integer getAvailableSeatsInSeatPool(String seatpoolId, | |
| 220 | ContextInfo context) throws InvalidParameterException, | |
| 221 | MissingParameterException, OperationFailedException, | |
| 222 | PermissionDeniedException { | |
| 223 | if (null == context) { | |
| 224 | throw new MissingParameterException(); | |
| 225 | } | |
| 226 | | |
| 227 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getAvailableSeatsInSeatPool", null)) { | |
| 228 | return getNextDecorator().getAvailableSeatsInSeatPool(seatpoolId, context); | |
| 229 | } | |
| 230 | else { | |
| 231 | throw new PermissionDeniedException(); | |
| 232 | } | |
| 233 | } | |
| 234 | ||
| 235 | | |
| 236 | @Override | |
| 237 | public RegRequestInfo createRegRequest(String regRequestTypeKey, | |
| 238 | RegRequestInfo regRequestInfo, ContextInfo context) | |
| 239 | throws AlreadyExistsException, DataValidationErrorException, | |
| 240 | InvalidParameterException, MissingParameterException, | |
| 241 | OperationFailedException, PermissionDeniedException, | |
| 242 | ReadOnlyException, DoesNotExistException { | |
| 243 | | |
| 244 | if (null == context) { | |
| 245 | throw new MissingParameterException(); | |
| 246 | } | |
| 247 | | |
| 248 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "createRegRequest", null)) { | |
| 249 | return getNextDecorator().createRegRequest(regRequestTypeKey, regRequestInfo, context); | |
| 250 | } | |
| 251 | else { | |
| 252 | throw new PermissionDeniedException(); | |
| 253 | } | |
| 254 | } | |
| 255 | ||
| 256 | @Override | |
| 257 | public RegRequestInfo updateRegRequest(String regRequestId, | |
| 258 | RegRequestInfo regRequestInfo, ContextInfo context) | |
| 259 | throws DataValidationErrorException, DoesNotExistException, | |
| 260 | InvalidParameterException, MissingParameterException, | |
| 261 | OperationFailedException, PermissionDeniedException, | |
| 262 | VersionMismatchException, ReadOnlyException { | |
| 263 | if (null == context) { | |
| 264 | throw new MissingParameterException(); | |
| 265 | } | |
| 266 | | |
| 267 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "updateRegRequest", null)) { | |
| 268 | return getNextDecorator().updateRegRequest(regRequestId, regRequestInfo, context); | |
| 269 | } | |
| 270 | else { | |
| 271 | throw new PermissionDeniedException(); | |
| 272 | } | |
| 273 | } | |
| 274 | ||
| 275 | @Override | |
| 276 | public StatusInfo deleteRegRequest(String regRequestId, ContextInfo context) | |
| 277 | throws InvalidParameterException, MissingParameterException, | |
| 278 | OperationFailedException, PermissionDeniedException, | |
| 279 | DoesNotExistException { | |
| 280 | if (null == context) { | |
| 281 | throw new MissingParameterException(); | |
| 282 | } | |
| 283 | | |
| 284 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "deleteRegRequest", null)) { | |
| 285 | return getNextDecorator().deleteRegRequest(regRequestId, context); | |
| 286 | } | |
| 287 | else { | |
| 288 | throw new PermissionDeniedException(); | |
| 289 | } | |
| 290 | } | |
| 291 | ||
| 292 | @Override | |
| 293 | public List<ValidationResultInfo> validateRegRequest(String validationTypeKey , | |
| 294 | String typeKey, RegRequestInfo regRequestInfo, ContextInfo context) | |
| 295 | throws DataValidationErrorException, InvalidParameterException, | |
| 296 | MissingParameterException, OperationFailedException, | |
| 297 | PermissionDeniedException { | |
| 298 | if (null == context) { | |
| 299 | throw new MissingParameterException(); | |
| 300 | } | |
| 301 | | |
| 302 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "validateRegRequest", null)) { | |
| 303 | return getNextDecorator().validateRegRequest(validationTypeKey, typeKey, regRequestInfo, context); | |
| 304 | } | |
| 305 | else { | |
| 306 | throw new PermissionDeniedException(); | |
| 307 | } | |
| 308 | } | |
| 309 | ||
| 310 | @Override | |
| 311 | public List<ValidationResultInfo> verifyRegRequestForSubmission( | |
| 312 | String regRequestId, ContextInfo context) | |
| 313 | throws DataValidationErrorException, InvalidParameterException, | |
| 314 | MissingParameterException, OperationFailedException, | |
| 315 | PermissionDeniedException { | |
| 316 | if (null == context) { | |
| 317 | throw new MissingParameterException(); | |
| 318 | } | |
| 319 | | |
| 320 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "verifyRegRequestForSubmission", null)) { | |
| 321 | return getNextDecorator().verifyRegRequestForSubmission(regRequestId, context); | |
| 322 | } | |
| 323 | else { | |
| 324 | throw new PermissionDeniedException(); | |
| 325 | } | |
| 326 | } | |
| 327 | ||
| 328 | | |
| 329 | | |
| 330 | ||
| 331 | @Override | |
| 332 | public RegRequestInfo createRegRequestFromExisting( | |
| 333 | String existingRegRequestId, ContextInfo context) | |
| 334 | throws InvalidParameterException, MissingParameterException, | |
| 335 | OperationFailedException, PermissionDeniedException, | |
| 336 | DoesNotExistException, DataValidationErrorException { | |
| 337 | if (null == context) { | |
| 338 | throw new MissingParameterException(); | |
| 339 | } | |
| 340 | | |
| 341 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "createRegRequestFromExisting", null)) { | |
| 342 | return getNextDecorator().createRegRequestFromExisting(existingRegRequestId, context); | |
| 343 | } | |
| 344 | else { | |
| 345 | throw new PermissionDeniedException(); | |
| 346 | } | |
| 347 | } | |
| 348 | ||
| 349 | | |
| 350 | ||
| 351 | | |
| 352 | @Override | |
| 353 | public RegRequestInfo getRegRequest(String regRequestId, ContextInfo context) | |
| 354 | throws DoesNotExistException, InvalidParameterException, | |
| 355 | MissingParameterException, OperationFailedException, | |
| 356 | PermissionDeniedException { | |
| 357 | if (null == context) { | |
| 358 | throw new MissingParameterException(); | |
| 359 | } | |
| 360 | | |
| 361 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getRegRequest", null)) { | |
| 362 | return getNextDecorator().getRegRequest(regRequestId, context); | |
| 363 | } | |
| 364 | else { | |
| 365 | throw new PermissionDeniedException(); | |
| 366 | } | |
| 367 | } | |
| 368 | ||
| 369 | @Override | |
| 370 | public List<RegRequestInfo> getRegRequestsByIds( | |
| 371 | List<String> regRequestIds, ContextInfo context) | |
| 372 | throws DoesNotExistException, InvalidParameterException, | |
| 373 | MissingParameterException, OperationFailedException, | |
| 374 | PermissionDeniedException { | |
| 375 | if (null == context) { | |
| 376 | throw new MissingParameterException(); | |
| 377 | } | |
| 378 | | |
| 379 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getRegRequestsByIdList", null)) { | |
| 380 | return getNextDecorator().getRegRequestsByIds(regRequestIds, context); | |
| 381 | } | |
| 382 | else { | |
| 383 | throw new PermissionDeniedException(); | |
| 384 | } | |
| 385 | } | |
| 386 | ||
| 387 | @Override | |
| 388 | public CourseRegistrationInfo getCourseRegistration( | |
| 389 | String courseRegistrationId, ContextInfo context) | |
| 390 | throws DoesNotExistException, InvalidParameterException, | |
| 391 | MissingParameterException, OperationFailedException, | |
| 392 | PermissionDeniedException { | |
| 393 | if (null == context) { | |
| 394 | throw new MissingParameterException(); | |
| 395 | } | |
| 396 | | |
| 397 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getCourseRegistration", null)) { | |
| 398 | return getNextDecorator().getCourseRegistration(courseRegistrationId, context); | |
| 399 | } | |
| 400 | else { | |
| 401 | throw new PermissionDeniedException(); | |
| 402 | } | |
| 403 | } | |
| 404 | ||
| 405 | | |
| 406 | // @Override | |
| 407 | // public List<CourseRegistrationInfo> getCourseRegistrationsByIds( | |
| 408 | // List<String> courseRegistrationIds, ContextInfo context) | |
| 409 | // throws DoesNotExistException, InvalidParameterException, | |
| 410 | // MissingParameterException, OperationFailedException, | |
| 411 | // PermissionDeniedException { | |
| 412 | // if (null == context) { | |
| 413 | // throw new MissingParameterException(); | |
| 414 | // } | |
| 415 | // | |
| 416 | // if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "getCourseRegistrationsByIdList", null)) { | |
| 417 | // return getNextDecorator().getCourseRegistrationsByIds(courseRegistrationIds, context); | |
| 418 | // } | |
| 419 | // else { | |
| 420 | // throw new PermissionDeniedException(); | |
| 421 | // } | |
| 422 | // } | |
| 423 | ||
| 424 | | |
| 425 | ||
| 426 | | |
| 427 | ||
| 428 | ||
| 429 | | |
| 430 | ||
| 431 | ||
| 432 | @Override | |
| 433 | public List<CourseRegistrationInfo> searchForCourseRegistrations( | |
| 434 | QueryByCriteria criteria, ContextInfo context) | |
| 435 | throws InvalidParameterException, MissingParameterException, | |
| 436 | OperationFailedException, PermissionDeniedException { | |
| 437 | if (null == context) { | |
| 438 | throw new MissingParameterException(); | |
| 439 | } | |
| 440 | | |
| 441 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "searchForCourseRegistrations", null)) { | |
| 442 | return getNextDecorator().searchForCourseRegistrations(criteria, context); | |
| 443 | } | |
| 444 | else { | |
| 445 | throw new PermissionDeniedException(); | |
| 446 | } | |
| 447 | } | |
| 448 | ||
| 449 | @Override | |
| 450 | public List<String> searchForCourseRegistrationIds( | |
| 451 | QueryByCriteria criteria, ContextInfo context) | |
| 452 | throws InvalidParameterException, MissingParameterException, | |
| 453 | OperationFailedException, PermissionDeniedException { | |
| 454 | if (null == context) { | |
| 455 | throw new MissingParameterException(); | |
| 456 | } | |
| 457 | | |
| 458 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "searchForCourseOfferingRegistrationIds", null)) { | |
| 459 | return getNextDecorator().searchForCourseRegistrationIds(criteria, context); | |
| 460 | } | |
| 461 | else { | |
| 462 | throw new PermissionDeniedException(); | |
| 463 | } | |
| 464 | } | |
| 465 | ||
| 466 | @Override | |
| 467 | public List<ActivityRegistrationInfo> searchForActivityRegistrations( | |
| 468 | QueryByCriteria criteria, ContextInfo context) | |
| 469 | throws InvalidParameterException, MissingParameterException, | |
| 470 | OperationFailedException, PermissionDeniedException { | |
| 471 | if (null == context) { | |
| 472 | throw new MissingParameterException(); | |
| 473 | } | |
| 474 | | |
| 475 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "searchForActivityRegistrations", null)) { | |
| 476 | return getNextDecorator().searchForActivityRegistrations(criteria, context); | |
| 477 | } | |
| 478 | else { | |
| 479 | throw new PermissionDeniedException(); | |
| 480 | } | |
| 481 | } | |
| 482 | ||
| 483 | @Override | |
| 484 | public List<String> searchForActivityRegistrationIds( | |
| 485 | QueryByCriteria criteria, ContextInfo context) | |
| 486 | throws InvalidParameterException, MissingParameterException, | |
| 487 | OperationFailedException, PermissionDeniedException { | |
| 488 | if (null == context) { | |
| 489 | throw new MissingParameterException(); | |
| 490 | } | |
| 491 | | |
| 492 | if (permissionService.isAuthorized(context.getPrincipalId(), ENRLLMENT_NAMESPACE, SERVICE_NAME + "searchForActivityRegistrationIds", null)) { | |
| 493 | return getNextDecorator().searchForActivityRegistrationIds(criteria, context); | |
| 494 | } | |
| 495 | else { | |
| 496 | throw new PermissionDeniedException(); | |
| 497 | } | |
| 498 | } | |
| 499 | ||
| 500 | @Override | |
| 501 | public RegResponseInfo submitRegRequest(String regRequestId, | |
| 502 | ContextInfo context) throws DoesNotExistException, | |
| 503 | InvalidParameterException, MissingParameterException, | |
| 504 | OperationFailedException, PermissionDeniedException, | |
| 505 | AlreadyExistsException { | |
| 506 | | |
| 507 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "submitRegRequest"); | |
| 508 | | |
| 509 | return getNextDecorator().submitRegRequest(regRequestId, context); | |
| 510 | } | |
| 511 | ||
| 512 | private void checkAuthorization(ContextInfo context, | |
| 513 | String namespace, String serviceName, String methodName) throws MissingParameterException, PermissionDeniedException { | |
| 514 | ||
| 515 | if (null == context) { | |
| 516 | throw new MissingParameterException(); | |
| 517 | } | |
| 518 | | |
| 519 | if (!permissionService.isAuthorized(context.getPrincipalId(), namespace, serviceName + methodName, null)) { | |
| 520 | throw new PermissionDeniedException(); | |
| 521 | } | |
| 522 | } | |
| 523 | ||
| 524 | @Override | |
| 525 | public List<RegRequestItemInfo> getRegRequestItemsByCourseRegistration( | |
| 526 | String courseRegistrationId, ContextInfo context) | |
| 527 | throws DoesNotExistException, InvalidParameterException, | |
| 528 | MissingParameterException, OperationFailedException, | |
| 529 | PermissionDeniedException { | |
| 530 | | |
| 531 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getRegRequestItemsByCourseRegistration"); | |
| 532 | | |
| 533 | return getNextDecorator().getRegRequestItemsByCourseRegistration(courseRegistrationId, context); | |
| 534 | } | |
| 535 | ||
| 536 | @Override | |
| 537 | public List<RegRequestItemInfo> getRegRequestItemsByCourseOfferingAndStudent( | |
| 538 | String courseOfferingId, String studentId, ContextInfo context) | |
| 539 | throws DoesNotExistException, InvalidParameterException, | |
| 540 | MissingParameterException, OperationFailedException, | |
| 541 | PermissionDeniedException { | |
| 542 | | |
| 543 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getRegRequestItemsByCourseOfferingAndStudent"); | |
| 544 | | |
| 545 | return getNextDecorator().getRegRequestItemsByCourseOfferingAndStudent(courseOfferingId, studentId, context); | |
| 546 | } | |
| 547 | ||
| 548 | @Override | |
| 549 | public List<RegRequestInfo> getUnsubmittedRegRequestsByRequestorAndTerm( | |
| 550 | String requestorId, String termId, ContextInfo context) | |
| 551 | throws InvalidParameterException, MissingParameterException, | |
| 552 | OperationFailedException, PermissionDeniedException { | |
| 553 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getUnsubmittedRegRequestsByRequestorAndTerm"); | |
| 554 | | |
| 555 | return getNextDecorator().getUnsubmittedRegRequestsByRequestorAndTerm(requestorId, termId, context); | |
| 556 | } | |
| 557 | ||
| 558 | @Override | |
| 559 | public List<String> getCourseRegistrationIdsByType( | |
| 560 | String courseRegistrationTypeKey, ContextInfo context) | |
| 561 | throws InvalidParameterException, MissingParameterException, | |
| 562 | OperationFailedException, PermissionDeniedException { | |
| 563 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getCourseRegistrationIdsByType"); | |
| 564 | | |
| 565 | return getNextDecorator().getCourseRegistrationIdsByType(courseRegistrationTypeKey, context); | |
| 566 | } | |
| 567 | ||
| 568 | @Override | |
| 569 | public List<CourseRegistrationInfo> getCourseRegistrationsByStudent( | |
| 570 | String studentId, ContextInfo context) | |
| 571 | throws DoesNotExistException, InvalidParameterException, | |
| 572 | MissingParameterException, OperationFailedException, | |
| 573 | PermissionDeniedException { | |
| 574 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getCourseRegistrationsByStudent"); | |
| 575 | | |
| 576 | return getNextDecorator().getCourseRegistrationsByStudent(studentId, context); | |
| 577 | } | |
| 578 | ||
| 579 | @Override | |
| 580 | public List<CourseRegistrationInfo> getCourseRegistrationsByStudentAndCourseOffering( | |
| 581 | String studentId, String courseOfferingId, ContextInfo context) | |
| 582 | throws InvalidParameterException, MissingParameterException, | |
| 583 | OperationFailedException, PermissionDeniedException { | |
| 584 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getCourseRegistrationsByStudentAndCourseOffering"); | |
| 585 | | |
| 586 | return getNextDecorator().getCourseRegistrationsByStudentAndCourseOffering(studentId, courseOfferingId, context); | |
| 587 | } | |
| 588 | ||
| 589 | @Override | |
| 590 | public List<CourseRegistrationInfo> getCourseRegistrationsByStudentAndTerm( | |
| 591 | String studentId, String termId, ContextInfo context) | |
| 592 | throws DoesNotExistException, InvalidParameterException, | |
| 593 | MissingParameterException, OperationFailedException, | |
| 594 | PermissionDeniedException { | |
| 595 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getCourseRegistrationsByStudentAndTerm"); | |
| 596 | | |
| 597 | return getNextDecorator().getCourseRegistrationsByStudentAndTerm(studentId, termId, context); | |
| 598 | } | |
| 599 | ||
| 600 | @Override | |
| 601 | public List<CourseRegistrationInfo> getCourseRegistrationsByCourseOffering( | |
| 602 | String courseOfferingId, ContextInfo context) | |
| 603 | throws DoesNotExistException, InvalidParameterException, | |
| 604 | MissingParameterException, OperationFailedException, | |
| 605 | PermissionDeniedException { | |
| 606 | checkAuthorization (context, ENRLLMENT_NAMESPACE, SERVICE_NAME, "getCourseRegistrationsByCourseOffering"); | |
| 607 | | |
| 608 | return getNextDecorator().getCourseRegistrationsByCourseOffering(courseOfferingId, context); | |
| 609 | } | |
| 610 | ||
| 611 | *******/ | |
| 612 | ||
| 613 | ||
| 614 | ||
| 615 | } |