| 1 | |
package org.kuali.student.r2.core.classI.atp.service.impl; |
| 2 | |
|
| 3 | |
import java.util.ArrayList; |
| 4 | |
import java.util.Date; |
| 5 | |
import java.util.List; |
| 6 | |
|
| 7 | |
import javax.jws.WebService; |
| 8 | |
|
| 9 | |
import org.kuali.student.r2.common.datadictionary.dto.DictionaryEntryInfo; |
| 10 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 11 | |
import org.kuali.student.r2.common.dto.StateInfo; |
| 12 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 13 | |
import org.kuali.student.r2.common.dto.TypeInfo; |
| 14 | |
import org.kuali.student.r2.common.dto.TypeTypeRelationInfo; |
| 15 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 16 | |
import org.kuali.student.r2.common.exceptions.AlreadyExistsException; |
| 17 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 18 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 19 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 20 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 21 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 22 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 23 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 24 | |
import org.kuali.student.r2.core.atp.dto.AtpAtpRelationInfo; |
| 25 | |
import org.kuali.student.r2.core.atp.dto.AtpInfo; |
| 26 | |
import org.kuali.student.r2.core.atp.dto.AtpMilestoneRelationInfo; |
| 27 | |
import org.kuali.student.r2.core.atp.dto.MilestoneInfo; |
| 28 | |
import org.kuali.student.r2.core.atp.service.AtpService; |
| 29 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpAtpRelationDao; |
| 30 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpAtpRelationTypeDao; |
| 31 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpDao; |
| 32 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpRichTextDao; |
| 33 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpStateDao; |
| 34 | |
import org.kuali.student.r2.core.classI.atp.dao.AtpTypeDao; |
| 35 | |
import org.kuali.student.r2.core.classI.atp.dao.MilestoneDao; |
| 36 | |
import org.kuali.student.r2.core.classI.atp.dao.MilestoneTypeDao; |
| 37 | |
import org.kuali.student.r2.core.classI.atp.model.AtpAtpRelationEntity; |
| 38 | |
import org.kuali.student.r2.core.classI.atp.model.AtpEntity; |
| 39 | |
import org.kuali.student.r2.core.classI.atp.model.AtpRichTextEntity; |
| 40 | |
import org.kuali.student.r2.core.classI.atp.model.MilestoneEntity; |
| 41 | |
import org.kuali.student.r2.core.classI.atp.model.MilestoneTypeEntity; |
| 42 | |
import org.springframework.transaction.annotation.Transactional; |
| 43 | |
|
| 44 | |
@WebService(name = "AtpService", serviceName = "AtpService", portName = "AtpService", targetNamespace = "http://student.kuali.org/wsdl/atp") |
| 45 | |
@Transactional(readOnly=true,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
| 46 | 0 | public class AtpServiceImpl implements AtpService{ |
| 47 | |
|
| 48 | |
private AtpDao atpDao; |
| 49 | |
private AtpTypeDao atpTypeDao; |
| 50 | |
private AtpStateDao atpStateDao; |
| 51 | |
private AtpRichTextDao atpRichTextDao; |
| 52 | |
private AtpAtpRelationDao atpRelDao; |
| 53 | |
private AtpAtpRelationTypeDao atpRelTypeDao; |
| 54 | |
private MilestoneDao milestoneDao; |
| 55 | |
private MilestoneTypeDao milestoneTypeDao; |
| 56 | |
|
| 57 | |
public AtpDao getAtpDao() { |
| 58 | 0 | return atpDao; |
| 59 | |
} |
| 60 | |
|
| 61 | |
public void setAtpDao(AtpDao atpDao) { |
| 62 | 0 | this.atpDao = atpDao; |
| 63 | 0 | } |
| 64 | |
|
| 65 | |
public AtpTypeDao getAtpTypeDao() { |
| 66 | 0 | return atpTypeDao; |
| 67 | |
} |
| 68 | |
|
| 69 | |
public void setAtpTypeDao(AtpTypeDao atpTypeDao) { |
| 70 | 0 | this.atpTypeDao = atpTypeDao; |
| 71 | 0 | } |
| 72 | |
|
| 73 | |
public AtpStateDao getAtpStateDao() { |
| 74 | 0 | return atpStateDao; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setAtpStateDao(AtpStateDao atpStateDao) { |
| 78 | 0 | this.atpStateDao = atpStateDao; |
| 79 | 0 | } |
| 80 | |
|
| 81 | |
public AtpRichTextDao getAtpRichTextDao() { |
| 82 | 0 | return atpRichTextDao; |
| 83 | |
} |
| 84 | |
|
| 85 | |
public void setAtpRichTextDao(AtpRichTextDao atpRichTextDao) { |
| 86 | 0 | this.atpRichTextDao = atpRichTextDao; |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
|
| 90 | |
public AtpAtpRelationDao getAtpRelDao() { |
| 91 | 0 | return atpRelDao; |
| 92 | |
} |
| 93 | |
|
| 94 | |
public void setAtpRelDao(AtpAtpRelationDao atpRelDao) { |
| 95 | 0 | this.atpRelDao = atpRelDao; |
| 96 | 0 | } |
| 97 | |
|
| 98 | |
public AtpAtpRelationTypeDao getAtpRelTypeDao() { |
| 99 | 0 | return atpRelTypeDao; |
| 100 | |
} |
| 101 | |
|
| 102 | |
public void setAtpRelTypeDao(AtpAtpRelationTypeDao atpRelTypeDao) { |
| 103 | 0 | this.atpRelTypeDao = atpRelTypeDao; |
| 104 | 0 | } |
| 105 | |
|
| 106 | |
public MilestoneDao getMilestoneDao() { |
| 107 | 0 | return milestoneDao; |
| 108 | |
} |
| 109 | |
|
| 110 | |
public void setMilestoneDao(MilestoneDao milestoneDao) { |
| 111 | 0 | this.milestoneDao = milestoneDao; |
| 112 | 0 | } |
| 113 | |
|
| 114 | |
public MilestoneTypeDao getMilestoneTypeDao() { |
| 115 | 0 | return milestoneTypeDao; |
| 116 | |
} |
| 117 | |
|
| 118 | |
public void setMilestoneTypeDao(MilestoneTypeDao milestoneTypeDao) { |
| 119 | 0 | this.milestoneTypeDao = milestoneTypeDao; |
| 120 | 0 | } |
| 121 | |
|
| 122 | |
@Override |
| 123 | |
public List<String> getDataDictionaryEntryKeys(ContextInfo context) throws OperationFailedException, |
| 124 | |
MissingParameterException, PermissionDeniedException { |
| 125 | |
|
| 126 | 0 | return null; |
| 127 | |
} |
| 128 | |
|
| 129 | |
@Override |
| 130 | |
public DictionaryEntryInfo getDataDictionaryEntry(String entryKey, ContextInfo context) |
| 131 | |
throws OperationFailedException, MissingParameterException, PermissionDeniedException, |
| 132 | |
DoesNotExistException { |
| 133 | |
|
| 134 | 0 | return null; |
| 135 | |
} |
| 136 | |
|
| 137 | |
@Override |
| 138 | |
public TypeInfo getType(String typeKey, ContextInfo context) throws DoesNotExistException, |
| 139 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 140 | |
|
| 141 | 0 | return null; |
| 142 | |
} |
| 143 | |
|
| 144 | |
@Override |
| 145 | |
public List<TypeInfo> getTypesByRefObjectURI(String refObjectURI, ContextInfo context) |
| 146 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 147 | |
OperationFailedException { |
| 148 | |
|
| 149 | 0 | return null; |
| 150 | |
} |
| 151 | |
|
| 152 | |
@Override |
| 153 | |
public List<TypeInfo> getAllowedTypesForType(String ownerTypeKey, String relatedRefObjectURI, ContextInfo context) |
| 154 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 155 | |
OperationFailedException { |
| 156 | |
|
| 157 | 0 | return null; |
| 158 | |
} |
| 159 | |
|
| 160 | |
@Override |
| 161 | |
public List<TypeTypeRelationInfo> getTypeRelationsByOwnerType(String ownerTypeKey, String relationTypeKey, |
| 162 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 163 | |
OperationFailedException { |
| 164 | |
|
| 165 | 0 | return null; |
| 166 | |
} |
| 167 | |
|
| 168 | |
@Override |
| 169 | |
public List<String> getProcessKeys(String typeKey, ContextInfo context) throws DoesNotExistException, |
| 170 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 171 | |
|
| 172 | 0 | return null; |
| 173 | |
} |
| 174 | |
|
| 175 | |
@Override |
| 176 | |
public StateInfo getState(String processKey, String stateKey, ContextInfo context) throws DoesNotExistException, |
| 177 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 178 | |
|
| 179 | 0 | return null; |
| 180 | |
} |
| 181 | |
|
| 182 | |
@Override |
| 183 | |
public List<StateInfo> getStatesByProcess(String processKey, ContextInfo context) throws DoesNotExistException, |
| 184 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 185 | |
|
| 186 | 0 | return null; |
| 187 | |
} |
| 188 | |
|
| 189 | |
@Override |
| 190 | |
public List<StateInfo> getInitialValidStates(String processKey, ContextInfo context) throws DoesNotExistException, |
| 191 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 192 | |
|
| 193 | 0 | return null; |
| 194 | |
} |
| 195 | |
|
| 196 | |
@Override |
| 197 | |
public StateInfo getNextHappyState(String processKey, String currentStateKey, ContextInfo context) |
| 198 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 199 | |
OperationFailedException { |
| 200 | |
|
| 201 | 0 | return null; |
| 202 | |
} |
| 203 | |
|
| 204 | |
@Override |
| 205 | |
public AtpInfo getAtp(String atpKey, ContextInfo context) throws DoesNotExistException, InvalidParameterException, |
| 206 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 207 | 0 | AtpEntity atp = atpDao.find(atpKey); |
| 208 | 0 | return null != atp ? atp.toDto() : null; |
| 209 | |
} |
| 210 | |
|
| 211 | |
@Override |
| 212 | |
public List<AtpInfo> getAtpsByDate(Date searchDate, ContextInfo context) throws InvalidParameterException, |
| 213 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 214 | |
|
| 215 | 0 | return null; |
| 216 | |
} |
| 217 | |
|
| 218 | |
@Override |
| 219 | |
public List<AtpInfo> getAtpsByDates(Date startDate, Date endDate, ContextInfo context) |
| 220 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 221 | |
PermissionDeniedException { |
| 222 | |
|
| 223 | 0 | return null; |
| 224 | |
} |
| 225 | |
|
| 226 | |
@Override |
| 227 | |
public List<AtpInfo> getAtpsByKeyList(List<String> atpKeyList, ContextInfo context) throws DoesNotExistException, |
| 228 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 229 | |
|
| 230 | 0 | return null; |
| 231 | |
} |
| 232 | |
|
| 233 | |
@Override |
| 234 | |
public List<String> getAtpKeysByType(String atpTypeKey, ContextInfo context) throws InvalidParameterException, |
| 235 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 236 | |
|
| 237 | 0 | return null; |
| 238 | |
} |
| 239 | |
|
| 240 | |
@Override |
| 241 | |
public MilestoneInfo getMilestone(String milestoneKey, ContextInfo context) throws DoesNotExistException, |
| 242 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 243 | 0 | MilestoneEntity entity = milestoneDao.find(milestoneKey); |
| 244 | |
|
| 245 | 0 | if(entity != null) { |
| 246 | 0 | return entity.toDto(); |
| 247 | |
} |
| 248 | |
else { |
| 249 | 0 | throw new DoesNotExistException(milestoneKey); |
| 250 | |
} |
| 251 | |
|
| 252 | |
} |
| 253 | |
|
| 254 | |
@Override |
| 255 | |
public List<MilestoneInfo> getMilestonesByKeyList(List<String> milestoneKeyList, ContextInfo context) |
| 256 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 257 | |
OperationFailedException, PermissionDeniedException { |
| 258 | |
|
| 259 | 0 | List<MilestoneEntity> milestones = milestoneDao.findByIds(milestoneKeyList); |
| 260 | |
|
| 261 | 0 | List<MilestoneInfo> result = new ArrayList<MilestoneInfo>(milestones.size()); |
| 262 | 0 | for(MilestoneEntity entity : milestones) { |
| 263 | 0 | if(entity == null) { |
| 264 | |
|
| 265 | 0 | throw new DoesNotExistException(); |
| 266 | |
} |
| 267 | 0 | result.add(entity.toDto()); |
| 268 | |
} |
| 269 | |
|
| 270 | 0 | return result; |
| 271 | |
} |
| 272 | |
|
| 273 | |
@Override |
| 274 | |
public List<String> getMilestoneKeysByType(String milestoneTypeKey, ContextInfo context) |
| 275 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 276 | |
PermissionDeniedException { |
| 277 | |
|
| 278 | 0 | MilestoneTypeEntity type = milestoneTypeDao.find(milestoneTypeKey); |
| 279 | |
|
| 280 | 0 | if(type == null) { |
| 281 | 0 | throw new InvalidParameterException(milestoneTypeKey); |
| 282 | |
} |
| 283 | |
|
| 284 | 0 | List<MilestoneEntity> entities = milestoneDao.getByMilestoneTypeId(milestoneTypeKey); |
| 285 | |
|
| 286 | 0 | List<String> results = new ArrayList<String>(entities.size()); |
| 287 | |
|
| 288 | 0 | for(MilestoneEntity entity : entities) { |
| 289 | 0 | results.add(entity.getId()); |
| 290 | |
} |
| 291 | |
|
| 292 | 0 | return results; |
| 293 | |
} |
| 294 | |
|
| 295 | |
@Override |
| 296 | |
public List<MilestoneInfo> getMilestonesByAtp(String atpKey, ContextInfo context) throws InvalidParameterException, |
| 297 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 298 | |
|
| 299 | 0 | return null; |
| 300 | |
} |
| 301 | |
|
| 302 | |
@Override |
| 303 | |
public List<MilestoneInfo> getMilestonesByDates(Date startDate, Date endDate, ContextInfo context) |
| 304 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 305 | |
PermissionDeniedException { |
| 306 | |
|
| 307 | 0 | List<MilestoneEntity> entities = milestoneDao.getByDateRange(startDate, endDate); |
| 308 | |
|
| 309 | 0 | List<MilestoneInfo> results = new ArrayList<MilestoneInfo>(entities.size()); |
| 310 | |
|
| 311 | 0 | for(MilestoneEntity entity : entities) { |
| 312 | 0 | results.add(entity.toDto()); |
| 313 | |
} |
| 314 | |
|
| 315 | 0 | return results; |
| 316 | |
} |
| 317 | |
|
| 318 | |
@Override |
| 319 | |
public List<MilestoneInfo> getMilestonesByDatesAndType(String milestoneTypeKey, Date startDate, Date endDate, |
| 320 | |
ContextInfo context) throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 321 | |
PermissionDeniedException { |
| 322 | |
|
| 323 | 0 | MilestoneTypeEntity type = milestoneTypeDao.find(milestoneTypeKey); |
| 324 | |
|
| 325 | 0 | if(type == null) { |
| 326 | 0 | throw new InvalidParameterException(milestoneTypeKey); |
| 327 | |
} |
| 328 | |
|
| 329 | 0 | List<MilestoneEntity> entities = milestoneDao.getByDateRangeAndType(startDate, endDate, milestoneTypeKey); |
| 330 | |
|
| 331 | 0 | List<MilestoneInfo> results = new ArrayList<MilestoneInfo>(entities.size()); |
| 332 | |
|
| 333 | 0 | for(MilestoneEntity entity : entities) { |
| 334 | 0 | results.add(entity.toDto()); |
| 335 | |
} |
| 336 | |
|
| 337 | 0 | return results; |
| 338 | |
} |
| 339 | |
|
| 340 | |
@Override |
| 341 | |
public List<ValidationResultInfo> validateAtp(String validationType, AtpInfo atpInfo, ContextInfo context) |
| 342 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 343 | |
OperationFailedException { |
| 344 | |
|
| 345 | 0 | return null; |
| 346 | |
} |
| 347 | |
|
| 348 | |
@Override |
| 349 | |
@Transactional |
| 350 | |
public AtpInfo createAtp(String atpKey, AtpInfo atpInfo, ContextInfo context) throws AlreadyExistsException, |
| 351 | |
DataValidationErrorException, InvalidParameterException, MissingParameterException, |
| 352 | |
OperationFailedException, PermissionDeniedException { |
| 353 | |
|
| 354 | 0 | AtpEntity atp = new AtpEntity(atpInfo); |
| 355 | 0 | if (null != atpInfo.getStateKey()) { |
| 356 | 0 | atp.setAtpState(atpStateDao.find(atpInfo.getStateKey())); |
| 357 | |
} |
| 358 | 0 | if (null != atpInfo.getTypeKey()) { |
| 359 | 0 | atp.setAtpType(atpTypeDao.find(atpInfo.getTypeKey())); |
| 360 | |
} |
| 361 | 0 | if (null != atpInfo.getDescr()) { |
| 362 | 0 | atp.setDescr(new AtpRichTextEntity(atpInfo.getDescr())); |
| 363 | |
} |
| 364 | |
|
| 365 | 0 | AtpEntity existing = atpDao.find(atpKey); |
| 366 | 0 | if( existing != null) |
| 367 | 0 | throw new AlreadyExistsException(atpKey); |
| 368 | |
|
| 369 | |
|
| 370 | |
else |
| 371 | 0 | atpDao.persist(atp); |
| 372 | |
|
| 373 | 0 | return atpInfo; |
| 374 | |
} |
| 375 | |
|
| 376 | |
@Override |
| 377 | |
@Transactional(readOnly=false) |
| 378 | |
public AtpInfo updateAtp(String atpKey, AtpInfo atpInfo, ContextInfo context) throws DataValidationErrorException, |
| 379 | |
DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, |
| 380 | |
PermissionDeniedException, VersionMismatchException { |
| 381 | |
|
| 382 | 0 | AtpEntity atp = atpDao.find(atpKey); |
| 383 | |
|
| 384 | 0 | if( null != atp){ |
| 385 | 0 | AtpEntity modifiedAtp = new AtpEntity(atpInfo); |
| 386 | 0 | if(atpInfo.getStateKey() != null) |
| 387 | 0 | modifiedAtp.setAtpState(atpStateDao.find(atpInfo.getStateKey())); |
| 388 | 0 | if(atpInfo.getTypeKey() != null) |
| 389 | 0 | modifiedAtp.setAtpType(atpTypeDao.find(atpInfo.getTypeKey())); |
| 390 | 0 | atpDao.merge(modifiedAtp); |
| 391 | 0 | } |
| 392 | |
else |
| 393 | 0 | throw new DoesNotExistException(atpKey); |
| 394 | 0 | return atpInfo; |
| 395 | |
} |
| 396 | |
|
| 397 | |
@Override |
| 398 | |
@Transactional(readOnly=false) |
| 399 | |
public StatusInfo deleteAtp(String atpKey, ContextInfo context) throws DoesNotExistException, |
| 400 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 401 | |
|
| 402 | 0 | StatusInfo status = StatusInfo.newInstance(); |
| 403 | 0 | status.setSuccess(Boolean.TRUE); |
| 404 | |
|
| 405 | 0 | AtpEntity atp = atpDao.find(atpKey); |
| 406 | 0 | if( null != atp){ |
| 407 | 0 | atpDao.remove(atp); |
| 408 | |
} |
| 409 | |
else |
| 410 | 0 | status.setSuccess(Boolean.FALSE); |
| 411 | |
|
| 412 | 0 | return status; |
| 413 | |
} |
| 414 | |
|
| 415 | |
@Override |
| 416 | |
public List<ValidationResultInfo> validateMilestone(String validationType, MilestoneInfo milestoneInfo, |
| 417 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 418 | |
OperationFailedException { |
| 419 | |
|
| 420 | 0 | return null; |
| 421 | |
} |
| 422 | |
|
| 423 | |
@Override |
| 424 | |
public MilestoneInfo createMilestone(String milestoneKey, MilestoneInfo milestoneInfo, ContextInfo context) |
| 425 | |
throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, |
| 426 | |
MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 427 | |
|
| 428 | 0 | if(milestoneDao.find(milestoneKey) != null) { |
| 429 | 0 | throw new AlreadyExistsException(milestoneKey); |
| 430 | |
} |
| 431 | |
|
| 432 | 0 | MilestoneEntity entity = new MilestoneEntity(milestoneInfo); |
| 433 | |
|
| 434 | 0 | if(milestoneInfo.getTypeKey() != null) { |
| 435 | 0 | entity.setMilestoneType(milestoneTypeDao.find(milestoneInfo.getTypeKey())); |
| 436 | |
} |
| 437 | |
|
| 438 | 0 | if(milestoneInfo.getStateKey() != null) { |
| 439 | 0 | entity.setAtpState(atpStateDao.find(milestoneInfo.getStateKey())); |
| 440 | |
} |
| 441 | |
|
| 442 | 0 | if(milestoneInfo.getDescr() != null) { |
| 443 | 0 | entity.setDescr(new AtpRichTextEntity(milestoneInfo.getDescr())); |
| 444 | |
} |
| 445 | |
|
| 446 | 0 | milestoneDao.persist(entity); |
| 447 | |
|
| 448 | 0 | MilestoneInfo result = entity.toDto(); |
| 449 | |
|
| 450 | 0 | return result; |
| 451 | |
} |
| 452 | |
|
| 453 | |
@Override |
| 454 | |
public MilestoneInfo updateMilestone(String milestoneKey, MilestoneInfo milestoneInfo, ContextInfo context) |
| 455 | |
throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, |
| 456 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
| 457 | |
|
| 458 | 0 | MilestoneEntity existingEntity = milestoneDao.find(milestoneKey); |
| 459 | 0 | if(existingEntity == null) { |
| 460 | 0 | throw new DoesNotExistException(milestoneKey); |
| 461 | |
} |
| 462 | |
|
| 463 | 0 | MilestoneEntity updatedEntity = new MilestoneEntity(milestoneInfo); |
| 464 | |
|
| 465 | 0 | milestoneDao.merge(updatedEntity); |
| 466 | |
|
| 467 | 0 | return updatedEntity.toDto(); |
| 468 | |
} |
| 469 | |
|
| 470 | |
@Override |
| 471 | |
public StatusInfo deleteMilestone(String milestoneKey, ContextInfo context) throws DoesNotExistException, |
| 472 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 473 | 0 | StatusInfo status = StatusInfo.newInstance(); |
| 474 | 0 | status.setSuccess(Boolean.TRUE); |
| 475 | |
|
| 476 | 0 | MilestoneEntity existingEntity = milestoneDao.find(milestoneKey); |
| 477 | 0 | if(existingEntity != null){ |
| 478 | 0 | milestoneDao.remove(existingEntity); |
| 479 | |
} |
| 480 | |
else { |
| 481 | 0 | throw new DoesNotExistException(milestoneKey); |
| 482 | |
} |
| 483 | |
|
| 484 | 0 | return status; |
| 485 | |
} |
| 486 | |
|
| 487 | |
@Override |
| 488 | |
public AtpAtpRelationInfo getAtpAtpRelation(String atpAtpRelationId, ContextInfo context) |
| 489 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 490 | |
OperationFailedException, PermissionDeniedException { |
| 491 | |
|
| 492 | 0 | return null; |
| 493 | |
} |
| 494 | |
|
| 495 | |
@Override |
| 496 | |
public List<AtpAtpRelationInfo> getAtpAtpRelationsByIdList(List<String> atpAtpRelationIdList, ContextInfo context) |
| 497 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 498 | |
OperationFailedException, PermissionDeniedException { |
| 499 | |
|
| 500 | 0 | return null; |
| 501 | |
} |
| 502 | |
|
| 503 | |
@Override |
| 504 | |
public List<String> getAtpAtpRelationIdsByType(String atpAtpRelationTypeKey, ContextInfo context) |
| 505 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 506 | |
PermissionDeniedException { |
| 507 | |
|
| 508 | 0 | return null; |
| 509 | |
} |
| 510 | |
|
| 511 | |
@Override |
| 512 | |
public List<AtpAtpRelationInfo> getAtpAtpRelationsByAtp(String atpKey, ContextInfo context) |
| 513 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 514 | |
OperationFailedException, PermissionDeniedException { |
| 515 | |
|
| 516 | 0 | List<AtpAtpRelationEntity> relEntities = atpRelDao.getAtpAtpRelationsByAtp(atpKey); |
| 517 | 0 | List<AtpAtpRelationInfo> relInfos = new ArrayList<AtpAtpRelationInfo>(); |
| 518 | 0 | for(AtpAtpRelationEntity relEntity : relEntities){ |
| 519 | 0 | AtpAtpRelationInfo relInfo = relEntity.toDto(); |
| 520 | 0 | relInfos.add(relInfo); |
| 521 | 0 | } |
| 522 | |
|
| 523 | 0 | return relInfos; |
| 524 | |
} |
| 525 | |
|
| 526 | |
@Override |
| 527 | |
public List<ValidationResultInfo> validateAtpAtpRelation(String validationType, |
| 528 | |
AtpAtpRelationInfo atpAtpRelationInfo, ContextInfo context) throws DoesNotExistException, |
| 529 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 530 | |
|
| 531 | 0 | return null; |
| 532 | |
} |
| 533 | |
|
| 534 | |
@Override |
| 535 | |
@Transactional(readOnly=false) |
| 536 | |
public AtpAtpRelationInfo createAtpAtpRelation(AtpAtpRelationInfo atpAtpRelationInfo, ContextInfo context) |
| 537 | |
throws AlreadyExistsException, InvalidParameterException, MissingParameterException, |
| 538 | |
OperationFailedException, PermissionDeniedException { |
| 539 | |
|
| 540 | 0 | AtpAtpRelationEntity atpRel = new AtpAtpRelationEntity(atpAtpRelationInfo); |
| 541 | 0 | if (null != atpAtpRelationInfo.getStateKey()) { |
| 542 | 0 | atpRel.setAtpState(atpStateDao.find(atpAtpRelationInfo.getStateKey())); |
| 543 | |
} |
| 544 | 0 | if (null != atpAtpRelationInfo.getTypeKey()) { |
| 545 | 0 | atpRel.setAtpAtpRelationType(atpRelTypeDao.find(atpAtpRelationInfo.getTypeKey())); |
| 546 | |
} |
| 547 | 0 | if (null != atpAtpRelationInfo.getAtpKey()) { |
| 548 | 0 | atpRel.setAtp(atpDao.find(atpAtpRelationInfo.getAtpKey())); |
| 549 | |
} |
| 550 | 0 | if(null != atpAtpRelationInfo.getRelatedAtpKey()) { |
| 551 | 0 | atpRel.setRelatedAtp(atpDao.find(atpAtpRelationInfo.getRelatedAtpKey())); |
| 552 | |
} |
| 553 | |
|
| 554 | 0 | atpRelDao.persist(atpRel); |
| 555 | |
|
| 556 | 0 | return atpAtpRelationInfo; |
| 557 | |
|
| 558 | |
} |
| 559 | |
|
| 560 | |
@Override |
| 561 | |
@Transactional(readOnly=false) |
| 562 | |
public AtpAtpRelationInfo updateAtpAtpRelation(String atpAtpRelationId, AtpAtpRelationInfo atpAtpRelationInfo, |
| 563 | |
ContextInfo context) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, |
| 564 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
| 565 | |
|
| 566 | 0 | AtpAtpRelationEntity atpRel = atpRelDao.find(atpAtpRelationId); |
| 567 | |
|
| 568 | 0 | if( null != atpRel){ |
| 569 | 0 | AtpAtpRelationEntity modifiedatpRel = new AtpAtpRelationEntity(atpAtpRelationInfo); |
| 570 | 0 | if(atpAtpRelationInfo.getAtpKey() != null) |
| 571 | 0 | modifiedatpRel.setAtp(atpDao.find(atpAtpRelationInfo.getAtpKey())); |
| 572 | 0 | if(atpAtpRelationInfo.getRelatedAtpKey() != null) |
| 573 | 0 | modifiedatpRel.setRelatedAtp(atpDao.find(atpAtpRelationInfo.getRelatedAtpKey())); |
| 574 | 0 | if(atpAtpRelationInfo.getTypeKey() != null) |
| 575 | 0 | modifiedatpRel.setAtpAtpRelationType(atpRelTypeDao.find(atpAtpRelationInfo.getTypeKey())); |
| 576 | 0 | if(atpAtpRelationInfo.getStateKey() != null) |
| 577 | 0 | modifiedatpRel.setAtpState(atpStateDao.find(atpAtpRelationInfo.getStateKey())); |
| 578 | 0 | atpRelDao.merge(modifiedatpRel); |
| 579 | 0 | } |
| 580 | |
else |
| 581 | 0 | throw new DoesNotExistException(atpAtpRelationId); |
| 582 | 0 | return atpAtpRelationInfo; |
| 583 | |
} |
| 584 | |
|
| 585 | |
@Override |
| 586 | |
@Transactional(readOnly=false) |
| 587 | |
public StatusInfo deleteAtpAtpRelation(String atpAtpRelationId, ContextInfo context) throws DoesNotExistException, |
| 588 | |
InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 589 | |
|
| 590 | 0 | StatusInfo status = StatusInfo.newInstance(); |
| 591 | 0 | status.setSuccess(Boolean.TRUE); |
| 592 | |
|
| 593 | 0 | AtpAtpRelationEntity atpRel = atpRelDao.find(atpAtpRelationId); |
| 594 | 0 | if (atpRel != null) |
| 595 | 0 | atpRelDao.remove(atpRel); |
| 596 | |
else |
| 597 | 0 | status.setSuccess(Boolean.FALSE); |
| 598 | |
|
| 599 | 0 | return status; |
| 600 | |
} |
| 601 | |
|
| 602 | |
@Override |
| 603 | |
public AtpMilestoneRelationInfo getAtpMilestoneRelation(String atpMilestoneRelationId, ContextInfo context) |
| 604 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 605 | |
OperationFailedException, PermissionDeniedException { |
| 606 | |
|
| 607 | 0 | return null; |
| 608 | |
} |
| 609 | |
|
| 610 | |
@Override |
| 611 | |
public List<AtpMilestoneRelationInfo> getAtpMilestoneRelationsByIdList(List<String> atpMilestoneRelationIdList, |
| 612 | |
ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 613 | |
OperationFailedException, PermissionDeniedException { |
| 614 | |
|
| 615 | 0 | return null; |
| 616 | |
} |
| 617 | |
|
| 618 | |
@Override |
| 619 | |
public List<String> getAtpMilestoneRelationIdsByType(String atpMilestoneRelationTypeKey, ContextInfo context) |
| 620 | |
throws InvalidParameterException, MissingParameterException, OperationFailedException, |
| 621 | |
PermissionDeniedException { |
| 622 | |
|
| 623 | 0 | return null; |
| 624 | |
} |
| 625 | |
|
| 626 | |
@Override |
| 627 | |
public List<AtpMilestoneRelationInfo> getAtpMilestoneRelationsByAtp(String atpKey, ContextInfo context) |
| 628 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 629 | |
OperationFailedException, PermissionDeniedException { |
| 630 | |
|
| 631 | 0 | return null; |
| 632 | |
} |
| 633 | |
|
| 634 | |
@Override |
| 635 | |
public List<AtpMilestoneRelationInfo> getAtpMilestoneRelationsByMilestone(String milestoneKey, ContextInfo context) |
| 636 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 637 | |
OperationFailedException, PermissionDeniedException { |
| 638 | |
|
| 639 | 0 | return null; |
| 640 | |
} |
| 641 | |
|
| 642 | |
@Override |
| 643 | |
public List<ValidationResultInfo> validateAtpMilestoneRelation(String validationType, |
| 644 | |
AtpMilestoneRelationInfo atpMilestoneRelationInfo, ContextInfo context) throws DoesNotExistException, |
| 645 | |
InvalidParameterException, MissingParameterException, OperationFailedException { |
| 646 | |
|
| 647 | 0 | return null; |
| 648 | |
} |
| 649 | |
|
| 650 | |
@Override |
| 651 | |
public AtpMilestoneRelationInfo createAtpMilestoneRelation(AtpMilestoneRelationInfo atpMilestoneRelationInfo, |
| 652 | |
ContextInfo context) throws AlreadyExistsException, InvalidParameterException, MissingParameterException, |
| 653 | |
OperationFailedException, PermissionDeniedException { |
| 654 | |
|
| 655 | 0 | return null; |
| 656 | |
} |
| 657 | |
|
| 658 | |
@Override |
| 659 | |
public AtpMilestoneRelationInfo updateAtpMilestoneRelation(String atpMilestoneRelationId, |
| 660 | |
AtpMilestoneRelationInfo atpMilestoneRelationInfo, ContextInfo context) |
| 661 | |
throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, |
| 662 | |
MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
| 663 | |
|
| 664 | 0 | return null; |
| 665 | |
} |
| 666 | |
|
| 667 | |
@Override |
| 668 | |
public StatusInfo deleteAtpMilestoneRelation(String atpMilestoneRelationId, ContextInfo context) |
| 669 | |
throws DoesNotExistException, InvalidParameterException, MissingParameterException, |
| 670 | |
OperationFailedException, PermissionDeniedException { |
| 671 | |
|
| 672 | 0 | return null; |
| 673 | |
} |
| 674 | |
|
| 675 | |
} |