| 1 | |
package org.kuali.student.enrollment.class2.courseoffering.service.impl; |
| 2 | |
|
| 3 | |
import org.apache.commons.lang.StringUtils; |
| 4 | |
import org.kuali.rice.core.api.criteria.GenericQueryResults; |
| 5 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
| 6 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 7 | |
import org.kuali.student.common.util.UUIDHelper; |
| 8 | |
import org.kuali.student.enrollment.acal.dto.TermInfo; |
| 9 | |
import org.kuali.student.enrollment.acal.service.AcademicCalendarService; |
| 10 | |
import org.kuali.student.enrollment.class1.lui.model.LuiEntity; |
| 11 | |
import org.kuali.student.enrollment.class2.courseoffering.service.assembler.RegistrationGroupAssembler; |
| 12 | |
import org.kuali.student.enrollment.class2.courseoffering.service.decorators.R1CourseServiceHelper; |
| 13 | |
import org.kuali.student.enrollment.class2.courseoffering.service.transformer.ActivityOfferingTransformer; |
| 14 | |
import org.kuali.student.enrollment.class2.courseoffering.service.transformer.CourseOfferingTransformer; |
| 15 | |
import org.kuali.student.enrollment.class2.courseoffering.service.transformer.FormatOfferingTransformer; |
| 16 | |
import org.kuali.student.enrollment.courseoffering.dto.*; |
| 17 | |
import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService; |
| 18 | |
import org.kuali.student.enrollment.courseoffering.service.CourseOfferingServiceBusinessLogic; |
| 19 | |
import org.kuali.student.enrollment.lpr.dto.LuiPersonRelationInfo; |
| 20 | |
import org.kuali.student.enrollment.lpr.service.LuiPersonRelationService; |
| 21 | |
import org.kuali.student.enrollment.lui.dto.LuiInfo; |
| 22 | |
import org.kuali.student.enrollment.lui.dto.LuiLuiRelationInfo; |
| 23 | |
import org.kuali.student.enrollment.lui.service.LuiService; |
| 24 | |
import org.kuali.student.lum.course.dto.CourseInfo; |
| 25 | |
import org.kuali.student.lum.course.dto.FormatInfo; |
| 26 | |
import org.kuali.student.lum.course.service.CourseService; |
| 27 | |
import org.kuali.student.r2.common.criteria.CriteriaLookupService; |
| 28 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 29 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 30 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 31 | |
import org.kuali.student.r2.common.exceptions.*; |
| 32 | |
import org.kuali.student.r2.common.util.constants.AtpServiceConstants; |
| 33 | |
import org.kuali.student.r2.common.util.constants.LuiPersonRelationServiceConstants; |
| 34 | |
import org.kuali.student.r2.common.util.constants.LuiServiceConstants; |
| 35 | |
import org.kuali.student.r2.core.atp.dto.AtpInfo; |
| 36 | |
import org.kuali.student.r2.core.atp.service.AtpService; |
| 37 | |
import org.kuali.student.r2.core.state.service.StateService; |
| 38 | |
import org.kuali.student.r2.core.type.dto.TypeInfo; |
| 39 | |
import org.kuali.student.r2.core.type.service.TypeService; |
| 40 | |
import org.springframework.transaction.annotation.Transactional; |
| 41 | |
|
| 42 | |
import javax.jws.WebParam; |
| 43 | |
import javax.xml.namespace.QName; |
| 44 | |
import java.util.*; |
| 45 | |
|
| 46 | |
|
| 47 | 0 | public class CourseOfferingServiceImpl implements CourseOfferingService { |
| 48 | |
|
| 49 | |
private LuiService luiService; |
| 50 | |
private TypeService typeService; |
| 51 | |
private CourseService courseService; |
| 52 | |
private AcademicCalendarService acalService; |
| 53 | |
private AtpService atpService; |
| 54 | |
private RegistrationGroupAssembler registrationGroupAssembler; |
| 55 | |
private StateService stateService; |
| 56 | |
private LuiPersonRelationService lprService; |
| 57 | |
private CourseOfferingServiceBusinessLogic businessLogic; |
| 58 | |
|
| 59 | 0 | private static final Integer TEMP_MAX_ENROLLMENT_DEFAULT = 50; |
| 60 | |
|
| 61 | |
public CourseOfferingServiceBusinessLogic getBusinessLogic() { |
| 62 | 0 | return businessLogic; |
| 63 | |
} |
| 64 | |
|
| 65 | |
public void setBusinessLogic(CourseOfferingServiceBusinessLogic businessLogic) { |
| 66 | 0 | this.businessLogic = businessLogic; |
| 67 | 0 | } |
| 68 | |
|
| 69 | |
|
| 70 | |
@Override |
| 71 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 72 | |
public StatusInfo deleteCourseOfferingCascaded( String courseOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 73 | 0 | throw new UnsupportedOperationException(); |
| 74 | |
} |
| 75 | |
|
| 76 | |
@Override |
| 77 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 78 | |
public StatusInfo deleteFormatOfferingCascaded( String formatOfferingId,ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 79 | 0 | throw new UnsupportedOperationException(); |
| 80 | |
} |
| 81 | |
|
| 82 | |
@Override |
| 83 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 84 | |
public RegistrationGroupInfo createRegistrationGroup( String formatOfferingId, String registrationGroupType, RegistrationGroupInfo registrationGroupInfo, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 85 | 0 | throw new UnsupportedOperationException(); |
| 86 | |
} |
| 87 | |
|
| 88 | |
public CriteriaLookupService getCriteriaLookupService() { |
| 89 | 0 | return criteriaLookupService; |
| 90 | |
} |
| 91 | |
|
| 92 | |
public void setCriteriaLookupService(CriteriaLookupService criteriaLookupService) { |
| 93 | 0 | this.criteriaLookupService = criteriaLookupService; |
| 94 | 0 | } |
| 95 | |
|
| 96 | |
private CriteriaLookupService criteriaLookupService; |
| 97 | |
|
| 98 | |
public LuiService getLuiService() { |
| 99 | 0 | return luiService; |
| 100 | |
} |
| 101 | |
|
| 102 | |
public void setLuiService(LuiService luiService) { |
| 103 | 0 | this.luiService = luiService; |
| 104 | 0 | } |
| 105 | |
|
| 106 | |
public TypeService getTypeService() { |
| 107 | 0 | return typeService; |
| 108 | |
} |
| 109 | |
|
| 110 | |
public void setTypeService(TypeService typeService) { |
| 111 | 0 | this.typeService = typeService; |
| 112 | 0 | } |
| 113 | |
|
| 114 | |
public CourseService getCourseService() { |
| 115 | 0 | return courseService; |
| 116 | |
} |
| 117 | |
|
| 118 | |
public void setCourseService(CourseService courseService) { |
| 119 | 0 | this.courseService = courseService; |
| 120 | 0 | } |
| 121 | |
|
| 122 | |
public AcademicCalendarService getAcalService() { |
| 123 | 0 | return acalService; |
| 124 | |
} |
| 125 | |
|
| 126 | |
public void setAcalService(AcademicCalendarService acalService) { |
| 127 | 0 | this.acalService = acalService; |
| 128 | 0 | } |
| 129 | |
|
| 130 | |
public RegistrationGroupAssembler getRgAssembler() { |
| 131 | 0 | return registrationGroupAssembler; |
| 132 | |
} |
| 133 | |
|
| 134 | |
public void setRgAssembler(RegistrationGroupAssembler rgAssembler) { |
| 135 | 0 | this.registrationGroupAssembler = rgAssembler; |
| 136 | 0 | } |
| 137 | |
|
| 138 | |
public StateService getStateService() { |
| 139 | 0 | return stateService; |
| 140 | |
} |
| 141 | |
|
| 142 | |
public void setStateService(StateService stateService) { |
| 143 | 0 | this.stateService = stateService; |
| 144 | 0 | } |
| 145 | |
|
| 146 | |
public LuiPersonRelationService getLprService() { |
| 147 | 0 | return lprService; |
| 148 | |
} |
| 149 | |
|
| 150 | |
public void setLprService(LuiPersonRelationService lprService) { |
| 151 | 0 | this.lprService = lprService; |
| 152 | 0 | } |
| 153 | |
|
| 154 | |
@Override |
| 155 | |
@Transactional(readOnly = true) |
| 156 | |
public CourseOfferingInfo getCourseOffering(String courseOfferingId, ContextInfo context) |
| 157 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 158 | |
OperationFailedException, PermissionDeniedException { |
| 159 | 0 | LuiInfo lui = luiService.getLui(courseOfferingId, context); |
| 160 | 0 | CourseOfferingInfo co = new CourseOfferingInfo(); |
| 161 | 0 | new CourseOfferingTransformer().lui2CourseOffering(lui, co, context); |
| 162 | 0 | return co; |
| 163 | |
} |
| 164 | |
|
| 165 | |
@Override |
| 166 | |
@Transactional(readOnly = true) |
| 167 | |
public CourseOfferingAdminDisplayInfo getCourseOfferingAdminDisplay(String courseOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 168 | 0 | throw new UnsupportedOperationException("Not supported yet"); |
| 169 | |
} |
| 170 | |
|
| 171 | |
@Override |
| 172 | |
@Transactional(readOnly = true) |
| 173 | |
public List<CourseOfferingAdminDisplayInfo> getCourseOfferingAdminDisplaysByIds(List<String> courseOfferingIds, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 174 | 0 | throw new UnsupportedOperationException("Not supported yet"); |
| 175 | |
} |
| 176 | |
|
| 177 | |
@Override |
| 178 | |
public ActivityOfferingAdminDisplayInfo getActivityOfferingAdminDisplay(String activityOfferingId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 179 | 0 | throw new UnsupportedOperationException("Not supported yet"); |
| 180 | |
} |
| 181 | |
|
| 182 | |
@Override |
| 183 | |
public List<ActivityOfferingAdminDisplayInfo> getActivityOfferingAdminDisplaysByIds(List<String> activityOfferingIds, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 184 | 0 | throw new UnsupportedOperationException("Not supported yet"); |
| 185 | |
} |
| 186 | |
|
| 187 | |
@Override |
| 188 | |
public List<ActivityOfferingAdminDisplayInfo> getActivityOfferingAdminDisplaysForCourseOffering(String courseOfferingId, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 189 | 0 | throw new UnsupportedOperationException("Not supported yet"); |
| 190 | |
} |
| 191 | |
|
| 192 | |
@Override |
| 193 | |
@Transactional(readOnly = true) |
| 194 | |
public List<CourseOfferingInfo> getCourseOfferingsByIds(List<String> courseOfferingIds, ContextInfo context) |
| 195 | |
throws DoesNotExistException, InvalidParameterException, |
| 196 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 197 | |
|
| 198 | 0 | List<CourseOfferingInfo> results = new ArrayList<CourseOfferingInfo>(); |
| 199 | 0 | for (String id : courseOfferingIds) { |
| 200 | 0 | CourseOfferingInfo co = getCourseOffering(id, context); |
| 201 | 0 | results.add(co); |
| 202 | 0 | } |
| 203 | 0 | return results; |
| 204 | |
} |
| 205 | |
|
| 206 | |
@Override |
| 207 | |
@Transactional(readOnly = true) |
| 208 | |
public List<CourseOfferingInfo> getCourseOfferingsByCourse(String courseId, ContextInfo context) |
| 209 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 210 | |
OperationFailedException, PermissionDeniedException { |
| 211 | 0 | List<String> luiIds = luiService.getLuiIdsByClu(courseId, context); |
| 212 | 0 | List<CourseOfferingInfo> results = new ArrayList<CourseOfferingInfo>(); |
| 213 | 0 | for (String luiId : luiIds) { |
| 214 | 0 | CourseOfferingInfo co = getCourseOffering(luiId, context); |
| 215 | 0 | results.add(co); |
| 216 | 0 | } |
| 217 | 0 | return results; |
| 218 | |
} |
| 219 | |
|
| 220 | |
@Override |
| 221 | |
@Transactional(readOnly = true) |
| 222 | |
public List<CourseOfferingInfo> getCourseOfferingsByCourseAndTerm(String courseId, String termId, ContextInfo context) |
| 223 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 224 | |
OperationFailedException, PermissionDeniedException { |
| 225 | |
|
| 226 | 0 | acalService.getTerm(termId, context); |
| 227 | 0 | List<String> luiIds = luiService.getLuiIdsByAtpAndType(termId, LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, context); |
| 228 | 0 | List<CourseOfferingInfo> results = new ArrayList<CourseOfferingInfo>(); |
| 229 | |
|
| 230 | 0 | for (String luiId : luiIds) { |
| 231 | 0 | CourseOfferingInfo co = getCourseOffering(luiId, context); |
| 232 | |
|
| 233 | 0 | if (StringUtils.equals(co.getCourseId(), courseId)) { |
| 234 | 0 | results.add(co); |
| 235 | |
} |
| 236 | 0 | } |
| 237 | 0 | return results; |
| 238 | |
} |
| 239 | |
|
| 240 | |
@Override |
| 241 | |
@Transactional(readOnly = true) |
| 242 | |
public List<String> getCourseOfferingIdsByTerm(String termId, Boolean useIncludedTerm, ContextInfo context) |
| 243 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 244 | |
OperationFailedException, PermissionDeniedException { |
| 245 | 0 | this.acalService.getTerm(termId, context); |
| 246 | 0 | List<String> luiIds = luiService.getLuiIdsByAtpAndType(termId, LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, context); |
| 247 | 0 | return luiIds; |
| 248 | |
} |
| 249 | |
|
| 250 | |
@Override |
| 251 | |
@Transactional(readOnly = true) |
| 252 | |
public List<String> getCourseOfferingIdsByTermAndSubjectArea(String termId, String subjectArea, ContextInfo context) |
| 253 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 254 | |
OperationFailedException, PermissionDeniedException { |
| 255 | 0 | List<String> luiIds = luiService.getLuiIdsByAtpAndType(termId, LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, context); |
| 256 | 0 | List<String> results = new ArrayList<String>(); |
| 257 | |
|
| 258 | 0 | for (String luiId : luiIds) { |
| 259 | 0 | CourseOfferingInfo co = getCourseOffering(luiId, context); |
| 260 | |
|
| 261 | 0 | if (StringUtils.equals(co.getSubjectArea(), subjectArea)) { |
| 262 | 0 | results.add(luiId); |
| 263 | |
} |
| 264 | 0 | } |
| 265 | |
|
| 266 | 0 | return results; |
| 267 | |
} |
| 268 | |
|
| 269 | |
@Override |
| 270 | |
@Transactional(readOnly = true) |
| 271 | |
public List<CourseOfferingInfo> getCourseOfferingsByTermAndInstructor(String termId, String instructorId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 272 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 273 | 0 | List<LuiPersonRelationInfo> lprInfos = lprService.getLprsByPersonAndTypeForAtp(instructorId, termId, LuiPersonRelationServiceConstants.INSTRUCTOR_MAIN_TYPE_KEY, context); |
| 274 | 0 | List<CourseOfferingInfo> cos = new ArrayList<CourseOfferingInfo>(); |
| 275 | 0 | for (LuiPersonRelationInfo lprInfo : lprInfos) { |
| 276 | 0 | cos.add(getCourseOffering(lprInfo.getLuiId(), context)); |
| 277 | |
} |
| 278 | 0 | return cos; |
| 279 | |
} |
| 280 | |
|
| 281 | |
@Override |
| 282 | |
@Transactional(readOnly = true) |
| 283 | |
public List<String> getCourseOfferingIdsByTermAndUnitsContentOwner(String termId, String unitsContentOwnerId, |
| 284 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 285 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 286 | |
|
| 287 | 0 | List<String> luiIds = luiService.getLuiIdsByAtpAndType(termId, LuiServiceConstants.COURSE_OFFERING_TYPE_KEY, context); |
| 288 | 0 | List<String> results = new ArrayList<String>(); |
| 289 | |
|
| 290 | 0 | for (String luiId : luiIds) { |
| 291 | 0 | CourseOfferingInfo co = getCourseOffering(luiId, context); |
| 292 | |
|
| 293 | 0 | if (co.getUnitsContentOwnerOrgIds().contains(unitsContentOwnerId)) { |
| 294 | 0 | results.add(luiId); |
| 295 | |
} |
| 296 | 0 | } |
| 297 | |
|
| 298 | 0 | return results; |
| 299 | |
|
| 300 | |
} |
| 301 | |
|
| 302 | |
@Override |
| 303 | |
@Transactional(readOnly = true) |
| 304 | |
public List<String> getCourseOfferingIdsByType(String typeKey, ContextInfo context) throws DoesNotExistException, |
| 305 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 306 | 0 | throw new OperationFailedException("not implemented"); |
| 307 | |
} |
| 308 | |
|
| 309 | |
|
| 310 | |
@Transactional(readOnly = true) |
| 311 | |
public List<String> getCourseOfferingIdsByTermAndUnitContentOwner(String termKey, String unitOwnerId, |
| 312 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 313 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 314 | 0 | throw new OperationFailedException("not implemented"); |
| 315 | |
} |
| 316 | |
|
| 317 | |
|
| 318 | |
@Transactional(readOnly = true) |
| 319 | |
public List<CourseOfferingInfo> getCourseOfferingsBySoc(String s, ContextInfo contextInfo) throws DoesNotExistException, |
| 320 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 321 | 0 | throw new OperationFailedException("not implemented"); |
| 322 | |
} |
| 323 | |
|
| 324 | |
|
| 325 | |
@Transactional(readOnly = true) |
| 326 | |
public List<CourseOfferingInfo> getPublishedCourseOfferingsBySoc(String s, ContextInfo contextInfo) throws DoesNotExistException, |
| 327 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 328 | 0 | throw new OperationFailedException("not implemented"); |
| 329 | |
} |
| 330 | |
|
| 331 | |
@Override |
| 332 | |
@Transactional(readOnly = true) |
| 333 | |
public List<String> getValidCanonicalCourseToCourseOfferingOptionKeys(ContextInfo context) throws InvalidParameterException, |
| 334 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 335 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 336 | |
} |
| 337 | |
|
| 338 | |
@Override |
| 339 | |
@Transactional(readOnly = true) |
| 340 | |
public List<String> getValidRolloverOptionKeys(ContextInfo context) throws InvalidParameterException, |
| 341 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 342 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 343 | |
} |
| 344 | |
|
| 345 | |
@Override |
| 346 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 347 | |
public CourseOfferingInfo rolloverCourseOffering(String sourceCourseOfferingId, String targetTermId, List<String> optionKeys, ContextInfo context) throws AlreadyExistsException, |
| 348 | |
DataValidationErrorException, DoesNotExistException, DataValidationErrorException, InvalidParameterException, |
| 349 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 350 | 0 | return this.businessLogic.rolloverCourseOffering(sourceCourseOfferingId, targetTermId, optionKeys, context); |
| 351 | |
} |
| 352 | |
|
| 353 | |
|
| 354 | |
|
| 355 | |
@Override |
| 356 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 357 | |
public CourseOfferingInfo createCourseOffering(String courseId, String termId, String courseOfferingTypeKey, |
| 358 | |
CourseOfferingInfo coInfo, |
| 359 | |
List<String> optionKeys, ContextInfo context) |
| 360 | |
throws DoesNotExistException, DataValidationErrorException, |
| 361 | |
InvalidParameterException, MissingParameterException, |
| 362 | |
OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 363 | |
|
| 364 | |
|
| 365 | 0 | if (!courseId.equals(coInfo.getCourseId())) { |
| 366 | 0 | throw new InvalidParameterException(courseId + " does not match the corresponding value in the object " + coInfo.getCourseId()); |
| 367 | |
} |
| 368 | 0 | if (!termId.equals(coInfo.getTermId())) { |
| 369 | 0 | throw new InvalidParameterException(termId + " does not match the corresponding value in the object " + coInfo.getTermId()); |
| 370 | |
} |
| 371 | 0 | if (!courseOfferingTypeKey.equals(coInfo.getTypeKey())) { |
| 372 | 0 | throw new InvalidParameterException(courseOfferingTypeKey + " does not match the corresponding value in the object " + coInfo.getTypeKey()); |
| 373 | |
} |
| 374 | |
|
| 375 | 0 | TermInfo term = acalService.getTerm(termId, context); |
| 376 | 0 | CourseInfo courseInfo = getCourse(courseId); |
| 377 | |
|
| 378 | 0 | CourseOfferingTransformer coTransformer = new CourseOfferingTransformer(); |
| 379 | 0 | coTransformer.copyFromCanonical(courseInfo, coInfo, optionKeys); |
| 380 | |
|
| 381 | 0 | LuiInfo lui = new LuiInfo(); |
| 382 | 0 | coTransformer.courseOffering2Lui(coInfo, lui, context); |
| 383 | |
|
| 384 | 0 | lui = luiService.createLui(courseId, termId, lui.getTypeKey(), lui, context); |
| 385 | |
|
| 386 | 0 | CourseOfferingInfo createdCo = new CourseOfferingInfo(); |
| 387 | 0 | new CourseOfferingTransformer().lui2CourseOffering(lui, createdCo, context); |
| 388 | 0 | return createdCo; |
| 389 | |
} |
| 390 | |
|
| 391 | |
private CourseInfo getCourse(String courseId) throws DoesNotExistException, OperationFailedException { |
| 392 | 0 | R1CourseServiceHelper helper = new R1CourseServiceHelper (courseService, acalService); |
| 393 | 0 | CourseInfo courseInfo = helper.getCourse(courseId); |
| 394 | 0 | return courseInfo; |
| 395 | |
} |
| 396 | |
|
| 397 | |
@Override |
| 398 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 399 | |
public CourseOfferingInfo updateCourseOffering(String courseOfferingId, CourseOfferingInfo coInfo, ContextInfo context) |
| 400 | |
throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, |
| 401 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, |
| 402 | |
ReadOnlyException, VersionMismatchException { |
| 403 | 0 | if (!courseOfferingId.equals(coInfo.getId())) { |
| 404 | 0 | throw new InvalidParameterException(courseOfferingId + " does not match the corresponding value in the object " + coInfo.getId()); |
| 405 | |
} |
| 406 | |
|
| 407 | |
|
| 408 | 0 | LuiInfo lui = luiService.getLui(courseOfferingId, context); |
| 409 | 0 | CourseOfferingTransformer transformer = new CourseOfferingTransformer(); |
| 410 | |
|
| 411 | 0 | transformer.courseOffering2Lui(coInfo, lui, context); |
| 412 | 0 | lui = luiService.updateLui(courseOfferingId, lui, context); |
| 413 | |
|
| 414 | 0 | CourseOfferingInfo co = new CourseOfferingInfo(); |
| 415 | 0 | transformer.lui2CourseOffering(lui, co, context); |
| 416 | 0 | return co; |
| 417 | |
} |
| 418 | |
|
| 419 | |
@Override |
| 420 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 421 | |
public CourseOfferingInfo updateCourseOfferingFromCanonical(String courseOfferingId, |
| 422 | |
List<String> optionKeys, |
| 423 | |
ContextInfo context) |
| 424 | |
throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, |
| 425 | |
VersionMismatchException { |
| 426 | 0 | return this.businessLogic.updateCourseOfferingFromCanonical(courseOfferingId, optionKeys, context); |
| 427 | |
} |
| 428 | |
|
| 429 | |
private void processInstructors(String courseOfferingId, List<OfferingInstructorInfo> instructors, String atpId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 430 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException, VersionMismatchException { |
| 431 | |
|
| 432 | 0 | List<String> currrentInstructors = lprService.getPersonIdsByLuiAndTypeAndState(courseOfferingId, LuiPersonRelationServiceConstants.INSTRUCTOR_MAIN_TYPE_KEY, |
| 433 | |
LuiPersonRelationServiceConstants.ASSIGNED_STATE_KEY, context); |
| 434 | |
|
| 435 | 0 | if (instructors != null && !instructors.isEmpty()) { |
| 436 | 0 | for (OfferingInstructorInfo instructor : instructors) { |
| 437 | |
try { |
| 438 | 0 | if (currrentInstructors.contains(instructor.getPersonId())) { |
| 439 | 0 | LuiPersonRelationInfo existingLpr = getLpr(instructor.getPersonId(), courseOfferingId, context); |
| 440 | 0 | if (existingLpr != null) { |
| 441 | 0 | existingLpr.setCommitmentPercent(instructor.getPercentageEffort()); |
| 442 | 0 | lprService.updateLpr(existingLpr.getId(), existingLpr, context); |
| 443 | 0 | currrentInstructors.remove(instructor.getPersonId()); |
| 444 | |
} |
| 445 | 0 | } else { |
| 446 | 0 | lprService.createLpr(instructor.getPersonId(), courseOfferingId, instructor.getTypeKey(), getNewLpr(instructor, courseOfferingId), context); |
| 447 | |
} |
| 448 | 0 | } catch (AlreadyExistsException e) { |
| 449 | 0 | throw new OperationFailedException(); |
| 450 | 0 | } catch (DisabledIdentifierException e) { |
| 451 | 0 | throw new OperationFailedException(); |
| 452 | 0 | } catch (ReadOnlyException e) { |
| 453 | 0 | throw new OperationFailedException(); |
| 454 | 0 | } |
| 455 | |
} |
| 456 | |
} |
| 457 | |
|
| 458 | 0 | if (currrentInstructors != null && currrentInstructors.size() > 0) { |
| 459 | 0 | if (atpId != null) { |
| 460 | 0 | for (String instructorId : currrentInstructors) { |
| 461 | 0 | LuiPersonRelationInfo lpr = getLpr(instructorId, courseOfferingId, context); |
| 462 | 0 | if (lpr != null) { |
| 463 | 0 | lprService.deleteLpr(lpr.getId(), context); |
| 464 | |
} |
| 465 | 0 | } |
| 466 | |
} |
| 467 | |
} |
| 468 | 0 | } |
| 469 | |
|
| 470 | |
private LuiPersonRelationInfo getNewLpr(OfferingInstructorInfo instructor, String courseOfferingId) { |
| 471 | 0 | LuiPersonRelationInfo lpr = new LuiPersonRelationInfo(); |
| 472 | 0 | lpr.setPersonId(instructor.getPersonId()); |
| 473 | 0 | lpr.setCommitmentPercent(instructor.getPercentageEffort()); |
| 474 | 0 | lpr.setId(UUIDHelper.genStringUUID()); |
| 475 | 0 | lpr.setLuiId(courseOfferingId); |
| 476 | 0 | lpr.setTypeKey(instructor.getTypeKey()); |
| 477 | 0 | lpr.setStateKey(instructor.getStateKey()); |
| 478 | 0 | return lpr; |
| 479 | |
} |
| 480 | |
|
| 481 | |
private LuiPersonRelationInfo getLpr(String instructor, String courseOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 482 | |
OperationFailedException, PermissionDeniedException { |
| 483 | 0 | LuiPersonRelationInfo lpr = null; |
| 484 | |
try { |
| 485 | 0 | List<LuiPersonRelationInfo> lprs = lprService.getLprsByPersonAndLui(instructor, courseOfferingId, context); |
| 486 | |
|
| 487 | 0 | if (lprs != null && !lprs.isEmpty()) { |
| 488 | 0 | for (LuiPersonRelationInfo lpri : lprs) { |
| 489 | 0 | if (lpri.getTypeKey().equals(LuiPersonRelationServiceConstants.INSTRUCTOR_MAIN_TYPE_KEY)) { |
| 490 | 0 | lpr = lpri; |
| 491 | |
} |
| 492 | |
} |
| 493 | |
} |
| 494 | 0 | } catch (DisabledIdentifierException e) { |
| 495 | 0 | throw new OperationFailedException(); |
| 496 | 0 | } |
| 497 | |
|
| 498 | 0 | return lpr; |
| 499 | |
} |
| 500 | |
|
| 501 | |
@Override |
| 502 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 503 | |
public StatusInfo deleteCourseOffering(String courseOfferingId, ContextInfo context) |
| 504 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 505 | |
OperationFailedException, PermissionDeniedException { |
| 506 | |
try { |
| 507 | 0 | return luiService.deleteLui(courseOfferingId, context); |
| 508 | 0 | } catch (DependentObjectsExistException e) { |
| 509 | 0 | throw new OperationFailedException("Error deleting course offering", e); |
| 510 | |
} |
| 511 | |
} |
| 512 | |
|
| 513 | |
@Override |
| 514 | |
public List<ValidationResultInfo> validateCourseOffering(String validationType, CourseOfferingInfo courseOfferingInfo, |
| 515 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 516 | 0 | return new ArrayList<ValidationResultInfo>(); |
| 517 | |
} |
| 518 | |
|
| 519 | |
@Override |
| 520 | |
public List<ValidationResultInfo> validateCourseOfferingFromCanonical(CourseOfferingInfo courseOfferingInfo, |
| 521 | |
List<String> optionKeys, |
| 522 | |
ContextInfo context) |
| 523 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 524 | 0 | return this.businessLogic.validateCourseOfferingFromCanonical(courseOfferingInfo, optionKeys, context); |
| 525 | |
} |
| 526 | |
|
| 527 | |
@Override |
| 528 | |
@Transactional(readOnly = true) |
| 529 | |
public FormatOfferingInfo getFormatOffering(String formatOfferingId, ContextInfo context) |
| 530 | |
throws DoesNotExistException, InvalidParameterException, |
| 531 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 532 | 0 | LuiInfo lui = luiService.getLui(formatOfferingId, context); |
| 533 | 0 | FormatOfferingInfo fo = new FormatOfferingInfo(); |
| 534 | 0 | new FormatOfferingTransformer().lui2Format(lui, fo); |
| 535 | 0 | LuiInfo coLui = this.findCourseOfferingLui(lui.getId(), context); |
| 536 | 0 | fo.setCourseOfferingId(coLui.getId()); |
| 537 | 0 | return fo; |
| 538 | |
} |
| 539 | |
|
| 540 | |
private LuiInfo findCourseOfferingLui(String formatOfferingId, ContextInfo context) |
| 541 | |
throws OperationFailedException { |
| 542 | |
List<LuiInfo> rels; |
| 543 | |
try { |
| 544 | 0 | rels = luiService.getLuisByRelatedLuiAndRelationType(formatOfferingId, |
| 545 | |
LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY, context); |
| 546 | 0 | } catch (Exception ex) { |
| 547 | 0 | throw new OperationFailedException("unexpected", ex); |
| 548 | 0 | } |
| 549 | 0 | for (LuiInfo lui : rels) { |
| 550 | 0 | if (lui.getTypeKey().equals(LuiServiceConstants.COURSE_OFFERING_TYPE_KEY)) { |
| 551 | 0 | return lui; |
| 552 | |
} |
| 553 | |
} |
| 554 | 0 | throw new OperationFailedException("format offering is not associated with a course offering " + formatOfferingId + " among " + rels.size()); |
| 555 | |
} |
| 556 | |
|
| 557 | |
private LuiInfo findFormatOfferingLui(String activityOfferingId, ContextInfo context) |
| 558 | |
throws OperationFailedException { |
| 559 | |
List<LuiInfo> rels; |
| 560 | |
try { |
| 561 | 0 | rels = luiService.getLuisByRelatedLuiAndRelationType(activityOfferingId, LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY, context); |
| 562 | 0 | } catch (Exception ex) { |
| 563 | 0 | throw new OperationFailedException("unexpected", ex); |
| 564 | 0 | } |
| 565 | 0 | for (LuiInfo lui : rels) { |
| 566 | 0 | if (lui.getTypeKey().equals(LuiServiceConstants.FORMAT_OFFERING_TYPE_KEY)) { |
| 567 | 0 | return lui; |
| 568 | |
} |
| 569 | |
} |
| 570 | 0 | throw new OperationFailedException("format offering is not associated with a course offering " + activityOfferingId + " among " + rels.size()); |
| 571 | |
} |
| 572 | |
|
| 573 | |
@Override |
| 574 | |
@Transactional(readOnly = true) |
| 575 | |
public List<FormatOfferingInfo> getFormatOfferingsByCourseOffering(String courseOfferingId, ContextInfo context) |
| 576 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 577 | |
OperationFailedException, PermissionDeniedException { |
| 578 | |
|
| 579 | 0 | List<FormatOfferingInfo> formatOfferings = new ArrayList<FormatOfferingInfo>(); |
| 580 | |
|
| 581 | |
|
| 582 | 0 | List<LuiInfo> luis = luiService.getRelatedLuisByLuiAndRelationType(courseOfferingId,LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY,context); |
| 583 | 0 | for(LuiInfo lui:luis){ |
| 584 | |
|
| 585 | |
|
| 586 | 0 | if(LuiServiceConstants.FORMAT_OFFERING_TYPE_KEY.equals(lui.getTypeKey())){ |
| 587 | 0 | FormatOfferingInfo formatOffering = new FormatOfferingInfo(); |
| 588 | 0 | new FormatOfferingTransformer().lui2Format(lui,formatOffering); |
| 589 | 0 | formatOffering.setCourseOfferingId(courseOfferingId); |
| 590 | 0 | formatOfferings.add(formatOffering); |
| 591 | 0 | } |
| 592 | |
} |
| 593 | 0 | return formatOfferings; |
| 594 | |
} |
| 595 | |
|
| 596 | |
@Override |
| 597 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 598 | |
public StatusInfo deleteFormatOffering(String formatOfferingId, ContextInfo context) throws DoesNotExistException, |
| 599 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DependentObjectsExistException { |
| 600 | |
|
| 601 | 0 | List<LuiLuiRelationInfo> formatOfferingRelations = luiService.getLuiLuiRelationsByLui(formatOfferingId, context); |
| 602 | 0 | for (LuiLuiRelationInfo luiLuiRelation : formatOfferingRelations) { |
| 603 | 0 | luiService.deleteLuiLuiRelation(luiLuiRelation.getId(), context); |
| 604 | |
} |
| 605 | 0 | return luiService.deleteLui(formatOfferingId, context); |
| 606 | |
|
| 607 | |
} |
| 608 | |
|
| 609 | |
@Override |
| 610 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 611 | |
public FormatOfferingInfo updateFormatOffering(String formatOfferingId, FormatOfferingInfo formatOfferingInfo, ContextInfo context) |
| 612 | |
throws DataValidationErrorException, DoesNotExistException, |
| 613 | |
InvalidParameterException, MissingParameterException, OperationFailedException, |
| 614 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 615 | |
|
| 616 | 0 | LuiInfo lui = this.luiService.getLui(formatOfferingId, context); |
| 617 | |
|
| 618 | 0 | new FormatOfferingTransformer().format2Lui(formatOfferingInfo, lui); |
| 619 | 0 | lui = luiService.updateLui(formatOfferingId, lui, context); |
| 620 | |
|
| 621 | 0 | FormatOfferingInfo fo = new FormatOfferingInfo(); |
| 622 | 0 | new FormatOfferingTransformer().lui2Format(lui, fo); |
| 623 | 0 | LuiInfo coLui = this.findCourseOfferingLui(formatOfferingId, context); |
| 624 | 0 | fo.setCourseOfferingId(coLui.getId()); |
| 625 | 0 | return fo; |
| 626 | |
} |
| 627 | |
|
| 628 | |
@Override |
| 629 | |
public List<ValidationResultInfo> validateFormatOffering(String validationType, FormatOfferingInfo formatOfferingInfo, |
| 630 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 631 | 0 | return new ArrayList<ValidationResultInfo>(); |
| 632 | |
} |
| 633 | |
|
| 634 | |
@Override |
| 635 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 636 | |
public FormatOfferingInfo createFormatOffering(String courseOfferingId, String formatId, String formatOfferingType, FormatOfferingInfo foInfo, ContextInfo context) |
| 637 | |
throws DoesNotExistException, DataValidationErrorException, |
| 638 | |
InvalidParameterException, MissingParameterException, OperationFailedException, |
| 639 | |
PermissionDeniedException, ReadOnlyException { |
| 640 | |
|
| 641 | |
|
| 642 | 0 | if (!courseOfferingId.equals(foInfo.getCourseOfferingId())) { |
| 643 | 0 | throw new InvalidParameterException(courseOfferingId + " does not match the corresponding value in the object " + foInfo.getCourseOfferingId()); |
| 644 | |
} |
| 645 | 0 | if (!formatId.equals(foInfo.getFormatId())) { |
| 646 | 0 | throw new InvalidParameterException(formatId + " does not match the corresponding value in the object " + foInfo.getFormatId()); |
| 647 | |
} |
| 648 | 0 | if (!formatOfferingType.equals(foInfo.getTypeKey())) { |
| 649 | 0 | throw new InvalidParameterException(formatOfferingType + " does not match the corresponding value in the object " + foInfo.getTypeKey()); |
| 650 | |
} |
| 651 | |
|
| 652 | 0 | CourseOfferingInfo co = this.getCourseOffering(courseOfferingId, context); |
| 653 | 0 | if (foInfo.getTermId() != null) { |
| 654 | 0 | if (!co.getTermId().equals(foInfo.getTermId())) { |
| 655 | 0 | throw new InvalidParameterException(foInfo.getTermId() + " term in the format offering does not match the one in the course offering " + co.getTermId()); |
| 656 | |
} |
| 657 | |
} |
| 658 | 0 | foInfo.setTermId(co.getTermId()); |
| 659 | |
|
| 660 | |
|
| 661 | 0 | CourseInfo course = this.getCourse(co.getCourseId()); |
| 662 | 0 | FormatInfo format = null; |
| 663 | 0 | for (FormatInfo info : course.getFormats()) { |
| 664 | 0 | if (info.getId().equals(formatId)) { |
| 665 | 0 | format = info; |
| 666 | 0 | break; |
| 667 | |
} |
| 668 | |
} |
| 669 | 0 | if (format == null) { |
| 670 | 0 | throw new DoesNotExistException(formatId); |
| 671 | |
} |
| 672 | |
|
| 673 | 0 | LuiInfo lui = new LuiInfo(); |
| 674 | 0 | new FormatOfferingTransformer().format2Lui(foInfo, lui); |
| 675 | |
|
| 676 | |
|
| 677 | |
try { |
| 678 | 0 | lui = luiService.createLui(lui.getCluId(), lui.getAtpId(), lui.getTypeKey(), lui, context); |
| 679 | 0 | } catch (Exception aee) { |
| 680 | 0 | throw new OperationFailedException("Unexpected", aee); |
| 681 | 0 | } |
| 682 | |
|
| 683 | 0 | LuiLuiRelationInfo luiRel = new LuiLuiRelationInfo(); |
| 684 | 0 | luiRel.setLuiId(courseOfferingId); |
| 685 | 0 | luiRel.setName("co-fo-relation"); |
| 686 | 0 | luiRel.setRelatedLuiId(lui.getId()); |
| 687 | 0 | luiRel.setStateKey(LuiServiceConstants.LUI_LUI_RELATION_ACTIVE_STATE_KEY); |
| 688 | 0 | luiRel.setTypeKey(LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY); |
| 689 | 0 | luiRel.setEffectiveDate(new Date()); |
| 690 | |
try { |
| 691 | 0 | luiRel = luiService.createLuiLuiRelation(luiRel.getLuiId(), luiRel.getRelatedLuiId(), luiRel.getTypeKey(), luiRel, context); |
| 692 | 0 | } catch (Exception aee) { |
| 693 | 0 | throw new OperationFailedException("Unexpected", aee); |
| 694 | 0 | } |
| 695 | |
|
| 696 | 0 | FormatOfferingInfo formatOffering = new FormatOfferingInfo(); |
| 697 | 0 | new FormatOfferingTransformer().lui2Format(lui, formatOffering); |
| 698 | 0 | formatOffering.setCourseOfferingId(luiRel.getLuiId()); |
| 699 | 0 | return formatOffering; |
| 700 | |
} |
| 701 | |
|
| 702 | |
@Override |
| 703 | |
public TypeInfo getActivityOfferingType(String activityOfferingTypeKey, ContextInfo context) throws DoesNotExistException, |
| 704 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 705 | 0 | return typeService.getType(activityOfferingTypeKey, context); |
| 706 | |
} |
| 707 | |
|
| 708 | |
@Override |
| 709 | |
@Transactional(readOnly = true) |
| 710 | |
public List<TypeInfo> getActivityOfferingTypes(ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 711 | |
PermissionDeniedException { |
| 712 | |
try { |
| 713 | 0 | return typeService.getTypesForGroupType(LuiServiceConstants.ACTIVITY_OFFERING_GROUP_TYPE_KEY, context); |
| 714 | 0 | } catch (DoesNotExistException e) { |
| 715 | 0 | throw new OperationFailedException("Invalid group type used to retrieve Activity Offering Types: " + LuiServiceConstants.ACTIVITY_OFFERING_GROUP_TYPE_KEY); |
| 716 | |
} |
| 717 | |
} |
| 718 | |
|
| 719 | |
@Override |
| 720 | |
@Transactional(readOnly = true) |
| 721 | |
public List<TypeInfo> getActivityOfferingTypesForActivityType(String activityTypeKey, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 722 | |
OperationFailedException, PermissionDeniedException { |
| 723 | 0 | return typeService.getAllowedTypesForType(activityTypeKey, context); |
| 724 | |
} |
| 725 | |
|
| 726 | |
@Override |
| 727 | |
@Transactional(readOnly = true) |
| 728 | |
public ActivityOfferingInfo getActivityOffering(String activityOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 729 | |
OperationFailedException, PermissionDeniedException { |
| 730 | 0 | LuiInfo lui = luiService.getLui(activityOfferingId, context); |
| 731 | 0 | ActivityOfferingInfo ao = new ActivityOfferingInfo(); |
| 732 | 0 | ActivityOfferingTransformer.lui2Activity(ao, lui); |
| 733 | |
|
| 734 | 0 | LuiInfo foLui = this.findFormatOfferingLui(activityOfferingId, context); |
| 735 | 0 | LuiInfo coLui = this.findCourseOfferingLui(foLui.getId(),context); |
| 736 | 0 | ao.setFormatOfferingId(foLui.getId()); |
| 737 | 0 | ao.setCourseOfferingId(coLui.getId()); |
| 738 | 0 | ao.setFormatOfferingName(foLui.getName()); |
| 739 | 0 | ao.setCourseOfferingCode(coLui.getOfficialIdentifier().getCode()); |
| 740 | 0 | ao.setCourseOfferingTitle(coLui.getOfficialIdentifier().getLongName()); |
| 741 | 0 | AtpInfo termAtp = getAtpService().getAtp(ao.getTermId(),context); |
| 742 | 0 | ao.setTermCode(termAtp.getCode()); |
| 743 | 0 | return ao; |
| 744 | |
} |
| 745 | |
|
| 746 | |
@Override |
| 747 | |
public List<ActivityOfferingInfo> getActivityOfferingsByIds(List<String> strings, ContextInfo contextInfo) |
| 748 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 749 | |
OperationFailedException, PermissionDeniedException { |
| 750 | 0 | throw new OperationFailedException("not implemented"); |
| 751 | |
} |
| 752 | |
|
| 753 | |
@Override |
| 754 | |
public List<ActivityOfferingInfo> getActivityOfferingsByCourseOffering(String courseOfferingId, ContextInfo context) |
| 755 | |
throws DoesNotExistException, InvalidParameterException, |
| 756 | |
MissingParameterException, OperationFailedException, |
| 757 | |
PermissionDeniedException { |
| 758 | |
|
| 759 | 0 | List<ActivityOfferingInfo> list = new ArrayList<ActivityOfferingInfo>(); |
| 760 | 0 | List<FormatOfferingInfo> formats = this.getFormatOfferingsByCourseOffering(courseOfferingId, context); |
| 761 | 0 | for (FormatOfferingInfo fo : formats) { |
| 762 | 0 | List<ActivityOfferingInfo> activities = this.getActivityOfferingsByFormatOffering(courseOfferingId, context); |
| 763 | 0 | list.addAll(activities); |
| 764 | 0 | } |
| 765 | 0 | return list; |
| 766 | |
} |
| 767 | |
|
| 768 | |
private boolean _isActivityType(String luiTypeKey) { |
| 769 | 0 | if (luiTypeKey == null) { |
| 770 | 0 | return false; |
| 771 | |
} |
| 772 | 0 | if (luiTypeKey.startsWith(LuiServiceConstants.ACTIVITY_OFFERING_TYPE_KEY_PREFIX)) { |
| 773 | 0 | for (String s: LuiServiceConstants.ALL_ACTIVITY_TYPES) { |
| 774 | 0 | if (s.equals(luiTypeKey)) { |
| 775 | 0 | return true; |
| 776 | |
} |
| 777 | |
} |
| 778 | |
} |
| 779 | 0 | return false; |
| 780 | |
} |
| 781 | |
|
| 782 | |
@Override |
| 783 | |
public List<ActivityOfferingInfo> getActivityOfferingsByFormatOffering(String formatOfferingId, ContextInfo context) |
| 784 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 785 | 0 | List<ActivityOfferingInfo> activityOfferings = new ArrayList<ActivityOfferingInfo>(); |
| 786 | |
|
| 787 | |
|
| 788 | 0 | List<LuiInfo> luis = luiService.getRelatedLuisByLuiAndRelationType(formatOfferingId, LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY,context); |
| 789 | 0 | for (LuiInfo lui:luis) { |
| 790 | |
|
| 791 | |
|
| 792 | 0 | if (_isActivityType(lui.getTypeKey())) { |
| 793 | 0 | ActivityOfferingInfo activityOffering = new ActivityOfferingInfo(); |
| 794 | 0 | new ActivityOfferingTransformer().lui2Activity(activityOffering,lui); |
| 795 | 0 | activityOffering.setCourseOfferingId(formatOfferingId); |
| 796 | 0 | activityOfferings.add(activityOffering); |
| 797 | 0 | } |
| 798 | |
} |
| 799 | 0 | return activityOfferings; |
| 800 | |
} |
| 801 | |
|
| 802 | |
@Override |
| 803 | |
public List<ActivityOfferingInfo> getActivityOfferingsByCourseOfferingWithoutRegGroup(String courseOfferingId, ContextInfo context) |
| 804 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 805 | 0 | throw new UnsupportedOperationException(); |
| 806 | |
} |
| 807 | |
|
| 808 | |
|
| 809 | |
@Override |
| 810 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 811 | |
public ActivityOfferingInfo createActivityOffering(String formatOfferingId, |
| 812 | |
String activityId, |
| 813 | |
String activityOfferingTypeKey, |
| 814 | |
ActivityOfferingInfo aoInfo, ContextInfo context) |
| 815 | |
throws DoesNotExistException, DataValidationErrorException, |
| 816 | |
InvalidParameterException, MissingParameterException, |
| 817 | |
OperationFailedException, PermissionDeniedException, |
| 818 | |
ReadOnlyException { |
| 819 | |
|
| 820 | |
|
| 821 | 0 | if (!formatOfferingId.equals(aoInfo.getFormatOfferingId())) { |
| 822 | 0 | throw new InvalidParameterException(formatOfferingId + " does not match the corresponding value in the object " + aoInfo.getFormatOfferingId()); |
| 823 | |
} |
| 824 | 0 | if (!activityId.equals(aoInfo.getActivityId())) { |
| 825 | 0 | throw new InvalidParameterException(activityId + " does not match the corresponding value in the object " + aoInfo.getActivityId()); |
| 826 | |
} |
| 827 | 0 | if (!activityOfferingTypeKey.equals(aoInfo.getTypeKey())) { |
| 828 | 0 | throw new InvalidParameterException(activityOfferingTypeKey + " does not match the corresponding value in the object " + aoInfo.getTypeKey()); |
| 829 | |
} |
| 830 | |
|
| 831 | 0 | FormatOfferingInfo fo = this.getFormatOffering(formatOfferingId, context); |
| 832 | 0 | CourseOfferingInfo co = this.getCourseOffering(fo.getCourseOfferingId(), context); |
| 833 | 0 | if (aoInfo.getTermId() != null) { |
| 834 | 0 | if (!aoInfo.getTermId().equals(fo.getTermId())) { |
| 835 | 0 | throw new InvalidParameterException(aoInfo.getTermId() + " term in the activity offering does not match the one in the format offering " + fo.getTermId()); |
| 836 | |
} |
| 837 | |
} |
| 838 | 0 | aoInfo.setTermId(fo.getTermId()); |
| 839 | |
|
| 840 | 0 | LuiInfo lui = new LuiInfo(); |
| 841 | 0 | ActivityOfferingTransformer.activity2Lui(aoInfo, lui); |
| 842 | |
try { |
| 843 | 0 | String cluId = lui.getCluId(); |
| 844 | 0 | String atpId = lui.getAtpId(); |
| 845 | 0 | String typeKey = lui.getTypeKey(); |
| 846 | 0 | lui = luiService.createLui(cluId, atpId, typeKey, lui, context); |
| 847 | 0 | } catch (Exception ex) { |
| 848 | 0 | throw new OperationFailedException("unexpected", ex); |
| 849 | 0 | } |
| 850 | |
|
| 851 | |
|
| 852 | 0 | LuiLuiRelationInfo luiRel = new LuiLuiRelationInfo(); |
| 853 | 0 | luiRel.setLuiId(formatOfferingId); |
| 854 | 0 | luiRel.setName("fo-ao-relation"); |
| 855 | 0 | luiRel.setRelatedLuiId(lui.getId()); |
| 856 | 0 | luiRel.setTypeKey(LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY); |
| 857 | 0 | luiRel.setStateKey(LuiServiceConstants.LUI_LUI_RELATION_ACTIVE_STATE_KEY); |
| 858 | 0 | luiRel.setEffectiveDate(new Date()); |
| 859 | |
try { |
| 860 | 0 | luiRel = luiService.createLuiLuiRelation(luiRel.getLuiId(), luiRel.getRelatedLuiId(), luiRel.getTypeKey(), luiRel, context); |
| 861 | 0 | } catch (Exception ex) { |
| 862 | 0 | throw new OperationFailedException("unexpected", ex); |
| 863 | 0 | } |
| 864 | 0 | ActivityOfferingInfo ao = new ActivityOfferingInfo(); |
| 865 | 0 | ActivityOfferingTransformer.lui2Activity(ao, lui); |
| 866 | 0 | ao.setFormatOfferingId(luiRel.getLuiId()); |
| 867 | 0 | ao.setCourseOfferingId(co.getId()); |
| 868 | 0 | ao.setFormatOfferingName(fo.getName()); |
| 869 | 0 | ao.setCourseOfferingCode(co.getCourseOfferingCode()); |
| 870 | 0 | ao.setCourseOfferingTitle(co.getCourseOfferingTitle()); |
| 871 | 0 | AtpService localAtpService = getAtpService(); |
| 872 | 0 | String aoTermId = ao.getTermId(); |
| 873 | 0 | AtpInfo termAtp = localAtpService.getAtp(aoTermId, context); |
| 874 | 0 | ao.setTermCode(termAtp.getCode()); |
| 875 | 0 | return ao; |
| 876 | |
|
| 877 | |
} |
| 878 | |
|
| 879 | |
@Override |
| 880 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 881 | |
public ActivityOfferingInfo copyActivityOffering(String activityOfferingId, ContextInfo context) throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 882 | 0 | throw new OperationFailedException("not implemented"); |
| 883 | |
} |
| 884 | |
|
| 885 | |
@Override |
| 886 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 887 | |
public List<ActivityOfferingInfo> generateActivityOfferings(String formatOfferingId, String activityOfferingType, Integer quantity, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 888 | 0 | throw new OperationFailedException("not implemented"); |
| 889 | |
} |
| 890 | |
|
| 891 | |
|
| 892 | |
@Override |
| 893 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 894 | |
public ActivityOfferingInfo updateActivityOffering(String activityOfferingId, |
| 895 | |
ActivityOfferingInfo activityOfferingInfo, |
| 896 | |
ContextInfo context) |
| 897 | |
throws DataValidationErrorException, |
| 898 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 899 | |
OperationFailedException, PermissionDeniedException, |
| 900 | |
ReadOnlyException, VersionMismatchException { |
| 901 | |
|
| 902 | 0 | if (!activityOfferingId.equals(activityOfferingInfo.getId())) { |
| 903 | 0 | throw new InvalidParameterException(activityOfferingId + " does not match the corresponding value in the object " + activityOfferingInfo.getId()); |
| 904 | |
} |
| 905 | |
|
| 906 | 0 | LuiInfo lui = luiService.getLui(activityOfferingId, context); |
| 907 | |
|
| 908 | |
|
| 909 | 0 | ActivityOfferingTransformer.activity2Lui(activityOfferingInfo, lui); |
| 910 | |
|
| 911 | 0 | lui = luiService.updateLui(activityOfferingId, lui, context); |
| 912 | |
|
| 913 | 0 | ActivityOfferingInfo ao = new ActivityOfferingInfo(); |
| 914 | 0 | ActivityOfferingTransformer.lui2Activity(ao, lui); |
| 915 | 0 | LuiInfo foLui = this.findFormatOfferingLui(lui.getId(), context); |
| 916 | 0 | LuiInfo coLui = this.findCourseOfferingLui(foLui.getId(),context); |
| 917 | 0 | ao.setFormatOfferingId(foLui.getId()); |
| 918 | 0 | ao.setCourseOfferingId(coLui.getId()); |
| 919 | 0 | ao.setFormatOfferingName(foLui.getName()); |
| 920 | 0 | ao.setCourseOfferingCode(coLui.getOfficialIdentifier().getCode()); |
| 921 | 0 | ao.setCourseOfferingTitle(coLui.getOfficialIdentifier().getLongName()); |
| 922 | 0 | AtpInfo termAtp = getAtpService().getAtp(ao.getTermId(),context); |
| 923 | 0 | ao.setTermCode(termAtp.getCode()); |
| 924 | 0 | return ao; |
| 925 | |
} |
| 926 | |
|
| 927 | |
@Override |
| 928 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 929 | |
public StatusInfo deleteActivityOffering(String activityOfferingId, ContextInfo context) |
| 930 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 931 | |
OperationFailedException, PermissionDeniedException { |
| 932 | |
|
| 933 | |
try { |
| 934 | 0 | return luiService.deleteLui(activityOfferingId, context); |
| 935 | 0 | } catch (DependentObjectsExistException e) { |
| 936 | 0 | throw new OperationFailedException("Error deleting dependent objects", e); |
| 937 | |
} |
| 938 | |
} |
| 939 | |
|
| 940 | |
@Override |
| 941 | |
public List<ValidationResultInfo> validateActivityOffering(String validationType, |
| 942 | |
ActivityOfferingInfo activityOfferingInfo, ContextInfo context) |
| 943 | |
throws DoesNotExistException, |
| 944 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 945 | 0 | return new ArrayList<ValidationResultInfo>(); |
| 946 | |
} |
| 947 | |
|
| 948 | |
@Override |
| 949 | |
public Float calculateInClassContactHoursForTerm(String activityOfferingId, ContextInfo context) throws DoesNotExistException, |
| 950 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 951 | 0 | throw new UnsupportedOperationException(); |
| 952 | |
} |
| 953 | |
|
| 954 | |
@Override |
| 955 | |
public Float calculateOutofClassContactHoursForTerm(String activityOfferingId, ContextInfo context) |
| 956 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 957 | 0 | throw new UnsupportedOperationException(); |
| 958 | |
} |
| 959 | |
|
| 960 | |
@Override |
| 961 | |
public Float calculateTotalContactHoursForTerm(String activityOfferingId, ContextInfo context) throws DoesNotExistException, |
| 962 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 963 | 0 | throw new UnsupportedOperationException(); |
| 964 | |
} |
| 965 | |
|
| 966 | |
@Override |
| 967 | |
@Transactional(readOnly = true) |
| 968 | |
public RegistrationGroupInfo getRegistrationGroup(String registrationGroupId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 969 | |
OperationFailedException, PermissionDeniedException { |
| 970 | 0 | LuiInfo lui = luiService.getLui(registrationGroupId, context); |
| 971 | |
|
| 972 | 0 | return registrationGroupAssembler.assemble(lui, context); |
| 973 | |
|
| 974 | |
} |
| 975 | |
|
| 976 | |
@Override |
| 977 | |
@Transactional(readOnly = true) |
| 978 | |
public List<RegistrationGroupInfo> getRegistrationGroupsByIds(List<String> registrationGroupsIds, ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, |
| 979 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 980 | |
|
| 981 | 0 | List<RegistrationGroupInfo> regGroups = new ArrayList<RegistrationGroupInfo>(); |
| 982 | |
|
| 983 | 0 | for (String registrationGroupId : registrationGroupsIds) { |
| 984 | |
|
| 985 | 0 | regGroups.add(registrationGroupAssembler.assemble(luiService.getLui(registrationGroupId, contextInfo), contextInfo)); |
| 986 | |
} |
| 987 | |
|
| 988 | 0 | return regGroups; |
| 989 | |
} |
| 990 | |
|
| 991 | |
@Override |
| 992 | |
@Transactional(readOnly = true) |
| 993 | |
public List<RegistrationGroupInfo> getRegistrationGroupsForCourseOffering(String courseOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 994 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 995 | |
|
| 996 | 0 | List<RegistrationGroupInfo> rgs = new ArrayList<RegistrationGroupInfo>(); |
| 997 | 0 | List<String> rgIds = new ArrayList<String>(); |
| 998 | 0 | List<LuiLuiRelationInfo> rels = luiService.getLuiLuiRelationsByLui(courseOfferingId, context); |
| 999 | 0 | if (rels != null && !rels.isEmpty()) { |
| 1000 | 0 | for (LuiLuiRelationInfo rel : rels) { |
| 1001 | 0 | if (rel.getRelatedLuiId().equals(courseOfferingId)) { |
| 1002 | 0 | if (rel.getTypeKey().equals(LuiServiceConstants.LUI_LUI_RELATION_REGISTEREDFORVIA_TYPE_KEY)) { |
| 1003 | 0 | String luiId = rel.getLuiId(); |
| 1004 | 0 | LuiInfo lui = luiService.getLui(luiId, context); |
| 1005 | 0 | if (lui != null && lui.getTypeKey().equals(LuiServiceConstants.REGISTRATION_GROUP_TYPE_KEY) && !rgIds.contains(luiId)) { |
| 1006 | 0 | rgIds.add(luiId); |
| 1007 | 0 | rgs.add(getRegistrationGroup(luiId, context)); |
| 1008 | |
} |
| 1009 | 0 | } |
| 1010 | |
} |
| 1011 | |
} |
| 1012 | |
} |
| 1013 | |
|
| 1014 | 0 | return rgs; |
| 1015 | |
} |
| 1016 | |
|
| 1017 | |
@Override |
| 1018 | |
@Transactional(readOnly = true) |
| 1019 | |
public List<RegistrationGroupInfo> getRegistrationGroupsWithActivityOfferings(List<String> activityOfferingIds, |
| 1020 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1021 | 0 | throw new UnsupportedOperationException(); |
| 1022 | |
} |
| 1023 | |
|
| 1024 | |
@Override |
| 1025 | |
@Transactional(readOnly = true) |
| 1026 | |
public List<RegistrationGroupInfo> getRegistrationGroupsByFormatOffering(String formatOfferingId, ContextInfo context) |
| 1027 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1028 | 0 | throw new UnsupportedOperationException(); |
| 1029 | |
} |
| 1030 | |
|
| 1031 | |
|
| 1032 | |
|
| 1033 | |
@Override |
| 1034 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1035 | |
public List<RegistrationGroupInfo> generateRegistrationGroupsForFormatOffering(String formatOfferingId, ContextInfo context) |
| 1036 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1037 | 0 | throw new UnsupportedOperationException(); |
| 1038 | |
} |
| 1039 | |
|
| 1040 | |
private String getTermkeyByCourseOffering(String courseOfferingId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 1041 | |
OperationFailedException, PermissionDeniedException { |
| 1042 | 0 | String termId = null; |
| 1043 | |
|
| 1044 | 0 | LuiInfo co = luiService.getLui(courseOfferingId, context); |
| 1045 | 0 | if (co != null) { |
| 1046 | 0 | termId = co.getAtpId(); |
| 1047 | |
} |
| 1048 | |
|
| 1049 | 0 | return termId; |
| 1050 | |
} |
| 1051 | |
|
| 1052 | |
@Override |
| 1053 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1054 | |
public RegistrationGroupInfo updateRegistrationGroup(String registrationGroupId, RegistrationGroupInfo registrationGroupInfo, ContextInfo context) |
| 1055 | |
throws DataValidationErrorException, |
| 1056 | |
DoesNotExistException, InvalidParameterException, |
| 1057 | |
MissingParameterException, OperationFailedException, |
| 1058 | |
PermissionDeniedException, |
| 1059 | |
ReadOnlyException, VersionMismatchException { |
| 1060 | |
|
| 1061 | 0 | Set<String> existingRelatedLuiIds = new HashSet<String>(); |
| 1062 | 0 | Set<String> newRelatedLuiIds = new HashSet<String>(registrationGroupInfo.getActivityOfferingIds()); |
| 1063 | 0 | newRelatedLuiIds.add(registrationGroupInfo.getCourseOfferingId()); |
| 1064 | |
|
| 1065 | |
|
| 1066 | 0 | List<LuiLuiRelationInfo> llrs = luiService.getLuiLuiRelationsByLui(registrationGroupId, context); |
| 1067 | 0 | for (LuiLuiRelationInfo llr : llrs) { |
| 1068 | 0 | if (registrationGroupId.equals(llr.getLuiId()) && LuiServiceConstants.LUI_LUI_RELATION_REGISTEREDFORVIA_TYPE_KEY.equals(llr.getTypeKey())) { |
| 1069 | 0 | String relatedLuiId = llr.getRelatedLuiId(); |
| 1070 | 0 | existingRelatedLuiIds.add(relatedLuiId); |
| 1071 | 0 | if (!newRelatedLuiIds.contains(relatedLuiId)) { |
| 1072 | 0 | luiService.deleteLuiLuiRelation(llr.getId(), context); |
| 1073 | |
} |
| 1074 | 0 | } |
| 1075 | |
} |
| 1076 | |
|
| 1077 | |
|
| 1078 | 0 | for (String luiId : newRelatedLuiIds) { |
| 1079 | 0 | if (!existingRelatedLuiIds.contains(luiId)) { |
| 1080 | 0 | createLuiLuiRelationForRegGroups(registrationGroupId, luiId, LuiServiceConstants.LUI_LUI_RELATION_REGISTEREDFORVIA_TYPE_KEY, context); |
| 1081 | |
} |
| 1082 | |
} |
| 1083 | |
|
| 1084 | 0 | LuiInfo regGroupLui = registrationGroupAssembler.disassemble(registrationGroupInfo, context); |
| 1085 | 0 | LuiInfo updatedRegGroupLui = luiService.updateLui(regGroupLui.getId(), regGroupLui, context); |
| 1086 | 0 | return registrationGroupAssembler.assemble(updatedRegGroupLui, context); |
| 1087 | |
|
| 1088 | |
} |
| 1089 | |
|
| 1090 | |
@Override |
| 1091 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1092 | |
public StatusInfo deleteRegistrationGroup(String registrationGroupId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 1093 | |
OperationFailedException, PermissionDeniedException { |
| 1094 | |
try { |
| 1095 | 0 | return luiService.deleteLui(registrationGroupId, context); |
| 1096 | 0 | } catch (DependentObjectsExistException e) { |
| 1097 | 0 | throw new OperationFailedException("Could not delete LUI '" + registrationGroupId + "'", e); |
| 1098 | |
} |
| 1099 | |
} |
| 1100 | |
|
| 1101 | |
@Override |
| 1102 | |
public List<ValidationResultInfo> validateRegistrationGroup(String validationType, |
| 1103 | |
RegistrationGroupInfo registrationGroupInfo, ContextInfo context) throws DoesNotExistException, |
| 1104 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 1105 | 0 | throw new UnsupportedOperationException(); |
| 1106 | |
} |
| 1107 | |
|
| 1108 | |
@Override |
| 1109 | |
@Transactional(readOnly = true) |
| 1110 | |
public RegistrationGroupTemplateInfo getRegistrationGroupTemplate(String registrationGroupTemplateId, |
| 1111 | |
ContextInfo context) |
| 1112 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1113 | 0 | throw new UnsupportedOperationException(); |
| 1114 | |
} |
| 1115 | |
|
| 1116 | |
@Override |
| 1117 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1118 | |
public RegistrationGroupTemplateInfo updateRegistrationGroupTemplate(String registrationGroupTemplateId, |
| 1119 | |
RegistrationGroupTemplateInfo registrationGroupTemplateInfo, |
| 1120 | |
ContextInfo context) |
| 1121 | |
throws DataValidationErrorException, DoesNotExistException, |
| 1122 | |
InvalidParameterException, MissingParameterException, |
| 1123 | |
OperationFailedException, PermissionDeniedException, |
| 1124 | |
ReadOnlyException, VersionMismatchException { |
| 1125 | 0 | throw new UnsupportedOperationException(); |
| 1126 | |
} |
| 1127 | |
|
| 1128 | |
@Override |
| 1129 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1130 | |
public StatusInfo deleteRegistrationGroupTemplate(String registrationGroupTemplateId, ContextInfo context) |
| 1131 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1132 | 0 | throw new UnsupportedOperationException(); |
| 1133 | |
} |
| 1134 | |
|
| 1135 | |
@Override |
| 1136 | |
@Transactional(readOnly = true) |
| 1137 | |
public SeatPoolDefinitionInfo getSeatPoolDefinition(String seatPoolDefinitionId, ContextInfo context) |
| 1138 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1139 | 0 | throw new UnsupportedOperationException(); |
| 1140 | |
} |
| 1141 | |
|
| 1142 | |
@Override |
| 1143 | |
@Transactional(readOnly = true) |
| 1144 | |
public List<SeatPoolDefinitionInfo> getSeatPoolDefinitionsForCourseOffering(String courseOfferingId, ContextInfo context) |
| 1145 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1146 | 0 | throw new UnsupportedOperationException(); |
| 1147 | |
} |
| 1148 | |
|
| 1149 | |
@Override |
| 1150 | |
@Transactional(readOnly = true) |
| 1151 | |
public List<SeatPoolDefinitionInfo> getSeatPoolDefinitionsForRegGroup(String registrationGroupId, ContextInfo context) |
| 1152 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1153 | 0 | throw new UnsupportedOperationException(); |
| 1154 | |
} |
| 1155 | |
|
| 1156 | |
@Override |
| 1157 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1158 | |
public SeatPoolDefinitionInfo createSeatPoolDefinition(SeatPoolDefinitionInfo seatPoolDefinitionInfo, ContextInfo context) |
| 1159 | |
throws DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException { |
| 1160 | 0 | throw new UnsupportedOperationException(); |
| 1161 | |
} |
| 1162 | |
|
| 1163 | |
@Override |
| 1164 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1165 | |
public SeatPoolDefinitionInfo updateSeatPoolDefinition(String seatPoolDefinitionId, |
| 1166 | |
SeatPoolDefinitionInfo seatPoolDefinitionInfo, |
| 1167 | |
ContextInfo context) |
| 1168 | |
throws DataValidationErrorException, |
| 1169 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 1170 | |
OperationFailedException, PermissionDeniedException, |
| 1171 | |
ReadOnlyException, ReadOnlyException, VersionMismatchException { |
| 1172 | 0 | throw new UnsupportedOperationException(); |
| 1173 | |
} |
| 1174 | |
|
| 1175 | |
@Override |
| 1176 | |
public List<ValidationResultInfo> validateSeatPoolDefinition(String validationTypeKey, |
| 1177 | |
SeatPoolDefinitionInfo seatPoolDefinitionInfo, ContextInfo context) throws DataValidationErrorException, |
| 1178 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
| 1179 | 0 | throw new UnsupportedOperationException(); |
| 1180 | |
} |
| 1181 | |
|
| 1182 | |
@Override |
| 1183 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 1184 | |
public StatusInfo deleteSeatPoolDefinition(String seatPoolDefinitionId, ContextInfo context) throws DoesNotExistException, |
| 1185 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1186 | 0 | throw new UnsupportedOperationException(); |
| 1187 | |
} |
| 1188 | |
|
| 1189 | |
@Override |
| 1190 | |
public List<CourseOfferingInfo> searchForCourseOfferings(QueryByCriteria criteria, ContextInfo context) |
| 1191 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1192 | 0 | GenericQueryResults<LuiEntity> results = criteriaLookupService.lookup(LuiEntity.class, criteria); |
| 1193 | 0 | List<CourseOfferingInfo> courseOfferings = new ArrayList<CourseOfferingInfo>(results.getResults().size()); |
| 1194 | 0 | for (LuiEntity lui : results.getResults()) { |
| 1195 | |
try { |
| 1196 | 0 | if(checkTypeForCourseOfferingType(lui.getLuiType())){ |
| 1197 | 0 | CourseOfferingInfo co = this.getCourseOffering(lui.getId(), context); |
| 1198 | 0 | courseOfferings.add(co); |
| 1199 | |
} |
| 1200 | 0 | } catch (DoesNotExistException ex) { |
| 1201 | 0 | throw new OperationFailedException(lui.getId(), ex); |
| 1202 | 0 | } |
| 1203 | |
} |
| 1204 | 0 | return courseOfferings; |
| 1205 | |
} |
| 1206 | |
|
| 1207 | |
private void createLuiLuiRelationForRegGroups(String luiId, String relatedLuiId, String luLuRelationTypeKey, ContextInfo context) throws DataValidationErrorException, |
| 1208 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1209 | |
try { |
| 1210 | 0 | LuiLuiRelationInfo luiRel = new LuiLuiRelationInfo(); |
| 1211 | 0 | luiRel.setLuiId(luiId); |
| 1212 | 0 | luiRel.setRelatedLuiId(relatedLuiId); |
| 1213 | 0 | luiRel.setTypeKey(LuiServiceConstants.LUI_LUI_RELATION_ASSOCIATED_TYPE_KEY); |
| 1214 | 0 | luiRel.setStateKey(LuiServiceConstants.LUI_LUI_RELATION_ACTIVE_STATE_KEY); |
| 1215 | 0 | luiRel.setEffectiveDate(new Date()); |
| 1216 | |
try { |
| 1217 | 0 | luiService.createLuiLuiRelation(luiId, relatedLuiId, luLuRelationTypeKey, luiRel, context); |
| 1218 | 0 | } catch (ReadOnlyException roe) { |
| 1219 | 0 | throw new OperationFailedException("setting read only fields", roe); |
| 1220 | 0 | } |
| 1221 | 0 | } catch (CircularRelationshipException e) { |
| 1222 | 0 | throw new OperationFailedException(); |
| 1223 | 0 | } catch (DoesNotExistException e) { |
| 1224 | 0 | throw new OperationFailedException(); |
| 1225 | 0 | } |
| 1226 | 0 | } |
| 1227 | |
|
| 1228 | |
@Override |
| 1229 | |
public List<String> searchForCourseOfferingIds(QueryByCriteria criteria, ContextInfo context) throws InvalidParameterException, |
| 1230 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1231 | 0 | throw new UnsupportedOperationException(); |
| 1232 | |
} |
| 1233 | |
|
| 1234 | |
@Override |
| 1235 | |
public List<ActivityOfferingInfo> searchForActivityOfferings(QueryByCriteria criteria, ContextInfo context) |
| 1236 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1237 | 0 | GenericQueryResults<LuiEntity> results = criteriaLookupService.lookup(LuiEntity.class, criteria); |
| 1238 | 0 | List<ActivityOfferingInfo> activityOfferingInfos = new ArrayList<ActivityOfferingInfo>(results.getResults().size()); |
| 1239 | 0 | for (LuiEntity lui : results.getResults()) { |
| 1240 | |
try { |
| 1241 | 0 | if(checkTypeForActivityOfferingType(lui.getLuiType(), context)){ |
| 1242 | 0 | ActivityOfferingInfo ao = this.getActivityOffering(lui.getId(), context); |
| 1243 | 0 | activityOfferingInfos.add(ao); |
| 1244 | |
} |
| 1245 | 0 | } catch (DoesNotExistException ex) { |
| 1246 | 0 | throw new OperationFailedException(lui.getId(), ex); |
| 1247 | 0 | } |
| 1248 | |
} |
| 1249 | 0 | return activityOfferingInfos; |
| 1250 | |
} |
| 1251 | |
|
| 1252 | |
@Override |
| 1253 | |
@Transactional(readOnly = true) |
| 1254 | |
public List<String> searchForActivityOfferingIds(QueryByCriteria criteria, ContextInfo context) throws InvalidParameterException, |
| 1255 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1256 | 0 | throw new UnsupportedOperationException(); |
| 1257 | |
} |
| 1258 | |
|
| 1259 | |
@Override |
| 1260 | |
@Transactional(readOnly = true) |
| 1261 | |
public List<RegistrationGroupInfo> searchForRegistrationGroups(QueryByCriteria criteria, ContextInfo context) |
| 1262 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1263 | 0 | throw new UnsupportedOperationException(); |
| 1264 | |
} |
| 1265 | |
|
| 1266 | |
@Override |
| 1267 | |
@Transactional(readOnly = true) |
| 1268 | |
public List<String> searchForRegistrationGroupIds(QueryByCriteria criteria, ContextInfo context) throws InvalidParameterException, |
| 1269 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1270 | 0 | throw new UnsupportedOperationException(); |
| 1271 | |
} |
| 1272 | |
|
| 1273 | |
@Override |
| 1274 | |
@Transactional(readOnly = true) |
| 1275 | |
public List<SeatPoolDefinitionInfo> searchForSeatpoolDefinitions(QueryByCriteria criteria, ContextInfo context) |
| 1276 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1277 | 0 | throw new UnsupportedOperationException(); |
| 1278 | |
} |
| 1279 | |
|
| 1280 | |
@Override |
| 1281 | |
@Transactional(readOnly = true) |
| 1282 | |
public List<String> searchForSeatpoolDefinitionIds(QueryByCriteria criteria, ContextInfo context) throws InvalidParameterException, |
| 1283 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1284 | 0 | throw new UnsupportedOperationException(); |
| 1285 | |
} |
| 1286 | |
|
| 1287 | |
private boolean checkTypeForCourseOfferingType(String typeKey){ |
| 1288 | 0 | return typeKey.equals(LuiServiceConstants.COURSE_OFFERING_TYPE_KEY); |
| 1289 | |
} |
| 1290 | |
|
| 1291 | |
private boolean checkTypeForActivityOfferingType(String typeKey, ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 1292 | 0 | List<TypeInfo> types = getActivityOfferingTypes(context); |
| 1293 | 0 | return checkTypeInTypes(typeKey, types); |
| 1294 | |
} |
| 1295 | |
|
| 1296 | |
private boolean checkTypeInTypes(String typeKey, List<TypeInfo> types) { |
| 1297 | 0 | if (types != null && !types.isEmpty()) { |
| 1298 | 0 | for (TypeInfo type : types) { |
| 1299 | 0 | if (type.getKey().equals(typeKey)) { |
| 1300 | 0 | return true; |
| 1301 | |
} |
| 1302 | |
} |
| 1303 | |
} |
| 1304 | |
|
| 1305 | 0 | return false; |
| 1306 | |
} |
| 1307 | |
|
| 1308 | |
public AtpService getAtpService() { |
| 1309 | 0 | if(atpService == null) { |
| 1310 | 0 | Object o = GlobalResourceLoader.getService(new QName(AtpServiceConstants.NAMESPACE, |
| 1311 | |
AtpServiceConstants.SERVICE_NAME_LOCAL_PART)); |
| 1312 | 0 | atpService = (AtpService) o; |
| 1313 | |
} |
| 1314 | 0 | return atpService; |
| 1315 | |
} |
| 1316 | |
|
| 1317 | |
public void setAtpService(AtpService atpService) { |
| 1318 | 0 | this.atpService = atpService; |
| 1319 | 0 | } |
| 1320 | |
} |