| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.student.enrollment.class2.courseofferingset.service.impl; |
| 18 | |
|
| 19 | |
import java.util.ArrayList; |
| 20 | |
import java.util.List; |
| 21 | |
import javax.annotation.Resource; |
| 22 | |
import javax.jws.WebParam; |
| 23 | |
|
| 24 | |
import org.kuali.rice.core.api.criteria.GenericQueryResults; |
| 25 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
| 26 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocDao; |
| 27 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocRolloverResultDao; |
| 28 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocRolloverResultItemDao; |
| 29 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocEntity; |
| 30 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultEntity; |
| 31 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultItemEntity; |
| 32 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultOptionEntity; |
| 33 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocInfo; |
| 34 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo; |
| 35 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo; |
| 36 | |
import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService; |
| 37 | |
import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetServiceBusinessLogic; |
| 38 | |
import org.kuali.student.r2.common.criteria.CriteriaLookupService; |
| 39 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 40 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 41 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 42 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 43 | |
import org.kuali.student.r2.common.exceptions.DependentObjectsExistException; |
| 44 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 45 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 46 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 47 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 48 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 49 | |
import org.kuali.student.r2.common.exceptions.ReadOnlyException; |
| 50 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 51 | |
import org.kuali.student.r2.common.util.constants.CourseOfferingSetServiceConstants; |
| 52 | |
import org.springframework.transaction.annotation.Transactional; |
| 53 | |
|
| 54 | 0 | public class CourseOfferingSetServiceImpl implements CourseOfferingSetService { |
| 55 | |
|
| 56 | |
@Resource |
| 57 | |
private SocDao socDao; |
| 58 | |
@Resource |
| 59 | |
private SocRolloverResultDao socRorDao; |
| 60 | |
@Resource |
| 61 | |
private SocRolloverResultItemDao socRorItemDao; |
| 62 | |
private CourseOfferingSetServiceBusinessLogic businessLogic; |
| 63 | |
private CriteriaLookupService criteriaLookupService; |
| 64 | |
|
| 65 | |
public CourseOfferingSetServiceBusinessLogic getBusinessLogic() { |
| 66 | 0 | return businessLogic; |
| 67 | |
} |
| 68 | |
|
| 69 | |
public void setBusinessLogic(CourseOfferingSetServiceBusinessLogic businessLogic) { |
| 70 | 0 | this.businessLogic = businessLogic; |
| 71 | 0 | } |
| 72 | |
|
| 73 | |
public SocDao getSocDao() { |
| 74 | 0 | return socDao; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setSocDao(SocDao socDao) { |
| 78 | 0 | this.socDao = socDao; |
| 79 | 0 | } |
| 80 | |
|
| 81 | |
public SocRolloverResultDao getSocRorDao() { |
| 82 | 0 | return socRorDao; |
| 83 | |
} |
| 84 | |
|
| 85 | |
public void setSocRorDao(SocRolloverResultDao socRorDao) { |
| 86 | 0 | this.socRorDao = socRorDao; |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
public SocRolloverResultItemDao getSocRorItemDao() { |
| 90 | 0 | return socRorItemDao; |
| 91 | |
} |
| 92 | |
|
| 93 | |
public void setSocRorItemDao(SocRolloverResultItemDao socRorItemDao) { |
| 94 | 0 | this.socRorItemDao = socRorItemDao; |
| 95 | 0 | } |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
@Override |
| 101 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 102 | |
public SocInfo createSoc(String termId, String typeKey, SocInfo info, ContextInfo context) throws DoesNotExistException, |
| 103 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 104 | |
PermissionDeniedException, ReadOnlyException { |
| 105 | 0 | if (!termId.equals(info.getTermId())) { |
| 106 | 0 | throw new InvalidParameterException("termId does not match the value in the info object"); |
| 107 | |
} |
| 108 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 109 | 0 | throw new InvalidParameterException("typeKey does not match the value in the info object"); |
| 110 | |
} |
| 111 | 0 | SocEntity entity = new SocEntity(info); |
| 112 | 0 | entity.setId(info.getId()); |
| 113 | 0 | entity.setSocType(typeKey); |
| 114 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 115 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 116 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 117 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 118 | 0 | socDao.persist(entity); |
| 119 | 0 | return entity.toDto(); |
| 120 | |
} |
| 121 | |
|
| 122 | |
@Override |
| 123 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 124 | |
public SocRolloverResultInfo createSocRolloverResult(String typeKey, SocRolloverResultInfo info, ContextInfo context) throws |
| 125 | |
DoesNotExistException, |
| 126 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 127 | |
PermissionDeniedException, ReadOnlyException { |
| 128 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 129 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object"); |
| 130 | |
} |
| 131 | 0 | SocRolloverResultEntity entity = new SocRolloverResultEntity(info); |
| 132 | 0 | entity.setId(info.getId()); |
| 133 | 0 | entity.setSocRorType(typeKey); |
| 134 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 135 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 136 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 137 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 138 | 0 | socRorDao.persist(entity); |
| 139 | 0 | return entity.toDto(); |
| 140 | |
} |
| 141 | |
|
| 142 | |
@Override |
| 143 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 144 | |
public SocRolloverResultItemInfo createSocRolloverResultItem(String socRorId, String typeKey, SocRolloverResultItemInfo info, ContextInfo context) throws |
| 145 | |
DoesNotExistException, |
| 146 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 147 | |
PermissionDeniedException, ReadOnlyException { |
| 148 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 149 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object"); |
| 150 | |
} |
| 151 | 0 | SocRolloverResultItemEntity entity = new SocRolloverResultItemEntity(info); |
| 152 | 0 | entity.setId(info.getId()); |
| 153 | 0 | entity.setSocRorType(typeKey); |
| 154 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 155 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 156 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 157 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 158 | 0 | socRorItemDao.persist(entity); |
| 159 | 0 | return entity.toDto(); |
| 160 | |
} |
| 161 | |
|
| 162 | |
@Override |
| 163 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 164 | |
public Integer createSocRolloverResultItems(String socRorId, String typeKey, List<SocRolloverResultItemInfo> infos, ContextInfo context) |
| 165 | |
throws DoesNotExistException, |
| 166 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 167 | |
PermissionDeniedException, ReadOnlyException { |
| 168 | 0 | int count = 0; |
| 169 | 0 | for (SocRolloverResultItemInfo info : infos) { |
| 170 | 0 | count++; |
| 171 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 172 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object " + count); |
| 173 | |
} |
| 174 | 0 | if (!socRorId.equals(info.getSocRolloverResultId())) { |
| 175 | 0 | throw new InvalidParameterException("rollover result id does not match the value in the info object " + count); |
| 176 | |
} |
| 177 | 0 | SocRolloverResultItemEntity entity = new SocRolloverResultItemEntity(info); |
| 178 | 0 | entity.setId(info.getId()); |
| 179 | 0 | entity.setSocRorType(typeKey); |
| 180 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 181 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 182 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 183 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 184 | 0 | socRorItemDao.persist(entity); |
| 185 | 0 | } |
| 186 | 0 | return new Integer(count); |
| 187 | |
} |
| 188 | |
|
| 189 | |
@Override |
| 190 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 191 | |
public Integer deleteCourseOfferingsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 192 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 193 | 0 | return this.businessLogic.deleteCourseOfferingsBySoc(socId, context); |
| 194 | |
} |
| 195 | |
|
| 196 | |
@Override |
| 197 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 198 | |
public StatusInfo deleteSoc(String id, ContextInfo context) throws DependentObjectsExistException, DoesNotExistException, |
| 199 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 200 | 0 | SocEntity entity = socDao.find(id); |
| 201 | 0 | if (null == entity) { |
| 202 | 0 | throw new DoesNotExistException(id); |
| 203 | |
} |
| 204 | 0 | socDao.remove(entity); |
| 205 | 0 | StatusInfo status = new StatusInfo(); |
| 206 | 0 | status.setSuccess(Boolean.TRUE); |
| 207 | 0 | return status; |
| 208 | |
} |
| 209 | |
|
| 210 | |
@Override |
| 211 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 212 | |
public StatusInfo deleteSocRolloverResult(String id, ContextInfo context) throws DoesNotExistException, |
| 213 | |
DependentObjectsExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 214 | |
PermissionDeniedException { |
| 215 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 216 | 0 | if (null == entity) { |
| 217 | 0 | throw new DoesNotExistException(id); |
| 218 | |
} |
| 219 | 0 | List<SocRolloverResultItemInfo> items = this.getSocRolloverResultItemsByResultId(id, context); |
| 220 | 0 | if (!items.isEmpty()) { |
| 221 | 0 | throw new DependentObjectsExistException(items.size() + " items exist"); |
| 222 | |
} |
| 223 | 0 | socRorDao.remove(entity); |
| 224 | 0 | StatusInfo status = new StatusInfo(); |
| 225 | 0 | status.setSuccess(Boolean.TRUE); |
| 226 | 0 | return status; |
| 227 | |
} |
| 228 | |
|
| 229 | |
@Override |
| 230 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 231 | |
public StatusInfo deleteSocRolloverResultItem(String id, ContextInfo context) throws |
| 232 | |
DoesNotExistException, |
| 233 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 234 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 235 | 0 | if (null == entity) { |
| 236 | 0 | throw new DoesNotExistException(id); |
| 237 | |
} |
| 238 | 0 | socRorItemDao.remove(entity); |
| 239 | 0 | StatusInfo status = new StatusInfo(); |
| 240 | 0 | status.setSuccess(Boolean.TRUE); |
| 241 | 0 | return status; |
| 242 | |
} |
| 243 | |
|
| 244 | |
@Override |
| 245 | |
@Transactional(readOnly = true) |
| 246 | |
public List<String> getCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 247 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 248 | 0 | return this.businessLogic.getCourseOfferingIdsBySoc(socId, context); |
| 249 | |
} |
| 250 | |
|
| 251 | |
@Override |
| 252 | |
@Transactional(readOnly = true) |
| 253 | |
public List<String> getCourseOfferingIdsWithUnscheduledFinalExamsBySoc(String socId, ContextInfo context) throws |
| 254 | |
DoesNotExistException, |
| 255 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 256 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 257 | |
} |
| 258 | |
|
| 259 | |
@Override |
| 260 | |
@Transactional(readOnly = true) |
| 261 | |
public List<String> getPublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 262 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 263 | 0 | return this.businessLogic.getPublishedCourseOfferingIdsBySoc(socId, context); |
| 264 | |
} |
| 265 | |
|
| 266 | |
@Override |
| 267 | |
@Transactional(readOnly = true) |
| 268 | |
public SocInfo getSoc(String id, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 269 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 270 | 0 | SocEntity entity = socDao.find(id); |
| 271 | 0 | if (null == entity) { |
| 272 | 0 | throw new DoesNotExistException(id); |
| 273 | |
} |
| 274 | 0 | return entity.toDto(); |
| 275 | |
} |
| 276 | |
|
| 277 | |
@Override |
| 278 | |
@Transactional(readOnly = true) |
| 279 | |
public List<String> getSocIdsByCourseOffering(String courseOfferingId, ContextInfo context) throws DoesNotExistException, |
| 280 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 281 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 282 | |
} |
| 283 | |
|
| 284 | |
@Override |
| 285 | |
@Transactional(readOnly = true) |
| 286 | |
public List<String> getSocIdsByTerm(String termId, ContextInfo context) throws DoesNotExistException, |
| 287 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 288 | 0 | List<SocEntity> entities = socDao.getByTerm(termId); |
| 289 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 290 | 0 | for (SocEntity entity : entities) { |
| 291 | 0 | list.add(entity.getId()); |
| 292 | |
} |
| 293 | 0 | return list; |
| 294 | |
} |
| 295 | |
|
| 296 | |
@Override |
| 297 | |
@Transactional(readOnly = true) |
| 298 | |
public List<String> getSocIdsByTermAndSubjectArea(String termId, String subjectArea, ContextInfo context) throws |
| 299 | |
DoesNotExistException, |
| 300 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 301 | 0 | List<SocEntity> entities = socDao.getByTermAndSubjectArea(termId, subjectArea); |
| 302 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 303 | 0 | for (SocEntity entity : entities) { |
| 304 | 0 | list.add(entity.getId()); |
| 305 | |
} |
| 306 | 0 | return list; |
| 307 | |
} |
| 308 | |
|
| 309 | |
@Override |
| 310 | |
@Transactional(readOnly = true) |
| 311 | |
public List<String> getSocIdsByTermAndUnitsContentOwner(String termId, String unitsContentOwnerId, ContextInfo context) throws |
| 312 | |
DoesNotExistException, |
| 313 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 314 | 0 | List<SocEntity> entities = socDao.getByTermAndUnitsContentOwner(termId, unitsContentOwnerId); |
| 315 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 316 | 0 | for (SocEntity entity : entities) { |
| 317 | 0 | list.add(entity.getId()); |
| 318 | |
} |
| 319 | 0 | return list; |
| 320 | |
} |
| 321 | |
|
| 322 | |
@Override |
| 323 | |
@Transactional(readOnly = true) |
| 324 | |
public List<String> getSocIdsByType(String typeKey, ContextInfo context) throws DoesNotExistException, |
| 325 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 326 | 0 | List<SocEntity> entities = socDao.getBySocTypeId(typeKey); |
| 327 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 328 | 0 | for (SocEntity entity : entities) { |
| 329 | 0 | list.add(entity.getId()); |
| 330 | |
} |
| 331 | 0 | return list; |
| 332 | |
} |
| 333 | |
|
| 334 | |
@Override |
| 335 | |
@Transactional(readOnly = true) |
| 336 | |
public SocRolloverResultInfo getSocRolloverResult(String id, ContextInfo context) throws DoesNotExistException, |
| 337 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 338 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 339 | 0 | if (null == entity) { |
| 340 | 0 | throw new DoesNotExistException(id); |
| 341 | |
} |
| 342 | 0 | SocRolloverResultInfo info = entity.toDto(); |
| 343 | 0 | this.updateCalculatedFields(info, context); |
| 344 | 0 | return info; |
| 345 | |
} |
| 346 | |
|
| 347 | |
|
| 348 | |
|
| 349 | |
private void updateCalculatedFields(SocRolloverResultInfo info, ContextInfo context) throws OperationFailedException { |
| 350 | |
try { |
| 351 | 0 | if (info.getSourceSocId() != null) { |
| 352 | 0 | SocInfo sourceSoc = this.getSoc(info.getSourceSocId(), context); |
| 353 | 0 | info.setSourceTermId(sourceSoc.getTermId()); |
| 354 | |
} |
| 355 | |
|
| 356 | 0 | if (info.getStateKey().equals(CourseOfferingSetServiceConstants.FINISHED_RESULT_STATE_KEY)) { |
| 357 | 0 | List<SocRolloverResultItemInfo> items = this.getSocRolloverResultItemsByResultId(info.getId(), context); |
| 358 | 0 | int success = 0; |
| 359 | 0 | int failure = 0; |
| 360 | 0 | for (SocRolloverResultItemInfo item : items) { |
| 361 | 0 | if (item.getStateKey().equals(CourseOfferingSetServiceConstants.SUCCESS_RESULT_ITEM_STATE_KEY)) { |
| 362 | 0 | success++; |
| 363 | |
} else { |
| 364 | 0 | failure++; |
| 365 | |
} |
| 366 | |
} |
| 367 | 0 | info.setItemsCreated(success); |
| 368 | 0 | info.setItemsSkipped(failure); |
| 369 | |
} |
| 370 | 0 | } catch (Exception ex) { |
| 371 | 0 | throw new OperationFailedException("unexpected", ex); |
| 372 | 0 | } |
| 373 | 0 | } |
| 374 | |
|
| 375 | |
@Override |
| 376 | |
public List<SocRolloverResultInfo> getSocRolloverResultsBySourceAndTargetSocs(String sourceSocId, String targetSocId, ContextInfo context) throws |
| 377 | |
DoesNotExistException, |
| 378 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 379 | |
|
| 380 | 0 | List<SocRolloverResultInfo> list = new ArrayList<SocRolloverResultInfo>(); |
| 381 | 0 | List<String> ids = this.getSocRolloverResultIdsBySourceSoc(sourceSocId, context); |
| 382 | 0 | for (String id : ids) { |
| 383 | 0 | SocRolloverResultInfo info = this.getSocRolloverResult(id, context); |
| 384 | 0 | if (targetSocId.equals(info.getTargetSocId())) { |
| 385 | 0 | list.add(info); |
| 386 | |
} |
| 387 | 0 | } |
| 388 | 0 | return list; |
| 389 | |
} |
| 390 | |
|
| 391 | |
@Override |
| 392 | |
@Transactional(readOnly = true) |
| 393 | |
public List<String> getSocRolloverResultIdsBySourceSoc(String sourceSocId, ContextInfo context) throws DoesNotExistException, |
| 394 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 395 | 0 | List<SocRolloverResultEntity> entities = socRorDao.getBySourceSocId(sourceSocId); |
| 396 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 397 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 398 | 0 | list.add(entity.getId()); |
| 399 | |
} |
| 400 | 0 | return list; |
| 401 | |
} |
| 402 | |
|
| 403 | |
@Override |
| 404 | |
@Transactional(readOnly = true) |
| 405 | |
public List<String> getSocRolloverResultIdsByTargetSoc(String targetSocId, ContextInfo context) throws DoesNotExistException, |
| 406 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 407 | 0 | List<SocRolloverResultEntity> entities = socRorDao.getByTargetSocId(targetSocId); |
| 408 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 409 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 410 | 0 | list.add(entity.getId()); |
| 411 | |
} |
| 412 | 0 | return list; |
| 413 | |
} |
| 414 | |
|
| 415 | |
@Override |
| 416 | |
@Transactional(readOnly = true) |
| 417 | |
public SocRolloverResultItemInfo getSocRolloverResultItem(String id, ContextInfo context) throws |
| 418 | |
DoesNotExistException, |
| 419 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 420 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 421 | 0 | if (null == entity) { |
| 422 | 0 | throw new DoesNotExistException(id); |
| 423 | |
} |
| 424 | 0 | return entity.toDto(); |
| 425 | |
} |
| 426 | |
|
| 427 | |
@Override |
| 428 | |
@Transactional(readOnly = true) |
| 429 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultId(String socRolloverResultId, ContextInfo context) throws |
| 430 | |
DoesNotExistException, |
| 431 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 432 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultId(socRolloverResultId); |
| 433 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 434 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 435 | 0 | list.add(entity.toDto()); |
| 436 | |
} |
| 437 | 0 | return list; |
| 438 | |
} |
| 439 | |
|
| 440 | |
@Override |
| 441 | |
@Transactional(readOnly = true) |
| 442 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndSourceCourseOfferingId(String socRolloverResultId, String sourceCourseOfferingId, ContextInfo context) throws |
| 443 | |
DoesNotExistException, |
| 444 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 445 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultIdAndSourceCourseOfferingId( |
| 446 | |
socRolloverResultId, sourceCourseOfferingId); |
| 447 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 448 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 449 | 0 | list.add(entity.toDto()); |
| 450 | |
} |
| 451 | 0 | return list; |
| 452 | |
} |
| 453 | |
|
| 454 | |
@Override |
| 455 | |
@Transactional(readOnly = true) |
| 456 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndTargetCourseOfferingId(String socRolloverResultId, String targetCourseOfferingId, ContextInfo context) throws |
| 457 | |
DoesNotExistException, |
| 458 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 459 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultIdAndTargetCourseOfferingId( |
| 460 | |
socRolloverResultId, targetCourseOfferingId); |
| 461 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 462 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 463 | 0 | list.add(entity.toDto()); |
| 464 | |
} |
| 465 | 0 | return list; |
| 466 | |
} |
| 467 | |
|
| 468 | |
@Override |
| 469 | |
@Transactional(readOnly = true) |
| 470 | |
public List<SocRolloverResultInfo> getSocRolloverResultsByIds(List<String> ids, ContextInfo context) throws |
| 471 | |
DoesNotExistException, |
| 472 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 473 | 0 | List<SocRolloverResultEntity> entities = socRorDao.findByIds(ids); |
| 474 | 0 | List<SocRolloverResultInfo> list = new ArrayList<SocRolloverResultInfo>(entities.size()); |
| 475 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 476 | 0 | if (entity == null) { |
| 477 | |
|
| 478 | |
|
| 479 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 480 | |
} |
| 481 | 0 | list.add(entity.toDto()); |
| 482 | |
} |
| 483 | 0 | return list; |
| 484 | |
} |
| 485 | |
|
| 486 | |
@Override |
| 487 | |
@Transactional(readOnly = true) |
| 488 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByIds(List<String> ids, ContextInfo context) throws |
| 489 | |
DoesNotExistException, |
| 490 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 491 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.findByIds(ids); |
| 492 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 493 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 494 | 0 | if (entity == null) { |
| 495 | |
|
| 496 | |
|
| 497 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 498 | |
} |
| 499 | 0 | list.add(entity.toDto()); |
| 500 | |
} |
| 501 | 0 | return list; |
| 502 | |
} |
| 503 | |
|
| 504 | |
@Override |
| 505 | |
@Transactional(readOnly = true) |
| 506 | |
public List<SocInfo> getSocsByIds(List<String> ids, ContextInfo context) throws DoesNotExistException, |
| 507 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 508 | 0 | List<SocEntity> entities = socDao.findByIds(ids); |
| 509 | 0 | List<SocInfo> list = new ArrayList<SocInfo>(entities.size()); |
| 510 | 0 | for (SocEntity entity : entities) { |
| 511 | 0 | if (entity == null) { |
| 512 | |
|
| 513 | |
|
| 514 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 515 | |
} |
| 516 | 0 | list.add(entity.toDto()); |
| 517 | |
} |
| 518 | 0 | return list; |
| 519 | |
} |
| 520 | |
|
| 521 | |
@Override |
| 522 | |
@Transactional(readOnly = true) |
| 523 | |
public List<String> getUnpublishedActivityOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 524 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 525 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 526 | |
} |
| 527 | |
|
| 528 | |
@Override |
| 529 | |
@Transactional(readOnly = true) |
| 530 | |
public List<String> getUnpublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 531 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 532 | 0 | return this.businessLogic.getUnpublishedCourseOfferingIdsBySoc(socId, context); |
| 533 | |
} |
| 534 | |
|
| 535 | |
@Override |
| 536 | |
@Transactional(readOnly = true) |
| 537 | |
public List<String> getUnscheduledActivityOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 538 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 539 | 0 | return this.businessLogic.getUnscheduledActivityOfferingIdsBySoc(socId, context); |
| 540 | |
} |
| 541 | |
|
| 542 | |
@Override |
| 543 | |
@Transactional(readOnly = true) |
| 544 | |
public Boolean isCourseOfferingInSoc(String socId, String courseOfferingId, ContextInfo context) throws DoesNotExistException, |
| 545 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 546 | 0 | return this.businessLogic.isCourseOfferingInSoc(socId, courseOfferingId, context); |
| 547 | |
} |
| 548 | |
|
| 549 | |
@Override |
| 550 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 551 | |
public SocRolloverResultInfo reverseRollover(String rolloverResultId, List<String> optionKeys, ContextInfo context) throws |
| 552 | |
DoesNotExistException, |
| 553 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 554 | 0 | return this.businessLogic.reverseRollover(rolloverResultId, optionKeys, context); |
| 555 | |
} |
| 556 | |
|
| 557 | |
@Override |
| 558 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 559 | |
public SocInfo rolloverSoc(String sourceSocId, String targetTermId, List<String> optionKeys, ContextInfo context) throws |
| 560 | |
DoesNotExistException, |
| 561 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 562 | 0 | return this.businessLogic.rolloverSoc(sourceSocId, targetTermId, optionKeys, context); |
| 563 | |
} |
| 564 | |
|
| 565 | |
@Override |
| 566 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 567 | |
public StatusInfo scheduleSoc(String socId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 568 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 569 | 0 | throw new OperationFailedException("not implemented yet"); |
| 570 | |
} |
| 571 | |
|
| 572 | |
@Override |
| 573 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 574 | |
public SocInfo updateSoc(String id, SocInfo info, ContextInfo context) throws DataValidationErrorException, |
| 575 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 576 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 577 | 0 | SocEntity entity = socDao.find(id); |
| 578 | 0 | if (entity == null) { |
| 579 | 0 | throw new DoesNotExistException(id); |
| 580 | |
} |
| 581 | 0 | entity.fromDTO(info); |
| 582 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 583 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 584 | 0 | socDao.merge(entity); |
| 585 | 0 | return entity.toDto(); |
| 586 | |
} |
| 587 | |
|
| 588 | |
@Override |
| 589 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 590 | |
public SocRolloverResultInfo updateSocRolloverProgress(String id, Integer itemsProcessed, ContextInfo context) throws |
| 591 | |
DataValidationErrorException, |
| 592 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 593 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 594 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 595 | 0 | if (entity == null) { |
| 596 | 0 | throw new DoesNotExistException(id); |
| 597 | |
} |
| 598 | 0 | entity.setItemsProcessed(itemsProcessed); |
| 599 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 600 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 601 | 0 | socRorDao.merge(entity); |
| 602 | 0 | return entity.toDto(); |
| 603 | |
} |
| 604 | |
|
| 605 | |
@Override |
| 606 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 607 | |
public SocRolloverResultInfo updateSocRolloverResult(String id, SocRolloverResultInfo info, ContextInfo context) throws |
| 608 | |
DataValidationErrorException, |
| 609 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 610 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 611 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 612 | 0 | if (entity == null) { |
| 613 | 0 | throw new DoesNotExistException(id); |
| 614 | |
} |
| 615 | |
|
| 616 | |
|
| 617 | |
|
| 618 | 0 | List<SocRolloverResultOptionEntity> notDeletedOptions = new ArrayList<SocRolloverResultOptionEntity>( |
| 619 | |
entity.getOptions().size()); |
| 620 | 0 | for (SocRolloverResultOptionEntity optionEntity : entity.getOptions()) { |
| 621 | 0 | if (!info.getOptionKeys().contains(optionEntity.getOptionId())) { |
| 622 | 0 | socDao.getEm().remove(optionEntity); |
| 623 | |
} else { |
| 624 | 0 | notDeletedOptions.add(optionEntity); |
| 625 | |
} |
| 626 | |
} |
| 627 | 0 | entity.setOptions(notDeletedOptions); |
| 628 | 0 | entity.fromDTO(info); |
| 629 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 630 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 631 | 0 | socRorDao.merge(entity); |
| 632 | 0 | return entity.toDto(); |
| 633 | |
} |
| 634 | |
|
| 635 | |
@Override |
| 636 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 637 | |
public SocRolloverResultItemInfo updateSocRolloverResultItem(String id, SocRolloverResultItemInfo info, ContextInfo context) throws |
| 638 | |
DataValidationErrorException, |
| 639 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 640 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 641 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 642 | 0 | if (entity == null) { |
| 643 | 0 | throw new DoesNotExistException(id); |
| 644 | |
} |
| 645 | 0 | entity.fromDTO(info); |
| 646 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 647 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 648 | 0 | socRorItemDao.merge(entity); |
| 649 | 0 | return entity.toDto(); |
| 650 | |
} |
| 651 | |
|
| 652 | |
@Override |
| 653 | |
public List<ValidationResultInfo> validateSoc(String validationType, SocInfo socInfo, ContextInfo context) throws |
| 654 | |
DoesNotExistException, |
| 655 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 656 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 657 | |
} |
| 658 | |
|
| 659 | |
@Override |
| 660 | |
public List<ValidationResultInfo> validateSocRolloverResult(String validationType, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context) throws |
| 661 | |
DoesNotExistException, |
| 662 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 663 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 664 | |
} |
| 665 | |
|
| 666 | |
@Override |
| 667 | |
public List<ValidationResultInfo> validateSocRolloverResultItem(String validationType, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context) throws |
| 668 | |
DoesNotExistException, |
| 669 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 670 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 671 | |
} |
| 672 | |
|
| 673 | |
@Override |
| 674 | |
@Transactional(readOnly = true) |
| 675 | |
public List<String> searchForSocRolloverResultIds(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "context") ContextInfo context) throws |
| 676 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 677 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 678 | |
} |
| 679 | |
|
| 680 | |
@Override |
| 681 | |
@Transactional(readOnly = true) |
| 682 | |
public List<SocRolloverResultInfo> searchForSocRolloverResults(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "context") ContextInfo context) throws |
| 683 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 684 | 0 | GenericQueryResults<SocRolloverResultEntity> results = criteriaLookupService.lookup(SocRolloverResultEntity.class, |
| 685 | |
criteria); |
| 686 | 0 | List<SocRolloverResultInfo> socRolloverResultInfos = new ArrayList<SocRolloverResultInfo>(results.getResults().size()); |
| 687 | 0 | for (SocRolloverResultEntity socRolloverResult : results.getResults()) { |
| 688 | 0 | SocRolloverResultInfo socRolloverResultInfo = socRolloverResult.toDto(); |
| 689 | 0 | socRolloverResultInfos.add(socRolloverResultInfo); |
| 690 | 0 | } |
| 691 | 0 | return socRolloverResultInfos; |
| 692 | |
} |
| 693 | |
|
| 694 | |
public void setCriteriaLookupService(CriteriaLookupService criteriaLookupService) { |
| 695 | 0 | this.criteriaLookupService = criteriaLookupService; |
| 696 | 0 | } |
| 697 | |
} |