| 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 | |
|
| 23 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocDao; |
| 24 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocRolloverResultDao; |
| 25 | |
import org.kuali.student.enrollment.class2.courseofferingset.dao.SocRolloverResultItemDao; |
| 26 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocEntity; |
| 27 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultEntity; |
| 28 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultItemEntity; |
| 29 | |
import org.kuali.student.enrollment.class2.courseofferingset.model.SocRolloverResultOptionEntity; |
| 30 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocInfo; |
| 31 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo; |
| 32 | |
import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo; |
| 33 | |
import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService; |
| 34 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 35 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 36 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 37 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 38 | |
import org.kuali.student.r2.common.exceptions.DependentObjectsExistException; |
| 39 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 40 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 41 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 42 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 43 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 44 | |
import org.kuali.student.r2.common.exceptions.ReadOnlyException; |
| 45 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 46 | |
import org.springframework.transaction.annotation.Transactional; |
| 47 | |
|
| 48 | |
@Transactional(readOnly = true, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 49 | 0 | public class CourseOfferingSetServiceImpl implements CourseOfferingSetService { |
| 50 | |
|
| 51 | |
@Resource |
| 52 | |
private SocDao socDao; |
| 53 | |
@Resource |
| 54 | |
private SocRolloverResultDao socRorDao; |
| 55 | |
@Resource |
| 56 | |
private SocRolloverResultItemDao socRorItemDao; |
| 57 | |
|
| 58 | |
public SocDao getSocDao() { |
| 59 | 0 | return socDao; |
| 60 | |
} |
| 61 | |
|
| 62 | |
public void setSocDao(SocDao socDao) { |
| 63 | 0 | this.socDao = socDao; |
| 64 | 0 | } |
| 65 | |
|
| 66 | |
public SocRolloverResultDao getSocRorDao() { |
| 67 | 0 | return socRorDao; |
| 68 | |
} |
| 69 | |
|
| 70 | |
public void setSocRorDao(SocRolloverResultDao socRorDao) { |
| 71 | 0 | this.socRorDao = socRorDao; |
| 72 | 0 | } |
| 73 | |
|
| 74 | |
public SocRolloverResultItemDao getSocRorItemDao() { |
| 75 | 0 | return socRorItemDao; |
| 76 | |
} |
| 77 | |
|
| 78 | |
public void setSocRorItemDao(SocRolloverResultItemDao socRorItemDao) { |
| 79 | 0 | this.socRorItemDao = socRorItemDao; |
| 80 | 0 | } |
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
@Override |
| 86 | |
@Transactional(readOnly = false) |
| 87 | |
public SocInfo createSoc(String termId, String typeKey, SocInfo info, ContextInfo context) throws DoesNotExistException, |
| 88 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 89 | |
PermissionDeniedException, ReadOnlyException { |
| 90 | 0 | if (!termId.equals(info.getTermId())) { |
| 91 | 0 | throw new InvalidParameterException("termId does not match the value in the info object"); |
| 92 | |
} |
| 93 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 94 | 0 | throw new InvalidParameterException("typeKey does not match the value in the info object"); |
| 95 | |
} |
| 96 | 0 | SocEntity entity = new SocEntity(info); |
| 97 | 0 | entity.setId(info.getId()); |
| 98 | 0 | entity.setSocType(typeKey); |
| 99 | |
|
| 100 | 0 | entity.setEntityCreated(context); |
| 101 | |
|
| 102 | 0 | socDao.persist(entity); |
| 103 | 0 | return entity.toDto(); |
| 104 | |
} |
| 105 | |
|
| 106 | |
@Override |
| 107 | |
@Transactional(readOnly = false) |
| 108 | |
public SocRolloverResultInfo createSocRolloverResult(String typeKey, SocRolloverResultInfo info, ContextInfo context) throws |
| 109 | |
DoesNotExistException, |
| 110 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 111 | |
PermissionDeniedException, ReadOnlyException { |
| 112 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 113 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object"); |
| 114 | |
} |
| 115 | 0 | SocRolloverResultEntity entity = new SocRolloverResultEntity(info); |
| 116 | 0 | entity.setId(info.getId()); |
| 117 | 0 | entity.setSocRorType(typeKey); |
| 118 | |
|
| 119 | 0 | entity.setEntityCreated(context); |
| 120 | |
|
| 121 | 0 | socRorDao.persist(entity); |
| 122 | 0 | return entity.toDto(); |
| 123 | |
} |
| 124 | |
|
| 125 | |
@Override |
| 126 | |
@Transactional(readOnly = false) |
| 127 | |
public SocRolloverResultItemInfo createSocRolloverResultItem(String socRorId, String typeKey, SocRolloverResultItemInfo info, ContextInfo context) throws |
| 128 | |
DoesNotExistException, |
| 129 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 130 | |
PermissionDeniedException, ReadOnlyException { |
| 131 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 132 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object"); |
| 133 | |
} |
| 134 | 0 | SocRolloverResultItemEntity entity = new SocRolloverResultItemEntity(info); |
| 135 | 0 | entity.setId(info.getId()); |
| 136 | 0 | entity.setSocRorType(typeKey); |
| 137 | |
|
| 138 | 0 | entity.setEntityCreated(context); |
| 139 | |
|
| 140 | 0 | socRorItemDao.persist(entity); |
| 141 | 0 | return entity.toDto(); |
| 142 | |
} |
| 143 | |
|
| 144 | |
@Override |
| 145 | |
@Transactional(readOnly = false) |
| 146 | |
public Integer createSocRolloverResultItems(String socRorId, String typeKey, List<SocRolloverResultItemInfo> infos, ContextInfo context) |
| 147 | |
throws DoesNotExistException, |
| 148 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 149 | |
PermissionDeniedException, ReadOnlyException { |
| 150 | 0 | int count = 0; |
| 151 | 0 | for (SocRolloverResultItemInfo info : infos) { |
| 152 | 0 | count++; |
| 153 | 0 | if (!typeKey.equals(info.getTypeKey())) { |
| 154 | 0 | throw new InvalidParameterException("TypeKey does not match the value in the info object " + count); |
| 155 | |
} |
| 156 | 0 | if (!socRorId.equals(info.getSocRolloverResultId())) { |
| 157 | 0 | throw new InvalidParameterException("rollover result id does not match the value in the info object " + count); |
| 158 | |
} |
| 159 | 0 | SocRolloverResultItemEntity entity = new SocRolloverResultItemEntity(info); |
| 160 | 0 | entity.setId(info.getId()); |
| 161 | 0 | entity.setSocRorType(typeKey); |
| 162 | |
|
| 163 | 0 | entity.setEntityCreated(context); |
| 164 | |
|
| 165 | 0 | socRorItemDao.persist(entity); |
| 166 | 0 | } |
| 167 | 0 | return new Integer(count); |
| 168 | |
} |
| 169 | |
|
| 170 | |
@Override |
| 171 | |
@Transactional(readOnly = false) |
| 172 | |
public Integer deleteCourseOfferingsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 173 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 174 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 175 | |
} |
| 176 | |
|
| 177 | |
@Override |
| 178 | |
@Transactional(readOnly = false) |
| 179 | |
public StatusInfo deleteSoc(String id, ContextInfo context) throws DependentObjectsExistException, DoesNotExistException, |
| 180 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 181 | 0 | SocEntity entity = socDao.find(id); |
| 182 | 0 | if (null == entity) { |
| 183 | 0 | throw new DoesNotExistException(id); |
| 184 | |
} |
| 185 | 0 | socDao.remove(entity); |
| 186 | 0 | StatusInfo status = new StatusInfo(); |
| 187 | 0 | status.setSuccess(Boolean.TRUE); |
| 188 | 0 | return status; |
| 189 | |
} |
| 190 | |
|
| 191 | |
@Override |
| 192 | |
@Transactional(readOnly = false) |
| 193 | |
public StatusInfo deleteSocRolloverResult(String id, ContextInfo context) throws DoesNotExistException, |
| 194 | |
DependentObjectsExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 195 | |
PermissionDeniedException { |
| 196 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 197 | 0 | if (null == entity) { |
| 198 | 0 | throw new DoesNotExistException(id); |
| 199 | |
} |
| 200 | 0 | List<SocRolloverResultItemInfo> items = this.getSocRolloverResultItemsByResultId(id, context); |
| 201 | 0 | if (!items.isEmpty()) { |
| 202 | 0 | throw new DependentObjectsExistException(items.size() + " items exist"); |
| 203 | |
} |
| 204 | 0 | socRorDao.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) |
| 212 | |
public StatusInfo deleteSocRolloverResultItem(String id, ContextInfo context) throws |
| 213 | |
DoesNotExistException, |
| 214 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 215 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 216 | 0 | if (null == entity) { |
| 217 | 0 | throw new DoesNotExistException(id); |
| 218 | |
} |
| 219 | 0 | socRorItemDao.remove(entity); |
| 220 | 0 | StatusInfo status = new StatusInfo(); |
| 221 | 0 | status.setSuccess(Boolean.TRUE); |
| 222 | 0 | return status; |
| 223 | |
} |
| 224 | |
|
| 225 | |
@Override |
| 226 | |
public List<String> getCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 227 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 228 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 229 | |
} |
| 230 | |
|
| 231 | |
@Override |
| 232 | |
public List<String> getCourseOfferingIdsWithUnscheduledFinalExamsBySoc(String socId, ContextInfo context) throws |
| 233 | |
DoesNotExistException, |
| 234 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 235 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 236 | |
} |
| 237 | |
|
| 238 | |
@Override |
| 239 | |
public List<String> getPublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 240 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 241 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 242 | |
} |
| 243 | |
|
| 244 | |
@Override |
| 245 | |
public SocInfo getSoc(String id, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 246 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 247 | 0 | SocEntity entity = socDao.find(id); |
| 248 | 0 | if (null == entity) { |
| 249 | 0 | throw new DoesNotExistException(id); |
| 250 | |
} |
| 251 | 0 | return entity.toDto(); |
| 252 | |
} |
| 253 | |
|
| 254 | |
@Override |
| 255 | |
public List<String> getSocIdsByCourseOffering(String courseOfferingId, ContextInfo context) throws DoesNotExistException, |
| 256 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 257 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 258 | |
} |
| 259 | |
|
| 260 | |
@Override |
| 261 | |
public List<String> getSocIdsByTerm(String termId, ContextInfo context) throws DoesNotExistException, |
| 262 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 263 | 0 | List<SocEntity> entities = socDao.getByTerm(termId); |
| 264 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 265 | 0 | for (SocEntity entity : entities) { |
| 266 | 0 | list.add(entity.getId()); |
| 267 | |
} |
| 268 | 0 | return list; |
| 269 | |
} |
| 270 | |
|
| 271 | |
@Override |
| 272 | |
public List<String> getSocIdsByTermAndSubjectArea(String termId, String subjectArea, ContextInfo context) throws |
| 273 | |
DoesNotExistException, |
| 274 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 275 | 0 | List<SocEntity> entities = socDao.getByTermAndSubjectArea(termId, subjectArea); |
| 276 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 277 | 0 | for (SocEntity entity : entities) { |
| 278 | 0 | list.add(entity.getId()); |
| 279 | |
} |
| 280 | 0 | return list; |
| 281 | |
} |
| 282 | |
|
| 283 | |
@Override |
| 284 | |
public List<String> getSocIdsByTermAndUnitsContentOwner(String termId, String unitsContentOwnerId, ContextInfo context) throws |
| 285 | |
DoesNotExistException, |
| 286 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 287 | 0 | List<SocEntity> entities = socDao.getByTermAndUnitsContentOwner(termId, unitsContentOwnerId); |
| 288 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 289 | 0 | for (SocEntity entity : entities) { |
| 290 | 0 | list.add(entity.getId()); |
| 291 | |
} |
| 292 | 0 | return list; |
| 293 | |
} |
| 294 | |
|
| 295 | |
@Override |
| 296 | |
public List<String> getSocIdsByType(String typeKey, ContextInfo context) throws DoesNotExistException, |
| 297 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 298 | 0 | List<SocEntity> entities = socDao.getBySocTypeId(typeKey); |
| 299 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 300 | 0 | for (SocEntity entity : entities) { |
| 301 | 0 | list.add(entity.getId()); |
| 302 | |
} |
| 303 | 0 | return list; |
| 304 | |
} |
| 305 | |
|
| 306 | |
@Override |
| 307 | |
public SocRolloverResultInfo getSocRolloverResult(String id, ContextInfo context) throws DoesNotExistException, |
| 308 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 309 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 310 | 0 | if (null == entity) { |
| 311 | 0 | throw new DoesNotExistException(id); |
| 312 | |
} |
| 313 | 0 | return entity.toDto(); |
| 314 | |
} |
| 315 | |
|
| 316 | |
@Override |
| 317 | |
public List<String> getSocRolloverResultIdsBySourceSoc(String sourceSocId, ContextInfo context) throws DoesNotExistException, |
| 318 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 319 | 0 | List<SocRolloverResultEntity> entities = socRorDao.getBySourceSocId(sourceSocId); |
| 320 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 321 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 322 | 0 | list.add(entity.getId()); |
| 323 | |
} |
| 324 | 0 | return list; |
| 325 | |
} |
| 326 | |
|
| 327 | |
@Override |
| 328 | |
public List<String> getSocRolloverResultIdsByTargetSoc(String targetSocId, ContextInfo context) throws DoesNotExistException, |
| 329 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 330 | 0 | List<SocRolloverResultEntity> entities = socRorDao.getByTargetSocId(targetSocId); |
| 331 | 0 | List<String> list = new ArrayList<String>(entities.size()); |
| 332 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 333 | 0 | list.add(entity.getId()); |
| 334 | |
} |
| 335 | 0 | return list; |
| 336 | |
} |
| 337 | |
|
| 338 | |
@Override |
| 339 | |
public SocRolloverResultItemInfo getSocRolloverResultItem(String id, ContextInfo context) throws |
| 340 | |
DoesNotExistException, |
| 341 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 342 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 343 | 0 | if (null == entity) { |
| 344 | 0 | throw new DoesNotExistException(id); |
| 345 | |
} |
| 346 | 0 | return entity.toDto(); |
| 347 | |
} |
| 348 | |
|
| 349 | |
@Override |
| 350 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultId(String socRolloverResultId, ContextInfo context) throws |
| 351 | |
DoesNotExistException, |
| 352 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 353 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultId(socRolloverResultId); |
| 354 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 355 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 356 | 0 | list.add(entity.toDto()); |
| 357 | |
} |
| 358 | 0 | return list; |
| 359 | |
} |
| 360 | |
|
| 361 | |
@Override |
| 362 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndSourceCourseOfferingId(String socRolloverResultId, String sourceCourseOfferingId, ContextInfo context) throws |
| 363 | |
DoesNotExistException, |
| 364 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 365 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultIdAndSourceCourseOfferingId( |
| 366 | |
socRolloverResultId, sourceCourseOfferingId); |
| 367 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 368 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 369 | 0 | list.add(entity.toDto()); |
| 370 | |
} |
| 371 | 0 | return list; |
| 372 | |
} |
| 373 | |
|
| 374 | |
@Override |
| 375 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndTargetCourseOfferingId(String socRolloverResultId, String targetCourseOfferingId, ContextInfo context) throws |
| 376 | |
DoesNotExistException, |
| 377 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 378 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.getBySocRolloverResultIdAndTargetCourseOfferingId( |
| 379 | |
socRolloverResultId, targetCourseOfferingId); |
| 380 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 381 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 382 | 0 | list.add(entity.toDto()); |
| 383 | |
} |
| 384 | 0 | return list; |
| 385 | |
} |
| 386 | |
|
| 387 | |
@Override |
| 388 | |
public List<SocRolloverResultInfo> getSocRolloverResultsByIds(List<String> ids, ContextInfo context) throws |
| 389 | |
DoesNotExistException, |
| 390 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 391 | 0 | List<SocRolloverResultEntity> entities = socRorDao.findByIds(ids); |
| 392 | 0 | List<SocRolloverResultInfo> list = new ArrayList<SocRolloverResultInfo>(entities.size()); |
| 393 | 0 | for (SocRolloverResultEntity entity : entities) { |
| 394 | 0 | if (entity == null) { |
| 395 | |
|
| 396 | |
|
| 397 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 398 | |
} |
| 399 | 0 | list.add(entity.toDto()); |
| 400 | |
} |
| 401 | 0 | return list; |
| 402 | |
} |
| 403 | |
|
| 404 | |
@Override |
| 405 | |
public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByIds(List<String> ids, ContextInfo context) throws |
| 406 | |
DoesNotExistException, |
| 407 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 408 | 0 | List<SocRolloverResultItemEntity> entities = socRorItemDao.findByIds(ids); |
| 409 | 0 | List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(entities.size()); |
| 410 | 0 | for (SocRolloverResultItemEntity entity : entities) { |
| 411 | 0 | if (entity == null) { |
| 412 | |
|
| 413 | |
|
| 414 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 415 | |
} |
| 416 | 0 | list.add(entity.toDto()); |
| 417 | |
} |
| 418 | 0 | return list; |
| 419 | |
} |
| 420 | |
|
| 421 | |
@Override |
| 422 | |
public List<SocInfo> getSocsByIds(List<String> ids, ContextInfo context) throws DoesNotExistException, |
| 423 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 424 | 0 | List<SocEntity> entities = socDao.findByIds(ids); |
| 425 | 0 | List<SocInfo> list = new ArrayList<SocInfo>(entities.size()); |
| 426 | 0 | for (SocEntity entity : entities) { |
| 427 | 0 | if (entity == null) { |
| 428 | |
|
| 429 | |
|
| 430 | 0 | throw new DoesNotExistException(ids.get(list.size())); |
| 431 | |
} |
| 432 | 0 | list.add(entity.toDto()); |
| 433 | |
} |
| 434 | 0 | return list; |
| 435 | |
} |
| 436 | |
|
| 437 | |
@Override |
| 438 | |
public List<String> getUnpublishedActivityOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 439 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 440 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 441 | |
} |
| 442 | |
|
| 443 | |
@Override |
| 444 | |
public List<String> getUnpublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 445 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 446 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 447 | |
} |
| 448 | |
|
| 449 | |
@Override |
| 450 | |
public List<String> getUnscheduledActivityOfferingIdsBySoc(String socId, ContextInfo context) throws DoesNotExistException, |
| 451 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 452 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 453 | |
} |
| 454 | |
|
| 455 | |
@Override |
| 456 | |
public Boolean isCourseOfferingInSoc(String socId, String courseOfferingId, ContextInfo context) throws DoesNotExistException, |
| 457 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 458 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 459 | |
} |
| 460 | |
|
| 461 | |
@Override |
| 462 | |
@Transactional(readOnly = false) |
| 463 | |
public SocRolloverResultInfo reverseRollover(String rolloverResultId, List<String> optionKeys, ContextInfo context) throws |
| 464 | |
DoesNotExistException, |
| 465 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 466 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 467 | |
} |
| 468 | |
|
| 469 | |
@Override |
| 470 | |
@Transactional(readOnly = false) |
| 471 | |
public SocInfo rolloverSoc(String sourceSocId, String targetTermId, List<String> optionKeys, ContextInfo context) throws |
| 472 | |
DoesNotExistException, |
| 473 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 474 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 475 | |
} |
| 476 | |
|
| 477 | |
@Override |
| 478 | |
@Transactional(readOnly = false) |
| 479 | |
public StatusInfo scheduleSoc(String socId, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 480 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 481 | 0 | throw new OperationFailedException("Configuration error Implemented in the calculuation layer"); |
| 482 | |
} |
| 483 | |
|
| 484 | |
@Override |
| 485 | |
@Transactional(readOnly = false) |
| 486 | |
public SocInfo updateSoc(String id, SocInfo info, ContextInfo context) throws DataValidationErrorException, |
| 487 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 488 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 489 | 0 | SocEntity entity = socDao.find(id); |
| 490 | 0 | if (entity == null) { |
| 491 | 0 | throw new DoesNotExistException(id); |
| 492 | |
} |
| 493 | 0 | entity.fromDTO(info); |
| 494 | |
|
| 495 | 0 | entity.setEntityUpdated(context); |
| 496 | |
|
| 497 | 0 | socDao.merge(entity); |
| 498 | 0 | return entity.toDto(); |
| 499 | |
} |
| 500 | |
|
| 501 | |
@Override |
| 502 | |
@Transactional(readOnly = false) |
| 503 | |
public SocRolloverResultInfo updateSocRolloverProgress(String id, Integer itemsProcessed, ContextInfo context) throws |
| 504 | |
DataValidationErrorException, |
| 505 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 506 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 507 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 508 | 0 | if (entity == null) { |
| 509 | 0 | throw new DoesNotExistException(id); |
| 510 | |
} |
| 511 | 0 | entity.setItemsProcessed(itemsProcessed); |
| 512 | |
|
| 513 | 0 | entity.setEntityUpdated(context); |
| 514 | |
|
| 515 | 0 | socRorDao.merge(entity); |
| 516 | 0 | return entity.toDto(); |
| 517 | |
} |
| 518 | |
|
| 519 | |
@Override |
| 520 | |
@Transactional(readOnly = false) |
| 521 | |
public SocRolloverResultInfo updateSocRolloverResult(String id, SocRolloverResultInfo info, ContextInfo context) throws |
| 522 | |
DataValidationErrorException, |
| 523 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 524 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 525 | 0 | SocRolloverResultEntity entity = socRorDao.find(id); |
| 526 | 0 | if (entity == null) { |
| 527 | 0 | throw new DoesNotExistException(id); |
| 528 | |
} |
| 529 | |
|
| 530 | |
|
| 531 | |
|
| 532 | 0 | List<SocRolloverResultOptionEntity> notDeletedOptions = new ArrayList<SocRolloverResultOptionEntity> (entity.getOptions().size()); |
| 533 | 0 | for (SocRolloverResultOptionEntity optionEntity : entity.getOptions()) { |
| 534 | 0 | if (!info.getOptionKeys().contains(optionEntity.getOptionId())) { |
| 535 | 0 | socDao.getEm().remove(optionEntity); |
| 536 | |
} |
| 537 | |
else { |
| 538 | 0 | notDeletedOptions.add(optionEntity); |
| 539 | |
} |
| 540 | |
} |
| 541 | 0 | entity.setOptions(notDeletedOptions); |
| 542 | 0 | entity.fromDTO(info); |
| 543 | |
|
| 544 | 0 | entity.setEntityUpdated(context); |
| 545 | |
|
| 546 | 0 | socRorDao.merge(entity); |
| 547 | 0 | return entity.toDto(); |
| 548 | |
} |
| 549 | |
|
| 550 | |
@Override |
| 551 | |
@Transactional(readOnly = false) |
| 552 | |
public SocRolloverResultItemInfo updateSocRolloverResultItem(String id, SocRolloverResultItemInfo info, ContextInfo context) throws |
| 553 | |
DataValidationErrorException, |
| 554 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 555 | |
PermissionDeniedException, ReadOnlyException, VersionMismatchException { |
| 556 | 0 | SocRolloverResultItemEntity entity = socRorItemDao.find(id); |
| 557 | 0 | if (entity == null) { |
| 558 | 0 | throw new DoesNotExistException(id); |
| 559 | |
} |
| 560 | 0 | entity.fromDTO(info); |
| 561 | |
|
| 562 | 0 | entity.setEntityUpdated(context); |
| 563 | |
|
| 564 | 0 | socRorItemDao.merge(entity); |
| 565 | 0 | return entity.toDto(); |
| 566 | |
} |
| 567 | |
|
| 568 | |
@Override |
| 569 | |
public List<ValidationResultInfo> validateSoc(String validationType, SocInfo socInfo, ContextInfo context) throws |
| 570 | |
DoesNotExistException, |
| 571 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 572 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 573 | |
} |
| 574 | |
|
| 575 | |
@Override |
| 576 | |
public List<ValidationResultInfo> validateSocRolloverResult(String validationType, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context) throws |
| 577 | |
DoesNotExistException, |
| 578 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 579 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 580 | |
} |
| 581 | |
|
| 582 | |
@Override |
| 583 | |
public List<ValidationResultInfo> validateSocRolloverResultItem(String validationType, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context) throws |
| 584 | |
DoesNotExistException, |
| 585 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 586 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 587 | |
} |
| 588 | |
} |