| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |  package org.kuali.student.core.atp.service.impl; | 
  | 10 |  |   | 
  | 11 |  |  import java.util.Date; | 
  | 12 |  |  import java.util.List; | 
  | 13 |  |   | 
  | 14 |  |  import javax.jws.WebService; | 
  | 15 |  |   | 
  | 16 |  |  import org.kuali.student.common.validator.Validator; | 
  | 17 |  |  import org.kuali.student.common.validator.ValidatorFactory; | 
  | 18 |  |  import org.kuali.student.core.atp.dao.AtpDao; | 
  | 19 |  |  import org.kuali.student.core.atp.dto.AtpDurationTypeInfo; | 
  | 20 |  |  import org.kuali.student.core.atp.dto.AtpInfo; | 
  | 21 |  |  import org.kuali.student.core.atp.dto.AtpSeasonalTypeInfo; | 
  | 22 |  |  import org.kuali.student.core.atp.dto.AtpTypeInfo; | 
  | 23 |  |  import org.kuali.student.core.atp.dto.DateRangeInfo; | 
  | 24 |  |  import org.kuali.student.core.atp.dto.DateRangeTypeInfo; | 
  | 25 |  |  import org.kuali.student.core.atp.dto.MilestoneInfo; | 
  | 26 |  |  import org.kuali.student.core.atp.dto.MilestoneTypeInfo; | 
  | 27 |  |  import org.kuali.student.core.atp.entity.Atp; | 
  | 28 |  |  import org.kuali.student.core.atp.entity.AtpDurationType; | 
  | 29 |  |  import org.kuali.student.core.atp.entity.AtpSeasonalType; | 
  | 30 |  |  import org.kuali.student.core.atp.entity.AtpType; | 
  | 31 |  |  import org.kuali.student.core.atp.entity.DateRange; | 
  | 32 |  |  import org.kuali.student.core.atp.entity.DateRangeType; | 
  | 33 |  |  import org.kuali.student.core.atp.entity.Milestone; | 
  | 34 |  |  import org.kuali.student.core.atp.entity.MilestoneType; | 
  | 35 |  |  import org.kuali.student.core.atp.service.AtpService; | 
  | 36 |  |  import org.kuali.student.core.dictionary.dto.ObjectStructureDefinition; | 
  | 37 |  |  import org.kuali.student.core.dictionary.service.DictionaryService; | 
  | 38 |  |  import org.kuali.student.core.dto.StatusInfo; | 
  | 39 |  |  import org.kuali.student.core.exceptions.AlreadyExistsException; | 
  | 40 |  |  import org.kuali.student.core.exceptions.DataValidationErrorException; | 
  | 41 |  |  import org.kuali.student.core.exceptions.DoesNotExistException; | 
  | 42 |  |  import org.kuali.student.core.exceptions.InvalidParameterException; | 
  | 43 |  |  import org.kuali.student.core.exceptions.MissingParameterException; | 
  | 44 |  |  import org.kuali.student.core.exceptions.OperationFailedException; | 
  | 45 |  |  import org.kuali.student.core.exceptions.PermissionDeniedException; | 
  | 46 |  |  import org.kuali.student.core.exceptions.VersionMismatchException; | 
  | 47 |  |  import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo; | 
  | 48 |  |  import org.kuali.student.core.search.dto.SearchRequest; | 
  | 49 |  |  import org.kuali.student.core.search.dto.SearchResult; | 
  | 50 |  |  import org.kuali.student.core.search.dto.SearchResultTypeInfo; | 
  | 51 |  |  import org.kuali.student.core.search.dto.SearchTypeInfo; | 
  | 52 |  |  import org.kuali.student.core.search.service.SearchManager; | 
  | 53 |  |  import org.kuali.student.core.validation.dto.ValidationResultInfo; | 
  | 54 |  |  import org.springframework.transaction.annotation.Transactional; | 
  | 55 |  |   | 
  | 56 |  |  @WebService(endpointInterface = "org.kuali.student.core.atp.service.AtpService", serviceName = "AtpService", portName = "AtpService", targetNamespace = "http://student.kuali.org/wsdl/atp") | 
  | 57 |  |  @Transactional(readOnly=true,noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) | 
  | 58 | 0 |  public class AtpServiceImpl implements AtpService { | 
  | 59 |  |   | 
  | 60 |  |      private AtpDao atpDao; | 
  | 61 |  |      private SearchManager searchManager; | 
  | 62 |  |      private DictionaryService dictionaryServiceDelegate; | 
  | 63 |  |      private ValidatorFactory validatorFactory; | 
  | 64 |  |   | 
  | 65 |  |      @Override | 
  | 66 |  |      @Transactional(readOnly=false) | 
  | 67 |  |      public DateRangeInfo addDateRange(String atpKey, String dateRangeKey, DateRangeInfo dateRangeInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 68 |  |   | 
  | 69 | 0 |          CheckMissingParameters(new String[]{"atpKey", "dateRangeKey", "dateRangeInfo"}, new Object[]{atpKey, dateRangeKey, dateRangeInfo}); | 
  | 70 |  |   | 
  | 71 | 0 |          dateRangeInfo.setAtpId(atpKey); | 
  | 72 | 0 |          dateRangeInfo.setId(dateRangeKey); | 
  | 73 |  |           | 
  | 74 |  |           | 
  | 75 |  |          List<ValidationResultInfo> validationResults; | 
  | 76 |  |          try { | 
  | 77 | 0 |              validationResults = validateDateRange("OBJECT", dateRangeInfo); | 
  | 78 | 0 |          } catch (DoesNotExistException e1) { | 
  | 79 | 0 |              throw new OperationFailedException("Validation call failed." + e1.getMessage()); | 
  | 80 | 0 |          } | 
  | 81 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 82 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 83 |  |          } | 
  | 84 |  |           | 
  | 85 |  |           | 
  | 86 | 0 |          DateRange dateRange = null; | 
  | 87 |  |   | 
  | 88 |  |          try { | 
  | 89 | 0 |              dateRange = AtpAssembler.toDateRange(false, dateRangeInfo, atpDao); | 
  | 90 | 0 |          } catch (DoesNotExistException e) {} catch (VersionMismatchException e) {} | 
  | 91 |  |   | 
  | 92 | 0 |          atpDao.create(dateRange); | 
  | 93 |  |   | 
  | 94 | 0 |          return AtpAssembler.toDateRangeInfo(dateRange); | 
  | 95 |  |      } | 
  | 96 |  |   | 
  | 97 |  |      private void CheckMissingParameters(String[] paramNames, Object[] params) throws MissingParameterException { | 
  | 98 | 0 |          String errors = null; | 
  | 99 | 0 |          int i = 0; | 
  | 100 | 0 |          for (Object param : params) { | 
  | 101 | 0 |              if (param == null) { | 
  | 102 | 0 |                  errors = errors == null ? paramNames[i] : errors + ", " + paramNames[i]; | 
  | 103 |  |              } | 
  | 104 | 0 |              i++; | 
  | 105 |  |          } | 
  | 106 | 0 |          if (errors != null) { | 
  | 107 | 0 |              throw new MissingParameterException("Missing Parameters: " + errors); | 
  | 108 |  |          } | 
  | 109 | 0 |      } | 
  | 110 |  |   | 
  | 111 |  |      @Override | 
  | 112 |  |      @Transactional(readOnly=false) | 
  | 113 |  |      public MilestoneInfo addMilestone(String atpKey, String milestoneKey, MilestoneInfo milestoneInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 114 |  |   | 
  | 115 | 0 |          CheckMissingParameters(new String[]{"atpKey", "milestoneKey", "milestoneInfo"}, new Object[]{atpKey, milestoneKey, milestoneInfo}); | 
  | 116 |  |   | 
  | 117 | 0 |          milestoneInfo.setAtpId(atpKey); | 
  | 118 | 0 |          milestoneInfo.setId(milestoneKey); | 
  | 119 |  |   | 
  | 120 |  |           | 
  | 121 |  |          List<ValidationResultInfo> validationResults; | 
  | 122 |  |          try { | 
  | 123 | 0 |              validationResults = validateMilestone("OBJECT", milestoneInfo); | 
  | 124 | 0 |          } catch (DoesNotExistException e1) { | 
  | 125 | 0 |              throw new OperationFailedException("Validation call failed." + e1.getMessage()); | 
  | 126 | 0 |          } | 
  | 127 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 128 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 129 |  |          } | 
  | 130 |  |                   | 
  | 131 | 0 |          Milestone milestone = null; | 
  | 132 |  |          try { | 
  | 133 | 0 |              milestone = AtpAssembler.toMilestone(false, milestoneInfo, atpDao); | 
  | 134 | 0 |          } catch (DoesNotExistException e) {} catch (VersionMismatchException e) {} | 
  | 135 |  |   | 
  | 136 | 0 |          atpDao.create(milestone); | 
  | 137 |  |   | 
  | 138 | 0 |          return AtpAssembler.toMilestoneInfo(milestone); | 
  | 139 |  |      } | 
  | 140 |  |   | 
  | 141 |  |      @Override | 
  | 142 |  |      @Transactional(readOnly=false) | 
  | 143 |  |      public AtpInfo createAtp(String atpTypeKey, String atpKey, AtpInfo atpInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 144 |  |   | 
  | 145 | 0 |          CheckMissingParameters(new String[]{"atpTypeKey", "atpKey", "atpInfo"}, new Object[]{atpTypeKey, atpKey, atpInfo}); | 
  | 146 |  |   | 
  | 147 | 0 |          atpInfo.setType(atpTypeKey); | 
  | 148 | 0 |          atpInfo.setId(atpKey); | 
  | 149 |  |   | 
  | 150 |  |           | 
  | 151 |  |          List<ValidationResultInfo> validationResults; | 
  | 152 |  |          try { | 
  | 153 | 0 |              validationResults = validateAtp("OBJECT", atpInfo); | 
  | 154 | 0 |          } catch (DoesNotExistException e1) { | 
  | 155 | 0 |              throw new OperationFailedException("Validation call failed." + e1.getMessage()); | 
  | 156 | 0 |          } | 
  | 157 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 158 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 159 |  |          } | 
  | 160 |  |           | 
  | 161 | 0 |          Atp atp = null; | 
  | 162 |  |          try { | 
  | 163 | 0 |              atp = AtpAssembler.toAtp(false, atpInfo, atpDao); | 
  | 164 | 0 |          } catch (DoesNotExistException e) {} catch (VersionMismatchException e) {} | 
  | 165 |  |   | 
  | 166 | 0 |          atpDao.create(atp); | 
  | 167 |  |   | 
  | 168 | 0 |          AtpInfo result = AtpAssembler.toAtpInfo(atp); | 
  | 169 | 0 |          return result; | 
  | 170 |  |      } | 
  | 171 |  |   | 
  | 172 |  |      @Override | 
  | 173 |  |      @Transactional(readOnly=false) | 
  | 174 |  |      public StatusInfo deleteAtp(String atpKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 175 |  |   | 
  | 176 | 0 |          atpDao.delete(Atp.class, atpKey); | 
  | 177 |  |   | 
  | 178 | 0 |          StatusInfo statusInfo = new StatusInfo(); | 
  | 179 | 0 |          statusInfo.setSuccess(true); | 
  | 180 |  |   | 
  | 181 | 0 |          return statusInfo; | 
  | 182 |  |      } | 
  | 183 |  |   | 
  | 184 |  |      @Override | 
  | 185 |  |      public AtpInfo getAtp(String atpKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 186 |  |   | 
  | 187 | 0 |          Atp atp = atpDao.fetch(Atp.class, atpKey); | 
  | 188 |  |   | 
  | 189 | 0 |          return AtpAssembler.toAtpInfo(atp); | 
  | 190 |  |      } | 
  | 191 |  |   | 
  | 192 |  |      @Override | 
  | 193 |  |      public AtpDurationTypeInfo getAtpDurationType(String atpDurationTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 194 |  |   | 
  | 195 | 0 |          AtpDurationType atpDurationType = atpDao.fetch(AtpDurationType.class, atpDurationTypeKey); | 
  | 196 |  |   | 
  | 197 | 0 |          return AtpAssembler.toGenericTypeInfo(AtpDurationTypeInfo.class, atpDurationType); | 
  | 198 |  |      } | 
  | 199 |  |   | 
  | 200 |  |      @Override | 
  | 201 |  |      public AtpSeasonalTypeInfo getAtpSeasonalType(String atpSeasonalTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 202 |  |   | 
  | 203 | 0 |          AtpSeasonalType atpSeasonalType = atpDao.fetch(AtpSeasonalType.class, atpSeasonalTypeKey); | 
  | 204 |  |   | 
  | 205 | 0 |          return AtpAssembler.toGenericTypeInfo(AtpSeasonalTypeInfo.class, atpSeasonalType); | 
  | 206 |  |      } | 
  | 207 |  |   | 
  | 208 |  |      @Override | 
  | 209 |  |      public AtpTypeInfo getAtpType(String atpTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 210 |  |   | 
  | 211 | 0 |          AtpType atpType = atpDao.fetch(AtpType.class, atpTypeKey); | 
  | 212 |  |   | 
  | 213 | 0 |          return AtpAssembler.toAtpTypeInfo(atpType); | 
  | 214 |  |      } | 
  | 215 |  |   | 
  | 216 |  |      @Override | 
  | 217 |  |      public DateRangeInfo getDateRange(String dateRangeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 218 |  |   | 
  | 219 | 0 |          DateRange dateRange = atpDao.fetch(DateRange.class, dateRangeKey); | 
  | 220 |  |   | 
  | 221 | 0 |          return AtpAssembler.toDateRangeInfo(dateRange); | 
  | 222 |  |   | 
  | 223 |  |      } | 
  | 224 |  |   | 
  | 225 |  |      @Override | 
  | 226 |  |      public DateRangeTypeInfo getDateRangeType(String dateRangeTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 227 |  |   | 
  | 228 | 0 |          DateRangeType dateRangeType = atpDao.fetch(DateRangeType.class, dateRangeTypeKey); | 
  | 229 |  |   | 
  | 230 | 0 |          return AtpAssembler.toGenericTypeInfo(DateRangeTypeInfo.class, dateRangeType); | 
  | 231 |  |      } | 
  | 232 |  |   | 
  | 233 |  |      @Override | 
  | 234 |  |      public MilestoneInfo getMilestone(String milestoneKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 235 |  |   | 
  | 236 | 0 |          Milestone milestone = atpDao.fetch(Milestone.class, milestoneKey); | 
  | 237 |  |   | 
  | 238 | 0 |          return AtpAssembler.toMilestoneInfo(milestone); | 
  | 239 |  |   | 
  | 240 |  |      } | 
  | 241 |  |   | 
  | 242 |  |      @Override | 
  | 243 |  |      public MilestoneTypeInfo getMilestoneType(String milestoneTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 244 |  |   | 
  | 245 | 0 |          MilestoneType milestoneType = atpDao.fetch(MilestoneType.class, milestoneTypeKey); | 
  | 246 |  |   | 
  | 247 | 0 |          return AtpAssembler.toGenericTypeInfo(MilestoneTypeInfo.class, milestoneType); | 
  | 248 |  |      } | 
  | 249 |  |   | 
  | 250 |  |      @Override | 
  | 251 |  |      public List<AtpDurationTypeInfo> getAtpDurationTypes() throws OperationFailedException { | 
  | 252 |  |   | 
  | 253 | 0 |          List<AtpDurationType> atpDurationTypes = atpDao.find(AtpDurationType.class); | 
  | 254 |  |   | 
  | 255 | 0 |          return AtpAssembler.toGenericTypeInfoList(AtpDurationTypeInfo.class, atpDurationTypes); | 
  | 256 |  |      } | 
  | 257 |  |   | 
  | 258 |  |      @Override | 
  | 259 |  |      public List<AtpSeasonalTypeInfo> getAtpSeasonalTypes() throws OperationFailedException { | 
  | 260 |  |   | 
  | 261 | 0 |          List<AtpSeasonalType> atpSeasonalTypes = atpDao.find(AtpSeasonalType.class); | 
  | 262 |  |   | 
  | 263 | 0 |          return AtpAssembler.toGenericTypeInfoList(AtpSeasonalTypeInfo.class, atpSeasonalTypes); | 
  | 264 |  |      } | 
  | 265 |  |   | 
  | 266 |  |      @Override | 
  | 267 |  |      public List<AtpTypeInfo> getAtpTypes() throws OperationFailedException { | 
  | 268 |  |   | 
  | 269 | 0 |          List<AtpType> atpTypes = atpDao.find(AtpType.class); | 
  | 270 |  |   | 
  | 271 | 0 |          return AtpAssembler.toAtpTypeInfoList(atpTypes); | 
  | 272 |  |      } | 
  | 273 |  |   | 
  | 274 |  |      @Override | 
  | 275 |  |      public List<AtpInfo> getAtpsByAtpType(String atpTypeKey) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 276 |  |   | 
  | 277 | 0 |          List<Atp> atps = atpDao.findAtpsByAtpType(atpTypeKey); | 
  | 278 |  |   | 
  | 279 | 0 |          return AtpAssembler.toAtpInfoList(atps); | 
  | 280 |  |      } | 
  | 281 |  |   | 
  | 282 |  |      @Override | 
  | 283 |  |      public List<AtpInfo> getAtpsByDate(Date searchDate) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 284 |  |   | 
  | 285 | 0 |          List<Atp> atps = atpDao.findAtpsByDate(searchDate); | 
  | 286 |  |   | 
  | 287 | 0 |          return AtpAssembler.toAtpInfoList(atps); | 
  | 288 |  |      } | 
  | 289 |  |   | 
  | 290 |  |      @Override | 
  | 291 |  |      public List<AtpInfo> getAtpsByDates(Date startDate, Date endDate) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 292 |  |   | 
  | 293 | 0 |          List<Atp> atps = atpDao.findAtpsByDates(startDate, endDate); | 
  | 294 |  |   | 
  | 295 | 0 |          return AtpAssembler.toAtpInfoList(atps); | 
  | 296 |  |      } | 
  | 297 |  |   | 
  | 298 |  |      @Override | 
  | 299 |  |      public List<DateRangeTypeInfo> getDateRangeTypes() throws OperationFailedException { | 
  | 300 |  |   | 
  | 301 | 0 |          List<DateRangeType> dateRangeTypes = atpDao.find(DateRangeType.class); | 
  | 302 |  |   | 
  | 303 | 0 |          return AtpAssembler.toGenericTypeInfoList(DateRangeTypeInfo.class, dateRangeTypes); | 
  | 304 |  |      } | 
  | 305 |  |   | 
  | 306 |  |      @Override | 
  | 307 |  |      public List<DateRangeTypeInfo> getDateRangeTypesForAtpType(String atpTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 308 |  |   | 
  | 309 | 0 |          List<DateRangeType> dateRangeTypes = atpDao.findDateRangeTypesForAtpType(atpTypeKey); | 
  | 310 |  |   | 
  | 311 | 0 |          return AtpAssembler.toGenericTypeInfoList(DateRangeTypeInfo.class, dateRangeTypes); | 
  | 312 |  |      } | 
  | 313 |  |   | 
  | 314 |  |      @Override | 
  | 315 |  |      public List<DateRangeInfo> getDateRangesByAtp(String atpKey) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 316 |  |   | 
  | 317 | 0 |          List<DateRange> dateRanges = atpDao.findDateRangesByAtp(atpKey); | 
  | 318 |  |   | 
  | 319 | 0 |          return AtpAssembler.toDateRangeInfoList(dateRanges); | 
  | 320 |  |      } | 
  | 321 |  |   | 
  | 322 |  |      @Override | 
  | 323 |  |      public List<DateRangeInfo> getDateRangesByDate(Date searchDate) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 324 |  |   | 
  | 325 | 0 |          List<DateRange> dateRanges = atpDao.findDateRangesByDate(searchDate); | 
  | 326 |  |   | 
  | 327 | 0 |          return AtpAssembler.toDateRangeInfoList(dateRanges); | 
  | 328 |  |      } | 
  | 329 |  |   | 
  | 330 |  |      @Override | 
  | 331 |  |      public List<MilestoneTypeInfo> getMilestoneTypes() throws OperationFailedException { | 
  | 332 |  |   | 
  | 333 | 0 |          List<MilestoneType> milestoneTypes = atpDao.find(MilestoneType.class); | 
  | 334 |  |   | 
  | 335 | 0 |          return AtpAssembler.toGenericTypeInfoList(MilestoneTypeInfo.class, milestoneTypes); | 
  | 336 |  |      } | 
  | 337 |  |   | 
  | 338 |  |      @Override | 
  | 339 |  |      public List<MilestoneTypeInfo> getMilestoneTypesForAtpType(String atpTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 340 |  |   | 
  | 341 | 0 |          List<MilestoneType> milestoneTypes = atpDao.findMilestoneTypesForAtpType(atpTypeKey); | 
  | 342 |  |   | 
  | 343 | 0 |          return AtpAssembler.toGenericTypeInfoList(MilestoneTypeInfo.class, milestoneTypes); | 
  | 344 |  |      } | 
  | 345 |  |   | 
  | 346 |  |      @Override | 
  | 347 |  |      public List<MilestoneInfo> getMilestonesByAtp(String atpKey) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 348 |  |   | 
  | 349 | 0 |          List<Milestone> milestones = atpDao.findMilestonesByAtp(atpKey); | 
  | 350 |  |   | 
  | 351 | 0 |          return AtpAssembler.toMilestoneInfoList(milestones); | 
  | 352 |  |      } | 
  | 353 |  |   | 
  | 354 |  |      @Override | 
  | 355 |  |      public List<MilestoneInfo> getMilestonesByDates(Date startDate, Date endDate) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 356 |  |   | 
  | 357 | 0 |          List<Milestone> milestones = atpDao.findMilestonesByDates(startDate, endDate); | 
  | 358 |  |   | 
  | 359 | 0 |          return AtpAssembler.toMilestoneInfoList(milestones); | 
  | 360 |  |      } | 
  | 361 |  |   | 
  | 362 |  |      @Override | 
  | 363 |  |      public List<MilestoneInfo> getMilestonesByDatesAndType(String milestoneTypeKey, Date startDate, Date endDate) throws InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 364 |  |   | 
  | 365 | 0 |          List<Milestone> milestones = atpDao.findMilestonesByDatesAndType(milestoneTypeKey, startDate, endDate); | 
  | 366 |  |   | 
  | 367 | 0 |          return AtpAssembler.toMilestoneInfoList(milestones); | 
  | 368 |  |      } | 
  | 369 |  |   | 
  | 370 |  |      @Override | 
  | 371 |  |      @Transactional(readOnly=false) | 
  | 372 |  |      public StatusInfo removeDateRange(String dateRangeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 373 |  |   | 
  | 374 | 0 |          atpDao.delete(DateRange.class, dateRangeKey); | 
  | 375 |  |   | 
  | 376 | 0 |          StatusInfo statusInfo = new StatusInfo(); | 
  | 377 | 0 |          statusInfo.setSuccess(true); | 
  | 378 |  |   | 
  | 379 | 0 |          return statusInfo; | 
  | 380 |  |      } | 
  | 381 |  |   | 
  | 382 |  |      @Override | 
  | 383 |  |      @Transactional(readOnly=false) | 
  | 384 |  |      public StatusInfo removeMilestone(String milestoneKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { | 
  | 385 |  |   | 
  | 386 | 0 |          atpDao.delete(Milestone.class, milestoneKey); | 
  | 387 |  |   | 
  | 388 | 0 |          StatusInfo statusInfo = new StatusInfo(); | 
  | 389 | 0 |          statusInfo.setSuccess(true); | 
  | 390 |  |   | 
  | 391 | 0 |          return statusInfo; | 
  | 392 |  |      } | 
  | 393 |  |   | 
  | 394 |  |      @Override | 
  | 395 |  |      @Transactional(readOnly=false) | 
  | 396 |  |      public AtpInfo updateAtp(String atpKey, AtpInfo atpInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { | 
  | 397 |  |   | 
  | 398 | 0 |          CheckMissingParameters(new String[]{"atpKey", "atpInfo"}, new Object[]{atpKey, atpInfo}); | 
  | 399 |  |   | 
  | 400 | 0 |          atpInfo.setId(atpKey); | 
  | 401 |  |   | 
  | 402 | 0 |          List<ValidationResultInfo> validationResults = validateAtp("OBJECT", atpInfo); | 
  | 403 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 404 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 405 |  |          } | 
  | 406 |  |           | 
  | 407 | 0 |          Atp atp = AtpAssembler.toAtp(true, atpInfo, atpDao); | 
  | 408 | 0 |          if (atp == null) { | 
  | 409 | 0 |              throw new DoesNotExistException("Atp does not exist for key: " + atpKey); | 
  | 410 |  |          } | 
  | 411 |  |   | 
  | 412 | 0 |          Atp updatedAtp = atpDao.update(atp); | 
  | 413 |  |   | 
  | 414 | 0 |          AtpInfo result = AtpAssembler.toAtpInfo(updatedAtp); | 
  | 415 | 0 |          return result; | 
  | 416 |  |      } | 
  | 417 |  |   | 
  | 418 |  |      @Override | 
  | 419 |  |      @Transactional(readOnly=false) | 
  | 420 |  |      public DateRangeInfo updateDateRange(String dateRangeKey, DateRangeInfo dateRangeInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { | 
  | 421 |  |   | 
  | 422 | 0 |          CheckMissingParameters(new String[]{"dateRangeKey", "dateRangeInfo"}, new Object[]{dateRangeKey, dateRangeInfo}); | 
  | 423 |  |   | 
  | 424 | 0 |          dateRangeInfo.setId(dateRangeKey); | 
  | 425 |  |   | 
  | 426 | 0 |          List<ValidationResultInfo> validationResults = validateDateRange("OBJECT", dateRangeInfo); | 
  | 427 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 428 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 429 |  |          } | 
  | 430 |  |           | 
  | 431 | 0 |          DateRange dateRange = AtpAssembler.toDateRange(true, dateRangeInfo, atpDao); | 
  | 432 |  |   | 
  | 433 | 0 |          DateRange updatedDateRange = atpDao.update(dateRange); | 
  | 434 |  |   | 
  | 435 | 0 |          DateRangeInfo result = AtpAssembler.toDateRangeInfo(updatedDateRange); | 
  | 436 | 0 |          return result; | 
  | 437 |  |      } | 
  | 438 |  |   | 
  | 439 |  |      @Override | 
  | 440 |  |      @Transactional(readOnly=false) | 
  | 441 |  |      public MilestoneInfo updateMilestone(String milestoneKey, MilestoneInfo milestoneInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { | 
  | 442 |  |   | 
  | 443 | 0 |          CheckMissingParameters(new String[]{"milestoneKey", "milestoneInfo"}, new Object[]{milestoneKey, milestoneInfo}); | 
  | 444 |  |   | 
  | 445 | 0 |          milestoneInfo.setId(milestoneKey); | 
  | 446 |  |   | 
  | 447 |  |           | 
  | 448 | 0 |          List<ValidationResultInfo> validationResults = validateMilestone("OBJECT", milestoneInfo); | 
  | 449 | 0 |          if (null != validationResults && validationResults.size() > 0) { | 
  | 450 | 0 |              throw new DataValidationErrorException("Validation error!", validationResults); | 
  | 451 |  |          } | 
  | 452 |  |           | 
  | 453 |  |           | 
  | 454 | 0 |          Milestone milestone = AtpAssembler.toMilestone(true, milestoneInfo, atpDao); | 
  | 455 | 0 |          if (milestone == null) { | 
  | 456 | 0 |              throw new DoesNotExistException("Milestone does not exist for key: " + milestoneKey); | 
  | 457 |  |          } | 
  | 458 |  |   | 
  | 459 | 0 |          Milestone updatedMilestone = atpDao.update(milestone); | 
  | 460 |  |   | 
  | 461 | 0 |          MilestoneInfo result = AtpAssembler.toMilestoneInfo(updatedMilestone); | 
  | 462 | 0 |          return result; | 
  | 463 |  |      } | 
  | 464 |  |   | 
  | 465 |  |      @Override | 
  | 466 |  |      public List<ValidationResultInfo> validateAtp(String validationType, AtpInfo atpInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 467 | 0 |          checkForMissingParameter(validationType, "validationType"); | 
  | 468 | 0 |          checkForMissingParameter(atpInfo, "dateRangeInfo"); | 
  | 469 |  |   | 
  | 470 | 0 |          ObjectStructureDefinition objStructure = this.getObjectStructure(AtpInfo.class.getName()); | 
  | 471 | 0 |          Validator defaultValidator = validatorFactory.getValidator(); | 
  | 472 | 0 |          List<ValidationResultInfo> validationResults = defaultValidator.validateObject(atpInfo, objStructure); | 
  | 473 | 0 |          return validationResults; | 
  | 474 |  |      } | 
  | 475 |  |   | 
  | 476 |  |      @Override | 
  | 477 |  |      public List<ValidationResultInfo> validateDateRange(String validationType, DateRangeInfo dateRangeInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 478 | 0 |          checkForMissingParameter(validationType, "validationType"); | 
  | 479 | 0 |          checkForMissingParameter(dateRangeInfo, "dateRangeInfo"); | 
  | 480 |  |   | 
  | 481 | 0 |          ObjectStructureDefinition objStructure = this.getObjectStructure(DateRangeInfo.class.getName()); | 
  | 482 | 0 |          Validator defaultValidator = validatorFactory.getValidator(); | 
  | 483 | 0 |          List<ValidationResultInfo> validationResults = defaultValidator.validateObject(dateRangeInfo, objStructure); | 
  | 484 | 0 |          return validationResults; | 
  | 485 |  |      } | 
  | 486 |  |   | 
  | 487 |  |      @Override | 
  | 488 |  |      public List<ValidationResultInfo> validateMilestone(String validationType, MilestoneInfo milestoneInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 489 | 0 |          checkForMissingParameter(validationType, "validationType"); | 
  | 490 | 0 |          checkForMissingParameter(milestoneInfo, "milestoneInfo"); | 
  | 491 |  |   | 
  | 492 | 0 |          ObjectStructureDefinition objStructure = this.getObjectStructure(MilestoneInfo.class.getName()); | 
  | 493 | 0 |          Validator defaultValidator = validatorFactory.getValidator(); | 
  | 494 | 0 |          List<ValidationResultInfo> validationResults = defaultValidator.validateObject(milestoneInfo, objStructure); | 
  | 495 | 0 |          return validationResults; | 
  | 496 |  |      } | 
  | 497 |  |   | 
  | 498 |  |       | 
  | 499 |  |   | 
  | 500 |  |   | 
  | 501 |  |   | 
  | 502 |  |   | 
  | 503 |  |   | 
  | 504 |  |   | 
  | 505 |  |   | 
  | 506 |  |      private void checkForMissingParameter(Object param, String paramName) throws MissingParameterException { | 
  | 507 | 0 |          if (param == null) { | 
  | 508 | 0 |              throw new MissingParameterException(paramName + " can not be null"); | 
  | 509 |  |          } | 
  | 510 | 0 |      } | 
  | 511 |  |   | 
  | 512 |  |      public AtpDao getAtpDao() { | 
  | 513 | 0 |          return atpDao; | 
  | 514 |  |      } | 
  | 515 |  |   | 
  | 516 |  |      public void setAtpDao(AtpDao atpDao) { | 
  | 517 | 0 |          this.atpDao = atpDao; | 
  | 518 | 0 |      } | 
  | 519 |  |   | 
  | 520 |  |      public SearchManager getSearchManager() { | 
  | 521 | 0 |          return searchManager; | 
  | 522 |  |      } | 
  | 523 |  |   | 
  | 524 |  |      public void setSearchManager(SearchManager searchManager) { | 
  | 525 | 0 |          this.searchManager = searchManager; | 
  | 526 | 0 |      } | 
  | 527 |  |   | 
  | 528 |  |      @Override | 
  | 529 |  |      public SearchCriteriaTypeInfo getSearchCriteriaType(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 530 |  |   | 
  | 531 | 0 |          return searchManager.getSearchCriteriaType(searchCriteriaTypeKey); | 
  | 532 |  |      } | 
  | 533 |  |   | 
  | 534 |  |      @Override | 
  | 535 |  |      public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() throws OperationFailedException { | 
  | 536 | 0 |          return searchManager.getSearchCriteriaTypes(); | 
  | 537 |  |      } | 
  | 538 |  |   | 
  | 539 |  |      @Override | 
  | 540 |  |      public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 541 | 0 |          checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); | 
  | 542 | 0 |          return searchManager.getSearchResultType(searchResultTypeKey); | 
  | 543 |  |      } | 
  | 544 |  |   | 
  | 545 |  |      @Override | 
  | 546 |  |      public List<SearchResultTypeInfo> getSearchResultTypes() throws OperationFailedException { | 
  | 547 | 0 |          return searchManager.getSearchResultTypes(); | 
  | 548 |  |      } | 
  | 549 |  |   | 
  | 550 |  |      @Override | 
  | 551 |  |      public SearchTypeInfo getSearchType(String searchTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 552 | 0 |          checkForMissingParameter(searchTypeKey, "searchTypeKey"); | 
  | 553 | 0 |          return searchManager.getSearchType(searchTypeKey); | 
  | 554 |  |      } | 
  | 555 |  |   | 
  | 556 |  |      @Override | 
  | 557 |  |      public List<SearchTypeInfo> getSearchTypes() throws OperationFailedException { | 
  | 558 | 0 |          return searchManager.getSearchTypes(); | 
  | 559 |  |      } | 
  | 560 |  |   | 
  | 561 |  |      @Override | 
  | 562 |  |      public List<SearchTypeInfo> getSearchTypesByCriteria(String searchCriteriaTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 563 | 0 |          checkForMissingParameter(searchCriteriaTypeKey, "searchCriteriaTypeKey"); | 
  | 564 | 0 |          return searchManager.getSearchTypesByCriteria(searchCriteriaTypeKey); | 
  | 565 |  |      } | 
  | 566 |  |   | 
  | 567 |  |      @Override | 
  | 568 |  |      public List<SearchTypeInfo> getSearchTypesByResult(String searchResultTypeKey) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { | 
  | 569 | 0 |          checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); | 
  | 570 | 0 |          return searchManager.getSearchTypesByResult(searchResultTypeKey); | 
  | 571 |  |      } | 
  | 572 |  |   | 
  | 573 |  |      @Override | 
  | 574 |  |      public SearchResult search(SearchRequest searchRequest) throws MissingParameterException { | 
  | 575 | 0 |          return searchManager.search(searchRequest, atpDao); | 
  | 576 |  |      } | 
  | 577 |  |   | 
  | 578 |  |      @Override | 
  | 579 |  |      public ObjectStructureDefinition getObjectStructure(String objectTypeKey) { | 
  | 580 | 0 |          return dictionaryServiceDelegate.getObjectStructure(objectTypeKey); | 
  | 581 |  |      } | 
  | 582 |  |   | 
  | 583 |  |      @Override | 
  | 584 |  |      public List<String> getObjectTypes() { | 
  | 585 | 0 |          return dictionaryServiceDelegate.getObjectTypes(); | 
  | 586 |  |      } | 
  | 587 |  |   | 
  | 588 |  |       | 
  | 589 |  |   | 
  | 590 |  |   | 
  | 591 |  |      public ValidatorFactory getValidatorFactory() { | 
  | 592 | 0 |          return validatorFactory; | 
  | 593 |  |      } | 
  | 594 |  |   | 
  | 595 |  |       | 
  | 596 |  |   | 
  | 597 |  |   | 
  | 598 |  |   | 
  | 599 |  |      public void setValidatorFactory(ValidatorFactory validatorFactory) { | 
  | 600 | 0 |          this.validatorFactory = validatorFactory; | 
  | 601 | 0 |      } | 
  | 602 |  |   | 
  | 603 |  |       | 
  | 604 |  |   | 
  | 605 |  |   | 
  | 606 |  |      public DictionaryService getDictionaryServiceDelegate() { | 
  | 607 | 0 |          return dictionaryServiceDelegate; | 
  | 608 |  |      } | 
  | 609 |  |   | 
  | 610 |  |       | 
  | 611 |  |   | 
  | 612 |  |   | 
  | 613 |  |      public void setDictionaryServiceDelegate(DictionaryService dictionaryServiceDelegate) { | 
  | 614 | 0 |          this.dictionaryServiceDelegate = dictionaryServiceDelegate; | 
  | 615 | 0 |      } | 
  | 616 |  |       | 
  | 617 |  |  } |