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