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