| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |  package org.kuali.student.enrollment.class2.courseofferingset.service.impl; | 
  | 6 |  |   | 
  | 7 |  |  import java.util.ArrayList; | 
  | 8 |  |  import java.util.Date; | 
  | 9 |  |  import java.util.LinkedHashMap; | 
  | 10 |  |  import java.util.List; | 
  | 11 |  |  import java.util.Map; | 
  | 12 |  |  import org.kuali.student.enrollment.courseofferingset.dto.SocInfo; | 
  | 13 |  |  import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultInfo; | 
  | 14 |  |  import org.kuali.student.enrollment.courseofferingset.dto.SocRolloverResultItemInfo; | 
  | 15 |  |  import org.kuali.student.enrollment.courseofferingset.service.CourseOfferingSetService; | 
  | 16 |  |  import org.kuali.student.r2.common.dto.ContextInfo; | 
  | 17 |  |  import org.kuali.student.r2.common.dto.MetaInfo; | 
  | 18 |  |  import org.kuali.student.r2.common.dto.StatusInfo; | 
  | 19 |  |  import org.kuali.student.r2.common.dto.ValidationResultInfo; | 
  | 20 |  |  import org.kuali.student.r2.common.exceptions.DataValidationErrorException; | 
  | 21 |  |  import org.kuali.student.r2.common.exceptions.DependentObjectsExistException; | 
  | 22 |  |  import org.kuali.student.r2.common.exceptions.DoesNotExistException; | 
  | 23 |  |  import org.kuali.student.r2.common.exceptions.InvalidParameterException; | 
  | 24 |  |  import org.kuali.student.r2.common.exceptions.MissingParameterException; | 
  | 25 |  |  import org.kuali.student.r2.common.exceptions.OperationFailedException; | 
  | 26 |  |  import org.kuali.student.r2.common.exceptions.PermissionDeniedException; | 
  | 27 |  |  import org.kuali.student.r2.common.exceptions.ReadOnlyException; | 
  | 28 |  |  import org.kuali.student.r2.common.exceptions.VersionMismatchException; | 
  | 29 |  |   | 
  | 30 | 0 |  public class CourseOfferingSetServiceMockImpl implements CourseOfferingSetService { | 
  | 31 |  |   | 
  | 32 |  |       | 
  | 33 |  |      @Override | 
  | 34 |  |      public SocInfo getSoc(String socId, ContextInfo context) | 
  | 35 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 36 |  |              PermissionDeniedException { | 
  | 37 | 0 |          if (!this.socMap.containsKey(socId)) { | 
  | 38 | 0 |              throw new DoesNotExistException(socId); | 
  | 39 |  |          } | 
  | 40 | 0 |          return this.socMap.get(socId); | 
  | 41 |  |      } | 
  | 42 |  |   | 
  | 43 |  |      @Override | 
  | 44 |  |      public List<SocInfo> getSocsByIds(List<String> socIds, ContextInfo context) | 
  | 45 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 46 |  |              PermissionDeniedException { | 
  | 47 | 0 |          List<SocInfo> list = new ArrayList<SocInfo>(); | 
  | 48 | 0 |          for (String id : socIds) { | 
  | 49 | 0 |              list.add(this.getSoc(id, context)); | 
  | 50 |  |          } | 
  | 51 | 0 |          return list; | 
  | 52 |  |      } | 
  | 53 |  |   | 
  | 54 |  |      @Override | 
  | 55 |  |      public List<String> getSocIdsByTerm(String termId, ContextInfo context) | 
  | 56 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 57 |  |              PermissionDeniedException { | 
  | 58 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 59 | 0 |          for (SocInfo info : socMap.values()) { | 
  | 60 | 0 |              if (termId.equals(info.getTermId())) { | 
  | 61 | 0 |                  list.add(info.getId()); | 
  | 62 |  |              } | 
  | 63 |  |          } | 
  | 64 | 0 |          return list; | 
  | 65 |  |      } | 
  | 66 |  |   | 
  | 67 |  |      @Override | 
  | 68 |  |      public List<String> getSocIdsByTermAndSubjectArea(String termId, String subjectArea, ContextInfo context) | 
  | 69 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 70 |  |              PermissionDeniedException { | 
  | 71 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 72 | 0 |          for (SocInfo info : socMap.values()) { | 
  | 73 | 0 |              if (termId.equals(info.getTermId())) { | 
  | 74 | 0 |                  if (subjectArea.equals(info.getSubjectArea())) { | 
  | 75 | 0 |                      list.add(info.getId()); | 
  | 76 |  |                  } | 
  | 77 |  |              } | 
  | 78 |  |          } | 
  | 79 | 0 |          return list; | 
  | 80 |  |      } | 
  | 81 |  |   | 
  | 82 |  |      @Override | 
  | 83 |  |      public List<String> getSocIdsByTermAndUnitsContentOwner(String termId, String unitsContentOwnerId, ContextInfo context) | 
  | 84 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 85 |  |              PermissionDeniedException { | 
  | 86 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 87 | 0 |          for (SocInfo info : socMap.values()) { | 
  | 88 | 0 |              if (termId.equals(info.getTermId())) { | 
  | 89 | 0 |                  if (unitsContentOwnerId.equals(info.getUnitsContentOwnerId())) { | 
  | 90 | 0 |                      list.add(info.getId()); | 
  | 91 |  |                  } | 
  | 92 |  |              } | 
  | 93 |  |          } | 
  | 94 | 0 |          return list; | 
  | 95 |  |      } | 
  | 96 |  |   | 
  | 97 |  |      @Override | 
  | 98 |  |      public List<String> getSocIdsByType(String typeKey, ContextInfo context) | 
  | 99 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 100 |  |              PermissionDeniedException { | 
  | 101 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 102 | 0 |          for (SocInfo info : socMap.values()) { | 
  | 103 | 0 |              if (typeKey.equals(info.getTypeKey())) { | 
  | 104 | 0 |                  list.add(info.getId()); | 
  | 105 |  |              } | 
  | 106 |  |          } | 
  | 107 | 0 |          return list; | 
  | 108 |  |      } | 
  | 109 |  |       | 
  | 110 |  |       | 
  | 111 | 0 |      private Map<String, SocInfo> socMap = new LinkedHashMap<String, SocInfo>(); | 
  | 112 |  |   | 
  | 113 |  |      @Override | 
  | 114 |  |      public SocInfo createSoc(String termId, String socTypeKey, SocInfo socInfo, ContextInfo context) | 
  | 115 |  |              throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, | 
  | 116 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException { | 
  | 117 |  |           | 
  | 118 | 0 |          if (!socTypeKey.equals(socInfo.getTypeKey())) { | 
  | 119 | 0 |              throw new InvalidParameterException("The type parameter does not match the type on the info object"); | 
  | 120 |  |          } | 
  | 121 |  |           | 
  | 122 | 0 |          SocInfo copy = new SocInfo(socInfo); | 
  | 123 | 0 |          if (copy.getId() == null) { | 
  | 124 | 0 |              copy.setId(socMap.size() + ""); | 
  | 125 |  |          } | 
  | 126 | 0 |          copy.setMeta(newMeta(context)); | 
  | 127 | 0 |          socMap.put(copy.getId(), copy); | 
  | 128 | 0 |          return new SocInfo(copy); | 
  | 129 |  |      } | 
  | 130 |  |   | 
  | 131 |  |      @Override | 
  | 132 |  |      public SocInfo updateSoc(String socId, SocInfo socInfo, ContextInfo context) | 
  | 133 |  |              throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, | 
  | 134 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { | 
  | 135 |  |           | 
  | 136 | 0 |          if (!socId.equals(socInfo.getId())) { | 
  | 137 | 0 |              throw new InvalidParameterException("The id parameter does not match the id on the info object"); | 
  | 138 |  |          } | 
  | 139 | 0 |          SocInfo copy = new SocInfo(socInfo); | 
  | 140 | 0 |          SocInfo old = this.getSoc(socInfo.getId(), context); | 
  | 141 | 0 |          if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { | 
  | 142 | 0 |              throw new VersionMismatchException(old.getMeta().getVersionInd()); | 
  | 143 |  |          } | 
  | 144 | 0 |          copy.setMeta(updateMeta(copy.getMeta(), context)); | 
  | 145 | 0 |          this.socMap.put(socInfo.getId(), copy); | 
  | 146 | 0 |          return new SocInfo(copy); | 
  | 147 |  |      } | 
  | 148 |  |   | 
  | 149 |  |      @Override | 
  | 150 |  |      public StatusInfo deleteSoc(String socId, ContextInfo context) | 
  | 151 |  |              throws DependentObjectsExistException, DoesNotExistException, InvalidParameterException, MissingParameterException, | 
  | 152 |  |              OperationFailedException, PermissionDeniedException { | 
  | 153 | 0 |          if (this.socMap.remove(socId) == null) { | 
  | 154 | 0 |              throw new DoesNotExistException(socId); | 
  | 155 |  |          } | 
  | 156 | 0 |          return newStatus(); | 
  | 157 |  |      } | 
  | 158 |  |   | 
  | 159 |  |      @Override | 
  | 160 |  |      public List<ValidationResultInfo> validateSoc(String validationType, SocInfo socInfo, ContextInfo context) | 
  | 161 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 162 |  |           | 
  | 163 | 0 |          return new ArrayList<ValidationResultInfo>(); | 
  | 164 |  |      } | 
  | 165 |  |   | 
  | 166 |  |      @Override | 
  | 167 |  |      public List<String> getSocIdsByCourseOffering(String courseOfferingId, ContextInfo context) | 
  | 168 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 169 |  |              PermissionDeniedException { | 
  | 170 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 171 | 0 |          for (SocInfo info : socMap.values()) { | 
  | 172 | 0 |              if (this.isCourseOfferingInSoc(info.getId(), courseOfferingId, context)) { | 
  | 173 | 0 |                  list.add(info.getId()); | 
  | 174 |  |              } | 
  | 175 |  |          } | 
  | 176 | 0 |          return list; | 
  | 177 |  |      } | 
  | 178 |  |   | 
  | 179 |  |      @Override | 
  | 180 |  |      public List<String> getCourseOfferingIdsBySoc(String socId, ContextInfo context) | 
  | 181 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 182 |  |              PermissionDeniedException { | 
  | 183 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 184 |  |      } | 
  | 185 |  |   | 
  | 186 |  |      @Override | 
  | 187 |  |      public Integer deleteCourseOfferingsBySoc(String socId, ContextInfo context) | 
  | 188 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 189 |  |              PermissionDeniedException { | 
  | 190 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 191 |  |      } | 
  | 192 |  |   | 
  | 193 |  |      @Override | 
  | 194 |  |      public Boolean isCourseOfferingInSoc(String socId, String courseOfferingId, ContextInfo context) | 
  | 195 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 196 |  |              PermissionDeniedException { | 
  | 197 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 198 |  |      } | 
  | 199 |  |   | 
  | 200 |  |      @Override | 
  | 201 |  |      public List<String> getPublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) | 
  | 202 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 203 |  |              PermissionDeniedException { | 
  | 204 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 205 |  |      } | 
  | 206 |  |   | 
  | 207 |  |      @Override | 
  | 208 |  |      public List<String> getUnpublishedCourseOfferingIdsBySoc(String socId, ContextInfo context) | 
  | 209 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 210 |  |              PermissionDeniedException { | 
  | 211 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 212 |  |      } | 
  | 213 |  |   | 
  | 214 |  |      @Override | 
  | 215 |  |      public List<String> getUnpublishedActivityOfferingIdsBySoc(String socId, ContextInfo context) | 
  | 216 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 217 |  |              PermissionDeniedException { | 
  | 218 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 219 |  |      } | 
  | 220 |  |   | 
  | 221 |  |      @Override | 
  | 222 |  |      public List<String> getUnscheduledActivityOfferingIdsBySoc(String socId, ContextInfo context) | 
  | 223 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 224 |  |              PermissionDeniedException { | 
  | 225 | 0 |          throw new OperationFailedException("not impemented"); | 
  | 226 |  |      } | 
  | 227 |  |   | 
  | 228 |  |      @Override | 
  | 229 |  |      public List<String> getCourseOfferingIdsWithUnscheduledFinalExamsBySoc(String socId, ContextInfo context) | 
  | 230 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 231 |  |              PermissionDeniedException { | 
  | 232 | 0 |          throw new OperationFailedException("scheduleSoc has not been implemented"); | 
  | 233 |  |      } | 
  | 234 |  |   | 
  | 235 |  |      @Override | 
  | 236 |  |      public StatusInfo scheduleSoc(String socId, ContextInfo context) | 
  | 237 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 238 |  |              PermissionDeniedException { | 
  | 239 | 0 |          throw new OperationFailedException("scheduleSoc has not been implemented"); | 
  | 240 |  |      } | 
  | 241 |  |   | 
  | 242 |  |      @Override | 
  | 243 |  |      public SocInfo rolloverSoc(String sourceSocId, String targetTermId, List<String> optionKeys, ContextInfo context) | 
  | 244 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 245 |  |              PermissionDeniedException { | 
  | 246 | 0 |          throw new OperationFailedException("reverseRollover has not been implemented"); | 
  | 247 |  |      } | 
  | 248 |  |   | 
  | 249 |  |      @Override | 
  | 250 |  |      public SocRolloverResultInfo getSocRolloverResult(String rolloverResultId, ContextInfo context) | 
  | 251 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 252 |  |              PermissionDeniedException { | 
  | 253 | 0 |          if (!this.socRolloverResultMap.containsKey(rolloverResultId)) { | 
  | 254 | 0 |              throw new DoesNotExistException(rolloverResultId); | 
  | 255 |  |          } | 
  | 256 | 0 |          return this.socRolloverResultMap.get(rolloverResultId); | 
  | 257 |  |      } | 
  | 258 |  |   | 
  | 259 |  |      @Override | 
  | 260 |  |      public List<SocRolloverResultInfo> getSocRolloverResultsByIds(List<String> rolloverResultIds, ContextInfo context) | 
  | 261 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 262 |  |              PermissionDeniedException { | 
  | 263 | 0 |          List<SocRolloverResultInfo> list = new ArrayList<SocRolloverResultInfo>(); | 
  | 264 | 0 |          for (String id : rolloverResultIds) { | 
  | 265 | 0 |              list.add(this.getSocRolloverResult(id, context)); | 
  | 266 |  |          } | 
  | 267 | 0 |          return list; | 
  | 268 |  |      } | 
  | 269 |  |   | 
  | 270 |  |      @Override | 
  | 271 |  |      public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByIds(List<String> rolloverResultItemIds, ContextInfo context) | 
  | 272 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 273 |  |              PermissionDeniedException { | 
  | 274 | 0 |          List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(); | 
  | 275 | 0 |          for (String id : rolloverResultItemIds) { | 
  | 276 | 0 |              list.add(this.getSocRolloverResultItem(id, context)); | 
  | 277 |  |          } | 
  | 278 | 0 |          return list; | 
  | 279 |  |      } | 
  | 280 |  |   | 
  | 281 |  |      @Override | 
  | 282 |  |      public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultId(String socRolloverResultId, ContextInfo context) | 
  | 283 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 284 |  |              PermissionDeniedException { | 
  | 285 | 0 |          List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(); | 
  | 286 | 0 |          for (SocRolloverResultItemInfo info : socRolloverResultItemMap.values()) { | 
  | 287 | 0 |              if (socRolloverResultId.equals(info.getSocRolloverResultId())) { | 
  | 288 | 0 |                  list.add(info); | 
  | 289 |  |              } | 
  | 290 |  |          } | 
  | 291 | 0 |          return list; | 
  | 292 |  |      } | 
  | 293 |  |   | 
  | 294 |  |      @Override | 
  | 295 |  |      public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndSourceCourseOfferingId(String socRolloverResultId, String sourceCourseOfferingId, ContextInfo context) | 
  | 296 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 297 |  |              PermissionDeniedException { | 
  | 298 | 0 |          List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(); | 
  | 299 | 0 |          for (SocRolloverResultItemInfo info : socRolloverResultItemMap.values()) { | 
  | 300 | 0 |              if (socRolloverResultId.equals(info.getSocRolloverResultId())) { | 
  | 301 | 0 |                  if (sourceCourseOfferingId.equals(info.getTargetCourseOfferingId())) { | 
  | 302 | 0 |                      list.add(info); | 
  | 303 |  |                  } | 
  | 304 |  |              } | 
  | 305 |  |          } | 
  | 306 | 0 |          return list; | 
  | 307 |  |      } | 
  | 308 |  |   | 
  | 309 |  |      @Override | 
  | 310 |  |      public List<SocRolloverResultItemInfo> getSocRolloverResultItemsByResultIdAndTargetCourseOfferingId(String socRolloverResultId, String targetCourseOfferingId, ContextInfo context) | 
  | 311 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 312 |  |              PermissionDeniedException { | 
  | 313 | 0 |          List<SocRolloverResultItemInfo> list = new ArrayList<SocRolloverResultItemInfo>(); | 
  | 314 | 0 |          for (SocRolloverResultItemInfo info : socRolloverResultItemMap.values()) { | 
  | 315 | 0 |              if (socRolloverResultId.equals(info.getSocRolloverResultId())) { | 
  | 316 | 0 |                  if (targetCourseOfferingId.equals(info.getTargetCourseOfferingId())) { | 
  | 317 | 0 |                      list.add(info); | 
  | 318 |  |                  } | 
  | 319 |  |              } | 
  | 320 |  |          } | 
  | 321 | 0 |          return list; | 
  | 322 |  |      } | 
  | 323 |  |   | 
  | 324 |  |      @Override | 
  | 325 |  |      public List<String> getSocRolloverResultIdsByTargetSoc(String targetSocId, ContextInfo context) | 
  | 326 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 327 |  |              PermissionDeniedException { | 
  | 328 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 329 | 0 |          for (SocRolloverResultInfo info : socRolloverResultMap.values()) { | 
  | 330 | 0 |              if (targetSocId.equals(info.getTargetSocId())) { | 
  | 331 | 0 |                  list.add(info.getId()); | 
  | 332 |  |              } | 
  | 333 |  |          } | 
  | 334 | 0 |          return list; | 
  | 335 |  |      } | 
  | 336 |  |   | 
  | 337 |  |      @Override | 
  | 338 |  |      public List<String> getSocRolloverResultIdsBySourceSoc(String sourceSocId, ContextInfo context) | 
  | 339 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 340 |  |              PermissionDeniedException { | 
  | 341 | 0 |          List<String> list = new ArrayList<String>(); | 
  | 342 | 0 |          for (SocRolloverResultInfo info : socRolloverResultMap.values()) { | 
  | 343 | 0 |              if (sourceSocId.equals(info.getSourceSocId())) { | 
  | 344 | 0 |                  list.add(info.getId()); | 
  | 345 |  |              } | 
  | 346 |  |          } | 
  | 347 | 0 |          return list; | 
  | 348 |  |      } | 
  | 349 |  |   | 
  | 350 |  |      @Override | 
  | 351 |  |      public SocRolloverResultInfo reverseRollover(String rolloverResultId, List<String> optionKeys, ContextInfo context) | 
  | 352 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 353 |  |              PermissionDeniedException { | 
  | 354 | 0 |          throw new OperationFailedException("reverseRollover has not been implemented"); | 
  | 355 |  |      } | 
  | 356 |  |       | 
  | 357 |  |       | 
  | 358 | 0 |      private Map<String, SocRolloverResultInfo> socRolloverResultMap = new LinkedHashMap<String, SocRolloverResultInfo>(); | 
  | 359 |  |   | 
  | 360 |  |      @Override | 
  | 361 |  |      public SocRolloverResultInfo createSocRolloverResult(String socRolloverResultTypeKey, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context) | 
  | 362 |  |              throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, | 
  | 363 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException { | 
  | 364 |  |           | 
  | 365 | 0 |          if (!socRolloverResultTypeKey.equals(socRolloverResultInfo.getTypeKey())) { | 
  | 366 | 0 |              throw new InvalidParameterException("The type parameter does not match the type on the info object"); | 
  | 367 |  |          } | 
  | 368 | 0 |          SocRolloverResultInfo copy = new SocRolloverResultInfo(socRolloverResultInfo); | 
  | 369 | 0 |          if (copy.getId() == null) { | 
  | 370 | 0 |              copy.setId(socRolloverResultMap.size() + ""); | 
  | 371 |  |          } | 
  | 372 | 0 |          copy.setMeta(newMeta(context)); | 
  | 373 | 0 |          socRolloverResultMap.put(copy.getId(), copy); | 
  | 374 | 0 |          return new SocRolloverResultInfo(copy); | 
  | 375 |  |      } | 
  | 376 |  |   | 
  | 377 |  |      @Override | 
  | 378 |  |      public SocRolloverResultInfo updateSocRolloverResult(String socRolloverResultId, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context) | 
  | 379 |  |              throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, | 
  | 380 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { | 
  | 381 |  |           | 
  | 382 | 0 |          if (!socRolloverResultId.equals(socRolloverResultInfo.getId())) { | 
  | 383 | 0 |              throw new InvalidParameterException("The id parameter does not match the id on the info object"); | 
  | 384 |  |          } | 
  | 385 | 0 |          SocRolloverResultInfo copy = new SocRolloverResultInfo(socRolloverResultInfo); | 
  | 386 | 0 |          SocRolloverResultInfo old = this.getSocRolloverResult(socRolloverResultInfo.getId(), context); | 
  | 387 | 0 |          if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { | 
  | 388 | 0 |              throw new VersionMismatchException(old.getMeta().getVersionInd()); | 
  | 389 |  |          } | 
  | 390 | 0 |          copy.setMeta(updateMeta(copy.getMeta(), context)); | 
  | 391 | 0 |          this.socRolloverResultMap.put(socRolloverResultInfo.getId(), copy); | 
  | 392 | 0 |          return new SocRolloverResultInfo(copy); | 
  | 393 |  |      } | 
  | 394 |  |   | 
  | 395 |  |      @Override | 
  | 396 |  |      public SocRolloverResultInfo updateSocRolloverProgress(String socRolloverResultId, Integer itemsProcessed, ContextInfo context) | 
  | 397 |  |              throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, | 
  | 398 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { | 
  | 399 | 0 |          SocRolloverResultInfo info = this.getSocRolloverResult(socRolloverResultId, context); | 
  | 400 | 0 |          info = new SocRolloverResultInfo(info); | 
  | 401 | 0 |          info.setItemsProcessed(itemsProcessed); | 
  | 402 | 0 |          return this.updateSocRolloverResult(info.getId(), info, context); | 
  | 403 |  |      } | 
  | 404 |  |   | 
  | 405 |  |      @Override | 
  | 406 |  |      public StatusInfo deleteSocRolloverResult(String socRolloverResultId, ContextInfo context) | 
  | 407 |  |              throws DoesNotExistException, DependentObjectsExistException, | 
  | 408 |  |              InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 409 |  |              PermissionDeniedException { | 
  | 410 | 0 |          List<SocRolloverResultItemInfo> items = this.getSocRolloverResultItemsByResultId(socRolloverResultId, context); | 
  | 411 | 0 |          if (!items.isEmpty()) { | 
  | 412 | 0 |              throw new DependentObjectsExistException(items.size() + " items exist"); | 
  | 413 |  |          } | 
  | 414 | 0 |          if (this.socRolloverResultMap.remove(socRolloverResultId) == null) { | 
  | 415 | 0 |              throw new DoesNotExistException(socRolloverResultId); | 
  | 416 |  |          } | 
  | 417 | 0 |          return newStatus(); | 
  | 418 |  |      } | 
  | 419 |  |   | 
  | 420 |  |      @Override | 
  | 421 |  |      public List<ValidationResultInfo> validateSocRolloverResult(String validationType, SocRolloverResultInfo socRolloverResultInfo, ContextInfo context) | 
  | 422 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 423 |  |           | 
  | 424 | 0 |          return new ArrayList<ValidationResultInfo>(); | 
  | 425 |  |      } | 
  | 426 |  |   | 
  | 427 |  |      @Override | 
  | 428 |  |      public SocRolloverResultItemInfo getSocRolloverResultItem(String socRolloverResultItemId, ContextInfo context) | 
  | 429 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 430 |  |              PermissionDeniedException { | 
  | 431 | 0 |          if (!this.socRolloverResultItemMap.containsKey(socRolloverResultItemId)) { | 
  | 432 | 0 |              throw new DoesNotExistException(socRolloverResultItemId); | 
  | 433 |  |          } | 
  | 434 | 0 |          return this.socRolloverResultItemMap.get(socRolloverResultItemId); | 
  | 435 |  |      } | 
  | 436 |  |       | 
  | 437 |  |       | 
  | 438 | 0 |      private Map<String, SocRolloverResultItemInfo> socRolloverResultItemMap = new LinkedHashMap<String, SocRolloverResultItemInfo>(); | 
  | 439 |  |   | 
  | 440 |  |      @Override | 
  | 441 |  |      public SocRolloverResultItemInfo createSocRolloverResultItem(String socRolloverResultId, String socRolloverResultItemTypeKey, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context) | 
  | 442 |  |              throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, | 
  | 443 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException { | 
  | 444 |  |           | 
  | 445 | 0 |          if (!socRolloverResultItemTypeKey.equals(socRolloverResultItemInfo.getTypeKey())) { | 
  | 446 | 0 |              throw new InvalidParameterException("The type parameter does not match the type on the info object"); | 
  | 447 |  |          } | 
  | 448 |  |           | 
  | 449 | 0 |          SocRolloverResultItemInfo copy = new SocRolloverResultItemInfo(socRolloverResultItemInfo); | 
  | 450 | 0 |          if (copy.getId() == null) { | 
  | 451 | 0 |              copy.setId(socRolloverResultItemMap.size() + ""); | 
  | 452 |  |          } | 
  | 453 | 0 |          copy.setMeta(newMeta(context)); | 
  | 454 | 0 |          socRolloverResultItemMap.put(copy.getId(), copy); | 
  | 455 | 0 |          return new SocRolloverResultItemInfo(copy); | 
  | 456 |  |      } | 
  | 457 |  |   | 
  | 458 |  |      @Override | 
  | 459 |  |      public Integer createSocRolloverResultItems(String socRolloverResultId, String typeKey, | 
  | 460 |  |              List<SocRolloverResultItemInfo> infos, ContextInfo context) | 
  | 461 |  |              throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, | 
  | 462 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException { | 
  | 463 | 0 |          int count = 0; | 
  | 464 | 0 |          for (SocRolloverResultItemInfo info : infos) { | 
  | 465 | 0 |              count++; | 
  | 466 | 0 |              this.createSocRolloverResultItem(socRolloverResultId, typeKey, info, context); | 
  | 467 |  |          } | 
  | 468 | 0 |          return new Integer(count); | 
  | 469 |  |      } | 
  | 470 |  |   | 
  | 471 |  |      @Override | 
  | 472 |  |      public SocRolloverResultItemInfo updateSocRolloverResultItem(String socRolloverResultItemId, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context) | 
  | 473 |  |              throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, | 
  | 474 |  |              OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException { | 
  | 475 |  |           | 
  | 476 | 0 |          if (!socRolloverResultItemId.equals(socRolloverResultItemInfo.getId())) { | 
  | 477 | 0 |              throw new InvalidParameterException("The id parameter does not match the id on the info object"); | 
  | 478 |  |          } | 
  | 479 | 0 |          SocRolloverResultItemInfo copy = new SocRolloverResultItemInfo(socRolloverResultItemInfo); | 
  | 480 | 0 |          SocRolloverResultItemInfo old = this.getSocRolloverResultItem(socRolloverResultItemInfo.getId(), context); | 
  | 481 | 0 |          if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) { | 
  | 482 | 0 |              throw new VersionMismatchException(old.getMeta().getVersionInd()); | 
  | 483 |  |          } | 
  | 484 | 0 |          copy.setMeta(updateMeta(copy.getMeta(), context)); | 
  | 485 | 0 |          this.socRolloverResultItemMap.put(socRolloverResultItemInfo.getId(), copy); | 
  | 486 | 0 |          return new SocRolloverResultItemInfo(copy); | 
  | 487 |  |      } | 
  | 488 |  |   | 
  | 489 |  |      @Override | 
  | 490 |  |      public StatusInfo deleteSocRolloverResultItem(String socRolloverResultItemId, ContextInfo context) | 
  | 491 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, | 
  | 492 |  |              PermissionDeniedException { | 
  | 493 | 0 |          if (this.socRolloverResultItemMap.remove(socRolloverResultItemId) == null) { | 
  | 494 | 0 |              throw new DoesNotExistException(socRolloverResultItemId); | 
  | 495 |  |          } | 
  | 496 | 0 |          return newStatus(); | 
  | 497 |  |      } | 
  | 498 |  |   | 
  | 499 |  |      @Override | 
  | 500 |  |      public List<ValidationResultInfo> validateSocRolloverResultItem(String validationType, SocRolloverResultItemInfo socRolloverResultItemInfo, ContextInfo context) | 
  | 501 |  |              throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 502 |  |           | 
  | 503 | 0 |          return new ArrayList<ValidationResultInfo>(); | 
  | 504 |  |      } | 
  | 505 |  |   | 
  | 506 |  |      private MetaInfo newMeta(ContextInfo context) { | 
  | 507 | 0 |          MetaInfo meta = new MetaInfo(); | 
  | 508 | 0 |          meta.setCreateId(context.getPrincipalId()); | 
  | 509 | 0 |          meta.setCreateTime(new Date()); | 
  | 510 | 0 |          meta.setUpdateId(context.getPrincipalId()); | 
  | 511 | 0 |          meta.setUpdateTime(meta.getCreateTime()); | 
  | 512 | 0 |          meta.setVersionInd("0"); | 
  | 513 | 0 |          return meta; | 
  | 514 |  |      } | 
  | 515 |  |   | 
  | 516 |  |      private StatusInfo newStatus() { | 
  | 517 | 0 |          StatusInfo status = new StatusInfo(); | 
  | 518 | 0 |          status.setSuccess(Boolean.TRUE); | 
  | 519 | 0 |          return status; | 
  | 520 |  |      } | 
  | 521 |  |   | 
  | 522 |  |      private MetaInfo updateMeta(MetaInfo old, ContextInfo context) { | 
  | 523 | 0 |          MetaInfo meta = new MetaInfo(old); | 
  | 524 | 0 |          meta.setUpdateId(context.getPrincipalId()); | 
  | 525 | 0 |          meta.setUpdateTime(new Date()); | 
  | 526 | 0 |          meta.setVersionInd((Integer.parseInt(meta.getVersionInd()) + 1) + ""); | 
  | 527 | 0 |          return meta; | 
  | 528 |  |      } | 
  | 529 |  |  } |