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