| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.student.enrollment.class1.lui.service.impl; |
| 18 | |
|
| 19 | |
import java.util.ArrayList; |
| 20 | |
import java.util.List; |
| 21 | |
|
| 22 | |
import org.kuali.rice.core.api.criteria.QueryByCriteria; |
| 23 | |
|
| 24 | |
import org.kuali.student.enrollment.class1.lui.dao.LuiDao; |
| 25 | |
import org.kuali.student.enrollment.class1.lui.dao.LuiLuiRelationDao; |
| 26 | |
import org.kuali.student.enrollment.class1.lui.model.LuiEntity; |
| 27 | |
import org.kuali.student.enrollment.class1.lui.model.LuiIdentifierEntity; |
| 28 | |
import org.kuali.student.enrollment.class1.lui.model.LuiLuiRelationEntity; |
| 29 | |
|
| 30 | |
import org.kuali.student.enrollment.lui.dto.LuiCapacityInfo; |
| 31 | |
import org.kuali.student.enrollment.lui.dto.LuiInfo; |
| 32 | |
import org.kuali.student.enrollment.lui.dto.LuiLuiRelationInfo; |
| 33 | |
import org.kuali.student.enrollment.lui.infc.LuiIdentifier; |
| 34 | |
import org.kuali.student.enrollment.lui.service.LuiService; |
| 35 | |
|
| 36 | |
import org.kuali.student.r2.common.dto.ContextInfo; |
| 37 | |
import org.kuali.student.r2.common.dto.StatusInfo; |
| 38 | |
import org.kuali.student.r2.common.dto.ValidationResultInfo; |
| 39 | |
|
| 40 | |
import org.kuali.student.r2.common.exceptions.CircularRelationshipException; |
| 41 | |
import org.kuali.student.r2.common.exceptions.DataValidationErrorException; |
| 42 | |
import org.kuali.student.r2.common.exceptions.DependentObjectsExistException; |
| 43 | |
import org.kuali.student.r2.common.exceptions.DoesNotExistException; |
| 44 | |
import org.kuali.student.r2.common.exceptions.InvalidParameterException; |
| 45 | |
import org.kuali.student.r2.common.exceptions.MissingParameterException; |
| 46 | |
import org.kuali.student.r2.common.exceptions.OperationFailedException; |
| 47 | |
import org.kuali.student.r2.common.exceptions.PermissionDeniedException; |
| 48 | |
import org.kuali.student.r2.common.exceptions.ReadOnlyException; |
| 49 | |
import org.kuali.student.r2.common.exceptions.VersionMismatchException; |
| 50 | |
|
| 51 | |
import org.kuali.student.r2.common.infc.ValidationResult; |
| 52 | |
import org.springframework.transaction.annotation.Transactional; |
| 53 | |
|
| 54 | |
|
| 55 | 0 | public class LuiServiceImpl |
| 56 | |
implements LuiService { |
| 57 | |
|
| 58 | |
private LuiDao luiDao; |
| 59 | |
private LuiLuiRelationDao luiLuiRelationDao; |
| 60 | |
|
| 61 | |
public LuiDao getLuiDao() { |
| 62 | 0 | return luiDao; |
| 63 | |
} |
| 64 | |
|
| 65 | |
public void setLuiDao(LuiDao luiDao) { |
| 66 | 0 | this.luiDao = luiDao; |
| 67 | 0 | } |
| 68 | |
|
| 69 | |
public LuiLuiRelationDao getLuiLuiRelationDao() { |
| 70 | 0 | return luiLuiRelationDao; |
| 71 | |
} |
| 72 | |
|
| 73 | |
public void setLuiLuiRelationDao(LuiLuiRelationDao luiLuiRelationDao) { |
| 74 | 0 | this.luiLuiRelationDao = luiLuiRelationDao; |
| 75 | 0 | } |
| 76 | |
|
| 77 | |
@Override |
| 78 | |
@Transactional(readOnly = true) |
| 79 | |
public LuiInfo getLui(String luiId, ContextInfo context) |
| 80 | |
throws DoesNotExistException, InvalidParameterException, |
| 81 | |
MissingParameterException, OperationFailedException, |
| 82 | |
PermissionDeniedException { |
| 83 | |
|
| 84 | 0 | LuiEntity lui = luiDao.find(luiId); |
| 85 | 0 | if (null == lui) { |
| 86 | 0 | throw new DoesNotExistException(luiId); |
| 87 | |
} |
| 88 | |
|
| 89 | 0 | return lui.toDto(); |
| 90 | |
} |
| 91 | |
|
| 92 | |
@Override |
| 93 | |
@Transactional(readOnly = true) |
| 94 | |
public List<LuiInfo> getLuisByIds(List<String> luiIds, ContextInfo context) |
| 95 | |
throws DoesNotExistException, InvalidParameterException, |
| 96 | |
MissingParameterException, OperationFailedException, |
| 97 | |
PermissionDeniedException { |
| 98 | |
|
| 99 | 0 | List<LuiEntity> entityList = luiDao.findByIds(luiIds); |
| 100 | 0 | List<LuiInfo> infoList = new ArrayList<LuiInfo>(); |
| 101 | |
|
| 102 | |
|
| 103 | 0 | for (LuiEntity luiEntity : entityList) { |
| 104 | |
|
| 105 | 0 | infoList.add(luiEntity.toDto()); |
| 106 | |
} |
| 107 | |
|
| 108 | 0 | return infoList; |
| 109 | |
} |
| 110 | |
|
| 111 | |
@Override |
| 112 | |
@Transactional(readOnly = true) |
| 113 | |
public List<String> getLuiIdsByType(String luiTypeKey, ContextInfo context) |
| 114 | |
throws InvalidParameterException, MissingParameterException, |
| 115 | |
OperationFailedException, PermissionDeniedException { |
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | 0 | List<LuiEntity> luis = luiDao.getLuisByType(luiTypeKey); |
| 120 | 0 | List<String> luiIds = new ArrayList<String>(); |
| 121 | |
|
| 122 | 0 | for (LuiEntity lui : luis) { |
| 123 | 0 | luiIds.add(lui.getId()); |
| 124 | |
} |
| 125 | |
|
| 126 | 0 | return luiIds; |
| 127 | |
} |
| 128 | |
|
| 129 | |
@Override |
| 130 | |
@Transactional(readOnly = true) |
| 131 | |
public List<String> getLuiIdsByClu(String cluId, ContextInfo context) |
| 132 | |
throws InvalidParameterException, MissingParameterException, |
| 133 | |
OperationFailedException, PermissionDeniedException { |
| 134 | |
|
| 135 | 0 | List<LuiEntity> luis = luiDao.getLuisByClu(cluId); |
| 136 | 0 | List<String> luiIds = new ArrayList<String>(); |
| 137 | |
|
| 138 | 0 | for (LuiEntity lui : luis) { |
| 139 | 0 | luiIds.add(lui.getId()); |
| 140 | |
} |
| 141 | |
|
| 142 | 0 | return luiIds; |
| 143 | |
} |
| 144 | |
|
| 145 | |
@Override |
| 146 | |
@Transactional(readOnly = true) |
| 147 | |
public List<String> getLuiIdsByAtpAndType(String atpId, String typeKey, |
| 148 | |
ContextInfo context) |
| 149 | |
throws InvalidParameterException, MissingParameterException, |
| 150 | |
OperationFailedException, PermissionDeniedException { |
| 151 | |
|
| 152 | 0 | List<LuiEntity> luis = luiDao.getLuisByAtpAndType(atpId, typeKey); |
| 153 | 0 | List<String> luiIds = new ArrayList<String>(); |
| 154 | |
|
| 155 | 0 | for (LuiEntity lui : luis) { |
| 156 | 0 | luiIds.add(lui.getId()); |
| 157 | |
} |
| 158 | |
|
| 159 | 0 | return luiIds; |
| 160 | |
} |
| 161 | |
|
| 162 | |
@Override |
| 163 | |
@Transactional(readOnly = true) |
| 164 | |
public List<String> getLuiIdsByAtpAndClu(String cluId, String atpId,ContextInfo context) |
| 165 | |
throws InvalidParameterException, MissingParameterException, |
| 166 | |
OperationFailedException, PermissionDeniedException { |
| 167 | |
|
| 168 | 0 | List<LuiEntity> luis = luiDao.getLuisByAtpAndClu(atpId, cluId); |
| 169 | 0 | List<String> luiIds = new ArrayList<String>(); |
| 170 | |
|
| 171 | 0 | for (LuiEntity lui : luis) { |
| 172 | 0 | luiIds.add(lui.getId()); |
| 173 | |
} |
| 174 | |
|
| 175 | 0 | return luiIds; |
| 176 | |
} |
| 177 | |
|
| 178 | |
@Override |
| 179 | |
@Transactional(readOnly = true) |
| 180 | |
public List<LuiInfo> getLuisByAtpAndClu(String cluId, String atpId, |
| 181 | |
ContextInfo context) |
| 182 | |
throws InvalidParameterException, MissingParameterException, |
| 183 | |
OperationFailedException, PermissionDeniedException { |
| 184 | |
|
| 185 | 0 | List<LuiEntity> luiEntities = luiDao.getLuisByAtpAndClu(atpId, cluId); |
| 186 | 0 | List<LuiInfo> luiInfos = new ArrayList<LuiInfo>(); |
| 187 | 0 | for(LuiEntity luiEntity: luiEntities){ |
| 188 | 0 | luiInfos.add(luiEntity.toDto()); |
| 189 | |
} |
| 190 | 0 | return luiInfos; |
| 191 | |
|
| 192 | |
} |
| 193 | |
|
| 194 | |
@Override |
| 195 | |
@Transactional(readOnly = true) |
| 196 | |
public List<String> searchForLuiIds(QueryByCriteria criteria, |
| 197 | |
ContextInfo context) |
| 198 | |
throws InvalidParameterException, MissingParameterException, |
| 199 | |
OperationFailedException, PermissionDeniedException { |
| 200 | 0 | return new ArrayList<String>(); |
| 201 | |
} |
| 202 | |
|
| 203 | |
@Override |
| 204 | |
@Transactional(readOnly = true) |
| 205 | |
public List<LuiInfo> searchForLuis(QueryByCriteria criteria, |
| 206 | |
ContextInfo context) |
| 207 | |
throws InvalidParameterException, MissingParameterException, |
| 208 | |
OperationFailedException, PermissionDeniedException { |
| 209 | |
|
| 210 | 0 | return new ArrayList<LuiInfo>(); |
| 211 | |
} |
| 212 | |
|
| 213 | |
@Override |
| 214 | |
public List<ValidationResultInfo> validateLui(String validationTypeKey, |
| 215 | |
String luiTypeKey, |
| 216 | |
String cluId, |
| 217 | |
String atpId, |
| 218 | |
LuiInfo luiInfo, |
| 219 | |
ContextInfo context) |
| 220 | |
throws DoesNotExistException, InvalidParameterException, |
| 221 | |
MissingParameterException, OperationFailedException, |
| 222 | |
PermissionDeniedException { |
| 223 | 0 | return new ArrayList<ValidationResultInfo>(); |
| 224 | |
} |
| 225 | |
|
| 226 | |
@Override |
| 227 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 228 | |
public LuiInfo createLui(String cluId, String atpId, String luiTypeKey, LuiInfo luiInfo, ContextInfo context) |
| 229 | |
throws DataValidationErrorException, DoesNotExistException, |
| 230 | |
InvalidParameterException, MissingParameterException, |
| 231 | |
OperationFailedException, PermissionDeniedException, |
| 232 | |
ReadOnlyException { |
| 233 | |
|
| 234 | 0 | if (!cluId.equals(luiInfo.getCluId())) { |
| 235 | 0 | throw new InvalidParameterException(cluId + " does not match the cluId in the info object " + luiInfo.getCluId()); |
| 236 | |
} |
| 237 | 0 | if (!atpId.equals(luiInfo.getAtpId())) { |
| 238 | 0 | throw new InvalidParameterException(atpId + " does not match the atp in the info object " + luiInfo.getAtpId()); |
| 239 | |
} |
| 240 | 0 | if (!luiTypeKey.equals(luiInfo.getTypeKey())) { |
| 241 | 0 | throw new InvalidParameterException(luiTypeKey + " does not match the type in the info object " + luiInfo.getTypeKey()); |
| 242 | |
} |
| 243 | |
|
| 244 | 0 | LuiEntity entity = new LuiEntity(luiInfo); |
| 245 | 0 | entity.setAtpId(atpId); |
| 246 | 0 | entity.setCluId(cluId); |
| 247 | 0 | entity.setLuiType(luiTypeKey); |
| 248 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 249 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 250 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 251 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 252 | 0 | if(entity.getIdentifiers()!=null){ |
| 253 | 0 | for(LuiIdentifierEntity ident:entity.getIdentifiers()){ |
| 254 | 0 | ident.setCreateId(context.getPrincipalId()); |
| 255 | 0 | ident.setCreateTime(context.getCurrentDate()); |
| 256 | 0 | ident.setUpdateId(context.getPrincipalId()); |
| 257 | 0 | ident.setUpdateTime(context.getCurrentDate()); |
| 258 | |
} |
| 259 | |
} |
| 260 | 0 | luiDao.persist(entity); |
| 261 | |
|
| 262 | 0 | return entity.toDto(); |
| 263 | |
} |
| 264 | |
|
| 265 | |
@Override |
| 266 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 267 | |
public LuiInfo updateLui(String luiId, LuiInfo luiInfo, ContextInfo context) |
| 268 | |
throws DataValidationErrorException, DoesNotExistException, |
| 269 | |
InvalidParameterException, MissingParameterException, |
| 270 | |
OperationFailedException, PermissionDeniedException, |
| 271 | |
ReadOnlyException, VersionMismatchException { |
| 272 | |
|
| 273 | 0 | LuiEntity entity = luiDao.find(luiId); |
| 274 | |
|
| 275 | 0 | if (!luiId.equals(luiInfo.getId())) { |
| 276 | 0 | throw new InvalidParameterException(luiId + " does not match the id on the object " + luiInfo.getId()); |
| 277 | |
} |
| 278 | 0 | if (null == entity) { |
| 279 | 0 | throw new DoesNotExistException(luiId); |
| 280 | |
} |
| 281 | |
|
| 282 | |
|
| 283 | 0 | List<Object> orphans = entity.fromDto(luiInfo); |
| 284 | |
|
| 285 | |
|
| 286 | 0 | for(Object orphan : orphans){ |
| 287 | 0 | luiDao.getEm().remove(orphan); |
| 288 | |
} |
| 289 | |
|
| 290 | |
|
| 291 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 292 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 293 | |
|
| 294 | |
|
| 295 | 0 | entity = luiDao.merge(entity); |
| 296 | |
|
| 297 | 0 | return entity.toDto(); |
| 298 | |
} |
| 299 | |
|
| 300 | |
@Override |
| 301 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 302 | |
public StatusInfo deleteLui(String luiId, ContextInfo context) |
| 303 | |
throws DependentObjectsExistException, DoesNotExistException, |
| 304 | |
InvalidParameterException, MissingParameterException, |
| 305 | |
OperationFailedException, PermissionDeniedException { |
| 306 | |
|
| 307 | 0 | LuiEntity entity = luiDao.find(luiId); |
| 308 | 0 | if (null == entity) { |
| 309 | 0 | throw new DoesNotExistException(luiId); |
| 310 | |
} |
| 311 | 0 | List<LuiLuiRelationEntity> rels = luiLuiRelationDao.getLuiLuiRelationsByLui(luiId); |
| 312 | 0 | for (LuiLuiRelationEntity rel : rels) { |
| 313 | 0 | luiLuiRelationDao.remove(rel); |
| 314 | |
} |
| 315 | 0 | luiDao.remove(entity); |
| 316 | 0 | StatusInfo status = new StatusInfo(); |
| 317 | 0 | status.setSuccess(Boolean.TRUE); |
| 318 | 0 | return status; |
| 319 | |
} |
| 320 | |
|
| 321 | |
@Override |
| 322 | |
@Transactional(readOnly = true) |
| 323 | |
public LuiLuiRelationInfo getLuiLuiRelation(String luiLuiRelationId, |
| 324 | |
ContextInfo context) |
| 325 | |
throws InvalidParameterException, MissingParameterException, |
| 326 | |
OperationFailedException, PermissionDeniedException { |
| 327 | |
|
| 328 | 0 | return luiLuiRelationDao.find(luiLuiRelationId).toDto(); |
| 329 | |
} |
| 330 | |
|
| 331 | |
@Override |
| 332 | |
@Transactional(readOnly = true) |
| 333 | |
public List<LuiLuiRelationInfo> getLuiLuiRelationsByIds(List<String> luiLuiRelationIds, |
| 334 | |
ContextInfo context) |
| 335 | |
throws InvalidParameterException, MissingParameterException, |
| 336 | |
OperationFailedException, PermissionDeniedException { |
| 337 | |
|
| 338 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 339 | |
} |
| 340 | |
|
| 341 | |
@Override |
| 342 | |
@Transactional(readOnly = true) |
| 343 | |
public List<String> getLuiLuiRelationIdsByType(String luiLuiRelationTypeKey, |
| 344 | |
ContextInfo context) |
| 345 | |
throws InvalidParameterException, MissingParameterException, |
| 346 | |
OperationFailedException, PermissionDeniedException { |
| 347 | |
|
| 348 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 349 | |
} |
| 350 | |
|
| 351 | |
@Override |
| 352 | |
@Transactional(readOnly = true) |
| 353 | |
public List<LuiLuiRelationInfo> getLuiLuiRelationsByLui(String luiId, |
| 354 | |
ContextInfo context) |
| 355 | |
throws InvalidParameterException, MissingParameterException, |
| 356 | |
OperationFailedException, PermissionDeniedException { |
| 357 | |
|
| 358 | |
|
| 359 | |
|
| 360 | 0 | List<LuiLuiRelationEntity> relEntities = luiLuiRelationDao.getLuiLuiRelationsByLui(luiId); |
| 361 | 0 | List<LuiLuiRelationInfo> relInfos = new ArrayList<LuiLuiRelationInfo>(); |
| 362 | 0 | if (relEntities != null && !relEntities.isEmpty()) { |
| 363 | 0 | for (LuiLuiRelationEntity relEntity : relEntities) { |
| 364 | 0 | LuiLuiRelationInfo relInfo = relEntity.toDto(); |
| 365 | 0 | relInfos.add(relInfo); |
| 366 | 0 | } |
| 367 | |
} |
| 368 | 0 | return relInfos; |
| 369 | |
} |
| 370 | |
|
| 371 | |
@Override |
| 372 | |
@Transactional(readOnly = true) |
| 373 | |
public List<LuiLuiRelationInfo> getLuiLuiRelationsByLuiAndRelatedLui(String luiId, |
| 374 | |
String relatedLuiId, |
| 375 | |
ContextInfo context) |
| 376 | |
throws InvalidParameterException, MissingParameterException, |
| 377 | |
OperationFailedException, PermissionDeniedException { |
| 378 | |
|
| 379 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 380 | |
} |
| 381 | |
|
| 382 | |
@Override |
| 383 | |
@Transactional(readOnly = true) |
| 384 | |
public List<LuiInfo> getLuiLuiRelationsByLuiAndRelatedLuiType(String luiId, |
| 385 | |
String relatedLuiTypeKey, |
| 386 | |
ContextInfo contextInfo) |
| 387 | |
throws InvalidParameterException, MissingParameterException, |
| 388 | |
OperationFailedException, PermissionDeniedException { |
| 389 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 390 | |
} |
| 391 | |
|
| 392 | |
@Override |
| 393 | |
@Transactional(readOnly = true) |
| 394 | |
public List<LuiInfo> getLuisByRelatedLuiAndRelationType(String relatedLuiId, |
| 395 | |
String luiLuiRelationTypeKey, |
| 396 | |
ContextInfo context) |
| 397 | |
throws InvalidParameterException, MissingParameterException, |
| 398 | |
OperationFailedException, PermissionDeniedException { |
| 399 | |
|
| 400 | 0 | List<LuiEntity> entityList = luiLuiRelationDao.getLuisByRelation(relatedLuiId, luiLuiRelationTypeKey); |
| 401 | 0 | List<LuiInfo> infoList = new ArrayList<LuiInfo>(); |
| 402 | 0 | if (entityList != null && !entityList.isEmpty()) { |
| 403 | 0 | for (LuiEntity entity : entityList) { |
| 404 | 0 | infoList.add(entity.toDto()); |
| 405 | |
} |
| 406 | |
|
| 407 | |
} |
| 408 | |
|
| 409 | 0 | return infoList; |
| 410 | |
} |
| 411 | |
|
| 412 | |
@Override |
| 413 | |
@Transactional(readOnly = true) |
| 414 | |
public List<String> getLuiIdsByRelatedLuiAndRelationType(String relatedLuiId, |
| 415 | |
String luiLuiRelationTypeKey, |
| 416 | |
ContextInfo context) |
| 417 | |
throws InvalidParameterException, MissingParameterException, |
| 418 | |
OperationFailedException, PermissionDeniedException { |
| 419 | |
|
| 420 | 0 | List<String> returnVals = new ArrayList<String>(); |
| 421 | 0 | returnVals.addAll(luiLuiRelationDao.getLuiIdsByRelation(relatedLuiId, luiLuiRelationTypeKey)); |
| 422 | 0 | return returnVals; |
| 423 | |
} |
| 424 | |
|
| 425 | |
@Override |
| 426 | |
@Transactional(readOnly = true) |
| 427 | |
public List<String> getLuiIdsByLuiAndRelationType(String luiId, |
| 428 | |
String luiLuiRelationTypeKey, |
| 429 | |
ContextInfo context) |
| 430 | |
throws InvalidParameterException, MissingParameterException, |
| 431 | |
OperationFailedException, PermissionDeniedException { |
| 432 | |
|
| 433 | 0 | List<String> returnVals = new ArrayList<String>(); |
| 434 | 0 | returnVals.addAll(luiLuiRelationDao.getRelatedLuisByLuiId(luiId, luiLuiRelationTypeKey)); |
| 435 | 0 | return returnVals; |
| 436 | |
} |
| 437 | |
|
| 438 | |
@Override |
| 439 | |
@Transactional(readOnly = true) |
| 440 | |
public List<LuiInfo> getRelatedLuisByLuiAndRelationType(String luiId, |
| 441 | |
String luiLuiRelationTypeKey, |
| 442 | |
ContextInfo context) |
| 443 | |
throws InvalidParameterException, MissingParameterException, |
| 444 | |
OperationFailedException, PermissionDeniedException { |
| 445 | |
|
| 446 | 0 | List<LuiInfo> relatedLuis = new ArrayList<LuiInfo>(); |
| 447 | 0 | List<LuiEntity> relatedLuiEntities = luiLuiRelationDao.getRelatedLuisByLuiIdAndRelationType(luiId,luiLuiRelationTypeKey ) ; |
| 448 | 0 | for(LuiEntity relatedLuiEntity : relatedLuiEntities) { |
| 449 | 0 | relatedLuis.add(relatedLuiEntity.toDto()); |
| 450 | |
} |
| 451 | |
|
| 452 | 0 | return relatedLuis; |
| 453 | |
} |
| 454 | |
|
| 455 | |
@Override |
| 456 | |
@Transactional(readOnly = true) |
| 457 | |
public List<String> searchForLuiLuiRelationIds(QueryByCriteria criteria, |
| 458 | |
ContextInfo context) |
| 459 | |
throws InvalidParameterException, MissingParameterException, |
| 460 | |
OperationFailedException, PermissionDeniedException { |
| 461 | |
|
| 462 | |
|
| 463 | 0 | return new ArrayList<String>(); |
| 464 | |
} |
| 465 | |
|
| 466 | |
@Override |
| 467 | |
@Transactional(readOnly = true) |
| 468 | |
public List<LuiLuiRelationInfo> searchForLuiLuiRelations(QueryByCriteria criteria, |
| 469 | |
ContextInfo context) |
| 470 | |
throws InvalidParameterException, MissingParameterException, |
| 471 | |
OperationFailedException, PermissionDeniedException { |
| 472 | |
|
| 473 | |
|
| 474 | 0 | return new ArrayList<LuiLuiRelationInfo>(); |
| 475 | |
} |
| 476 | |
|
| 477 | |
@Override |
| 478 | |
@Transactional(readOnly = true) |
| 479 | |
public List<ValidationResultInfo> validateLuiLuiRelation(String validationTypeKey, |
| 480 | |
String luiId, |
| 481 | |
String relatedLuiId, |
| 482 | |
String luiLuiRelationTypeKey, |
| 483 | |
LuiLuiRelationInfo luiLuiRelationInfo, |
| 484 | |
ContextInfo context) |
| 485 | |
throws DoesNotExistException, InvalidParameterException, |
| 486 | |
MissingParameterException, OperationFailedException { |
| 487 | |
|
| 488 | 0 | List<ValidationResultInfo> validationResultInfos = new ArrayList<ValidationResultInfo>() ; |
| 489 | 0 | ValidationResultInfo invalidIdsValidationInfo = new ValidationResultInfo(); |
| 490 | 0 | if(luiLuiRelationInfo.getLuiId() ==null || luiLuiRelationInfo.getRelatedLuiId() == null) { |
| 491 | 0 | invalidIdsValidationInfo.setError("Relation Info is missing relation id data"); |
| 492 | 0 | invalidIdsValidationInfo.setLevel(ValidationResult.ErrorLevel.ERROR); |
| 493 | 0 | validationResultInfos.add(invalidIdsValidationInfo); |
| 494 | |
} |
| 495 | 0 | ValidationResultInfo typeStateValidation = new ValidationResultInfo(); |
| 496 | 0 | if(luiLuiRelationInfo.getTypeKey() ==null || luiLuiRelationInfo.getStateKey()==null ){ |
| 497 | 0 | typeStateValidation.setError("Missing type or state data"); |
| 498 | 0 | typeStateValidation.setLevel(ValidationResult.ErrorLevel.ERROR); |
| 499 | 0 | validationResultInfos.add(typeStateValidation); |
| 500 | |
|
| 501 | |
} |
| 502 | 0 | return validationResultInfos; |
| 503 | |
} |
| 504 | |
|
| 505 | |
@Override |
| 506 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 507 | |
public LuiLuiRelationInfo createLuiLuiRelation(String luiId, |
| 508 | |
String relatedLuiId, |
| 509 | |
String luiLuiRelationTypeKey, |
| 510 | |
LuiLuiRelationInfo luiLuiRelationInfo, |
| 511 | |
ContextInfo context) |
| 512 | |
throws CircularRelationshipException, DataValidationErrorException, |
| 513 | |
DoesNotExistException, InvalidParameterException, |
| 514 | |
MissingParameterException, OperationFailedException, |
| 515 | |
PermissionDeniedException, ReadOnlyException { |
| 516 | |
|
| 517 | 0 | LuiLuiRelationEntity entity = new LuiLuiRelationEntity(luiLuiRelationInfo); |
| 518 | 0 | entity.setLuiLuiRelationType(luiLuiRelationTypeKey); |
| 519 | 0 | entity.setLui(luiDao.find(luiId)); |
| 520 | 0 | if (entity.getLui() == null) { |
| 521 | 0 | throw new DoesNotExistException(luiId); |
| 522 | |
} |
| 523 | |
|
| 524 | 0 | entity.setRelatedLui(luiDao.find(relatedLuiId)); |
| 525 | 0 | if (entity.getRelatedLui() == null) { |
| 526 | 0 | throw new DoesNotExistException(relatedLuiId); |
| 527 | |
} |
| 528 | |
|
| 529 | 0 | entity.setLuiLuiRelationType(luiLuiRelationTypeKey); |
| 530 | 0 | entity.setCreateId(context.getPrincipalId()); |
| 531 | 0 | entity.setCreateTime(context.getCurrentDate()); |
| 532 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 533 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 534 | 0 | luiLuiRelationDao.persist(entity); |
| 535 | |
|
| 536 | 0 | return entity.toDto(); |
| 537 | |
} |
| 538 | |
|
| 539 | |
@Override |
| 540 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 541 | |
public LuiLuiRelationInfo updateLuiLuiRelation(String luiLuiRelationId, |
| 542 | |
LuiLuiRelationInfo luiLuiRelationInfo, |
| 543 | |
ContextInfo context) |
| 544 | |
throws DataValidationErrorException, DoesNotExistException, |
| 545 | |
InvalidParameterException, MissingParameterException, |
| 546 | |
OperationFailedException, PermissionDeniedException, |
| 547 | |
ReadOnlyException, VersionMismatchException { |
| 548 | |
|
| 549 | 0 | if (!luiLuiRelationId.equals(luiLuiRelationInfo.getId())) { |
| 550 | 0 | throw new InvalidParameterException(luiLuiRelationId + " does not match the id on the object " + luiLuiRelationInfo.getId()); |
| 551 | |
} |
| 552 | |
|
| 553 | 0 | LuiLuiRelationEntity entity = luiLuiRelationDao.find(luiLuiRelationId); |
| 554 | 0 | if (entity == null) { |
| 555 | 0 | throw new DoesNotExistException(luiLuiRelationId); |
| 556 | |
} |
| 557 | |
|
| 558 | 0 | entity.fromDto(luiLuiRelationInfo); |
| 559 | 0 | entity.setUpdateId(context.getPrincipalId()); |
| 560 | 0 | entity.setUpdateTime(context.getCurrentDate()); |
| 561 | 0 | luiLuiRelationDao.merge(entity); |
| 562 | |
|
| 563 | 0 | return entity.toDto(); |
| 564 | |
} |
| 565 | |
|
| 566 | |
@Override |
| 567 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 568 | |
public StatusInfo deleteLuiLuiRelation(String luiLuiRelationId, |
| 569 | |
ContextInfo context) |
| 570 | |
throws DoesNotExistException, InvalidParameterException, |
| 571 | |
MissingParameterException, OperationFailedException, |
| 572 | |
PermissionDeniedException { |
| 573 | |
|
| 574 | 0 | LuiLuiRelationEntity entity = luiLuiRelationDao.find(luiLuiRelationId); |
| 575 | 0 | if (entity == null) { |
| 576 | 0 | throw new DoesNotExistException(luiLuiRelationId); |
| 577 | |
} |
| 578 | 0 | luiLuiRelationDao.remove(entity); |
| 579 | 0 | StatusInfo status = new StatusInfo(); |
| 580 | 0 | status.setSuccess(Boolean.TRUE); |
| 581 | |
|
| 582 | 0 | return status; |
| 583 | |
} |
| 584 | |
|
| 585 | |
@Override |
| 586 | |
@Transactional(readOnly = true) |
| 587 | |
public LuiCapacityInfo getLuiCapacity(String luiCapacityId, |
| 588 | |
ContextInfo context) |
| 589 | |
throws DoesNotExistException, InvalidParameterException, |
| 590 | |
MissingParameterException, OperationFailedException, |
| 591 | |
PermissionDeniedException { |
| 592 | |
|
| 593 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 594 | |
} |
| 595 | |
|
| 596 | |
@Override |
| 597 | |
@Transactional(readOnly = true) |
| 598 | |
public List<LuiCapacityInfo> getLuiCapacitiesByIds(List<String> luiCapacityIds, |
| 599 | |
ContextInfo context) |
| 600 | |
throws DoesNotExistException, InvalidParameterException, |
| 601 | |
MissingParameterException, OperationFailedException, |
| 602 | |
PermissionDeniedException { |
| 603 | |
|
| 604 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 605 | |
} |
| 606 | |
|
| 607 | |
@Override |
| 608 | |
@Transactional(readOnly = true) |
| 609 | |
public List<LuiCapacityInfo> getLuiCapacitiesByLui(String luiId, |
| 610 | |
ContextInfo context) |
| 611 | |
throws InvalidParameterException, MissingParameterException, |
| 612 | |
OperationFailedException, PermissionDeniedException { |
| 613 | |
|
| 614 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 615 | |
} |
| 616 | |
|
| 617 | |
@Override |
| 618 | |
@Transactional(readOnly = true) |
| 619 | |
public List<String> getLuiCapacityIdsByType(String luiCapacityTypeKey, |
| 620 | |
ContextInfo context) |
| 621 | |
throws InvalidParameterException, MissingParameterException, |
| 622 | |
OperationFailedException, PermissionDeniedException { |
| 623 | |
|
| 624 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 625 | |
} |
| 626 | |
|
| 627 | |
@Override |
| 628 | |
@Transactional(readOnly = true) |
| 629 | |
public List<String> searchForLuiCapacityIds(QueryByCriteria criteria, |
| 630 | |
ContextInfo context) |
| 631 | |
throws InvalidParameterException, MissingParameterException, |
| 632 | |
OperationFailedException, PermissionDeniedException { |
| 633 | |
|
| 634 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 635 | |
} |
| 636 | |
|
| 637 | |
@Override |
| 638 | |
@Transactional(readOnly = true) |
| 639 | |
public List<LuiCapacityInfo> searchForLuiCapacities(QueryByCriteria criteria, |
| 640 | |
ContextInfo context) |
| 641 | |
throws InvalidParameterException, MissingParameterException, |
| 642 | |
OperationFailedException, PermissionDeniedException { |
| 643 | |
|
| 644 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 645 | |
} |
| 646 | |
|
| 647 | |
@Override |
| 648 | |
public List<ValidationResultInfo> validateLuiCapacity(String validationTypeKey, |
| 649 | |
String luiCapacityTypeKey, |
| 650 | |
LuiCapacityInfo luiCapacityInfo, |
| 651 | |
ContextInfo context) |
| 652 | |
throws DoesNotExistException, InvalidParameterException, |
| 653 | |
MissingParameterException, OperationFailedException, |
| 654 | |
PermissionDeniedException { |
| 655 | |
|
| 656 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 657 | |
} |
| 658 | |
|
| 659 | |
@Override |
| 660 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 661 | |
public LuiCapacityInfo createLuiCapacity(String luiCapacityTypeKey, |
| 662 | |
LuiCapacityInfo luiCapacityInfo, |
| 663 | |
ContextInfo context) |
| 664 | |
throws DataValidationErrorException, DoesNotExistException, |
| 665 | |
InvalidParameterException, MissingParameterException, |
| 666 | |
OperationFailedException, PermissionDeniedException, |
| 667 | |
ReadOnlyException { |
| 668 | |
|
| 669 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 670 | |
} |
| 671 | |
|
| 672 | |
@Override |
| 673 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 674 | |
public LuiCapacityInfo updateLuiCapacity(String luiCapacityId, |
| 675 | |
LuiCapacityInfo luiCapacityInfo, |
| 676 | |
ContextInfo context) |
| 677 | |
throws DataValidationErrorException, DoesNotExistException, |
| 678 | |
InvalidParameterException, MissingParameterException, |
| 679 | |
OperationFailedException, PermissionDeniedException, |
| 680 | |
ReadOnlyException, VersionMismatchException { |
| 681 | |
|
| 682 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 683 | |
} |
| 684 | |
|
| 685 | |
@Override |
| 686 | |
@Transactional(readOnly = false, noRollbackFor = {DoesNotExistException.class}, rollbackFor = {Throwable.class}) |
| 687 | |
public StatusInfo deleteLuiCapacity(String luiCapacityId, |
| 688 | |
ContextInfo context) |
| 689 | |
throws DoesNotExistException, InvalidParameterException, |
| 690 | |
MissingParameterException, OperationFailedException, |
| 691 | |
PermissionDeniedException { |
| 692 | |
|
| 693 | 0 | throw new UnsupportedOperationException("Not supported yet."); |
| 694 | |
} |
| 695 | |
} |