| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.lum.lu.service.impl; |
| 17 | |
|
| 18 | |
import java.util.ArrayList; |
| 19 | |
import java.util.Date; |
| 20 | |
import java.util.HashMap; |
| 21 | |
import java.util.HashSet; |
| 22 | |
import java.util.Iterator; |
| 23 | |
import java.util.List; |
| 24 | |
import java.util.Map; |
| 25 | |
import java.util.Map.Entry; |
| 26 | |
import java.util.Set; |
| 27 | |
|
| 28 | |
import javax.jws.WebService; |
| 29 | |
import javax.persistence.NoResultException; |
| 30 | |
|
| 31 | |
import org.apache.log4j.Logger; |
| 32 | |
import org.kuali.student.common.validator.Validator; |
| 33 | |
import org.kuali.student.common.validator.ValidatorFactory; |
| 34 | |
import org.kuali.student.core.dictionary.dto.ObjectStructureDefinition; |
| 35 | |
import org.kuali.student.core.dictionary.service.DictionaryService; |
| 36 | |
import org.kuali.student.core.dto.CurrencyAmountInfo; |
| 37 | |
import org.kuali.student.core.dto.StatusInfo; |
| 38 | |
import org.kuali.student.core.entity.Amount; |
| 39 | |
import org.kuali.student.core.entity.TimeAmount; |
| 40 | |
import org.kuali.student.core.entity.Version; |
| 41 | |
import org.kuali.student.core.entity.VersionEntity; |
| 42 | |
import org.kuali.student.core.exceptions.AlreadyExistsException; |
| 43 | |
import org.kuali.student.core.exceptions.CircularRelationshipException; |
| 44 | |
import org.kuali.student.core.exceptions.DataValidationErrorException; |
| 45 | |
import org.kuali.student.core.exceptions.DependentObjectsExistException; |
| 46 | |
import org.kuali.student.core.exceptions.DoesNotExistException; |
| 47 | |
import org.kuali.student.core.exceptions.IllegalVersionSequencingException; |
| 48 | |
import org.kuali.student.core.exceptions.InvalidParameterException; |
| 49 | |
import org.kuali.student.core.exceptions.MissingParameterException; |
| 50 | |
import org.kuali.student.core.exceptions.OperationFailedException; |
| 51 | |
import org.kuali.student.core.exceptions.PermissionDeniedException; |
| 52 | |
import org.kuali.student.core.exceptions.UnsupportedActionException; |
| 53 | |
import org.kuali.student.core.exceptions.VersionMismatchException; |
| 54 | |
import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo; |
| 55 | |
import org.kuali.student.core.search.dto.SearchRequest; |
| 56 | |
import org.kuali.student.core.search.dto.SearchResult; |
| 57 | |
import org.kuali.student.core.search.dto.SearchResultCell; |
| 58 | |
import org.kuali.student.core.search.dto.SearchResultRow; |
| 59 | |
import org.kuali.student.core.search.dto.SearchResultTypeInfo; |
| 60 | |
import org.kuali.student.core.search.dto.SearchTypeInfo; |
| 61 | |
import org.kuali.student.core.search.service.SearchManager; |
| 62 | |
import org.kuali.student.core.validation.dto.ValidationResultInfo; |
| 63 | |
import org.kuali.student.core.versionmanagement.dto.VersionDisplayInfo; |
| 64 | |
import org.kuali.student.lum.lu.LUConstants; |
| 65 | |
import org.kuali.student.lum.lu.dao.LuDao; |
| 66 | |
import org.kuali.student.lum.lu.dto.AccreditationInfo; |
| 67 | |
import org.kuali.student.lum.lu.dto.AdminOrgInfo; |
| 68 | |
import org.kuali.student.lum.lu.dto.AffiliatedOrgInfo; |
| 69 | |
import org.kuali.student.lum.lu.dto.CluCluRelationInfo; |
| 70 | |
import org.kuali.student.lum.lu.dto.CluFeeRecordInfo; |
| 71 | |
import org.kuali.student.lum.lu.dto.CluIdentifierInfo; |
| 72 | |
import org.kuali.student.lum.lu.dto.CluInfo; |
| 73 | |
import org.kuali.student.lum.lu.dto.CluInstructorInfo; |
| 74 | |
import org.kuali.student.lum.lu.dto.CluLoRelationInfo; |
| 75 | |
import org.kuali.student.lum.lu.dto.CluLoRelationTypeInfo; |
| 76 | |
import org.kuali.student.lum.lu.dto.CluPublicationInfo; |
| 77 | |
import org.kuali.student.lum.lu.dto.CluResultInfo; |
| 78 | |
import org.kuali.student.lum.lu.dto.CluResultTypeInfo; |
| 79 | |
import org.kuali.student.lum.lu.dto.CluSetInfo; |
| 80 | |
import org.kuali.student.lum.lu.dto.CluSetTreeViewInfo; |
| 81 | |
import org.kuali.student.lum.lu.dto.CluSetTypeInfo; |
| 82 | |
import org.kuali.student.lum.lu.dto.DeliveryMethodTypeInfo; |
| 83 | |
import org.kuali.student.lum.lu.dto.FieldInfo; |
| 84 | |
import org.kuali.student.lum.lu.dto.InstructionalFormatTypeInfo; |
| 85 | |
import org.kuali.student.lum.lu.dto.LuCodeInfo; |
| 86 | |
import org.kuali.student.lum.lu.dto.LuCodeTypeInfo; |
| 87 | |
import org.kuali.student.lum.lu.dto.LuLuRelationTypeInfo; |
| 88 | |
import org.kuali.student.lum.lu.dto.LuPublicationTypeInfo; |
| 89 | |
import org.kuali.student.lum.lu.dto.LuTypeInfo; |
| 90 | |
import org.kuali.student.lum.lu.dto.LuiInfo; |
| 91 | |
import org.kuali.student.lum.lu.dto.LuiLuiRelationInfo; |
| 92 | |
import org.kuali.student.lum.lu.dto.MembershipQueryInfo; |
| 93 | |
import org.kuali.student.lum.lu.dto.ResultOptionInfo; |
| 94 | |
import org.kuali.student.lum.lu.dto.ResultUsageTypeInfo; |
| 95 | |
import org.kuali.student.lum.lu.entity.Clu; |
| 96 | |
import org.kuali.student.lum.lu.entity.CluAccounting; |
| 97 | |
import org.kuali.student.lum.lu.entity.CluAccountingAttribute; |
| 98 | |
import org.kuali.student.lum.lu.entity.CluAccreditation; |
| 99 | |
import org.kuali.student.lum.lu.entity.CluAccreditationAttribute; |
| 100 | |
import org.kuali.student.lum.lu.entity.CluAdminOrg; |
| 101 | |
import org.kuali.student.lum.lu.entity.CluAdminOrgAttribute; |
| 102 | |
import org.kuali.student.lum.lu.entity.CluAtpTypeKey; |
| 103 | |
import org.kuali.student.lum.lu.entity.CluAttribute; |
| 104 | |
import org.kuali.student.lum.lu.entity.CluCampusLocation; |
| 105 | |
import org.kuali.student.lum.lu.entity.CluCluRelation; |
| 106 | |
import org.kuali.student.lum.lu.entity.CluCluRelationAttribute; |
| 107 | |
import org.kuali.student.lum.lu.entity.CluFee; |
| 108 | |
import org.kuali.student.lum.lu.entity.CluIdentifier; |
| 109 | |
import org.kuali.student.lum.lu.entity.CluInstructor; |
| 110 | |
import org.kuali.student.lum.lu.entity.CluInstructorAttribute; |
| 111 | |
import org.kuali.student.lum.lu.entity.CluLoRelation; |
| 112 | |
import org.kuali.student.lum.lu.entity.CluLoRelationAttribute; |
| 113 | |
import org.kuali.student.lum.lu.entity.CluLoRelationType; |
| 114 | |
import org.kuali.student.lum.lu.entity.CluPublication; |
| 115 | |
import org.kuali.student.lum.lu.entity.CluPublicationAttribute; |
| 116 | |
import org.kuali.student.lum.lu.entity.CluPublicationType; |
| 117 | |
import org.kuali.student.lum.lu.entity.CluPublicationVariant; |
| 118 | |
import org.kuali.student.lum.lu.entity.CluResult; |
| 119 | |
import org.kuali.student.lum.lu.entity.CluResultType; |
| 120 | |
import org.kuali.student.lum.lu.entity.CluSet; |
| 121 | |
import org.kuali.student.lum.lu.entity.CluSetAttribute; |
| 122 | |
import org.kuali.student.lum.lu.entity.CluSetJoinVersionIndClu; |
| 123 | |
import org.kuali.student.lum.lu.entity.CluSetType; |
| 124 | |
import org.kuali.student.lum.lu.entity.DeliveryMethodType; |
| 125 | |
import org.kuali.student.lum.lu.entity.InstructionalFormatType; |
| 126 | |
import org.kuali.student.lum.lu.entity.LuCode; |
| 127 | |
import org.kuali.student.lum.lu.entity.LuCodeAttribute; |
| 128 | |
import org.kuali.student.lum.lu.entity.LuCodeType; |
| 129 | |
import org.kuali.student.lum.lu.entity.LuLuRelationType; |
| 130 | |
import org.kuali.student.lum.lu.entity.LuPublicationType; |
| 131 | |
import org.kuali.student.lum.lu.entity.LuRichText; |
| 132 | |
import org.kuali.student.lum.lu.entity.LuType; |
| 133 | |
import org.kuali.student.lum.lu.entity.Lui; |
| 134 | |
import org.kuali.student.lum.lu.entity.LuiAttribute; |
| 135 | |
import org.kuali.student.lum.lu.entity.LuiLuiRelation; |
| 136 | |
import org.kuali.student.lum.lu.entity.LuiLuiRelationAttribute; |
| 137 | |
import org.kuali.student.lum.lu.entity.MembershipQuery; |
| 138 | |
import org.kuali.student.lum.lu.entity.ResultOption; |
| 139 | |
import org.kuali.student.lum.lu.entity.ResultUsageType; |
| 140 | |
import org.kuali.student.lum.lu.service.LuService; |
| 141 | |
import org.kuali.student.lum.lu.service.LuServiceConstants; |
| 142 | |
import org.springframework.beans.BeanUtils; |
| 143 | |
import org.springframework.transaction.annotation.Transactional; |
| 144 | |
|
| 145 | |
import edu.emory.mathcs.backport.java.util.Collections; |
| 146 | |
|
| 147 | |
|
| 148 | |
@WebService(endpointInterface = "org.kuali.student.lum.lu.service.LuService", serviceName = "LuService", portName = "LuService", targetNamespace = "http://student.kuali.org/wsdl/lu") |
| 149 | |
@Transactional(readOnly=true,noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
| 150 | 8 | public class LuServiceImpl implements LuService { |
| 151 | |
|
| 152 | 8 | final Logger logger = Logger.getLogger(LuServiceImpl.class); |
| 153 | |
|
| 154 | |
private LuDao luDao; |
| 155 | |
private SearchManager searchManager; |
| 156 | |
private DictionaryService dictionaryServiceDelegate; |
| 157 | |
private ValidatorFactory validatorFactory; |
| 158 | |
|
| 159 | |
public void setSearchManager(SearchManager searchManager) { |
| 160 | 4 | this.searchManager = searchManager; |
| 161 | 4 | } |
| 162 | |
|
| 163 | |
public void setDictionaryServiceDelegate( |
| 164 | |
DictionaryService dictionaryServiceDelegate) { |
| 165 | 3 | this.dictionaryServiceDelegate = dictionaryServiceDelegate; |
| 166 | 3 | } |
| 167 | |
|
| 168 | |
public DictionaryService getDictionaryServiceDelegate() { |
| 169 | 0 | return dictionaryServiceDelegate; |
| 170 | |
} |
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
|
| 177 | |
@Override |
| 178 | |
public List<DeliveryMethodTypeInfo> getDeliveryMethodTypes() |
| 179 | |
throws OperationFailedException { |
| 180 | 0 | return LuServiceAssembler.toDeliveryMethodTypeInfos(luDao |
| 181 | |
.find(DeliveryMethodType.class)); |
| 182 | |
} |
| 183 | |
|
| 184 | |
@Override |
| 185 | |
public DeliveryMethodTypeInfo getDeliveryMethodType( |
| 186 | |
String deliveryMethodTypeKey) throws DoesNotExistException, |
| 187 | |
InvalidParameterException, MissingParameterException, |
| 188 | |
OperationFailedException { |
| 189 | |
|
| 190 | 0 | checkForMissingParameter(deliveryMethodTypeKey, "deliveryMethodTypeKey"); |
| 191 | |
|
| 192 | 0 | return LuServiceAssembler.toDeliveryMethodTypeInfo(luDao.fetch( |
| 193 | |
DeliveryMethodType.class, deliveryMethodTypeKey)); |
| 194 | |
} |
| 195 | |
|
| 196 | |
@Override |
| 197 | |
public List<InstructionalFormatTypeInfo> getInstructionalFormatTypes() |
| 198 | |
throws OperationFailedException { |
| 199 | 0 | return LuServiceAssembler.toInstructionalFormatTypeInfos(luDao |
| 200 | |
.find(InstructionalFormatType.class)); |
| 201 | |
} |
| 202 | |
|
| 203 | |
@Override |
| 204 | |
public InstructionalFormatTypeInfo getInstructionalFormatType( |
| 205 | |
String instructionalFormatTypeKey) throws DoesNotExistException, |
| 206 | |
InvalidParameterException, MissingParameterException, |
| 207 | |
OperationFailedException { |
| 208 | 0 | checkForMissingParameter(instructionalFormatTypeKey, |
| 209 | |
"instructionalFormatTypeKey"); |
| 210 | |
|
| 211 | 0 | return LuServiceAssembler.toInstructionalFormatTypeInfo(luDao.fetch( |
| 212 | |
InstructionalFormatType.class, instructionalFormatTypeKey)); |
| 213 | |
} |
| 214 | |
|
| 215 | |
@Override |
| 216 | |
public List<LuTypeInfo> getLuTypes() throws OperationFailedException { |
| 217 | 0 | return LuServiceAssembler.toLuTypeInfos(luDao.find(LuType.class)); |
| 218 | |
} |
| 219 | |
|
| 220 | |
@Override |
| 221 | |
public LuTypeInfo getLuType(String luTypeKey) throws DoesNotExistException, |
| 222 | |
InvalidParameterException, MissingParameterException, |
| 223 | |
OperationFailedException { |
| 224 | 0 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 225 | |
|
| 226 | 0 | return LuServiceAssembler.toLuTypeInfo(luDao.fetch(LuType.class, |
| 227 | |
luTypeKey)); |
| 228 | |
} |
| 229 | |
|
| 230 | |
@Override |
| 231 | |
public LuCodeTypeInfo getLuCodeType(String luCodeTypeKey) |
| 232 | |
throws DoesNotExistException, InvalidParameterException, |
| 233 | |
MissingParameterException, OperationFailedException { |
| 234 | 0 | checkForMissingParameter(luCodeTypeKey, "luCodeTypeKey"); |
| 235 | 0 | return LuServiceAssembler.toLuCodeTypeInfo(luDao.fetch( |
| 236 | |
LuCodeType.class, luCodeTypeKey)); |
| 237 | |
} |
| 238 | |
|
| 239 | |
@Override |
| 240 | |
public List<LuCodeTypeInfo> getLuCodeTypes() |
| 241 | |
throws OperationFailedException { |
| 242 | 0 | return LuServiceAssembler.toLuCodeTypeInfos(luDao |
| 243 | |
.find(LuCodeType.class)); |
| 244 | |
} |
| 245 | |
|
| 246 | |
@Override |
| 247 | |
public List<LuLuRelationTypeInfo> getLuLuRelationTypes() |
| 248 | |
throws OperationFailedException { |
| 249 | 1 | return LuServiceAssembler.toLuLuRelationTypeInfos(luDao |
| 250 | |
.find(LuLuRelationType.class)); |
| 251 | |
} |
| 252 | |
|
| 253 | |
@Override |
| 254 | |
public LuLuRelationTypeInfo getLuLuRelationType(String luLuRelationTypeKey) |
| 255 | |
throws OperationFailedException, MissingParameterException, |
| 256 | |
DoesNotExistException { |
| 257 | 4 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 258 | |
|
| 259 | 3 | LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
| 260 | |
luLuRelationTypeKey); |
| 261 | 2 | return LuServiceAssembler.toLuLuRelationTypeInfo(luLuRelationType); |
| 262 | |
} |
| 263 | |
|
| 264 | |
@Override |
| 265 | |
public List<String> getAllowedLuLuRelationTypesForLuType(String luTypeKey, |
| 266 | |
String relatedLuTypeKey) throws DoesNotExistException, |
| 267 | |
InvalidParameterException, MissingParameterException, |
| 268 | |
OperationFailedException { |
| 269 | 0 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 270 | 0 | checkForMissingParameter(relatedLuTypeKey, "relatedLuTypeKey"); |
| 271 | |
|
| 272 | 0 | return luDao.getAllowedLuLuRelationTypesForLuType(luTypeKey, |
| 273 | |
relatedLuTypeKey); |
| 274 | |
} |
| 275 | |
|
| 276 | |
@Override |
| 277 | |
public List<LuPublicationTypeInfo> getLuPublicationTypes() |
| 278 | |
throws OperationFailedException { |
| 279 | 0 | return LuServiceAssembler.toLuPublicationTypeInfos(luDao |
| 280 | |
.find(LuPublicationType.class)); |
| 281 | |
} |
| 282 | |
|
| 283 | |
@Override |
| 284 | |
public LuPublicationTypeInfo getLuPublicationType( |
| 285 | |
String luPublicationTypeKey) throws DoesNotExistException, |
| 286 | |
InvalidParameterException, MissingParameterException, |
| 287 | |
OperationFailedException { |
| 288 | 0 | checkForMissingParameter(luPublicationTypeKey, "luPublicationTypeKey"); |
| 289 | |
|
| 290 | 0 | return LuServiceAssembler.toLuPublicationTypeInfo(luDao.fetch( |
| 291 | |
LuPublicationType.class, luPublicationTypeKey)); |
| 292 | |
} |
| 293 | |
|
| 294 | |
@Override |
| 295 | |
public List<String> getLuPublicationTypesForLuType(String luTypeKey) |
| 296 | |
throws DoesNotExistException, InvalidParameterException, |
| 297 | |
MissingParameterException, OperationFailedException { |
| 298 | 0 | throw new UnsupportedOperationException("getLuPublicationTypesForLuType"); |
| 299 | |
} |
| 300 | |
|
| 301 | |
@Override |
| 302 | |
public List<CluResultTypeInfo> getCluResultTypes() |
| 303 | |
throws OperationFailedException { |
| 304 | 0 | return LuServiceAssembler.toCluResultTypeInfos(luDao |
| 305 | |
.find(CluResultType.class)); |
| 306 | |
} |
| 307 | |
|
| 308 | |
@Override |
| 309 | |
public CluResultTypeInfo getCluResultType(String cluResultTypeKey) |
| 310 | |
throws DoesNotExistException, InvalidParameterException, |
| 311 | |
MissingParameterException, OperationFailedException { |
| 312 | 0 | return LuServiceAssembler.toCluResultTypeInfo(luDao.fetch( |
| 313 | |
CluResultType.class, cluResultTypeKey)); |
| 314 | |
} |
| 315 | |
|
| 316 | |
@Override |
| 317 | |
public List<CluResultTypeInfo> getCluResultTypesForLuType(String luTypeKey) |
| 318 | |
throws DoesNotExistException, InvalidParameterException, |
| 319 | |
MissingParameterException, OperationFailedException { |
| 320 | 0 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 321 | 0 | return LuServiceAssembler.toCluResultTypeInfos((luDao |
| 322 | |
.getAllowedCluResultTypesForLuType(luTypeKey))); |
| 323 | |
} |
| 324 | |
|
| 325 | |
@Override |
| 326 | |
public List<ResultUsageTypeInfo> getResultUsageTypes() |
| 327 | |
throws OperationFailedException { |
| 328 | 1 | return LuServiceAssembler.toResultUsageTypeInfos(luDao |
| 329 | |
.find(ResultUsageType.class)); |
| 330 | |
} |
| 331 | |
|
| 332 | |
@Override |
| 333 | |
public ResultUsageTypeInfo getResultUsageType(String resultUsageTypeKey) |
| 334 | |
throws DoesNotExistException, InvalidParameterException, |
| 335 | |
MissingParameterException, OperationFailedException { |
| 336 | 1 | checkForMissingParameter(resultUsageTypeKey, "resultUsageTypeKey"); |
| 337 | 1 | return LuServiceAssembler.toResultUsageTypeInfo(luDao.fetch( |
| 338 | |
ResultUsageType.class, resultUsageTypeKey)); |
| 339 | |
} |
| 340 | |
|
| 341 | |
@Override |
| 342 | |
public List<String> getAllowedResultUsageTypesForLuType(String luTypeKey) |
| 343 | |
throws DoesNotExistException, InvalidParameterException, |
| 344 | |
MissingParameterException, OperationFailedException { |
| 345 | 0 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 346 | |
|
| 347 | 0 | return luDao.getAllowedResultUsageTypesForLuType(luTypeKey); |
| 348 | |
} |
| 349 | |
|
| 350 | |
@Override |
| 351 | |
public List<String> getAllowedResultComponentTypesForResultUsageType( |
| 352 | |
String resultUsageTypeKey) throws DoesNotExistException, |
| 353 | |
InvalidParameterException, MissingParameterException, |
| 354 | |
OperationFailedException { |
| 355 | |
|
| 356 | 0 | checkForMissingParameter(resultUsageTypeKey, "resultUsageTypeKey"); |
| 357 | |
|
| 358 | 0 | return luDao |
| 359 | |
.getAllowedResultComponentTypesForResultUsageType(resultUsageTypeKey); |
| 360 | |
} |
| 361 | |
|
| 362 | |
@Override |
| 363 | |
public CluLoRelationTypeInfo getCluLoRelationType( |
| 364 | |
String cluLoRelationTypeKey) throws DoesNotExistException, |
| 365 | |
InvalidParameterException, MissingParameterException, |
| 366 | |
OperationFailedException { |
| 367 | 0 | checkForMissingParameter(cluLoRelationTypeKey, "cluLoRelationTypeKey"); |
| 368 | |
|
| 369 | 0 | CluLoRelationType cluLoRelationType = luDao.fetch( |
| 370 | |
CluLoRelationType.class, cluLoRelationTypeKey); |
| 371 | 0 | return LuServiceAssembler.toCluLoRelationTypeInfo(cluLoRelationType); |
| 372 | |
} |
| 373 | |
|
| 374 | |
@Override |
| 375 | |
public List<CluLoRelationTypeInfo> getCluLoRelationTypes() |
| 376 | |
throws OperationFailedException { |
| 377 | 0 | return LuServiceAssembler.toCluLoRelationTypeInfos(luDao |
| 378 | |
.find(CluLoRelationType.class)); |
| 379 | |
} |
| 380 | |
|
| 381 | |
@Override |
| 382 | |
public List<String> getAllowedCluLoRelationTypesForLuType(String luTypeKey) |
| 383 | |
throws DoesNotExistException, InvalidParameterException, |
| 384 | |
MissingParameterException, OperationFailedException { |
| 385 | |
|
| 386 | 0 | checkForMissingParameter(luTypeKey, luTypeKey); |
| 387 | |
|
| 388 | 0 | return luDao.getAllowedCluLoRelationTypesForLuType(luTypeKey); |
| 389 | |
} |
| 390 | |
|
| 391 | |
@Override |
| 392 | |
public List<CluSetTypeInfo> getCluSetTypes() |
| 393 | |
throws OperationFailedException { |
| 394 | 0 | return LuServiceAssembler.toCluSetTypeInfos(luDao |
| 395 | |
.find(CluSetType.class)); |
| 396 | |
} |
| 397 | |
|
| 398 | |
@Override |
| 399 | |
public CluSetTypeInfo getCluSetType(String cluSetTypeKey) |
| 400 | |
throws DoesNotExistException, InvalidParameterException, |
| 401 | |
MissingParameterException, OperationFailedException { |
| 402 | 0 | checkForMissingParameter(cluSetTypeKey, "cluSetTypeKey"); |
| 403 | 0 | return LuServiceAssembler.toCluSetTypeInfo(luDao.fetch( |
| 404 | |
CluSetType.class, cluSetTypeKey)); |
| 405 | |
} |
| 406 | |
|
| 407 | |
|
| 408 | |
|
| 409 | |
|
| 410 | |
|
| 411 | |
|
| 412 | |
@Override |
| 413 | |
public CluInfo getClu(String cluId) throws DoesNotExistException, |
| 414 | |
InvalidParameterException, MissingParameterException, |
| 415 | |
OperationFailedException { |
| 416 | |
|
| 417 | 178 | checkForMissingParameter(cluId, "cluId"); |
| 418 | |
|
| 419 | 177 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 420 | 172 | return LuServiceAssembler.toCluInfo(clu); |
| 421 | |
} |
| 422 | |
|
| 423 | |
@Override |
| 424 | |
public List<CluInfo> getClusByIdList(List<String> cluIdList) |
| 425 | |
throws DoesNotExistException, InvalidParameterException, |
| 426 | |
MissingParameterException, OperationFailedException { |
| 427 | 3 | checkForMissingParameter(cluIdList, "cluIdList"); |
| 428 | 2 | checkForEmptyList(cluIdList, "cluIdList"); |
| 429 | 2 | List<Clu> clus = luDao.getClusByIdList(cluIdList); |
| 430 | 2 | return LuServiceAssembler.toCluInfos(clus); |
| 431 | |
} |
| 432 | |
|
| 433 | |
@Override |
| 434 | |
public List<CluInfo> getClusByLuType(String luTypeKey, String luState) |
| 435 | |
throws DoesNotExistException, InvalidParameterException, |
| 436 | |
MissingParameterException, OperationFailedException { |
| 437 | 5 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 438 | 4 | checkForMissingParameter(luState, "lustate"); |
| 439 | 3 | List<Clu> clus = luDao.getClusByLuType(luTypeKey, luState); |
| 440 | 3 | return LuServiceAssembler.toCluInfos(clus); |
| 441 | |
} |
| 442 | |
|
| 443 | |
@Override |
| 444 | |
public List<String> getCluIdsByLuType(String luTypeKey, String luState) |
| 445 | |
throws DoesNotExistException, InvalidParameterException, |
| 446 | |
MissingParameterException, OperationFailedException { |
| 447 | 5 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 448 | 4 | checkForMissingParameter(luState, "luState"); |
| 449 | 3 | List<Clu> clus = luDao.getClusByLuType(luTypeKey, luState); |
| 450 | 3 | List<String> ids = new ArrayList<String>(clus.size()); |
| 451 | 3 | for (Clu clu : clus) { |
| 452 | 1 | ids.add(clu.getId()); |
| 453 | |
} |
| 454 | 3 | return ids; |
| 455 | |
} |
| 456 | |
|
| 457 | |
|
| 458 | |
|
| 459 | |
@Override |
| 460 | |
public List<String> getAllowedLuLuRelationTypesByCluId(String cluId, |
| 461 | |
String relatedCluId) throws DoesNotExistException, |
| 462 | |
InvalidParameterException, MissingParameterException, |
| 463 | |
OperationFailedException { |
| 464 | 0 | checkForMissingParameter(cluId, "cluId"); |
| 465 | 0 | checkForMissingParameter(relatedCluId, "relatedCluId"); |
| 466 | |
|
| 467 | 0 | return luDao.getAllowedLuLuRelationTypesByCluId(cluId, relatedCluId); |
| 468 | |
} |
| 469 | |
|
| 470 | |
@Override |
| 471 | |
public List<CluInfo> getClusByRelation(String relatedCluId, |
| 472 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 473 | |
InvalidParameterException, MissingParameterException, |
| 474 | |
OperationFailedException { |
| 475 | 5 | checkForMissingParameter(relatedCluId, "relatedCluId"); |
| 476 | 4 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 477 | |
|
| 478 | 3 | List<Clu> clus = luDao.getClusByRelation(relatedCluId, |
| 479 | |
luLuRelationTypeKey); |
| 480 | 3 | List<CluInfo> result = LuServiceAssembler.toCluInfos(clus); |
| 481 | 3 | return result; |
| 482 | |
|
| 483 | |
} |
| 484 | |
|
| 485 | |
@Override |
| 486 | |
public List<String> getCluIdsByRelation(String relatedCluId, |
| 487 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 488 | |
InvalidParameterException, MissingParameterException, |
| 489 | |
OperationFailedException { |
| 490 | 19 | checkForMissingParameter(relatedCluId, "relatedCluId"); |
| 491 | 18 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 492 | |
|
| 493 | 17 | List<String> cluIds = luDao.getCluIdsByRelatedCluId(relatedCluId, luLuRelationTypeKey); |
| 494 | 17 | return cluIds; |
| 495 | |
} |
| 496 | |
|
| 497 | |
@Override |
| 498 | |
public List<CluInfo> getRelatedClusByCluId(String cluId, |
| 499 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 500 | |
InvalidParameterException, MissingParameterException, |
| 501 | |
OperationFailedException { |
| 502 | 61 | checkForMissingParameter(cluId, "cluId"); |
| 503 | 61 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 504 | 61 | List<Clu> relatedClus = luDao.getRelatedClusByCluId(cluId, |
| 505 | |
luLuRelationTypeKey); |
| 506 | 61 | return LuServiceAssembler.toCluInfos(relatedClus); |
| 507 | |
} |
| 508 | |
|
| 509 | |
@Override |
| 510 | |
public List<String> getRelatedCluIdsByCluId(String cluId, |
| 511 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 512 | |
InvalidParameterException, MissingParameterException, |
| 513 | |
OperationFailedException { |
| 514 | 85 | checkForMissingParameter(cluId, "cluId"); |
| 515 | 85 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 516 | 85 | List<String> relatedCluIds = luDao.getRelatedCluIdsByCluId(cluId, |
| 517 | |
luLuRelationTypeKey); |
| 518 | 85 | return relatedCluIds; |
| 519 | |
} |
| 520 | |
|
| 521 | |
@Override |
| 522 | |
public CluCluRelationInfo getCluCluRelation(String cluCluRelationId) |
| 523 | |
throws DoesNotExistException, InvalidParameterException, |
| 524 | |
MissingParameterException, OperationFailedException { |
| 525 | 2 | checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
| 526 | 2 | return LuServiceAssembler.toCluCluRelationInfo(luDao.fetch( |
| 527 | |
CluCluRelation.class, cluCluRelationId)); |
| 528 | |
} |
| 529 | |
|
| 530 | |
@Override |
| 531 | |
public List<CluCluRelationInfo> getCluCluRelationsByClu(String cluId) |
| 532 | |
throws DoesNotExistException, InvalidParameterException, |
| 533 | |
MissingParameterException, OperationFailedException { |
| 534 | 80 | checkForMissingParameter(cluId, "cluId"); |
| 535 | 79 | List<CluCluRelation> cluCluRelations = luDao |
| 536 | |
.getCluCluRelationsByClu(cluId); |
| 537 | 79 | return LuServiceAssembler.toCluCluRelationInfos(cluCluRelations); |
| 538 | |
} |
| 539 | |
|
| 540 | |
|
| 541 | |
@Override |
| 542 | |
public List<CluPublicationInfo> getCluPublicationsByCluId(String cluId) |
| 543 | |
throws DoesNotExistException, InvalidParameterException, |
| 544 | |
MissingParameterException, OperationFailedException { |
| 545 | 185 | checkForMissingParameter(cluId, "cluId"); |
| 546 | 185 | List<CluPublication> cluPublications = luDao.getCluPublicationsByCluId(cluId); |
| 547 | 185 | return LuServiceAssembler.toCluPublicationInfos(cluPublications); |
| 548 | |
} |
| 549 | |
|
| 550 | |
@Override |
| 551 | |
public List<CluPublicationInfo> getCluPublicationsByType( |
| 552 | |
String luPublicationTypeKey) throws DoesNotExistException, |
| 553 | |
InvalidParameterException, MissingParameterException, |
| 554 | |
OperationFailedException { |
| 555 | 1 | checkForMissingParameter(luPublicationTypeKey, "luPublicationTypeKey"); |
| 556 | 1 | List<CluPublication> cluPublications = luDao.getCluPublicationsByType(luPublicationTypeKey); |
| 557 | 1 | return LuServiceAssembler.toCluPublicationInfos(cluPublications); |
| 558 | |
} |
| 559 | |
|
| 560 | |
@Override |
| 561 | |
public CluPublicationInfo getCluPublication(String cluPublicationId) |
| 562 | |
throws DoesNotExistException, InvalidParameterException, |
| 563 | |
MissingParameterException, OperationFailedException { |
| 564 | 1 | checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
| 565 | 1 | CluPublication cluPublication = luDao.fetch(CluPublication.class, cluPublicationId); |
| 566 | 1 | return LuServiceAssembler.toCluPublicationInfo(cluPublication); |
| 567 | |
} |
| 568 | |
|
| 569 | |
|
| 570 | |
|
| 571 | |
@Override |
| 572 | |
public CluResultInfo getCluResult(String cluResultId) |
| 573 | |
throws DoesNotExistException, InvalidParameterException, |
| 574 | |
MissingParameterException, OperationFailedException { |
| 575 | |
|
| 576 | 4 | checkForMissingParameter(cluResultId, "cluResultId"); |
| 577 | |
|
| 578 | 4 | CluResult cluResult = luDao.fetch(CluResult.class, cluResultId); |
| 579 | 4 | return LuServiceAssembler.toCluResultInfo(cluResult); |
| 580 | |
} |
| 581 | |
|
| 582 | |
@Override |
| 583 | |
public List<CluResultInfo> getCluResultByClu(String cluId) |
| 584 | |
throws DoesNotExistException, InvalidParameterException, |
| 585 | |
MissingParameterException, OperationFailedException { |
| 586 | |
|
| 587 | 122 | checkForMissingParameter(cluId, "cluId"); |
| 588 | |
|
| 589 | 122 | return LuServiceAssembler.toCluResultInfos(luDao |
| 590 | |
.getCluResultByClu(cluId)); |
| 591 | |
} |
| 592 | |
|
| 593 | |
@Override |
| 594 | |
public List<String> getCluIdsByResultUsageType(String resultUsageTypeKey) |
| 595 | |
throws DoesNotExistException, InvalidParameterException, |
| 596 | |
MissingParameterException, OperationFailedException { |
| 597 | 0 | return luDao.getCluIdsByResultUsageType(resultUsageTypeKey); |
| 598 | |
} |
| 599 | |
|
| 600 | |
@Override |
| 601 | |
public List<String> getCluIdsByResultComponent(String resultComponentId) |
| 602 | |
throws DoesNotExistException, InvalidParameterException, |
| 603 | |
MissingParameterException, OperationFailedException { |
| 604 | 0 | return luDao.getCluIdsByResultComponentId(resultComponentId); |
| 605 | |
} |
| 606 | |
|
| 607 | |
|
| 608 | |
|
| 609 | |
@Override |
| 610 | |
public CluLoRelationInfo getCluLoRelation(String cluLoRelationId) |
| 611 | |
throws DoesNotExistException, InvalidParameterException, |
| 612 | |
MissingParameterException, OperationFailedException, |
| 613 | |
PermissionDeniedException { |
| 614 | |
|
| 615 | 1 | checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
| 616 | |
|
| 617 | 1 | CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
| 618 | 1 | return LuServiceAssembler.toCluLoRelationInfo(reltn); |
| 619 | |
|
| 620 | |
} |
| 621 | |
|
| 622 | |
@Override |
| 623 | |
public List<CluLoRelationInfo> getCluLoRelationsByClu(String cluId) |
| 624 | |
throws DoesNotExistException, InvalidParameterException, |
| 625 | |
MissingParameterException, OperationFailedException { |
| 626 | |
|
| 627 | 182 | checkForMissingParameter(cluId, "cluId"); |
| 628 | 182 | List<CluLoRelation> cluLoRelations = luDao |
| 629 | |
.getCluLoRelationsByClu(cluId); |
| 630 | 182 | return LuServiceAssembler.toCluLoRelationInfos(cluLoRelations); |
| 631 | |
|
| 632 | |
} |
| 633 | |
|
| 634 | |
@Override |
| 635 | |
public List<CluLoRelationInfo> getCluLoRelationsByLo(String loId) |
| 636 | |
throws DoesNotExistException, InvalidParameterException, |
| 637 | |
MissingParameterException, OperationFailedException { |
| 638 | 1 | checkForMissingParameter(loId, "loId"); |
| 639 | 1 | List<CluLoRelation> cluLoRelations = luDao.getCluLoRelationsByLo(loId); |
| 640 | 1 | return LuServiceAssembler.toCluLoRelationInfos(cluLoRelations); |
| 641 | |
} |
| 642 | |
|
| 643 | |
|
| 644 | |
|
| 645 | |
@Override |
| 646 | |
public List<String> getResourceRequirementsForCluId(String cluId) |
| 647 | |
throws DoesNotExistException, InvalidParameterException, |
| 648 | |
MissingParameterException, OperationFailedException { |
| 649 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
| 650 | |
} |
| 651 | |
|
| 652 | |
|
| 653 | |
|
| 654 | |
@Override |
| 655 | |
public CluSetInfo getCluSetInfo(String cluSetId) |
| 656 | |
throws DoesNotExistException, InvalidParameterException, |
| 657 | |
MissingParameterException, OperationFailedException, |
| 658 | |
PermissionDeniedException { |
| 659 | 111 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 660 | 110 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 661 | 96 | CluSetInfo cluSetInfo = LuServiceAssembler.toCluSetInfo(cluSet); |
| 662 | 96 | setMembershipQuerySearchResult(cluSetInfo); |
| 663 | 96 | return cluSetInfo; |
| 664 | |
} |
| 665 | |
|
| 666 | |
@Override |
| 667 | |
public CluSetTreeViewInfo getCluSetTreeView(String cluSetId) |
| 668 | |
throws DoesNotExistException, InvalidParameterException, |
| 669 | |
MissingParameterException, OperationFailedException, |
| 670 | |
PermissionDeniedException { |
| 671 | |
|
| 672 | 36 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 673 | 35 | CluSetInfo cluSet = getCluSetInfo(cluSetId); |
| 674 | 34 | if (cluSet == null) { |
| 675 | 0 | return null; |
| 676 | |
} |
| 677 | |
|
| 678 | 34 | CluSetTreeViewInfo cluSetTreeView = new CluSetTreeViewInfo(); |
| 679 | 34 | getCluSetTreeViewHelper(cluSet, cluSetTreeView); |
| 680 | 34 | return cluSetTreeView; |
| 681 | |
} |
| 682 | |
|
| 683 | |
|
| 684 | |
|
| 685 | |
|
| 686 | |
|
| 687 | |
|
| 688 | |
|
| 689 | |
|
| 690 | |
|
| 691 | |
|
| 692 | |
|
| 693 | |
|
| 694 | |
|
| 695 | |
private void getCluSetTreeViewHelper(CluSetInfo cluSetInfo, |
| 696 | |
CluSetTreeViewInfo cluSetTreeViewInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 697 | 38 | cluSetTreeViewInfo.setName(cluSetInfo.getName()); |
| 698 | 38 | cluSetTreeViewInfo.setDescr(cluSetInfo.getDescr()); |
| 699 | 38 | cluSetTreeViewInfo.setEffectiveDate(cluSetInfo.getEffectiveDate()); |
| 700 | 38 | cluSetTreeViewInfo.setExpirationDate(cluSetInfo.getExpirationDate()); |
| 701 | 38 | cluSetTreeViewInfo.setAdminOrg(cluSetInfo.getAdminOrg()); |
| 702 | 38 | cluSetTreeViewInfo.setIsReusable(cluSetInfo.getIsReusable()); |
| 703 | 38 | cluSetTreeViewInfo.setIsReferenceable(cluSetInfo.getIsReferenceable()); |
| 704 | 38 | cluSetTreeViewInfo.setMetaInfo(cluSetInfo.getMetaInfo()); |
| 705 | 38 | cluSetTreeViewInfo.setAttributes(cluSetInfo.getAttributes()); |
| 706 | 38 | cluSetTreeViewInfo.setType(cluSetInfo.getType()); |
| 707 | 38 | cluSetTreeViewInfo.setState(cluSetInfo.getState()); |
| 708 | 38 | cluSetTreeViewInfo.setId(cluSetInfo.getId()); |
| 709 | |
|
| 710 | 38 | if (!cluSetInfo.getCluSetIds().isEmpty()) { |
| 711 | 2 | for (String cluSetId : cluSetInfo.getCluSetIds()) { |
| 712 | 4 | CluSetInfo subCluSet = getCluSetInfo(cluSetId); |
| 713 | 4 | List<CluSetTreeViewInfo> cluSets = |
| 714 | |
cluSetTreeViewInfo.getCluSets() == null ? |
| 715 | |
new ArrayList<CluSetTreeViewInfo>(0) : cluSetTreeViewInfo.getCluSets(); |
| 716 | |
|
| 717 | 4 | CluSetTreeViewInfo subCluSetTreeViewInfo = new CluSetTreeViewInfo(); |
| 718 | 4 | getCluSetTreeViewHelper(subCluSet, subCluSetTreeViewInfo); |
| 719 | 4 | cluSets.add(subCluSetTreeViewInfo); |
| 720 | |
|
| 721 | 4 | cluSetTreeViewInfo.setCluSets(cluSets); |
| 722 | 4 | } |
| 723 | |
} |
| 724 | 38 | List<CluInfo> clus = new ArrayList<CluInfo>(cluSetInfo.getCluIds().size()); |
| 725 | 38 | for (String cluId : cluSetInfo.getCluIds()) { |
| 726 | 171 | if(cluId!=null){ |
| 727 | 171 | clus.add(LuServiceAssembler.toCluInfo(luDao.getCurrentCluVersion(cluId))); |
| 728 | |
} |
| 729 | |
} |
| 730 | 38 | cluSetTreeViewInfo.setClus(clus); |
| 731 | 38 | } |
| 732 | |
|
| 733 | |
@Override |
| 734 | |
public List<CluSetInfo> getCluSetInfoByIdList(List<String> cluSetIdList) |
| 735 | |
throws DoesNotExistException, InvalidParameterException, |
| 736 | |
MissingParameterException, OperationFailedException, |
| 737 | |
PermissionDeniedException { |
| 738 | 5 | checkForMissingParameter(cluSetIdList, "cluSetIdList"); |
| 739 | 4 | checkForEmptyList(cluSetIdList, "cluSetIdList"); |
| 740 | 4 | List<CluSet> cluSets = luDao.getCluSetInfoByIdList(cluSetIdList); |
| 741 | 4 | return LuServiceAssembler.toCluSetInfos(cluSets); |
| 742 | |
} |
| 743 | |
|
| 744 | |
@Override |
| 745 | |
public List<String> getCluSetIdsFromCluSet(String cluSetId) |
| 746 | |
throws DoesNotExistException, InvalidParameterException, |
| 747 | |
MissingParameterException, OperationFailedException, |
| 748 | |
PermissionDeniedException { |
| 749 | 0 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 750 | 0 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 751 | 0 | List<String> ids = new ArrayList<String>(cluSet.getCluVerIndIds().size()); |
| 752 | 0 | if(cluSet.getCluSets()!=null){ |
| 753 | 0 | for (CluSet cluSet2 : cluSet.getCluSets()) { |
| 754 | 0 | ids.add(cluSet2.getId()); |
| 755 | |
} |
| 756 | |
} |
| 757 | 0 | return ids; |
| 758 | |
} |
| 759 | |
|
| 760 | |
@Override |
| 761 | |
public Boolean isCluSetDynamic(String cluSetId) |
| 762 | |
throws DoesNotExistException, InvalidParameterException, |
| 763 | |
MissingParameterException, OperationFailedException, |
| 764 | |
PermissionDeniedException { |
| 765 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
| 766 | |
} |
| 767 | |
|
| 768 | |
@Override |
| 769 | |
public List<CluInfo> getClusFromCluSet(String cluSetId) |
| 770 | |
throws DoesNotExistException, InvalidParameterException, |
| 771 | |
MissingParameterException, OperationFailedException, |
| 772 | |
PermissionDeniedException { |
| 773 | 3 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 774 | 2 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 775 | 1 | List<CluInfo> clus = new ArrayList<CluInfo>(cluSet.getCluVerIndIds().size()); |
| 776 | 1 | for (CluSetJoinVersionIndClu cluSetJnClu : cluSet.getCluVerIndIds()) { |
| 777 | 2 | clus.add(LuServiceAssembler.toCluInfo(luDao.getCurrentCluVersion(cluSetJnClu.getCluVersionIndId()))); |
| 778 | |
} |
| 779 | 1 | return clus; |
| 780 | |
} |
| 781 | |
|
| 782 | |
@Override |
| 783 | |
public List<String> getCluIdsFromCluSet(String cluSetId) |
| 784 | |
throws DoesNotExistException, InvalidParameterException, |
| 785 | |
MissingParameterException, OperationFailedException, |
| 786 | |
PermissionDeniedException { |
| 787 | 3 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 788 | 2 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 789 | 1 | List<String> ids = new ArrayList<String>(cluSet.getCluVerIndIds().size()); |
| 790 | 1 | for (CluSetJoinVersionIndClu cluSetJnClu : cluSet.getCluVerIndIds()) { |
| 791 | 2 | ids.add(cluSetJnClu.getCluVersionIndId()); |
| 792 | |
} |
| 793 | 1 | return ids; |
| 794 | |
} |
| 795 | |
|
| 796 | |
@Override |
| 797 | |
public List<CluInfo> getAllClusInCluSet(String cluSetId) |
| 798 | |
throws DoesNotExistException, InvalidParameterException, |
| 799 | |
MissingParameterException, OperationFailedException, |
| 800 | |
PermissionDeniedException { |
| 801 | 2 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 802 | 2 | List<String> cluIndIds = new ArrayList<String>(); |
| 803 | 2 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 804 | 2 | findClusInCluSet(cluIndIds, cluSet); |
| 805 | 2 | List<CluInfo> infos = new ArrayList<CluInfo>(cluIndIds.size()); |
| 806 | 2 | for (String cluIndId : cluIndIds) { |
| 807 | 5 | infos.add(LuServiceAssembler.toCluInfo(luDao.getCurrentCluVersion(cluIndId))); |
| 808 | |
} |
| 809 | 2 | return infos; |
| 810 | |
} |
| 811 | |
|
| 812 | |
@Override |
| 813 | |
public List<String> getAllCluIdsInCluSet(String cluSetId) |
| 814 | |
throws DoesNotExistException, InvalidParameterException, |
| 815 | |
MissingParameterException, OperationFailedException, |
| 816 | |
PermissionDeniedException { |
| 817 | 1 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 818 | 0 | List<String> ids = new ArrayList<String>(); |
| 819 | 0 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 820 | 0 | findClusInCluSet(ids, cluSet); |
| 821 | 0 | return ids; |
| 822 | |
} |
| 823 | |
|
| 824 | |
@Override |
| 825 | |
public Boolean isCluInCluSet(String cluId, String cluSetId) |
| 826 | |
throws DoesNotExistException, InvalidParameterException, |
| 827 | |
MissingParameterException, OperationFailedException, |
| 828 | |
PermissionDeniedException { |
| 829 | 6 | checkForMissingParameter(cluId, "cluId"); |
| 830 | 5 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 831 | 4 | return luDao.isCluInCluSet(cluId, cluSetId); |
| 832 | |
} |
| 833 | |
|
| 834 | |
|
| 835 | |
|
| 836 | |
|
| 837 | |
@Override |
| 838 | |
public LuiInfo getLui(String luiId) throws DoesNotExistException, |
| 839 | |
InvalidParameterException, MissingParameterException, |
| 840 | |
OperationFailedException { |
| 841 | |
|
| 842 | 4 | checkForMissingParameter(luiId, "luiId"); |
| 843 | |
|
| 844 | 3 | Lui lui = luDao.fetch(Lui.class, luiId); |
| 845 | 2 | return LuServiceAssembler.toLuiInfo(lui); |
| 846 | |
} |
| 847 | |
|
| 848 | |
@Override |
| 849 | |
public List<LuiInfo> getLuisByIdList(List<String> luiIdList) |
| 850 | |
throws DoesNotExistException, InvalidParameterException, |
| 851 | |
MissingParameterException, OperationFailedException { |
| 852 | 3 | checkForMissingParameter(luiIdList, "luiIdList"); |
| 853 | 2 | checkForEmptyList(luiIdList, "luiIdList"); |
| 854 | 2 | List<Lui> luis = luDao.getLuisByIdList(luiIdList); |
| 855 | 2 | return LuServiceAssembler.toLuiInfos(luis); |
| 856 | |
} |
| 857 | |
|
| 858 | |
@Override |
| 859 | |
public List<LuiInfo> getLuisInAtpByCluId(String cluId, String atpKey) |
| 860 | |
throws DoesNotExistException, InvalidParameterException, |
| 861 | |
MissingParameterException, OperationFailedException { |
| 862 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
| 863 | |
} |
| 864 | |
|
| 865 | |
@Override |
| 866 | |
public List<String> getLuiIdsByCluId(String cluId) |
| 867 | |
throws DoesNotExistException, InvalidParameterException, |
| 868 | |
MissingParameterException, OperationFailedException { |
| 869 | |
|
| 870 | 4 | checkForMissingParameter(cluId, "cluId"); |
| 871 | |
|
| 872 | 3 | return luDao.getLuiIdsByCluId(cluId); |
| 873 | |
} |
| 874 | |
|
| 875 | |
@Override |
| 876 | |
public List<String> getLuiIdsInAtpByCluId(String cluId, String atpKey) |
| 877 | |
throws DoesNotExistException, InvalidParameterException, |
| 878 | |
MissingParameterException, OperationFailedException { |
| 879 | |
|
| 880 | 6 | checkForMissingParameter(cluId, "cluId"); |
| 881 | 5 | checkForMissingParameter(atpKey, "atpKey"); |
| 882 | 4 | return luDao.getLuiIdsInAtpByCluId(cluId, atpKey); |
| 883 | |
} |
| 884 | |
|
| 885 | |
|
| 886 | |
|
| 887 | |
@Override |
| 888 | |
public List<String> getAllowedLuLuRelationTypesByLuiId(String luiId, |
| 889 | |
String relatedLuiId) throws DoesNotExistException, |
| 890 | |
InvalidParameterException, MissingParameterException, |
| 891 | |
OperationFailedException { |
| 892 | |
|
| 893 | 0 | checkForMissingParameter(luiId, "luiId"); |
| 894 | 0 | checkForMissingParameter(relatedLuiId, "relatedLuiId"); |
| 895 | |
|
| 896 | 0 | return luDao.getAllowedLuLuRelationTypesByLuiId(luiId, relatedLuiId); |
| 897 | |
} |
| 898 | |
|
| 899 | |
@Override |
| 900 | |
public List<LuiInfo> getLuisByRelation(String luiId, |
| 901 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 902 | |
InvalidParameterException, MissingParameterException, |
| 903 | |
OperationFailedException { |
| 904 | 2 | checkForMissingParameter(luiId, "luiId"); |
| 905 | 2 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 906 | |
|
| 907 | 2 | return LuServiceAssembler.toLuiInfos(luDao.getLuisByRelationType(luiId, |
| 908 | |
luLuRelationTypeKey)); |
| 909 | |
} |
| 910 | |
|
| 911 | |
@Override |
| 912 | |
public List<String> getLuiIdsByRelation(String luiId, |
| 913 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 914 | |
InvalidParameterException, MissingParameterException, |
| 915 | |
OperationFailedException { |
| 916 | 2 | checkForMissingParameter(luiId, "luiId"); |
| 917 | 2 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 918 | |
|
| 919 | 2 | return luDao.getLuiIdsByRelationType(luiId, luLuRelationTypeKey); |
| 920 | |
} |
| 921 | |
|
| 922 | |
@Override |
| 923 | |
public List<LuiInfo> getRelatedLuisByLuiId(String luiId, |
| 924 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 925 | |
InvalidParameterException, MissingParameterException, |
| 926 | |
OperationFailedException { |
| 927 | 1 | checkForMissingParameter(luiId, "luiId"); |
| 928 | 1 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 929 | 1 | List<Lui> relatedLuis = luDao.getRelatedLuisByLuiId(luiId, |
| 930 | |
luLuRelationTypeKey); |
| 931 | 1 | return LuServiceAssembler.toLuiInfos(relatedLuis); |
| 932 | |
} |
| 933 | |
|
| 934 | |
@Override |
| 935 | |
public List<String> getRelatedLuiIdsByLuiId(String luiId, |
| 936 | |
String luLuRelationTypeKey) throws DoesNotExistException, |
| 937 | |
InvalidParameterException, MissingParameterException, |
| 938 | |
OperationFailedException { |
| 939 | 1 | checkForMissingParameter(luiId, "luiId"); |
| 940 | 1 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 941 | 1 | List<String> relatedLuiIds = luDao.getRelatedLuiIdsByLuiId(luiId, |
| 942 | |
luLuRelationTypeKey); |
| 943 | 1 | return relatedLuiIds; |
| 944 | |
} |
| 945 | |
|
| 946 | |
@Override |
| 947 | |
public LuiLuiRelationInfo getLuiLuiRelation(String luiLuiRelationId) |
| 948 | |
throws DoesNotExistException, InvalidParameterException, |
| 949 | |
MissingParameterException, OperationFailedException { |
| 950 | 2 | checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
| 951 | 2 | LuiLuiRelation luiLuiRelation = luDao.fetch(LuiLuiRelation.class, |
| 952 | |
luiLuiRelationId); |
| 953 | 1 | return LuServiceAssembler.toLuiLuiRelationInfo(luiLuiRelation); |
| 954 | |
} |
| 955 | |
|
| 956 | |
@Override |
| 957 | |
public List<LuiLuiRelationInfo> getLuiLuiRelationsByLui(String luiId) |
| 958 | |
throws DoesNotExistException, InvalidParameterException, |
| 959 | |
MissingParameterException, OperationFailedException { |
| 960 | 3 | checkForMissingParameter(luiId, "luiId"); |
| 961 | 3 | List<LuiLuiRelation> entities = luDao.getLuiLuiRelations(luiId); |
| 962 | 3 | return LuServiceAssembler.toLuiLuiRelationInfos(entities); |
| 963 | |
} |
| 964 | |
|
| 965 | |
|
| 966 | |
|
| 967 | |
|
| 968 | |
|
| 969 | |
@Override |
| 970 | |
public List<ValidationResultInfo> validateClu(String validationType, |
| 971 | |
CluInfo cluInfo) throws DoesNotExistException, |
| 972 | |
InvalidParameterException, MissingParameterException, |
| 973 | |
OperationFailedException { |
| 974 | 233 | checkForMissingParameter(validationType, "validationType"); |
| 975 | 233 | checkForMissingParameter(cluInfo, "cluInfo"); |
| 976 | |
|
| 977 | 233 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluInfo.class.getName()); |
| 978 | 233 | Validator defaultValidator = validatorFactory.getValidator(); |
| 979 | 233 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluInfo, objStructure); |
| 980 | |
|
| 981 | 233 | return validationResults; |
| 982 | |
} |
| 983 | |
|
| 984 | |
@Override |
| 985 | |
@Transactional(readOnly=false) |
| 986 | |
public CluInfo createClu(String luTypeKey, CluInfo cluInfo) |
| 987 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 988 | |
DoesNotExistException, InvalidParameterException, |
| 989 | |
MissingParameterException, OperationFailedException, |
| 990 | |
PermissionDeniedException { |
| 991 | 164 | Clu clu = toCluForCreate(luTypeKey,cluInfo); |
| 992 | |
|
| 993 | 164 | if(clu.getVersion() == null){ |
| 994 | 164 | clu.setVersion(new Version()); |
| 995 | |
} |
| 996 | 164 | clu.getVersion().setCurrentVersionStart(new Date()); |
| 997 | 164 | luDao.create(clu); |
| 998 | 164 | return LuServiceAssembler.toCluInfo(clu); |
| 999 | |
} |
| 1000 | |
|
| 1001 | |
public Clu toCluForCreate(String luTypeKey, CluInfo cluInfo) |
| 1002 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 1003 | |
DoesNotExistException, InvalidParameterException, |
| 1004 | |
MissingParameterException, OperationFailedException, |
| 1005 | |
PermissionDeniedException { |
| 1006 | 182 | checkForMissingParameter(luTypeKey, "luTypeKey"); |
| 1007 | 182 | checkForMissingParameter(cluInfo, "cluInfo"); |
| 1008 | |
|
| 1009 | |
|
| 1010 | 182 | List<ValidationResultInfo> val = validateClu("SYSTEM", cluInfo); |
| 1011 | 182 | if(null != val && val.size() > 0) { |
| 1012 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1013 | |
} |
| 1014 | |
|
| 1015 | 182 | Clu clu = new Clu(); |
| 1016 | |
|
| 1017 | 182 | LuType luType = luDao.fetch(LuType.class, luTypeKey); |
| 1018 | 182 | clu.setLuType(luType); |
| 1019 | |
|
| 1020 | 182 | if (cluInfo.getOfficialIdentifier() != null) { |
| 1021 | 56 | clu.setOfficialIdentifier(LuServiceAssembler.createOfficialIdentifier(cluInfo)); |
| 1022 | |
} |
| 1023 | 182 | clu.setAlternateIdentifiers(LuServiceAssembler.createAlternateIdentifiers(cluInfo)); |
| 1024 | 182 | if (cluInfo.getDescr() != null) { |
| 1025 | 56 | LuRichText descr = LuServiceAssembler.toRichText(LuRichText.class, cluInfo.getDescr()); |
| 1026 | 56 | if (descr.getPlain() != null || descr.getFormatted() != null) { |
| 1027 | 56 | clu.setDescr(descr); |
| 1028 | |
} |
| 1029 | |
} |
| 1030 | |
|
| 1031 | 182 | if (clu.getAdminOrgs() == null) { |
| 1032 | 182 | clu.setAdminOrgs(new ArrayList<CluAdminOrg>(0)); |
| 1033 | |
} |
| 1034 | 182 | List<CluAdminOrg> adminOrgs = clu.getAdminOrgs(); |
| 1035 | 182 | for (AdminOrgInfo orgInfo : cluInfo.getAdminOrgs()) { |
| 1036 | 480 | CluAdminOrg instructor = new CluAdminOrg(); |
| 1037 | 480 | BeanUtils.copyProperties(orgInfo, instructor, |
| 1038 | |
new String[] { "attributes" }); |
| 1039 | 480 | instructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1040 | |
CluAdminOrgAttribute.class, orgInfo.getAttributes(), |
| 1041 | |
instructor, luDao)); |
| 1042 | 480 | instructor.setClu(clu); |
| 1043 | 480 | adminOrgs.add(instructor); |
| 1044 | 480 | } |
| 1045 | |
|
| 1046 | 182 | if (cluInfo.getPrimaryInstructor() != null) { |
| 1047 | 25 | CluInstructor primaryInstructor = new CluInstructor(); |
| 1048 | 25 | BeanUtils.copyProperties(cluInfo.getPrimaryInstructor(), |
| 1049 | |
primaryInstructor, new String[] { "attributes" }); |
| 1050 | 25 | primaryInstructor.setAttributes(LuServiceAssembler |
| 1051 | |
.toGenericAttributes(CluInstructorAttribute.class, cluInfo |
| 1052 | |
.getPrimaryInstructor().getAttributes(), |
| 1053 | |
primaryInstructor, luDao)); |
| 1054 | 25 | clu.setPrimaryInstructor(primaryInstructor); |
| 1055 | |
} |
| 1056 | |
|
| 1057 | 182 | if (clu.getInstructors() == null) { |
| 1058 | 182 | clu.setInstructors(new ArrayList<CluInstructor>(0)); |
| 1059 | |
} |
| 1060 | 182 | List<CluInstructor> instructors = clu.getInstructors(); |
| 1061 | 182 | for (CluInstructorInfo instructorInfo : cluInfo.getInstructors()) { |
| 1062 | 60 | CluInstructor instructor = new CluInstructor(); |
| 1063 | 60 | BeanUtils.copyProperties(instructorInfo, instructor, |
| 1064 | |
new String[] { "attributes" }); |
| 1065 | 60 | instructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1066 | |
CluInstructorAttribute.class, instructorInfo |
| 1067 | |
.getAttributes(), instructor, luDao)); |
| 1068 | 60 | instructors.add(instructor); |
| 1069 | 60 | } |
| 1070 | |
|
| 1071 | 182 | if (cluInfo.getStdDuration() != null) { |
| 1072 | 121 | clu.setStdDuration(LuServiceAssembler.toTimeAmount(cluInfo |
| 1073 | |
.getStdDuration())); |
| 1074 | |
} |
| 1075 | |
|
| 1076 | 182 | if (clu.getLuCodes() == null) { |
| 1077 | 182 | clu.setLuCodes(new ArrayList<LuCode>(0)); |
| 1078 | |
} |
| 1079 | 182 | List<LuCode> luCodes = clu.getLuCodes(); |
| 1080 | 182 | for (LuCodeInfo luCodeInfo : cluInfo.getLuCodes()) { |
| 1081 | 101 | LuCode luCode = new LuCode(); |
| 1082 | 101 | luCode.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1083 | |
LuCodeAttribute.class, luCodeInfo.getAttributes(), luCode, |
| 1084 | |
luDao)); |
| 1085 | 101 | BeanUtils.copyProperties(luCodeInfo, luCode, new String[] { |
| 1086 | |
"attributes", "metaInfo" }); |
| 1087 | 101 | luCode.setDescr(luCodeInfo.getDescr()); |
| 1088 | 101 | luCode.setClu(clu); |
| 1089 | 101 | luCodes.add(luCode); |
| 1090 | 101 | } |
| 1091 | |
|
| 1092 | 182 | if (clu.getOfferedAtpTypes() == null) { |
| 1093 | 182 | clu.setOfferedAtpTypes(new ArrayList<CluAtpTypeKey>(0)); |
| 1094 | |
} |
| 1095 | 182 | List<CluAtpTypeKey> offeredAtpTypes = clu.getOfferedAtpTypes(); |
| 1096 | 182 | for (String atpTypeKey : cluInfo.getOfferedAtpTypes()) { |
| 1097 | 50 | CluAtpTypeKey cluAtpTypeKey = new CluAtpTypeKey(); |
| 1098 | 50 | cluAtpTypeKey.setAtpTypeKey(atpTypeKey); |
| 1099 | 50 | cluAtpTypeKey.setClu(clu); |
| 1100 | 50 | offeredAtpTypes.add(cluAtpTypeKey); |
| 1101 | 50 | } |
| 1102 | |
|
| 1103 | |
|
| 1104 | 182 | if (cluInfo.getFeeInfo() != null) { |
| 1105 | 25 | CluFee cluFee = null; |
| 1106 | |
try { |
| 1107 | 25 | cluFee = LuServiceAssembler.toCluFee(clu, false, cluInfo |
| 1108 | |
.getFeeInfo(), luDao); |
| 1109 | 0 | } catch (VersionMismatchException e) { |
| 1110 | |
|
| 1111 | 25 | } |
| 1112 | 25 | clu.setFee(cluFee); |
| 1113 | |
} |
| 1114 | |
|
| 1115 | 182 | if (cluInfo.getAccountingInfo() != null) { |
| 1116 | 25 | CluAccounting cluAccounting = new CluAccounting(); |
| 1117 | 25 | cluAccounting.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1118 | |
CluAccountingAttribute.class, cluInfo.getAccountingInfo() |
| 1119 | |
.getAttributes(), cluAccounting, luDao)); |
| 1120 | 25 | cluAccounting.setAffiliatedOrgs(LuServiceAssembler |
| 1121 | |
.toAffiliatedOrgs(false, cluAccounting.getAffiliatedOrgs(), |
| 1122 | |
cluInfo.getAccountingInfo().getAffiliatedOrgs(), |
| 1123 | |
luDao)); |
| 1124 | 25 | clu.setAccounting(cluAccounting); |
| 1125 | |
} |
| 1126 | |
|
| 1127 | 182 | clu.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1128 | |
CluAttribute.class, cluInfo.getAttributes(), clu, luDao)); |
| 1129 | |
|
| 1130 | |
|
| 1131 | 182 | if (cluInfo.getIntensity() != null) { |
| 1132 | 121 | clu.setIntensity(LuServiceAssembler |
| 1133 | |
.toAmount(cluInfo.getIntensity())); |
| 1134 | |
} |
| 1135 | |
|
| 1136 | 182 | if (clu.getCampusLocations() == null) { |
| 1137 | 182 | clu.setCampusLocations(new ArrayList<CluCampusLocation>(0)); |
| 1138 | |
} |
| 1139 | 182 | List<CluCampusLocation> locations = clu.getCampusLocations(); |
| 1140 | 182 | for (String locationName : cluInfo.getCampusLocations()) { |
| 1141 | 82 | CluCampusLocation location = new CluCampusLocation(); |
| 1142 | 82 | location.setCampusLocation(locationName); |
| 1143 | 82 | location.setClu(clu); |
| 1144 | 82 | locations.add(location); |
| 1145 | 82 | } |
| 1146 | |
|
| 1147 | 182 | if (clu.getAccreditations() == null) { |
| 1148 | 182 | clu.setAccreditations(new ArrayList<CluAccreditation>(0)); |
| 1149 | |
} |
| 1150 | 182 | List<CluAccreditation> accreditations = clu.getAccreditations(); |
| 1151 | 182 | for (AccreditationInfo accreditationInfo : cluInfo.getAccreditations()) { |
| 1152 | 18 | CluAccreditation accreditation = new CluAccreditation(); |
| 1153 | 18 | BeanUtils.copyProperties(accreditationInfo, accreditation, |
| 1154 | |
new String[] { "attributes" }); |
| 1155 | 18 | accreditation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1156 | |
CluAccreditationAttribute.class, accreditationInfo |
| 1157 | |
.getAttributes(), accreditation, luDao)); |
| 1158 | 18 | accreditations.add(accreditation); |
| 1159 | 18 | } |
| 1160 | |
|
| 1161 | |
|
| 1162 | 182 | BeanUtils.copyProperties(cluInfo, clu, new String[] { "luType", |
| 1163 | |
"officialIdentifier", "alternateIdentifiers", "descr", |
| 1164 | |
"luCodes", "primaryInstructor", "instructors", "stdDuration", |
| 1165 | |
"offeredAtpTypes", "feeInfo", "accountingInfo", "attributes", |
| 1166 | |
"metaInfo", "versionInfo", "intensity", |
| 1167 | |
"campusLocations", "accreditations", |
| 1168 | |
"adminOrgs" }); |
| 1169 | |
|
| 1170 | 182 | return clu; |
| 1171 | |
} |
| 1172 | |
|
| 1173 | |
@Override |
| 1174 | |
@Transactional(readOnly=false) |
| 1175 | |
public CluInfo updateClu(String cluId, CluInfo cluInfo) |
| 1176 | |
throws DataValidationErrorException, DoesNotExistException, |
| 1177 | |
InvalidParameterException, MissingParameterException, |
| 1178 | |
OperationFailedException, PermissionDeniedException, |
| 1179 | |
VersionMismatchException { |
| 1180 | |
|
| 1181 | 50 | checkForMissingParameter(cluId, "cluId"); |
| 1182 | 50 | checkForMissingParameter(cluInfo, "cluInfo"); |
| 1183 | |
|
| 1184 | |
|
| 1185 | 50 | List<ValidationResultInfo> val = validateClu("SYSTEM", cluInfo); |
| 1186 | 50 | if(null != val && val.size() > 0) { |
| 1187 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1188 | |
} |
| 1189 | |
|
| 1190 | 50 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 1191 | |
|
| 1192 | 50 | if (!String.valueOf(clu.getVersionNumber()).equals( |
| 1193 | |
cluInfo.getMetaInfo().getVersionInd())) { |
| 1194 | 2 | throw new VersionMismatchException( |
| 1195 | |
"Clu to be updated is not the current version"); |
| 1196 | |
} |
| 1197 | |
|
| 1198 | 48 | LuType luType = luDao.fetch(LuType.class, cluInfo.getType()); |
| 1199 | 48 | clu.setLuType(luType); |
| 1200 | |
|
| 1201 | 48 | if (cluInfo.getOfficialIdentifier() != null) { |
| 1202 | 46 | LuServiceAssembler.updateOfficialIdentifier(clu, cluInfo); |
| 1203 | 2 | } else if (clu.getOfficialIdentifier() != null) { |
| 1204 | 0 | luDao.delete(clu.getOfficialIdentifier()); |
| 1205 | |
} |
| 1206 | |
|
| 1207 | |
|
| 1208 | |
|
| 1209 | |
|
| 1210 | 48 | Map<String, CluIdentifier> oldAltIdMap = new HashMap<String, CluIdentifier>(); |
| 1211 | 48 | LuServiceAssembler.updateAlternateIdentifier(oldAltIdMap, clu, cluInfo); |
| 1212 | |
|
| 1213 | 48 | for (Entry<String, CluIdentifier> entry : oldAltIdMap.entrySet()) { |
| 1214 | 1 | luDao.delete(entry.getValue()); |
| 1215 | |
} |
| 1216 | |
|
| 1217 | 48 | if (cluInfo.getDescr() != null && (cluInfo.getDescr().getPlain() != null || cluInfo.getDescr().getFormatted() != null)) { |
| 1218 | 46 | if (clu.getDescr() == null) { |
| 1219 | 0 | clu.setDescr(new LuRichText()); |
| 1220 | |
} |
| 1221 | 46 | BeanUtils.copyProperties(cluInfo.getDescr(), clu.getDescr()); |
| 1222 | 2 | } else if (clu.getDescr() != null) { |
| 1223 | 0 | luDao.delete(clu.getDescr()); |
| 1224 | 0 | clu.setDescr(null); |
| 1225 | |
} |
| 1226 | |
|
| 1227 | 48 | if (cluInfo.getPrimaryInstructor() != null) { |
| 1228 | 36 | if (clu.getPrimaryInstructor() == null) { |
| 1229 | 0 | clu.setPrimaryInstructor(new CluInstructor()); |
| 1230 | |
} |
| 1231 | 36 | BeanUtils.copyProperties(cluInfo.getPrimaryInstructor(), clu |
| 1232 | |
.getPrimaryInstructor(), new String[] { "attributes" }); |
| 1233 | 36 | clu.getPrimaryInstructor().setAttributes( |
| 1234 | |
LuServiceAssembler.toGenericAttributes( |
| 1235 | |
CluInstructorAttribute.class, cluInfo |
| 1236 | |
.getPrimaryInstructor().getAttributes(), |
| 1237 | |
clu.getPrimaryInstructor(), luDao)); |
| 1238 | 12 | } else if (clu.getPrimaryInstructor() != null) { |
| 1239 | 0 | luDao.delete(clu.getPrimaryInstructor()); |
| 1240 | |
} |
| 1241 | |
|
| 1242 | |
|
| 1243 | |
|
| 1244 | |
|
| 1245 | 48 | Map<String, CluInstructor> oldInstructorMap = new HashMap<String, CluInstructor>(); |
| 1246 | 48 | for (CluInstructor cluInstructor : clu.getInstructors()) { |
| 1247 | 30 | oldInstructorMap.put(cluInstructor.getOrgId() + "_" |
| 1248 | |
+ cluInstructor.getPersonId(), cluInstructor); |
| 1249 | |
} |
| 1250 | 48 | clu.getInstructors().clear(); |
| 1251 | |
|
| 1252 | |
|
| 1253 | |
|
| 1254 | |
|
| 1255 | 48 | for (CluInstructorInfo instructorInfo : cluInfo.getInstructors()) { |
| 1256 | 30 | CluInstructor cluInstructor = oldInstructorMap |
| 1257 | |
.remove(instructorInfo.getOrgId() + "_" |
| 1258 | |
+ instructorInfo.getPersonId()); |
| 1259 | 30 | if (cluInstructor == null) { |
| 1260 | 3 | cluInstructor = new CluInstructor(); |
| 1261 | |
} |
| 1262 | |
|
| 1263 | 30 | BeanUtils.copyProperties(instructorInfo, cluInstructor, |
| 1264 | |
new String[] { "attributes" }); |
| 1265 | 30 | cluInstructor.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1266 | |
CluInstructorAttribute.class, instructorInfo |
| 1267 | |
.getAttributes(), cluInstructor, luDao)); |
| 1268 | 30 | clu.getInstructors().add(cluInstructor); |
| 1269 | 30 | } |
| 1270 | |
|
| 1271 | |
|
| 1272 | 48 | for (Entry<String, CluInstructor> entry : oldInstructorMap.entrySet()) { |
| 1273 | 1 | luDao.delete(entry.getValue()); |
| 1274 | |
} |
| 1275 | |
|
| 1276 | 48 | if (cluInfo.getStdDuration() != null) { |
| 1277 | 36 | if (clu.getStdDuration() == null) { |
| 1278 | 0 | clu.setStdDuration(new TimeAmount()); |
| 1279 | |
} |
| 1280 | 36 | BeanUtils.copyProperties(cluInfo.getStdDuration(), clu |
| 1281 | |
.getStdDuration()); |
| 1282 | 12 | } else if (clu.getStdDuration() != null) { |
| 1283 | 0 | luDao.delete(clu.getStdDuration()); |
| 1284 | |
} |
| 1285 | |
|
| 1286 | |
|
| 1287 | |
|
| 1288 | |
|
| 1289 | 48 | Map<String, LuCode> oldLuCodeMap = new HashMap<String, LuCode>(); |
| 1290 | 48 | for (LuCode luCode : clu.getLuCodes()) { |
| 1291 | 138 | oldLuCodeMap.put(luCode.getId(), luCode); |
| 1292 | |
} |
| 1293 | 48 | clu.getLuCodes().clear(); |
| 1294 | |
|
| 1295 | |
|
| 1296 | |
|
| 1297 | |
|
| 1298 | 48 | for (LuCodeInfo luCodeInfo : cluInfo.getLuCodes()) { |
| 1299 | 136 | LuCode luCode = oldLuCodeMap.remove(luCodeInfo.getId()); |
| 1300 | 136 | if (luCode == null) { |
| 1301 | 135 | luCode = new LuCode(); |
| 1302 | |
} else { |
| 1303 | 1 | if (!String.valueOf(luCode.getVersionNumber()).equals( |
| 1304 | |
luCodeInfo.getMetaInfo().getVersionInd())) { |
| 1305 | 0 | throw new VersionMismatchException( |
| 1306 | |
"LuCode to be updated is not the current version"); |
| 1307 | |
} |
| 1308 | |
} |
| 1309 | |
|
| 1310 | 136 | luCode.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1311 | |
LuCodeAttribute.class, luCodeInfo.getAttributes(), luCode, |
| 1312 | |
luDao)); |
| 1313 | 136 | BeanUtils.copyProperties(luCodeInfo, luCode, new String[] { |
| 1314 | |
"attributes", "metaInfo" }); |
| 1315 | 136 | luCode.setDescr(luCodeInfo.getDescr()); |
| 1316 | 136 | luCode.setClu(clu); |
| 1317 | 136 | clu.getLuCodes().add(luCode); |
| 1318 | 136 | } |
| 1319 | |
|
| 1320 | |
|
| 1321 | 48 | for (Entry<String, LuCode> entry : oldLuCodeMap.entrySet()) { |
| 1322 | 137 | luDao.delete(entry.getValue()); |
| 1323 | |
} |
| 1324 | |
|
| 1325 | |
|
| 1326 | |
|
| 1327 | |
|
| 1328 | 48 | Map<String, CluAtpTypeKey> oldOfferedAtpTypesMap = new HashMap<String, CluAtpTypeKey>(); |
| 1329 | 48 | for (CluAtpTypeKey cluAtpTypeKey : clu.getOfferedAtpTypes()) { |
| 1330 | 20 | oldOfferedAtpTypesMap.put(cluAtpTypeKey.getAtpTypeKey(), |
| 1331 | |
cluAtpTypeKey); |
| 1332 | |
} |
| 1333 | 48 | clu.getOfferedAtpTypes().clear(); |
| 1334 | |
|
| 1335 | |
|
| 1336 | |
|
| 1337 | |
|
| 1338 | 48 | for (String atpTypeKey : cluInfo.getOfferedAtpTypes()) { |
| 1339 | 20 | CluAtpTypeKey cluAtpTypeKey = oldOfferedAtpTypesMap |
| 1340 | |
.remove(atpTypeKey); |
| 1341 | 20 | if (cluAtpTypeKey == null) { |
| 1342 | 1 | cluAtpTypeKey = new CluAtpTypeKey(); |
| 1343 | |
} |
| 1344 | |
|
| 1345 | 20 | cluAtpTypeKey.setAtpTypeKey(atpTypeKey); |
| 1346 | 20 | cluAtpTypeKey.setClu(clu); |
| 1347 | 20 | clu.getOfferedAtpTypes().add(cluAtpTypeKey); |
| 1348 | 20 | } |
| 1349 | |
|
| 1350 | |
|
| 1351 | 48 | for (Entry<String, CluAtpTypeKey> entry : oldOfferedAtpTypesMap |
| 1352 | |
.entrySet()) { |
| 1353 | 1 | luDao.delete(entry.getValue()); |
| 1354 | |
} |
| 1355 | |
|
| 1356 | 48 | if (cluInfo.getFeeInfo() != null) { |
| 1357 | 10 | if (clu.getFee() == null) { |
| 1358 | 0 | clu.setFee(LuServiceAssembler.toCluFee(clu, false, cluInfo |
| 1359 | |
.getFeeInfo(), luDao)); |
| 1360 | |
} else { |
| 1361 | 10 | clu.setFee(LuServiceAssembler.toCluFee(clu, true, cluInfo |
| 1362 | |
.getFeeInfo(), luDao)); |
| 1363 | |
} |
| 1364 | 38 | } else if (clu.getFee() != null) { |
| 1365 | 0 | luDao.delete(clu.getFee()); |
| 1366 | 0 | clu.setFee(null); |
| 1367 | |
} |
| 1368 | |
|
| 1369 | 48 | if (cluInfo.getAccountingInfo() != null) { |
| 1370 | 10 | if (clu.getAccounting() == null) { |
| 1371 | 0 | clu.setAccounting(new CluAccounting()); |
| 1372 | |
} |
| 1373 | 10 | clu.getAccounting().setAttributes( |
| 1374 | |
LuServiceAssembler.toGenericAttributes( |
| 1375 | |
CluAccountingAttribute.class, cluInfo |
| 1376 | |
.getAccountingInfo().getAttributes(), clu |
| 1377 | |
.getAccounting(), luDao)); |
| 1378 | 10 | clu.getAccounting().setAffiliatedOrgs(LuServiceAssembler |
| 1379 | |
.toAffiliatedOrgs(true, clu.getAccounting().getAffiliatedOrgs(), |
| 1380 | |
cluInfo.getAccountingInfo().getAffiliatedOrgs(), |
| 1381 | |
luDao)); |
| 1382 | |
|
| 1383 | 38 | } else if (clu.getAccounting() != null) { |
| 1384 | 0 | clu.setAccounting(null); |
| 1385 | |
} |
| 1386 | |
|
| 1387 | 48 | clu.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1388 | |
CluAttribute.class, cluInfo.getAttributes(), clu, luDao)); |
| 1389 | |
|
| 1390 | 48 | if (cluInfo.getIntensity() != null) { |
| 1391 | 36 | if (clu.getIntensity() == null) { |
| 1392 | 0 | clu.setIntensity(new Amount()); |
| 1393 | |
} |
| 1394 | 36 | BeanUtils |
| 1395 | |
.copyProperties(cluInfo.getIntensity(), clu.getIntensity()); |
| 1396 | 12 | } else if (clu.getIntensity() != null) { |
| 1397 | 0 | luDao.delete(clu.getIntensity()); |
| 1398 | |
} |
| 1399 | |
|
| 1400 | |
|
| 1401 | |
|
| 1402 | |
|
| 1403 | 48 | Map<String, CluCampusLocation> oldLocationsMap = new HashMap<String, CluCampusLocation>(); |
| 1404 | 48 | for (CluCampusLocation campus : clu.getCampusLocations()) { |
| 1405 | 75 | oldLocationsMap.put(campus.getCampusLocation(), campus); |
| 1406 | |
} |
| 1407 | 48 | clu.getCampusLocations().clear(); |
| 1408 | |
|
| 1409 | |
|
| 1410 | |
|
| 1411 | |
|
| 1412 | 48 | for (String locationName : cluInfo.getCampusLocations()) { |
| 1413 | 77 | CluCampusLocation location = oldLocationsMap.remove(locationName); |
| 1414 | 77 | if (location == null) { |
| 1415 | 4 | location = new CluCampusLocation(); |
| 1416 | |
} |
| 1417 | |
|
| 1418 | 77 | location.setCampusLocation(locationName); |
| 1419 | 77 | location.setClu(clu); |
| 1420 | 77 | clu.getCampusLocations().add(location); |
| 1421 | 77 | } |
| 1422 | |
|
| 1423 | |
|
| 1424 | 48 | for (Entry<String, CluCampusLocation> entry : oldLocationsMap |
| 1425 | |
.entrySet()) { |
| 1426 | 2 | luDao.delete(entry.getValue()); |
| 1427 | |
} |
| 1428 | |
|
| 1429 | |
|
| 1430 | |
|
| 1431 | |
|
| 1432 | 48 | Map<String, CluAccreditation> oldAccreditationMap = new HashMap<String, CluAccreditation>(); |
| 1433 | 48 | for (CluAccreditation cluAccreditation : clu.getAccreditations()) { |
| 1434 | 12 | oldAccreditationMap.put(cluAccreditation.getId(), |
| 1435 | |
cluAccreditation); |
| 1436 | |
} |
| 1437 | 48 | clu.getAccreditations().clear(); |
| 1438 | |
|
| 1439 | |
|
| 1440 | |
|
| 1441 | |
|
| 1442 | 48 | for (AccreditationInfo accreditationInfo : cluInfo.getAccreditations()) { |
| 1443 | 13 | CluAccreditation cluAccreditation = null; |
| 1444 | 13 | if(accreditationInfo.getId()!=null){ |
| 1445 | 11 | cluAccreditation = oldAccreditationMap.remove(accreditationInfo.getId()); |
| 1446 | |
} |
| 1447 | |
|
| 1448 | 13 | if (cluAccreditation == null) { |
| 1449 | 2 | cluAccreditation = new CluAccreditation(); |
| 1450 | |
} |
| 1451 | |
|
| 1452 | 13 | BeanUtils.copyProperties(accreditationInfo, cluAccreditation, |
| 1453 | |
new String[] { "attributes" }); |
| 1454 | 13 | cluAccreditation.setAttributes(LuServiceAssembler |
| 1455 | |
.toGenericAttributes(CluAccreditationAttribute.class, |
| 1456 | |
accreditationInfo.getAttributes(), |
| 1457 | |
cluAccreditation, luDao)); |
| 1458 | 13 | clu.getAccreditations().add(cluAccreditation); |
| 1459 | 13 | } |
| 1460 | |
|
| 1461 | |
|
| 1462 | 48 | for (Entry<String, CluAccreditation> entry : oldAccreditationMap |
| 1463 | |
.entrySet()) { |
| 1464 | 1 | luDao.delete(entry.getValue()); |
| 1465 | |
} |
| 1466 | |
|
| 1467 | |
|
| 1468 | |
|
| 1469 | |
|
| 1470 | 48 | Map<String, CluAdminOrg> oldAdminOrgsMap = new HashMap<String, CluAdminOrg>(); |
| 1471 | 48 | if(clu.getAdminOrgs()!=null){ |
| 1472 | 48 | for (CluAdminOrg cluOrg : clu.getAdminOrgs()) { |
| 1473 | 413 | oldAdminOrgsMap.put(cluOrg.getId(), cluOrg); |
| 1474 | |
} |
| 1475 | |
} |
| 1476 | 48 | clu.setAdminOrgs(new ArrayList<CluAdminOrg>()); |
| 1477 | |
|
| 1478 | |
|
| 1479 | |
|
| 1480 | |
|
| 1481 | 48 | for (AdminOrgInfo orgInfo : cluInfo.getAdminOrgs()) { |
| 1482 | 412 | CluAdminOrg cluOrg = null; |
| 1483 | 412 | if(orgInfo.getId() != null){ |
| 1484 | 2 | cluOrg = oldAdminOrgsMap.remove(orgInfo.getId()); |
| 1485 | |
} |
| 1486 | |
|
| 1487 | 412 | if (cluOrg == null) { |
| 1488 | 410 | cluOrg = new CluAdminOrg(); |
| 1489 | |
} |
| 1490 | |
|
| 1491 | |
|
| 1492 | 412 | BeanUtils.copyProperties(orgInfo, cluOrg, |
| 1493 | |
new String[] { "attributes","id" }); |
| 1494 | 412 | cluOrg.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1495 | |
CluAdminOrgAttribute.class, orgInfo.getAttributes(), |
| 1496 | |
cluOrg, luDao)); |
| 1497 | 412 | cluOrg.setClu(clu); |
| 1498 | 412 | clu.getAdminOrgs().add(cluOrg); |
| 1499 | 412 | } |
| 1500 | |
|
| 1501 | 48 | for (Entry<String, CluAdminOrg> entry : oldAdminOrgsMap.entrySet()) { |
| 1502 | 411 | luDao.delete(entry.getValue()); |
| 1503 | |
} |
| 1504 | |
|
| 1505 | |
|
| 1506 | 48 | BeanUtils.copyProperties(cluInfo, clu, new String[] { "luType", |
| 1507 | |
"officialIdentifier", "alternateIdentifiers", "descr", |
| 1508 | |
"luCodes", "primaryInstructor", "instructors", "stdDuration", |
| 1509 | |
"offeredAtpTypes", "feeInfo", "accountingInfo", "attributes", |
| 1510 | |
"metaInfo","intensity", |
| 1511 | |
"campusLocations", "accreditations", |
| 1512 | |
"adminOrgs" }); |
| 1513 | 48 | Clu updated = null; |
| 1514 | |
try { |
| 1515 | 48 | updated = luDao.update(clu); |
| 1516 | 0 | } catch (Exception e) { |
| 1517 | 0 | logger.error("Exception occured: ", e); |
| 1518 | 48 | } |
| 1519 | 48 | return LuServiceAssembler.toCluInfo(updated); |
| 1520 | |
} |
| 1521 | |
|
| 1522 | |
@Override |
| 1523 | |
@Transactional(readOnly=false) |
| 1524 | |
public StatusInfo deleteClu(String cluId) throws DoesNotExistException, |
| 1525 | |
InvalidParameterException, MissingParameterException, |
| 1526 | |
DependentObjectsExistException, OperationFailedException, |
| 1527 | |
PermissionDeniedException { |
| 1528 | 14 | checkForMissingParameter(cluId, "cluId"); |
| 1529 | |
|
| 1530 | 14 | luDao.delete(Clu.class, cluId); |
| 1531 | |
|
| 1532 | 14 | StatusInfo statusInfo = new StatusInfo(); |
| 1533 | 14 | statusInfo.setSuccess(true); |
| 1534 | |
|
| 1535 | 14 | return statusInfo; |
| 1536 | |
} |
| 1537 | |
|
| 1538 | |
@Override |
| 1539 | |
@Transactional(readOnly=false) |
| 1540 | |
public CluInfo updateCluState(String cluId, String luState) |
| 1541 | |
throws DataValidationErrorException, DoesNotExistException, |
| 1542 | |
InvalidParameterException, MissingParameterException, |
| 1543 | |
OperationFailedException, PermissionDeniedException { |
| 1544 | |
|
| 1545 | 0 | checkForMissingParameter(cluId, "cluId"); |
| 1546 | 0 | checkForMissingParameter(luState, "luState"); |
| 1547 | 0 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 1548 | 0 | clu.setState(luState); |
| 1549 | 0 | Clu updated = luDao.update(clu); |
| 1550 | 0 | return LuServiceAssembler.toCluInfo(updated); |
| 1551 | |
} |
| 1552 | |
|
| 1553 | |
@Override |
| 1554 | |
public List<ValidationResultInfo> validateCluCluRelation( |
| 1555 | |
String validationType, CluCluRelationInfo cluCluRelationInfo) |
| 1556 | |
throws DoesNotExistException, InvalidParameterException, |
| 1557 | |
MissingParameterException, OperationFailedException { |
| 1558 | 178 | checkForMissingParameter(validationType, "validationType"); |
| 1559 | 178 | checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
| 1560 | |
|
| 1561 | 178 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluCluRelationInfo.class.getName()); |
| 1562 | 178 | Validator defaultValidator = validatorFactory.getValidator(); |
| 1563 | 178 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluCluRelationInfo, objStructure); |
| 1564 | |
|
| 1565 | 178 | return validationResults; |
| 1566 | |
} |
| 1567 | |
|
| 1568 | |
@Override |
| 1569 | |
@Transactional(readOnly=false) |
| 1570 | |
public CluCluRelationInfo createCluCluRelation(String cluId, |
| 1571 | |
String relatedCluId, String luLuRelationTypeKey, |
| 1572 | |
CluCluRelationInfo cluCluRelationInfo) |
| 1573 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 1574 | |
DoesNotExistException, InvalidParameterException, |
| 1575 | |
MissingParameterException, OperationFailedException, |
| 1576 | |
PermissionDeniedException, CircularRelationshipException { |
| 1577 | 176 | checkForMissingParameter(cluId, "cluId"); |
| 1578 | 176 | checkForMissingParameter(relatedCluId, "relatedCluId"); |
| 1579 | 176 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 1580 | 176 | checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
| 1581 | |
|
| 1582 | 176 | if (cluId.equals(relatedCluId)) { |
| 1583 | 0 | throw new CircularRelationshipException( |
| 1584 | |
"Can not relate a Clu to itself"); |
| 1585 | |
} |
| 1586 | |
|
| 1587 | |
|
| 1588 | 176 | List<ValidationResultInfo> val = validateCluCluRelation("SYSTEM", cluCluRelationInfo); |
| 1589 | 176 | if(null != val && val.size() > 0) { |
| 1590 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1591 | |
} |
| 1592 | |
|
| 1593 | |
|
| 1594 | 176 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 1595 | 176 | Clu relatedClu = luDao.fetch(Clu.class, relatedCluId); |
| 1596 | |
|
| 1597 | 176 | CluCluRelation cluCluRelation = new CluCluRelation(); |
| 1598 | 176 | BeanUtils.copyProperties(cluCluRelationInfo, cluCluRelation, |
| 1599 | |
new String[] { "cluId", "relatedCluId", |
| 1600 | |
"isCluRelationRequired", "attributes", "metaInfo" }); |
| 1601 | |
|
| 1602 | 176 | cluCluRelation.setClu(clu); |
| 1603 | 176 | cluCluRelation.setRelatedClu(relatedClu); |
| 1604 | 176 | cluCluRelation.setCluRelationRequired(cluCluRelationInfo |
| 1605 | |
.getIsCluRelationRequired() == null ? true : cluCluRelationInfo |
| 1606 | |
.getIsCluRelationRequired()); |
| 1607 | |
|
| 1608 | 176 | cluCluRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1609 | |
CluCluRelationAttribute.class, cluCluRelationInfo |
| 1610 | |
.getAttributes(), cluCluRelation, luDao)); |
| 1611 | |
|
| 1612 | 176 | LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
| 1613 | |
luLuRelationTypeKey); |
| 1614 | |
|
| 1615 | 176 | cluCluRelation.setLuLuRelationType(luLuRelationType); |
| 1616 | |
|
| 1617 | 176 | luDao.create(cluCluRelation); |
| 1618 | |
|
| 1619 | 176 | return LuServiceAssembler.toCluCluRelationInfo(cluCluRelation); |
| 1620 | |
} |
| 1621 | |
|
| 1622 | |
@Override |
| 1623 | |
@Transactional(readOnly=false) |
| 1624 | |
public CluCluRelationInfo updateCluCluRelation( |
| 1625 | |
final String cluCluRelationId, |
| 1626 | |
final CluCluRelationInfo cluCluRelationInfo) |
| 1627 | |
throws DataValidationErrorException, DoesNotExistException, |
| 1628 | |
InvalidParameterException, MissingParameterException, |
| 1629 | |
OperationFailedException, PermissionDeniedException, |
| 1630 | |
VersionMismatchException { |
| 1631 | 2 | checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
| 1632 | 2 | checkForMissingParameter(cluCluRelationInfo, "cluCluRelationInfo"); |
| 1633 | |
|
| 1634 | |
|
| 1635 | 2 | List<ValidationResultInfo> val = validateCluCluRelation("SYSTEM", cluCluRelationInfo); |
| 1636 | 2 | if(null != val && val.size() > 0) { |
| 1637 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1638 | |
} |
| 1639 | |
|
| 1640 | 2 | final CluCluRelation cluCluRelation = luDao.fetch(CluCluRelation.class, |
| 1641 | |
cluCluRelationId); |
| 1642 | 2 | BeanUtils.copyProperties(cluCluRelationInfo, cluCluRelation, |
| 1643 | |
new String[] { "cluId", "relatedCluId", |
| 1644 | |
"isCluRelationRequired", "attributes", "metaInfo" }); |
| 1645 | |
|
| 1646 | 2 | cluCluRelation.setClu(luDao.fetch(Clu.class, cluCluRelationInfo |
| 1647 | |
.getCluId())); |
| 1648 | 2 | cluCluRelation.setRelatedClu(luDao.fetch(Clu.class, cluCluRelationInfo |
| 1649 | |
.getRelatedCluId())); |
| 1650 | 2 | cluCluRelation.setCluRelationRequired(cluCluRelationInfo |
| 1651 | |
.getIsCluRelationRequired() == null ? true : cluCluRelationInfo |
| 1652 | |
.getIsCluRelationRequired()); |
| 1653 | |
|
| 1654 | 2 | cluCluRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 1655 | |
CluCluRelationAttribute.class, cluCluRelationInfo |
| 1656 | |
.getAttributes(), cluCluRelation, luDao)); |
| 1657 | |
|
| 1658 | 2 | cluCluRelation.setLuLuRelationType(luDao.fetch(LuLuRelationType.class, |
| 1659 | |
cluCluRelationInfo.getType())); |
| 1660 | |
|
| 1661 | 2 | final CluCluRelation update = luDao.update(cluCluRelation); |
| 1662 | |
|
| 1663 | 2 | return LuServiceAssembler.toCluCluRelationInfo(update); |
| 1664 | |
} |
| 1665 | |
|
| 1666 | |
@Override |
| 1667 | |
@Transactional(readOnly=false) |
| 1668 | |
public StatusInfo deleteCluCluRelation(String cluCluRelationId) |
| 1669 | |
throws DoesNotExistException, InvalidParameterException, |
| 1670 | |
MissingParameterException, OperationFailedException, |
| 1671 | |
PermissionDeniedException { |
| 1672 | 20 | checkForMissingParameter(cluCluRelationId, "cluCluRelationId"); |
| 1673 | |
|
| 1674 | 20 | luDao.delete(CluCluRelation.class, cluCluRelationId); |
| 1675 | |
|
| 1676 | 20 | StatusInfo statusInfo = new StatusInfo(); |
| 1677 | 20 | statusInfo.setSuccess(true); |
| 1678 | |
|
| 1679 | 20 | return statusInfo; |
| 1680 | |
} |
| 1681 | |
|
| 1682 | |
@Override |
| 1683 | |
public List<ValidationResultInfo> validateCluPublication( |
| 1684 | |
String validationType, CluPublicationInfo cluPublicationInfo) |
| 1685 | |
throws DoesNotExistException, InvalidParameterException, |
| 1686 | |
MissingParameterException, OperationFailedException { |
| 1687 | |
|
| 1688 | 79 | checkForMissingParameter(validationType, "validationType"); |
| 1689 | 79 | checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
| 1690 | |
|
| 1691 | 79 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluPublicationInfo.class.getName()); |
| 1692 | 79 | Validator defaultValidator = validatorFactory.getValidator(); |
| 1693 | 79 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluPublicationInfo, objStructure); |
| 1694 | 79 | return validationResults; |
| 1695 | |
} |
| 1696 | |
|
| 1697 | |
@Override |
| 1698 | |
@Transactional(readOnly=false) |
| 1699 | |
public CluPublicationInfo createCluPublication(String cluId, |
| 1700 | |
String luPublicationType, CluPublicationInfo cluPublicationInfo) |
| 1701 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 1702 | |
InvalidParameterException, MissingParameterException, |
| 1703 | |
OperationFailedException, PermissionDeniedException { |
| 1704 | 58 | checkForMissingParameter(cluId, "cluId"); |
| 1705 | 58 | checkForMissingParameter(luPublicationType, "luPublicationType"); |
| 1706 | 58 | checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
| 1707 | |
|
| 1708 | |
|
| 1709 | |
List<ValidationResultInfo> val; |
| 1710 | |
try { |
| 1711 | 58 | val = validateCluPublication("SYSTEM", cluPublicationInfo); |
| 1712 | 58 | if(null != val && val.size() > 0) { |
| 1713 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1714 | |
} |
| 1715 | 0 | } catch (DoesNotExistException e) { |
| 1716 | 0 | throw new OperationFailedException("Error creating clu",e); |
| 1717 | 58 | } |
| 1718 | |
|
| 1719 | |
|
| 1720 | 58 | CluPublication cluPub = new CluPublication(); |
| 1721 | |
Clu clu; |
| 1722 | |
try { |
| 1723 | 58 | clu = luDao.fetch(Clu.class, cluId); |
| 1724 | 0 | } catch (DoesNotExistException e) { |
| 1725 | 0 | throw new InvalidParameterException("Clu does not exist for id:"+cluId); |
| 1726 | 58 | } |
| 1727 | |
|
| 1728 | |
CluPublicationType type; |
| 1729 | |
try{ |
| 1730 | 58 | type = luDao.fetch(CluPublicationType.class, luPublicationType); |
| 1731 | 0 | } catch (DoesNotExistException e) { |
| 1732 | 0 | throw new InvalidParameterException("CluPublication Type does not exist for id:" + luPublicationType); |
| 1733 | 58 | } |
| 1734 | |
|
| 1735 | 58 | cluPub.setClu(clu); |
| 1736 | 58 | cluPub.setId(cluPublicationInfo.getId()); |
| 1737 | 58 | cluPub.setEndCycle(cluPublicationInfo.getEndCycle()); |
| 1738 | 58 | cluPub.setStartCycle(cluPublicationInfo.getStartCycle()); |
| 1739 | 58 | cluPub.setEffectiveDate(cluPublicationInfo.getEffectiveDate()); |
| 1740 | 58 | cluPub.setExpirationDate(cluPublicationInfo.getExpirationDate()); |
| 1741 | 58 | cluPub.setState(cluPublicationInfo.getState()); |
| 1742 | 58 | cluPub.setType(type); |
| 1743 | 58 | cluPub.setAttributes(LuServiceAssembler.toGenericAttributes(CluPublicationAttribute.class, cluPublicationInfo.getAttributes(), cluPub, luDao)); |
| 1744 | 58 | cluPub.setVariants(LuServiceAssembler.toCluPublicationVariants(cluPublicationInfo.getVariants(), cluPub, luDao)); |
| 1745 | |
|
| 1746 | 58 | luDao.create(cluPub); |
| 1747 | |
|
| 1748 | 58 | return LuServiceAssembler.toCluPublicationInfo(cluPub); |
| 1749 | |
} |
| 1750 | |
|
| 1751 | |
@Override |
| 1752 | |
@Transactional(readOnly=false) |
| 1753 | |
public CluPublicationInfo updateCluPublication(String cluPublicationId, |
| 1754 | |
CluPublicationInfo cluPublicationInfo) |
| 1755 | |
throws DataValidationErrorException, DoesNotExistException, |
| 1756 | |
InvalidParameterException, MissingParameterException, |
| 1757 | |
OperationFailedException, PermissionDeniedException, |
| 1758 | |
VersionMismatchException { |
| 1759 | 21 | checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
| 1760 | 21 | checkForMissingParameter(cluPublicationInfo, "cluPublicationInfo"); |
| 1761 | |
|
| 1762 | |
|
| 1763 | |
List<ValidationResultInfo> val; |
| 1764 | |
try { |
| 1765 | 21 | val = validateCluPublication("SYSTEM", cluPublicationInfo); |
| 1766 | 21 | if(null != val && val.size() > 0) { |
| 1767 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1768 | |
} |
| 1769 | 0 | } catch (DoesNotExistException e) { |
| 1770 | 0 | throw new OperationFailedException("Error creating clu",e); |
| 1771 | 21 | } |
| 1772 | |
|
| 1773 | 21 | CluPublication cluPub = luDao.fetch(CluPublication.class, cluPublicationId); |
| 1774 | |
|
| 1775 | 21 | if (!String.valueOf(cluPub.getVersionNumber()).equals( |
| 1776 | |
cluPublicationInfo.getMetaInfo().getVersionInd())) { |
| 1777 | 1 | throw new VersionMismatchException( |
| 1778 | |
"CluPublication to be updated is not the current version"); |
| 1779 | |
} |
| 1780 | |
|
| 1781 | |
Clu clu; |
| 1782 | |
try { |
| 1783 | 20 | clu = luDao.fetch(Clu.class, cluPublicationInfo.getCluId()); |
| 1784 | 0 | } catch (DoesNotExistException e) { |
| 1785 | 0 | throw new InvalidParameterException("Clu does not exist for id:"+cluPublicationInfo.getCluId()); |
| 1786 | 20 | } |
| 1787 | |
|
| 1788 | |
CluPublicationType type; |
| 1789 | |
try{ |
| 1790 | 20 | type = luDao.fetch(CluPublicationType.class, cluPublicationInfo.getType()); |
| 1791 | 0 | } catch (DoesNotExistException e) { |
| 1792 | 0 | throw new InvalidParameterException("CluPublication Type does not exist for id:" + cluPublicationInfo.getType()); |
| 1793 | 20 | } |
| 1794 | |
|
| 1795 | |
|
| 1796 | |
|
| 1797 | |
|
| 1798 | 20 | Map<String, CluPublicationVariant> oldVariantMap = new HashMap<String, CluPublicationVariant>(); |
| 1799 | 20 | for (CluPublicationVariant variant : cluPub.getVariants()) { |
| 1800 | 21 | oldVariantMap.put(variant.getKey(), variant); |
| 1801 | |
} |
| 1802 | 20 | cluPub.getVariants().clear(); |
| 1803 | |
|
| 1804 | |
|
| 1805 | |
|
| 1806 | 20 | CluPublicationVariant variant = null; |
| 1807 | 20 | for (FieldInfo fieldInfo : cluPublicationInfo.getVariants()) { |
| 1808 | 21 | if (!oldVariantMap.containsKey(fieldInfo.getId())) { |
| 1809 | |
|
| 1810 | 2 | variant = new CluPublicationVariant(); |
| 1811 | 2 | variant.setKey(fieldInfo.getId()); |
| 1812 | 2 | variant.setValue(fieldInfo.getValue()); |
| 1813 | |
} else { |
| 1814 | |
|
| 1815 | 19 | variant = oldVariantMap.get(fieldInfo.getId()); |
| 1816 | 19 | variant.setValue(fieldInfo.getValue()); |
| 1817 | 19 | oldVariantMap.remove(fieldInfo.getId()); |
| 1818 | |
} |
| 1819 | |
|
| 1820 | 21 | cluPub.getVariants().add(variant); |
| 1821 | |
} |
| 1822 | |
|
| 1823 | |
|
| 1824 | 20 | for (Entry<String, CluPublicationVariant> entry : oldVariantMap.entrySet()) { |
| 1825 | 2 | luDao.delete(entry.getValue()); |
| 1826 | |
} |
| 1827 | |
|
| 1828 | 20 | cluPub.setClu(clu); |
| 1829 | 20 | cluPub.setEndCycle(cluPublicationInfo.getEndCycle()); |
| 1830 | 20 | cluPub.setStartCycle(cluPublicationInfo.getStartCycle()); |
| 1831 | 20 | cluPub.setEffectiveDate(cluPublicationInfo.getEffectiveDate()); |
| 1832 | 20 | cluPub.setExpirationDate(cluPublicationInfo.getExpirationDate()); |
| 1833 | 20 | cluPub.setState(cluPublicationInfo.getState()); |
| 1834 | 20 | cluPub.setType(type); |
| 1835 | 20 | cluPub.setAttributes(LuServiceAssembler.toGenericAttributes(CluPublicationAttribute.class, cluPublicationInfo.getAttributes(), cluPub, luDao)); |
| 1836 | |
|
| 1837 | 20 | CluPublication updated = luDao.update(cluPub); |
| 1838 | |
|
| 1839 | 20 | return LuServiceAssembler.toCluPublicationInfo(updated); |
| 1840 | |
} |
| 1841 | |
|
| 1842 | |
@Override |
| 1843 | |
@Transactional(readOnly=false) |
| 1844 | |
public StatusInfo deleteCluPublication(String cluPublicationId) |
| 1845 | |
throws DoesNotExistException, InvalidParameterException, |
| 1846 | |
MissingParameterException, DependentObjectsExistException, |
| 1847 | |
OperationFailedException, PermissionDeniedException { |
| 1848 | 0 | checkForMissingParameter(cluPublicationId, "cluPublicationId"); |
| 1849 | |
|
| 1850 | 0 | luDao.delete(CluPublication.class, cluPublicationId); |
| 1851 | |
|
| 1852 | 0 | StatusInfo statusInfo = new StatusInfo(); |
| 1853 | 0 | statusInfo.setSuccess(true); |
| 1854 | |
|
| 1855 | 0 | return statusInfo; } |
| 1856 | |
|
| 1857 | |
@Override |
| 1858 | |
public List<ValidationResultInfo> validateCluResult(String validationType, |
| 1859 | |
CluResultInfo cluResultInfo) throws DoesNotExistException, |
| 1860 | |
InvalidParameterException, MissingParameterException, |
| 1861 | |
OperationFailedException { |
| 1862 | 107 | checkForMissingParameter(validationType, "validationType"); |
| 1863 | 107 | checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
| 1864 | |
|
| 1865 | 107 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluResultInfo.class.getName()); |
| 1866 | 107 | Validator defaultValidator = validatorFactory.getValidator(); |
| 1867 | 107 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluResultInfo, objStructure); |
| 1868 | 107 | return validationResults; |
| 1869 | |
} |
| 1870 | |
|
| 1871 | |
@Override |
| 1872 | |
@Transactional(readOnly=false) |
| 1873 | |
public CluResultInfo createCluResult(String cluId, String cluResultTypeKey, |
| 1874 | |
CluResultInfo cluResultInfo) throws AlreadyExistsException, |
| 1875 | |
DataValidationErrorException, InvalidParameterException, |
| 1876 | |
MissingParameterException, OperationFailedException, |
| 1877 | |
PermissionDeniedException, DoesNotExistException { |
| 1878 | |
|
| 1879 | 86 | checkForMissingParameter(cluId, "cluId"); |
| 1880 | 86 | checkForMissingParameter(cluResultTypeKey, "cluResultTypeKey"); |
| 1881 | 86 | checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
| 1882 | |
|
| 1883 | |
|
| 1884 | 86 | List<ValidationResultInfo> val = validateCluResult("SYSTEM", cluResultInfo); |
| 1885 | 86 | if(null != val && val.size() > 0) { |
| 1886 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1887 | |
} |
| 1888 | |
|
| 1889 | 86 | cluResultInfo.setType(cluResultTypeKey); |
| 1890 | 86 | cluResultInfo.setCluId(cluId); |
| 1891 | |
|
| 1892 | 86 | List<ResultOption> resOptList = new ArrayList<ResultOption>(); |
| 1893 | 86 | for (ResultOptionInfo resOptInfo : cluResultInfo.getResultOptions()) { |
| 1894 | 121 | ResultOption resOpt = new ResultOption(); |
| 1895 | 121 | BeanUtils.copyProperties(resOptInfo, resOpt, new String[] { "id", |
| 1896 | |
"metaInfo", "resultUsageType", "desc" }); |
| 1897 | |
|
| 1898 | 121 | if(resOptInfo.getResultUsageTypeKey() != null) { |
| 1899 | 0 | ResultUsageType resUsageType = luDao.fetch(ResultUsageType.class, |
| 1900 | |
resOptInfo.getResultUsageTypeKey()); |
| 1901 | 0 | resOpt.setResultUsageType(resUsageType); |
| 1902 | |
} |
| 1903 | 121 | resOpt.setDesc(LuServiceAssembler.toRichText(LuRichText.class, resOptInfo.getDesc())); |
| 1904 | 121 | luDao.create(resOpt); |
| 1905 | 121 | resOptList.add(resOpt); |
| 1906 | 121 | } |
| 1907 | |
|
| 1908 | 86 | CluResult cluResult = new CluResult(); |
| 1909 | 86 | BeanUtils.copyProperties(cluResultInfo, cluResult, new String[] { "id", |
| 1910 | |
"desc", "resultOptions", "metaInfo" }); |
| 1911 | |
|
| 1912 | 86 | cluResult.setDesc(LuServiceAssembler |
| 1913 | |
.toRichText(LuRichText.class, cluResultInfo.getDesc())); |
| 1914 | 86 | cluResult.setResultOptions(resOptList); |
| 1915 | |
|
| 1916 | 86 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 1917 | 86 | cluResult.setClu(clu); |
| 1918 | |
|
| 1919 | 86 | CluResultType type = luDao.fetch(CluResultType.class, cluResultTypeKey); |
| 1920 | 86 | cluResult.setCluResultType(type); |
| 1921 | |
|
| 1922 | 86 | luDao.create(cluResult); |
| 1923 | |
|
| 1924 | 86 | return LuServiceAssembler.toCluResultInfo(cluResult); |
| 1925 | |
} |
| 1926 | |
|
| 1927 | |
@Override |
| 1928 | |
@Transactional(readOnly=false) |
| 1929 | |
public CluResultInfo updateCluResult(String cluResultId, |
| 1930 | |
CluResultInfo cluResultInfo) throws DataValidationErrorException, |
| 1931 | |
DoesNotExistException, InvalidParameterException, |
| 1932 | |
MissingParameterException, OperationFailedException, |
| 1933 | |
PermissionDeniedException, VersionMismatchException { |
| 1934 | |
|
| 1935 | 21 | checkForMissingParameter(cluResultId, "cluResultId"); |
| 1936 | 21 | checkForMissingParameter(cluResultInfo, "cluResultInfo"); |
| 1937 | |
|
| 1938 | |
|
| 1939 | 21 | List<ValidationResultInfo> val = validateCluResult("SYSTEM", cluResultInfo); |
| 1940 | 21 | if(null != val && val.size() > 0) { |
| 1941 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 1942 | |
} |
| 1943 | |
|
| 1944 | 21 | CluResult result = luDao.fetch(CluResult.class, cluResultId); |
| 1945 | 21 | if (!String.valueOf(result.getVersionNumber()).equals( |
| 1946 | |
cluResultInfo.getMetaInfo().getVersionInd())) { |
| 1947 | 0 | throw new VersionMismatchException( |
| 1948 | |
"CluResult to be updated is not the current version"); |
| 1949 | |
} |
| 1950 | |
|
| 1951 | |
|
| 1952 | |
|
| 1953 | |
|
| 1954 | 21 | Map<String, ResultOption> oldResultOptionMap = new HashMap<String, ResultOption>(); |
| 1955 | 21 | for (ResultOption opt : result.getResultOptions()) { |
| 1956 | 28 | oldResultOptionMap.put(opt.getId(), opt); |
| 1957 | |
} |
| 1958 | 21 | result.getResultOptions().clear(); |
| 1959 | |
|
| 1960 | |
|
| 1961 | |
|
| 1962 | 21 | for (ResultOptionInfo resOptInfo : cluResultInfo.getResultOptions()) { |
| 1963 | 27 | ResultOption opt = oldResultOptionMap.remove(resOptInfo.getId()); |
| 1964 | 27 | if (opt == null) { |
| 1965 | |
|
| 1966 | 1 | opt = new ResultOption(); |
| 1967 | |
|
| 1968 | 1 | BeanUtils.copyProperties(resOptInfo, opt, new String[] { |
| 1969 | |
"resultUsageType", "desc" }); |
| 1970 | |
} else { |
| 1971 | |
|
| 1972 | 26 | opt = luDao.fetch(ResultOption.class, resOptInfo.getId()); |
| 1973 | |
|
| 1974 | 26 | BeanUtils.copyProperties(resOptInfo, opt, new String[] { |
| 1975 | |
"id", "resultUsageType", "desc" }); |
| 1976 | |
} |
| 1977 | 27 | if(resOptInfo.getResultUsageTypeKey() != null && !resOptInfo.getResultUsageTypeKey().isEmpty()) { |
| 1978 | 1 | ResultUsageType resUsageType = luDao.fetch(ResultUsageType.class, |
| 1979 | |
resOptInfo.getResultUsageTypeKey()); |
| 1980 | 1 | opt.setResultUsageType(resUsageType); |
| 1981 | |
} |
| 1982 | 27 | opt.setDesc(LuServiceAssembler.toRichText(LuRichText.class, resOptInfo.getDesc())); |
| 1983 | 27 | result.getResultOptions().add(opt); |
| 1984 | 27 | } |
| 1985 | |
|
| 1986 | |
|
| 1987 | 21 | for (Entry<String, ResultOption> entry : oldResultOptionMap.entrySet()) { |
| 1988 | 2 | luDao.delete(entry.getValue()); |
| 1989 | |
} |
| 1990 | |
|
| 1991 | 21 | BeanUtils.copyProperties(cluResultInfo, result, new String[] { "id", |
| 1992 | |
"desc", "resultOptions" }); |
| 1993 | |
|
| 1994 | 21 | result.setDesc(LuServiceAssembler.toRichText(LuRichText.class, cluResultInfo.getDesc())); |
| 1995 | 21 | CluResultType type = luDao.fetch(CluResultType.class, cluResultInfo.getType()); |
| 1996 | 21 | result.setCluResultType(type); |
| 1997 | |
|
| 1998 | 21 | CluResult updated = luDao.update(result); |
| 1999 | |
|
| 2000 | 21 | return LuServiceAssembler.toCluResultInfo(updated); |
| 2001 | |
} |
| 2002 | |
|
| 2003 | |
@Override |
| 2004 | |
@Transactional(readOnly=false) |
| 2005 | |
public StatusInfo deleteCluResult(String cluResultId) |
| 2006 | |
throws DoesNotExistException, InvalidParameterException, |
| 2007 | |
MissingParameterException, DependentObjectsExistException, |
| 2008 | |
OperationFailedException, PermissionDeniedException { |
| 2009 | |
|
| 2010 | 4 | checkForMissingParameter(cluResultId, "cluResultId"); |
| 2011 | |
|
| 2012 | 4 | luDao.delete(CluResult.class, cluResultId); |
| 2013 | |
|
| 2014 | 4 | StatusInfo statusInfo = new StatusInfo(); |
| 2015 | 4 | statusInfo.setSuccess(true); |
| 2016 | |
|
| 2017 | 4 | return statusInfo; |
| 2018 | |
} |
| 2019 | |
|
| 2020 | |
@Override |
| 2021 | |
public List<ValidationResultInfo> validateCluLoRelation( |
| 2022 | |
String validationType, CluLoRelationInfo cluLoRelationInfo) |
| 2023 | |
throws DoesNotExistException, InvalidParameterException, |
| 2024 | |
MissingParameterException, OperationFailedException { |
| 2025 | |
|
| 2026 | 102 | checkForMissingParameter(validationType, "validationType"); |
| 2027 | 102 | checkForMissingParameter(cluLoRelationInfo, "cluLoRelationInfo"); |
| 2028 | |
|
| 2029 | 102 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluLoRelation.class.getName()); |
| 2030 | 102 | Validator defaultValidator = validatorFactory.getValidator(); |
| 2031 | 102 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluLoRelationInfo, objStructure); |
| 2032 | 102 | return validationResults; |
| 2033 | |
} |
| 2034 | |
|
| 2035 | |
@Override |
| 2036 | |
@Transactional(readOnly=false) |
| 2037 | |
public CluLoRelationInfo createCluLoRelation(String cluId, String loId, |
| 2038 | |
String cluLoRelationType, CluLoRelationInfo cluLoRelationInfo) |
| 2039 | |
throws AlreadyExistsException, DoesNotExistException, |
| 2040 | |
InvalidParameterException, MissingParameterException, |
| 2041 | |
OperationFailedException, PermissionDeniedException, DataValidationErrorException { |
| 2042 | 101 | checkForMissingParameter(loId, "loId"); |
| 2043 | 101 | checkForMissingParameter(cluId, "cluId"); |
| 2044 | 101 | checkForEmptyList(cluLoRelationType, "cluLoRelationType"); |
| 2045 | 101 | checkForEmptyList(cluLoRelationInfo, "cluLoRelationInfo"); |
| 2046 | |
|
| 2047 | |
|
| 2048 | 101 | List<ValidationResultInfo> val = validateCluLoRelation("SYSTEM", cluLoRelationInfo); |
| 2049 | 101 | if(null != val && val.size() > 0) { |
| 2050 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2051 | |
} |
| 2052 | |
|
| 2053 | 101 | Clu clu = luDao.fetch(Clu.class, cluId); |
| 2054 | 100 | if (clu == null) { |
| 2055 | 0 | throw new DoesNotExistException("Clu does not exist for id: " |
| 2056 | |
+ cluId); |
| 2057 | |
} |
| 2058 | |
|
| 2059 | 100 | CluLoRelationType cluLoRelationTypeEntity = luDao.fetch(CluLoRelationType.class, cluLoRelationType); |
| 2060 | 100 | if (cluLoRelationTypeEntity == null) { |
| 2061 | 0 | throw new DoesNotExistException("CluLoRelationType does not exist for id: " |
| 2062 | |
+ cluLoRelationType); |
| 2063 | |
} |
| 2064 | |
|
| 2065 | |
|
| 2066 | 100 | List<CluLoRelation> reltns = luDao.getCluLoRelationsByCludIdAndLoId( |
| 2067 | |
cluId, loId); |
| 2068 | 100 | if (reltns.size() > 0) { |
| 2069 | 1 | throw new AlreadyExistsException( |
| 2070 | |
"Relation already exists for cluId:" + cluId + " and Lo:" |
| 2071 | |
+ loId); |
| 2072 | |
} |
| 2073 | |
|
| 2074 | 99 | CluLoRelation cluLoRelation = new CluLoRelation(); |
| 2075 | 99 | BeanUtils.copyProperties(cluLoRelationInfo, cluLoRelation, |
| 2076 | |
new String[] { "cluId", "attributes", "metaInfo", "type" }); |
| 2077 | |
|
| 2078 | 99 | cluLoRelation.setClu(clu); |
| 2079 | 99 | cluLoRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2080 | |
CluLoRelationAttribute.class, |
| 2081 | |
cluLoRelationInfo.getAttributes(), cluLoRelation, luDao)); |
| 2082 | 99 | cluLoRelation.setType(cluLoRelationTypeEntity); |
| 2083 | |
|
| 2084 | 99 | luDao.create(cluLoRelation); |
| 2085 | |
|
| 2086 | 99 | return LuServiceAssembler.toCluLoRelationInfo(cluLoRelation); |
| 2087 | |
} |
| 2088 | |
|
| 2089 | |
@Override |
| 2090 | |
@Transactional(readOnly=false) |
| 2091 | |
public CluLoRelationInfo updateCluLoRelation(String cluLoRelationId, |
| 2092 | |
CluLoRelationInfo cluLoRelationInfo) |
| 2093 | |
throws DataValidationErrorException, DoesNotExistException, |
| 2094 | |
InvalidParameterException, MissingParameterException, |
| 2095 | |
OperationFailedException, PermissionDeniedException, |
| 2096 | |
VersionMismatchException { |
| 2097 | 1 | checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
| 2098 | 1 | checkForMissingParameter(cluLoRelationInfo, "cluLoRelationInfo"); |
| 2099 | |
|
| 2100 | |
|
| 2101 | 1 | List<ValidationResultInfo> val = validateCluLoRelation("SYSTEM", cluLoRelationInfo); |
| 2102 | 1 | if(null != val && val.size() > 0) { |
| 2103 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2104 | |
} |
| 2105 | |
|
| 2106 | 1 | CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
| 2107 | |
|
| 2108 | 1 | if (!String.valueOf(reltn.getVersionNumber()).equals( |
| 2109 | |
cluLoRelationInfo.getMetaInfo().getVersionInd())) { |
| 2110 | 0 | throw new VersionMismatchException( |
| 2111 | |
"CluLoRelation to be updated is not the current version"); |
| 2112 | |
} |
| 2113 | |
|
| 2114 | 1 | Clu clu = luDao.fetch(Clu.class, cluLoRelationInfo.getCluId()); |
| 2115 | 1 | if (clu == null) { |
| 2116 | 0 | throw new DoesNotExistException("Clu does not exist for id: " |
| 2117 | |
+ cluLoRelationInfo.getCluId()); |
| 2118 | |
} |
| 2119 | |
|
| 2120 | 1 | CluLoRelationType cluLoRelationTypeEntity = luDao.fetch(CluLoRelationType.class, cluLoRelationInfo.getType()); |
| 2121 | 1 | if (cluLoRelationTypeEntity == null) { |
| 2122 | 0 | throw new DoesNotExistException("CluLoRelationType does not exist for id: " |
| 2123 | |
+ cluLoRelationInfo.getType()); |
| 2124 | |
} |
| 2125 | |
|
| 2126 | 1 | BeanUtils.copyProperties(cluLoRelationInfo, reltn, new String[] { |
| 2127 | |
"cluId", "attributes", "metaInfo", "type"}); |
| 2128 | |
|
| 2129 | 1 | reltn.setClu(clu); |
| 2130 | 1 | reltn.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2131 | |
CluLoRelationAttribute.class, |
| 2132 | |
cluLoRelationInfo.getAttributes(), reltn, luDao)); |
| 2133 | 1 | reltn.setType(cluLoRelationTypeEntity); |
| 2134 | 1 | CluLoRelation updated = luDao.update(reltn); |
| 2135 | |
|
| 2136 | 1 | return LuServiceAssembler.toCluLoRelationInfo(updated); |
| 2137 | |
} |
| 2138 | |
|
| 2139 | |
@Override |
| 2140 | |
@Transactional(readOnly=false) |
| 2141 | |
public StatusInfo deleteCluLoRelation(String cluLoRelationId) |
| 2142 | |
throws DoesNotExistException, InvalidParameterException, |
| 2143 | |
MissingParameterException, OperationFailedException, |
| 2144 | |
PermissionDeniedException { |
| 2145 | 7 | checkForMissingParameter(cluLoRelationId, "cluLoRelationId"); |
| 2146 | |
|
| 2147 | 7 | CluLoRelation reltn = luDao.fetch(CluLoRelation.class, cluLoRelationId); |
| 2148 | 7 | if (reltn == null) { |
| 2149 | 0 | throw new DoesNotExistException( |
| 2150 | |
"CluLoRelation does not exist for id: " + cluLoRelationId); |
| 2151 | |
} |
| 2152 | |
|
| 2153 | 7 | luDao.delete(CluLoRelation.class, cluLoRelationId); |
| 2154 | |
|
| 2155 | 7 | StatusInfo statusInfo = new StatusInfo(); |
| 2156 | 7 | statusInfo.setSuccess(true); |
| 2157 | |
|
| 2158 | 7 | return statusInfo; |
| 2159 | |
} |
| 2160 | |
|
| 2161 | |
@Override |
| 2162 | |
@Transactional(readOnly=false) |
| 2163 | |
public StatusInfo addCluResourceRequirement(String resourceTypeKey, |
| 2164 | |
String cluId) throws AlreadyExistsException, DoesNotExistException, |
| 2165 | |
InvalidParameterException, MissingParameterException, |
| 2166 | |
OperationFailedException, PermissionDeniedException { |
| 2167 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
| 2168 | |
} |
| 2169 | |
|
| 2170 | |
@Override |
| 2171 | |
@Transactional(readOnly=false) |
| 2172 | |
public StatusInfo removeCluResourceRequirement(String resourceTypeKey, |
| 2173 | |
String cluId) throws DoesNotExistException, |
| 2174 | |
InvalidParameterException, MissingParameterException, |
| 2175 | |
OperationFailedException, PermissionDeniedException { |
| 2176 | |
|
| 2177 | 0 | return null; |
| 2178 | |
} |
| 2179 | |
|
| 2180 | |
@Override |
| 2181 | |
public List<ValidationResultInfo> validateCluSet(String validationType, |
| 2182 | |
CluSetInfo cluSetInfo) throws DoesNotExistException, |
| 2183 | |
InvalidParameterException, MissingParameterException, |
| 2184 | |
OperationFailedException { |
| 2185 | 46 | checkForMissingParameter(validationType, "validationType"); |
| 2186 | 46 | checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
| 2187 | |
|
| 2188 | 46 | ObjectStructureDefinition objStructure = this.getObjectStructure(CluSetInfo.class.getName()); |
| 2189 | 46 | Validator defaultValidator = validatorFactory.getValidator(); |
| 2190 | 46 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(cluSetInfo, objStructure); |
| 2191 | 46 | return validationResults; |
| 2192 | |
} |
| 2193 | |
|
| 2194 | |
@Override |
| 2195 | |
@Transactional(readOnly=false) |
| 2196 | |
public CluSetInfo createCluSet(String cluSetType, CluSetInfo cluSetInfo) |
| 2197 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 2198 | |
InvalidParameterException, MissingParameterException, |
| 2199 | |
OperationFailedException, PermissionDeniedException, |
| 2200 | |
UnsupportedActionException { |
| 2201 | |
|
| 2202 | 39 | checkForMissingParameter(cluSetType, "cluSetType"); |
| 2203 | 39 | checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
| 2204 | |
|
| 2205 | 39 | cluSetInfo.setType(cluSetType); |
| 2206 | |
|
| 2207 | 39 | validateCluSet(cluSetInfo); |
| 2208 | |
|
| 2209 | |
|
| 2210 | |
List<ValidationResultInfo> val; |
| 2211 | |
try { |
| 2212 | 36 | val = validateCluSet("SYSTEM", cluSetInfo); |
| 2213 | 0 | } catch (DoesNotExistException e) { |
| 2214 | 0 | throw new DataValidationErrorException("Validation error! " + e.getMessage()); |
| 2215 | 36 | } |
| 2216 | 36 | if(null != val && val.size() > 0) { |
| 2217 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2218 | |
} |
| 2219 | |
|
| 2220 | 36 | List<String> cluIdList = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
| 2221 | |
|
| 2222 | 36 | CluSet cluSet = null; |
| 2223 | |
try { |
| 2224 | 36 | cluSet = LuServiceAssembler.toCluSetEntity(cluSetInfo, this.luDao); |
| 2225 | 0 | } catch (DoesNotExistException e) { |
| 2226 | 0 | throw new DataValidationErrorException("Creating CluSet entity failed. Clu or CluSet does not exist: " + e.getMessage()); |
| 2227 | 36 | } |
| 2228 | |
|
| 2229 | 36 | cluSet = luDao.create(cluSet); |
| 2230 | |
|
| 2231 | 36 | CluSetInfo newCluSetInfo = LuServiceAssembler.toCluSetInfo(cluSet); |
| 2232 | |
|
| 2233 | 36 | if(cluIdList != null) { |
| 2234 | 6 | newCluSetInfo.getCluIds().addAll(cluIdList); |
| 2235 | |
} |
| 2236 | |
|
| 2237 | 36 | return newCluSetInfo; |
| 2238 | |
} |
| 2239 | |
|
| 2240 | |
private void setMembershipQuerySearchResult(CluSetInfo cluSetInfo) throws MissingParameterException { |
| 2241 | 96 | if(cluSetInfo.getMembershipQuery() == null) { |
| 2242 | 91 | return; |
| 2243 | |
} |
| 2244 | 5 | List<String> cluIds = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
| 2245 | 5 | cluSetInfo.getCluIds().addAll(cluIds); |
| 2246 | 5 | } |
| 2247 | |
|
| 2248 | |
private List<String> getMembershipQuerySearchResult(MembershipQueryInfo query) throws MissingParameterException { |
| 2249 | 51 | if(query == null) { |
| 2250 | 39 | return null; |
| 2251 | |
} |
| 2252 | 12 | SearchRequest sr = new SearchRequest(); |
| 2253 | 12 | sr.setSearchKey(query.getSearchTypeKey()); |
| 2254 | 12 | sr.setParams(query.getQueryParamValueList()); |
| 2255 | |
|
| 2256 | 12 | SearchResult result = search(sr); |
| 2257 | |
|
| 2258 | 12 | Set<String> cluIds = new HashSet<String>(); |
| 2259 | 12 | List<SearchResultRow> rows = result.getRows(); |
| 2260 | 12 | for(SearchResultRow row : rows) { |
| 2261 | 827 | List<SearchResultCell> cells = row.getCells(); |
| 2262 | 827 | for(SearchResultCell cell : cells) { |
| 2263 | 2481 | if(cell.getKey().equals("lu.resultColumn.luOptionalVersionIndId")&&cell.getValue()!=null) { |
| 2264 | 799 | cluIds.add(cell.getValue()); |
| 2265 | |
} |
| 2266 | |
} |
| 2267 | 827 | } |
| 2268 | 12 | return new ArrayList<String>(cluIds); |
| 2269 | |
} |
| 2270 | |
|
| 2271 | |
private void validateCluSet(CluSetInfo cluSetInfo) throws UnsupportedActionException { |
| 2272 | 49 | MembershipQueryInfo mqInfo = cluSetInfo.getMembershipQuery(); |
| 2273 | |
|
| 2274 | 49 | if (cluSetInfo.getType() == null) { |
| 2275 | 0 | throw new UnsupportedActionException("CluSet type cannot be null. CluSet id="+cluSetInfo.getId()); |
| 2276 | |
} |
| 2277 | 49 | else if(mqInfo != null && mqInfo.getSearchTypeKey() != null && !mqInfo.getSearchTypeKey().isEmpty() && |
| 2278 | |
(cluSetInfo.getCluIds().size() > 0 || cluSetInfo.getCluSetIds().size() > 0)) { |
| 2279 | 2 | throw new UnsupportedActionException("Dynamic CluSet cannot contain Clus and/or CluSets. CluSet id="+cluSetInfo.getId()); |
| 2280 | |
} |
| 2281 | 47 | else if (cluSetInfo.getCluIds().size() > 0 && cluSetInfo.getCluSetIds().size() > 0) { |
| 2282 | 1 | throw new UnsupportedActionException("CluSet cannot contain both Clus and CluSets. CluSet id="+cluSetInfo.getId()); |
| 2283 | |
} |
| 2284 | 46 | } |
| 2285 | |
|
| 2286 | |
@Override |
| 2287 | |
@Transactional(readOnly=false) |
| 2288 | |
public CluSetInfo updateCluSet(String cluSetId, CluSetInfo cluSetInfo) |
| 2289 | |
throws DataValidationErrorException, DoesNotExistException, |
| 2290 | |
InvalidParameterException, MissingParameterException, |
| 2291 | |
OperationFailedException, PermissionDeniedException, |
| 2292 | |
VersionMismatchException, CircularRelationshipException, |
| 2293 | |
UnsupportedActionException { |
| 2294 | |
|
| 2295 | |
|
| 2296 | 10 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2297 | 10 | checkForMissingParameter(cluSetInfo, "cluSetInfo"); |
| 2298 | |
|
| 2299 | |
|
| 2300 | 10 | List<ValidationResultInfo> val = validateCluSet("SYSTEM", cluSetInfo); |
| 2301 | 10 | if(null != val && val.size() > 0) { |
| 2302 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2303 | |
} |
| 2304 | |
|
| 2305 | 10 | cluSetInfo.setId(cluSetId); |
| 2306 | |
|
| 2307 | 10 | validateCluSet(cluSetInfo); |
| 2308 | |
|
| 2309 | 10 | List<String> cluIdList = getMembershipQuerySearchResult(cluSetInfo.getMembershipQuery()); |
| 2310 | |
|
| 2311 | 10 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 2312 | |
|
| 2313 | 10 | if (!cluSetInfo.getType().equals(cluSet.getType())) { |
| 2314 | 0 | throw new UnsupportedActionException("CluSet type is set at creation time and cannot be updated. CluSet id="+cluSetId); |
| 2315 | |
} |
| 2316 | |
|
| 2317 | 10 | if (!String.valueOf(cluSet.getVersionNumber()).equals( |
| 2318 | |
cluSetInfo.getMetaInfo().getVersionInd())) { |
| 2319 | 1 | throw new VersionMismatchException( |
| 2320 | |
"CluSet (id=" + cluSetId + |
| 2321 | |
") to be updated is not the current version " + |
| 2322 | |
"(version=" + cluSetInfo.getMetaInfo().getVersionInd() + |
| 2323 | |
"), current version="+cluSet.getVersionNumber()); |
| 2324 | |
} |
| 2325 | |
|
| 2326 | |
|
| 2327 | 9 | Map<String, CluSetJoinVersionIndClu> oldClus = new HashMap<String, CluSetJoinVersionIndClu>(); |
| 2328 | 9 | for(CluSetJoinVersionIndClu join:cluSet.getCluVerIndIds()){ |
| 2329 | 8 | oldClus.put(join.getCluVersionIndId(), join); |
| 2330 | |
} |
| 2331 | |
|
| 2332 | 9 | cluSet.getCluVerIndIds().clear(); |
| 2333 | |
|
| 2334 | 9 | for (String newCluId : cluSetInfo.getCluIds()) { |
| 2335 | 6 | CluSetJoinVersionIndClu join = oldClus.remove(newCluId); |
| 2336 | 6 | if (join == null) { |
| 2337 | 2 | join = new CluSetJoinVersionIndClu(); |
| 2338 | 2 | join.setCluSet(cluSet); |
| 2339 | 2 | join.setCluVersionIndId(newCluId); |
| 2340 | |
} |
| 2341 | 6 | cluSet.getCluVerIndIds().add(join); |
| 2342 | 6 | } |
| 2343 | |
|
| 2344 | |
|
| 2345 | 9 | for (Entry<String, CluSetJoinVersionIndClu> entry : oldClus.entrySet()) { |
| 2346 | 4 | luDao.delete(entry.getValue()); |
| 2347 | |
} |
| 2348 | |
|
| 2349 | |
|
| 2350 | 9 | if (cluSetInfo.getId() != null) { |
| 2351 | 9 | CluSetInfo originalCluSet = getCluSetInfo(cluSetInfo.getId()); |
| 2352 | 9 | List<CluSetInfo> origSubCSs = null; |
| 2353 | 9 | List<String> origSubCSIds = originalCluSet.getCluSetIds(); |
| 2354 | 9 | if (origSubCSIds != null && !origSubCSIds.isEmpty()) { |
| 2355 | 2 | origSubCSs = getCluSetInfoByIdList(origSubCSIds); |
| 2356 | |
} |
| 2357 | 9 | if (origSubCSs != null) { |
| 2358 | 2 | for (CluSetInfo origSubCS : origSubCSs) { |
| 2359 | 6 | if (!origSubCS.getIsReusable()) { |
| 2360 | 0 | deleteCluSet(origSubCS.getId()); |
| 2361 | |
} |
| 2362 | |
} |
| 2363 | |
} |
| 2364 | |
} |
| 2365 | |
|
| 2366 | |
|
| 2367 | 9 | if(cluSet.getCluSets()==null){ |
| 2368 | 0 | cluSet.setCluSets(new ArrayList<CluSet>()); |
| 2369 | |
} |
| 2370 | 9 | cluSet.setCluSets(null); |
| 2371 | 9 | if(!cluSetInfo.getCluSetIds().isEmpty()) { |
| 2372 | 3 | Set<String> newCluSetIds = new HashSet<String>(cluSetInfo.getCluSetIds()); |
| 2373 | 3 | if(cluSet.getCluSets()!=null){ |
| 2374 | 0 | for (Iterator<CluSet> i = cluSet.getCluSets().iterator(); i.hasNext();) { |
| 2375 | 0 | if (!newCluSetIds.remove(i.next().getId())) { |
| 2376 | 0 | i.remove(); |
| 2377 | |
} |
| 2378 | |
} |
| 2379 | |
} |
| 2380 | 3 | List<CluSet> cluSetList = luDao.getCluSetInfoByIdList(new ArrayList<String>(newCluSetIds)); |
| 2381 | 3 | cluSet.setCluSets(cluSetList); |
| 2382 | |
} |
| 2383 | |
|
| 2384 | 9 | BeanUtils.copyProperties(cluSetInfo, cluSet, new String[] { "descr", |
| 2385 | |
"attributes", "metaInfo", "membershipQuery" }); |
| 2386 | 9 | cluSet.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2387 | |
CluSetAttribute.class, cluSetInfo.getAttributes(), cluSet, luDao)); |
| 2388 | 9 | cluSet.setDescr(LuServiceAssembler.toRichText(LuRichText.class, cluSetInfo.getDescr())); |
| 2389 | |
|
| 2390 | 9 | MembershipQuery mq = LuServiceAssembler.toMembershipQueryEntity(cluSetInfo.getMembershipQuery()); |
| 2391 | 9 | cluSet.setMembershipQuery(mq); |
| 2392 | |
|
| 2393 | 9 | CluSet updated = luDao.update(cluSet); |
| 2394 | |
|
| 2395 | 9 | CluSetInfo updatedCluSetInfo = LuServiceAssembler.toCluSetInfo(updated); |
| 2396 | |
|
| 2397 | 9 | if(cluIdList != null) { |
| 2398 | 1 | updatedCluSetInfo.getCluIds().addAll(cluIdList); |
| 2399 | |
} |
| 2400 | |
|
| 2401 | 9 | return updatedCluSetInfo; |
| 2402 | |
} |
| 2403 | |
|
| 2404 | |
@Override |
| 2405 | |
@Transactional(readOnly=false) |
| 2406 | |
public StatusInfo deleteCluSet(String cluSetId) |
| 2407 | |
throws DoesNotExistException, InvalidParameterException, |
| 2408 | |
MissingParameterException, OperationFailedException, |
| 2409 | |
PermissionDeniedException { |
| 2410 | |
|
| 2411 | 1 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2412 | |
|
| 2413 | 1 | luDao.delete(CluSet.class, cluSetId); |
| 2414 | |
|
| 2415 | 1 | StatusInfo statusInfo = new StatusInfo(); |
| 2416 | 1 | statusInfo.setSuccess(true); |
| 2417 | |
|
| 2418 | 1 | return statusInfo; |
| 2419 | |
} |
| 2420 | |
|
| 2421 | |
@Override |
| 2422 | |
@Transactional(readOnly=false) |
| 2423 | |
public StatusInfo addCluSetToCluSet(String cluSetId, String addedCluSetId) |
| 2424 | |
throws DoesNotExistException, InvalidParameterException, |
| 2425 | |
MissingParameterException, OperationFailedException, |
| 2426 | |
PermissionDeniedException, UnsupportedActionException, |
| 2427 | |
CircularRelationshipException { |
| 2428 | 27 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2429 | 27 | checkForMissingParameter(addedCluSetId, "addedCluSetId"); |
| 2430 | |
|
| 2431 | 27 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 2432 | |
|
| 2433 | 27 | checkCluSetAlreadyAdded(cluSet, addedCluSetId); |
| 2434 | |
|
| 2435 | 25 | CluSet addedCluSet = luDao.fetch(CluSet.class, addedCluSetId); |
| 2436 | |
|
| 2437 | 23 | checkCluSetCircularReference(addedCluSet, cluSetId); |
| 2438 | |
|
| 2439 | 19 | if(cluSet.getCluSets()==null){ |
| 2440 | 0 | cluSet.setCluSets(new ArrayList<CluSet>()); |
| 2441 | |
} |
| 2442 | 19 | cluSet.getCluSets().add(addedCluSet); |
| 2443 | |
|
| 2444 | 19 | luDao.update(cluSet); |
| 2445 | |
|
| 2446 | 19 | StatusInfo statusInfo = new StatusInfo(); |
| 2447 | 19 | statusInfo.setSuccess(true); |
| 2448 | |
|
| 2449 | 19 | return statusInfo; |
| 2450 | |
} |
| 2451 | |
|
| 2452 | |
@Override |
| 2453 | |
@Transactional(readOnly=false) |
| 2454 | |
public StatusInfo removeCluSetFromCluSet(String cluSetId, |
| 2455 | |
String removedCluSetId) throws DoesNotExistException, |
| 2456 | |
InvalidParameterException, MissingParameterException, |
| 2457 | |
OperationFailedException, PermissionDeniedException, |
| 2458 | |
UnsupportedActionException { |
| 2459 | |
|
| 2460 | 1 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2461 | 1 | checkForMissingParameter(removedCluSetId, "removedCluSetId"); |
| 2462 | |
|
| 2463 | 1 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 2464 | 1 | if(cluSet.getCluSets()!=null){ |
| 2465 | 1 | for (Iterator<CluSet> i = cluSet.getCluSets().iterator(); i.hasNext();) { |
| 2466 | 2 | CluSet childCluSet = i.next(); |
| 2467 | 2 | if (childCluSet.getId().equals(removedCluSetId)) { |
| 2468 | 1 | i.remove(); |
| 2469 | 1 | luDao.update(cluSet); |
| 2470 | 1 | StatusInfo statusInfo = new StatusInfo(); |
| 2471 | 1 | statusInfo.setSuccess(true); |
| 2472 | |
|
| 2473 | 1 | return statusInfo; |
| 2474 | |
} |
| 2475 | 1 | } |
| 2476 | |
} |
| 2477 | |
|
| 2478 | 0 | StatusInfo statusInfo = new StatusInfo(); |
| 2479 | 0 | statusInfo.setSuccess(false); |
| 2480 | 0 | statusInfo.setMessage("CluSet does not contain CluSet:" |
| 2481 | |
+ removedCluSetId); |
| 2482 | |
|
| 2483 | 0 | return statusInfo; |
| 2484 | |
} |
| 2485 | |
|
| 2486 | |
@Override |
| 2487 | |
@Transactional(readOnly=false) |
| 2488 | |
public StatusInfo addCluToCluSet(String cluId, String cluSetId) |
| 2489 | |
throws DoesNotExistException, InvalidParameterException, |
| 2490 | |
MissingParameterException, OperationFailedException, |
| 2491 | |
PermissionDeniedException, UnsupportedActionException { |
| 2492 | |
|
| 2493 | 14 | checkForMissingParameter(cluId, "cluId"); |
| 2494 | 14 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2495 | |
|
| 2496 | 14 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 2497 | |
|
| 2498 | 13 | checkCluAlreadyAdded(cluSet, cluId); |
| 2499 | |
|
| 2500 | |
try{ |
| 2501 | 11 | luDao.getCurrentCluVersionInfo(cluId, LuServiceConstants.CLU_NAMESPACE_URI); |
| 2502 | 1 | }catch(NoResultException e){ |
| 2503 | 1 | throw new DoesNotExistException(); |
| 2504 | 10 | } |
| 2505 | |
|
| 2506 | 10 | CluSetJoinVersionIndClu join = new CluSetJoinVersionIndClu(); |
| 2507 | 10 | join.setCluSet(cluSet); |
| 2508 | 10 | join.setCluVersionIndId(cluId); |
| 2509 | |
|
| 2510 | 10 | cluSet.getCluVerIndIds().add(join); |
| 2511 | |
|
| 2512 | 10 | luDao.update(cluSet); |
| 2513 | |
|
| 2514 | 10 | StatusInfo statusInfo = new StatusInfo(); |
| 2515 | 10 | statusInfo.setSuccess(true); |
| 2516 | |
|
| 2517 | 10 | return statusInfo; |
| 2518 | |
} |
| 2519 | |
|
| 2520 | |
@Override |
| 2521 | |
@Transactional(readOnly=false) |
| 2522 | |
public StatusInfo removeCluFromCluSet(String cluId, String cluSetId) |
| 2523 | |
throws DoesNotExistException, InvalidParameterException, |
| 2524 | |
MissingParameterException, OperationFailedException, |
| 2525 | |
PermissionDeniedException, UnsupportedActionException { |
| 2526 | |
|
| 2527 | 1 | checkForMissingParameter(cluId, "cluId"); |
| 2528 | 1 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2529 | |
|
| 2530 | 1 | CluSet cluSet = luDao.fetch(CluSet.class, cluSetId); |
| 2531 | |
|
| 2532 | 1 | for (Iterator<CluSetJoinVersionIndClu> i = cluSet.getCluVerIndIds().iterator(); i.hasNext();) { |
| 2533 | 2 | CluSetJoinVersionIndClu join = i.next(); |
| 2534 | 2 | if (join.getCluVersionIndId().equals(cluId)) { |
| 2535 | 1 | i.remove(); |
| 2536 | 1 | luDao.delete(join); |
| 2537 | 1 | luDao.update(cluSet); |
| 2538 | 1 | StatusInfo statusInfo = new StatusInfo(); |
| 2539 | 1 | statusInfo.setSuccess(true); |
| 2540 | |
|
| 2541 | 1 | return statusInfo; |
| 2542 | |
} |
| 2543 | 1 | } |
| 2544 | |
|
| 2545 | 0 | StatusInfo statusInfo = new StatusInfo(); |
| 2546 | 0 | statusInfo.setSuccess(false); |
| 2547 | 0 | statusInfo.setMessage("Clu set does not contain Clu:" + cluId); |
| 2548 | |
|
| 2549 | 0 | return statusInfo; |
| 2550 | |
} |
| 2551 | |
|
| 2552 | |
@Override |
| 2553 | |
public List<ValidationResultInfo> validateLui(String validationType, |
| 2554 | |
LuiInfo luiInfo) throws DoesNotExistException, |
| 2555 | |
InvalidParameterException, MissingParameterException, |
| 2556 | |
OperationFailedException { |
| 2557 | 4 | checkForMissingParameter(validationType, "validationType"); |
| 2558 | 4 | checkForMissingParameter(luiInfo, "luiInfo"); |
| 2559 | |
|
| 2560 | 4 | ObjectStructureDefinition objStructure = this.getObjectStructure(LuiInfo.class.getName()); |
| 2561 | 4 | Validator defaultValidator = validatorFactory.getValidator(); |
| 2562 | 4 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(luiInfo, objStructure); |
| 2563 | 4 | return validationResults; |
| 2564 | |
} |
| 2565 | |
|
| 2566 | |
@Override |
| 2567 | |
@Transactional(readOnly=false) |
| 2568 | |
public LuiInfo createLui(String cluId, String atpKey, LuiInfo luiInfo) |
| 2569 | |
throws AlreadyExistsException, DataValidationErrorException, |
| 2570 | |
DoesNotExistException, InvalidParameterException, |
| 2571 | |
MissingParameterException, OperationFailedException, |
| 2572 | |
PermissionDeniedException { |
| 2573 | 2 | checkForMissingParameter(cluId, "cludId"); |
| 2574 | 2 | checkForMissingParameter(atpKey, "atpKey"); |
| 2575 | 2 | checkForMissingParameter(luiInfo, "luiInfo"); |
| 2576 | |
|
| 2577 | |
|
| 2578 | 2 | List<ValidationResultInfo> val = validateLui("SYSTEM", luiInfo); |
| 2579 | 2 | if(null != val && val.size() > 0) { |
| 2580 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2581 | |
} |
| 2582 | |
|
| 2583 | 2 | Lui lui = new Lui(); |
| 2584 | 2 | luiInfo.setCluId(cluId); |
| 2585 | 2 | luiInfo.setAtpId(atpKey); |
| 2586 | |
|
| 2587 | |
try { |
| 2588 | 2 | lui = LuServiceAssembler.toLui(false, luiInfo, luDao); |
| 2589 | 0 | } catch (VersionMismatchException vme) { |
| 2590 | 2 | } |
| 2591 | |
|
| 2592 | 2 | luDao.create(lui); |
| 2593 | |
|
| 2594 | 2 | return LuServiceAssembler.toLuiInfo(lui); |
| 2595 | |
} |
| 2596 | |
|
| 2597 | |
@Override |
| 2598 | |
@Transactional(readOnly=false) |
| 2599 | |
public LuiInfo updateLui(String luiId, LuiInfo luiInfo) |
| 2600 | |
throws DataValidationErrorException, DoesNotExistException, |
| 2601 | |
InvalidParameterException, MissingParameterException, |
| 2602 | |
OperationFailedException, PermissionDeniedException, |
| 2603 | |
VersionMismatchException { |
| 2604 | |
|
| 2605 | 2 | checkForMissingParameter(luiId, "luiId"); |
| 2606 | 2 | checkForMissingParameter(luiInfo, "luiInfo"); |
| 2607 | |
|
| 2608 | |
|
| 2609 | 2 | List<ValidationResultInfo> val = validateLui("SYSTEM", luiInfo); |
| 2610 | 2 | if(null != val && val.size() > 0) { |
| 2611 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2612 | |
} |
| 2613 | |
|
| 2614 | 2 | Lui lui = luDao.fetch(Lui.class, luiId); |
| 2615 | |
|
| 2616 | 2 | if (!String.valueOf(lui.getVersionNumber()).equals( |
| 2617 | |
luiInfo.getMetaInfo().getVersionInd())) { |
| 2618 | 1 | throw new VersionMismatchException( |
| 2619 | |
"Lui to be updated is not the current version"); |
| 2620 | |
} |
| 2621 | |
|
| 2622 | 1 | Clu clu = luDao.fetch(Clu.class, luiInfo.getCluId()); |
| 2623 | 1 | lui.setClu(clu); |
| 2624 | |
|
| 2625 | 1 | lui.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2626 | |
LuiAttribute.class, luiInfo.getAttributes(), lui, luDao)); |
| 2627 | |
|
| 2628 | |
|
| 2629 | 1 | BeanUtils.copyProperties(luiInfo, lui, new String[] { "cluId", |
| 2630 | |
"attributes" }); |
| 2631 | |
|
| 2632 | 1 | Lui updated = luDao.update(lui); |
| 2633 | |
|
| 2634 | 1 | return LuServiceAssembler.toLuiInfo(updated); |
| 2635 | |
} |
| 2636 | |
|
| 2637 | |
@Override |
| 2638 | |
@Transactional(readOnly=false) |
| 2639 | |
public StatusInfo deleteLui(String luiId) |
| 2640 | |
throws DependentObjectsExistException, DoesNotExistException, |
| 2641 | |
InvalidParameterException, MissingParameterException, |
| 2642 | |
OperationFailedException, PermissionDeniedException { |
| 2643 | |
|
| 2644 | 3 | checkForMissingParameter(luiId, "luiId"); |
| 2645 | |
|
| 2646 | 3 | luDao.delete(Lui.class, luiId); |
| 2647 | |
|
| 2648 | 2 | StatusInfo statusInfo = new StatusInfo(); |
| 2649 | 2 | statusInfo.setSuccess(true); |
| 2650 | |
|
| 2651 | 2 | return statusInfo; |
| 2652 | |
} |
| 2653 | |
|
| 2654 | |
@Override |
| 2655 | |
@Transactional(readOnly=false) |
| 2656 | |
public LuiInfo updateLuiState(String luiId, String luiState) |
| 2657 | |
throws DataValidationErrorException, DoesNotExistException, |
| 2658 | |
InvalidParameterException, MissingParameterException, |
| 2659 | |
OperationFailedException, PermissionDeniedException { |
| 2660 | |
|
| 2661 | |
|
| 2662 | 3 | checkForMissingParameter(luiId, "luiId"); |
| 2663 | 2 | checkForMissingParameter(luiState, "luiState"); |
| 2664 | 1 | Lui lui = luDao.fetch(Lui.class, luiId); |
| 2665 | 1 | lui.setState(luiState); |
| 2666 | 1 | Lui updated = luDao.update(lui); |
| 2667 | 1 | return LuServiceAssembler.toLuiInfo(updated); |
| 2668 | |
} |
| 2669 | |
|
| 2670 | |
@Override |
| 2671 | |
public List<ValidationResultInfo> validateLuiLuiRelation( |
| 2672 | |
String validationType, LuiLuiRelationInfo luiLuiRelationInfo) |
| 2673 | |
throws DoesNotExistException, InvalidParameterException, |
| 2674 | |
MissingParameterException, OperationFailedException { |
| 2675 | 3 | checkForMissingParameter(validationType, "validationType"); |
| 2676 | 3 | checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
| 2677 | |
|
| 2678 | 3 | ObjectStructureDefinition objStructure = this.getObjectStructure(LuiLuiRelation.class.getName()); |
| 2679 | 3 | Validator defaultValidator = validatorFactory.getValidator(); |
| 2680 | 3 | List<ValidationResultInfo> validationResults = defaultValidator.validateObject(luiLuiRelationInfo, objStructure); |
| 2681 | 3 | return validationResults; |
| 2682 | |
} |
| 2683 | |
|
| 2684 | |
@Override |
| 2685 | |
@Transactional(readOnly=false) |
| 2686 | |
public LuiLuiRelationInfo createLuiLuiRelation(String luiId, |
| 2687 | |
String relatedLuiId, String luLuRelationTypeKey, |
| 2688 | |
LuiLuiRelationInfo luiLuiRelationInfo) |
| 2689 | |
throws AlreadyExistsException, CircularRelationshipException, |
| 2690 | |
DataValidationErrorException, DoesNotExistException, |
| 2691 | |
InvalidParameterException, MissingParameterException, |
| 2692 | |
OperationFailedException, PermissionDeniedException { |
| 2693 | 1 | checkForMissingParameter(luiId, "luiId"); |
| 2694 | 1 | checkForMissingParameter(relatedLuiId, "relatedLuiId"); |
| 2695 | 1 | checkForMissingParameter(luLuRelationTypeKey, "luLuRelationTypeKey"); |
| 2696 | 1 | checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
| 2697 | |
|
| 2698 | |
|
| 2699 | 1 | List<ValidationResultInfo> val = validateLuiLuiRelation("SYSTEM", luiLuiRelationInfo); |
| 2700 | 1 | if(null != val && val.size() > 0) { |
| 2701 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2702 | |
} |
| 2703 | |
|
| 2704 | 1 | if (luiId.equals(relatedLuiId)) { |
| 2705 | 0 | throw new CircularRelationshipException( |
| 2706 | |
"Can not relate a Lui to itself"); |
| 2707 | |
} |
| 2708 | |
|
| 2709 | 1 | Lui lui = luDao.fetch(Lui.class, luiId); |
| 2710 | 1 | Lui relatedLui = luDao.fetch(Lui.class, relatedLuiId); |
| 2711 | |
|
| 2712 | 1 | LuiLuiRelation luiLuiRelation = new LuiLuiRelation(); |
| 2713 | 1 | BeanUtils.copyProperties(luiLuiRelationInfo, luiLuiRelation, |
| 2714 | |
new String[] { "luiId", "relatedLuiId", "attributes", |
| 2715 | |
"metaInfo" }); |
| 2716 | |
|
| 2717 | 1 | luiLuiRelation.setLui(lui); |
| 2718 | 1 | luiLuiRelation.setRelatedLui(relatedLui); |
| 2719 | 1 | luiLuiRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2720 | |
LuiLuiRelationAttribute.class, luiLuiRelationInfo |
| 2721 | |
.getAttributes(), luiLuiRelation, luDao)); |
| 2722 | |
|
| 2723 | 1 | LuLuRelationType luLuRelationType = luDao.fetch(LuLuRelationType.class, |
| 2724 | |
luLuRelationTypeKey); |
| 2725 | |
|
| 2726 | 1 | luiLuiRelation.setLuLuRelationType(luLuRelationType); |
| 2727 | |
|
| 2728 | 1 | luDao.create(luiLuiRelation); |
| 2729 | |
|
| 2730 | 1 | return LuServiceAssembler.toLuiLuiRelationInfo(luiLuiRelation); |
| 2731 | |
} |
| 2732 | |
|
| 2733 | |
@Override |
| 2734 | |
@Transactional(readOnly=false) |
| 2735 | |
public LuiLuiRelationInfo updateLuiLuiRelation(String luiLuiRelationId, |
| 2736 | |
LuiLuiRelationInfo luiLuiRelationInfo) |
| 2737 | |
throws DataValidationErrorException, DoesNotExistException, |
| 2738 | |
InvalidParameterException, MissingParameterException, |
| 2739 | |
OperationFailedException, PermissionDeniedException, |
| 2740 | |
VersionMismatchException { |
| 2741 | |
|
| 2742 | 2 | checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
| 2743 | 2 | checkForMissingParameter(luiLuiRelationInfo, "luiLuiRelationInfo"); |
| 2744 | |
|
| 2745 | |
|
| 2746 | 2 | List<ValidationResultInfo> val = validateLuiLuiRelation("SYSTEM", luiLuiRelationInfo); |
| 2747 | 2 | if(null != val && val.size() > 0) { |
| 2748 | 0 | throw new DataValidationErrorException("Validation error!", val); |
| 2749 | |
} |
| 2750 | |
|
| 2751 | 2 | LuiLuiRelation luiLuiRelation = luDao.fetch(LuiLuiRelation.class, |
| 2752 | |
luiLuiRelationId); |
| 2753 | |
|
| 2754 | 2 | if (!String.valueOf(luiLuiRelation.getVersionNumber()).equals( |
| 2755 | |
luiLuiRelationInfo.getMetaInfo().getVersionInd())) { |
| 2756 | 1 | throw new VersionMismatchException( |
| 2757 | |
"LuiLuiRelation to be updated is not the current version"); |
| 2758 | |
} |
| 2759 | |
|
| 2760 | 1 | BeanUtils.copyProperties(luiLuiRelationInfo, luiLuiRelation, |
| 2761 | |
new String[] { "luiId", "relatedLuiId", "attributes", |
| 2762 | |
"metaInfo" }); |
| 2763 | |
|
| 2764 | 1 | if (!luiLuiRelationInfo.getLuiId().equals( |
| 2765 | |
luiLuiRelation.getLui().getId())) { |
| 2766 | 1 | luiLuiRelation.setLui(luDao.fetch(Lui.class, luiLuiRelationInfo |
| 2767 | |
.getLuiId())); |
| 2768 | |
} |
| 2769 | |
|
| 2770 | 1 | if (!luiLuiRelationInfo.getRelatedLuiId().equals( |
| 2771 | |
luiLuiRelation.getRelatedLui().getId())) { |
| 2772 | 1 | luiLuiRelation.setRelatedLui(luDao.fetch(Lui.class, |
| 2773 | |
luiLuiRelationInfo.getRelatedLuiId())); |
| 2774 | |
} |
| 2775 | |
|
| 2776 | 1 | luiLuiRelation.setAttributes(LuServiceAssembler.toGenericAttributes( |
| 2777 | |
LuiLuiRelationAttribute.class, luiLuiRelationInfo |
| 2778 | |
.getAttributes(), luiLuiRelation, luDao)); |
| 2779 | |
|
| 2780 | 1 | if (!luiLuiRelationInfo.getType().equals( |
| 2781 | |
luiLuiRelation.getLuLuRelationType().getId())) { |
| 2782 | 1 | luiLuiRelation.setLuLuRelationType(luDao.fetch( |
| 2783 | |
LuLuRelationType.class, luiLuiRelationInfo.getType())); |
| 2784 | |
} |
| 2785 | |
|
| 2786 | 1 | LuiLuiRelation updated = luDao.update(luiLuiRelation); |
| 2787 | |
|
| 2788 | 1 | return LuServiceAssembler.toLuiLuiRelationInfo(updated); |
| 2789 | |
} |
| 2790 | |
|
| 2791 | |
@Override |
| 2792 | |
@Transactional(readOnly=false) |
| 2793 | |
public StatusInfo deleteLuiLuiRelation(String luiLuiRelationId) |
| 2794 | |
throws DoesNotExistException, InvalidParameterException, |
| 2795 | |
MissingParameterException, OperationFailedException, |
| 2796 | |
PermissionDeniedException { |
| 2797 | |
|
| 2798 | 1 | checkForMissingParameter(luiLuiRelationId, "luiLuiRelationId"); |
| 2799 | |
|
| 2800 | 1 | luDao.delete(LuiLuiRelation.class, luiLuiRelationId); |
| 2801 | |
|
| 2802 | 1 | StatusInfo statusInfo = new StatusInfo(); |
| 2803 | 1 | statusInfo.setSuccess(true); |
| 2804 | |
|
| 2805 | 1 | return statusInfo; |
| 2806 | |
} |
| 2807 | |
|
| 2808 | |
|
| 2809 | |
|
| 2810 | |
|
| 2811 | |
|
| 2812 | |
@Override |
| 2813 | |
public SearchCriteriaTypeInfo getSearchCriteriaType( |
| 2814 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
| 2815 | |
InvalidParameterException, MissingParameterException, |
| 2816 | |
OperationFailedException { |
| 2817 | |
|
| 2818 | 0 | return searchManager.getSearchCriteriaType(searchCriteriaTypeKey); |
| 2819 | |
} |
| 2820 | |
|
| 2821 | |
@Override |
| 2822 | |
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() |
| 2823 | |
throws OperationFailedException { |
| 2824 | 0 | return searchManager.getSearchCriteriaTypes(); |
| 2825 | |
} |
| 2826 | |
|
| 2827 | |
@Override |
| 2828 | |
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) |
| 2829 | |
throws DoesNotExistException, InvalidParameterException, |
| 2830 | |
MissingParameterException, OperationFailedException { |
| 2831 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
| 2832 | 0 | return searchManager.getSearchResultType(searchResultTypeKey); |
| 2833 | |
} |
| 2834 | |
|
| 2835 | |
@Override |
| 2836 | |
public List<SearchResultTypeInfo> getSearchResultTypes() |
| 2837 | |
throws OperationFailedException { |
| 2838 | 0 | return searchManager.getSearchResultTypes(); |
| 2839 | |
} |
| 2840 | |
|
| 2841 | |
@Override |
| 2842 | |
public SearchTypeInfo getSearchType(String searchTypeKey) |
| 2843 | |
throws DoesNotExistException, InvalidParameterException, |
| 2844 | |
MissingParameterException, OperationFailedException { |
| 2845 | 0 | checkForMissingParameter(searchTypeKey, "searchTypeKey"); |
| 2846 | 0 | return searchManager.getSearchType(searchTypeKey); |
| 2847 | |
} |
| 2848 | |
|
| 2849 | |
@Override |
| 2850 | |
public List<SearchTypeInfo> getSearchTypes() |
| 2851 | |
throws OperationFailedException { |
| 2852 | 0 | return searchManager.getSearchTypes(); |
| 2853 | |
} |
| 2854 | |
|
| 2855 | |
@Override |
| 2856 | |
public List<SearchTypeInfo> getSearchTypesByCriteria( |
| 2857 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
| 2858 | |
InvalidParameterException, MissingParameterException, |
| 2859 | |
OperationFailedException { |
| 2860 | 0 | checkForMissingParameter(searchCriteriaTypeKey, "searchCriteriaTypeKey"); |
| 2861 | 0 | return searchManager.getSearchTypesByCriteria(searchCriteriaTypeKey); |
| 2862 | |
} |
| 2863 | |
|
| 2864 | |
@Override |
| 2865 | |
public List<SearchTypeInfo> getSearchTypesByResult( |
| 2866 | |
String searchResultTypeKey) throws DoesNotExistException, |
| 2867 | |
InvalidParameterException, MissingParameterException, |
| 2868 | |
OperationFailedException { |
| 2869 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
| 2870 | 0 | return searchManager.getSearchTypesByResult(searchResultTypeKey); |
| 2871 | |
} |
| 2872 | |
|
| 2873 | |
private void checkCluAlreadyAdded(CluSet cluSet, String cluId) |
| 2874 | |
throws OperationFailedException { |
| 2875 | 13 | for (CluSetJoinVersionIndClu join : cluSet.getCluVerIndIds()) { |
| 2876 | 13 | if (join.getCluVersionIndId().equals(cluId)) { |
| 2877 | 2 | throw new OperationFailedException("CluSet already contains Clu (id='" + cluId + "')"); |
| 2878 | |
} |
| 2879 | |
} |
| 2880 | 11 | } |
| 2881 | |
|
| 2882 | |
private void checkCluSetAlreadyAdded(CluSet cluSet, String cluSetIdToAdd) |
| 2883 | |
throws OperationFailedException { |
| 2884 | 27 | if(cluSet.getCluSets()!=null){ |
| 2885 | 27 | for (CluSet childCluSet : cluSet.getCluSets()) { |
| 2886 | 20 | if (childCluSet.getId().equals(cluSetIdToAdd)) { |
| 2887 | 2 | throw new OperationFailedException("CluSet (id=" + cluSet.getId() + |
| 2888 | |
") already contains CluSet (id='" + cluSetIdToAdd + "')"); |
| 2889 | |
} |
| 2890 | |
} |
| 2891 | |
} |
| 2892 | 25 | } |
| 2893 | |
|
| 2894 | |
private void checkCluSetCircularReference(CluSet addedCluSet, String hostCluSetId) |
| 2895 | |
throws CircularRelationshipException { |
| 2896 | 77 | if (addedCluSet.getId().equals(hostCluSetId)) { |
| 2897 | 2 | throw new CircularRelationshipException( |
| 2898 | |
"Cannot add a CluSet (id=" + hostCluSetId + ") to ifself"); |
| 2899 | |
} |
| 2900 | 75 | if(addedCluSet.getCluSets()!=null){ |
| 2901 | 75 | for (CluSet childSet : addedCluSet.getCluSets()) { |
| 2902 | 56 | if (childSet.getId().equals(hostCluSetId)) { |
| 2903 | 2 | throw new CircularRelationshipException( |
| 2904 | |
"CluSet (id=" + hostCluSetId + |
| 2905 | |
") already contains this CluSet (id=" + |
| 2906 | |
childSet.getId() + ")"); |
| 2907 | |
} |
| 2908 | 54 | checkCluSetCircularReference(childSet, hostCluSetId); |
| 2909 | |
} |
| 2910 | |
} |
| 2911 | 71 | } |
| 2912 | |
|
| 2913 | |
private void findClusInCluSet(List<String> clus, CluSet parentCluSet) |
| 2914 | |
throws DoesNotExistException { |
| 2915 | 2 | List<String> processedCluSetIds = new ArrayList<String>(); |
| 2916 | 2 | doFindClusInCluSet(processedCluSetIds, clus, parentCluSet); |
| 2917 | 2 | } |
| 2918 | |
|
| 2919 | |
private void doFindClusInCluSet(List<String> processedCluSetIds, |
| 2920 | |
List<String> clus, CluSet parentCluSet) { |
| 2921 | 4 | for (CluSetJoinVersionIndClu join : parentCluSet.getCluVerIndIds()) { |
| 2922 | 7 | if (!clus.contains(join.getCluVersionIndId())) { |
| 2923 | 5 | clus.add(join.getCluVersionIndId()); |
| 2924 | |
} |
| 2925 | |
} |
| 2926 | 4 | if(parentCluSet.getCluSets()!=null){ |
| 2927 | 4 | for (CluSet cluSet : parentCluSet.getCluSets()) { |
| 2928 | |
|
| 2929 | 2 | if (!processedCluSetIds.contains(cluSet.getId())) { |
| 2930 | 2 | processedCluSetIds.add(cluSet.getId()); |
| 2931 | 2 | doFindClusInCluSet(processedCluSetIds, clus, cluSet); |
| 2932 | |
} |
| 2933 | |
} |
| 2934 | |
} |
| 2935 | 4 | } |
| 2936 | |
|
| 2937 | |
@Override |
| 2938 | |
public ObjectStructureDefinition getObjectStructure(String objectTypeKey) { |
| 2939 | 752 | return dictionaryServiceDelegate.getObjectStructure(objectTypeKey); |
| 2940 | |
} |
| 2941 | |
|
| 2942 | |
@Override |
| 2943 | |
public List<String> getObjectTypes() { |
| 2944 | 0 | return dictionaryServiceDelegate.getObjectTypes(); |
| 2945 | |
} |
| 2946 | |
|
| 2947 | |
public LuDao getLuDao() { |
| 2948 | 0 | return luDao; |
| 2949 | |
} |
| 2950 | |
|
| 2951 | |
public void setLuDao(LuDao luDao) { |
| 2952 | 4 | this.luDao = luDao; |
| 2953 | 4 | } |
| 2954 | |
|
| 2955 | |
@Override |
| 2956 | |
public SearchResult search(SearchRequest searchRequest) throws MissingParameterException { |
| 2957 | 18 | checkForMissingParameter(searchRequest, "searchRequest"); |
| 2958 | 18 | return searchManager.search(searchRequest, luDao); |
| 2959 | |
} |
| 2960 | |
|
| 2961 | |
|
| 2962 | |
|
| 2963 | |
|
| 2964 | |
|
| 2965 | |
|
| 2966 | |
|
| 2967 | |
|
| 2968 | |
|
| 2969 | |
private void checkForMissingParameter(Object param, String paramName) |
| 2970 | |
throws MissingParameterException { |
| 2971 | 5025 | if (param == null) { |
| 2972 | 27 | throw new MissingParameterException(paramName + " can not be null"); |
| 2973 | |
} |
| 2974 | 4998 | } |
| 2975 | |
|
| 2976 | |
|
| 2977 | |
|
| 2978 | |
|
| 2979 | |
|
| 2980 | |
|
| 2981 | |
private void checkForEmptyList(Object param, String paramName) |
| 2982 | |
throws MissingParameterException { |
| 2983 | 210 | if (param != null && param instanceof List<?> |
| 2984 | |
&& ((List<?>) param).size() == 0) { |
| 2985 | 0 | throw new MissingParameterException(paramName |
| 2986 | |
+ " can not be an empty list"); |
| 2987 | |
} |
| 2988 | 210 | } |
| 2989 | |
|
| 2990 | |
@Override |
| 2991 | |
@Transactional(readOnly=false) |
| 2992 | |
public StatusInfo addCluSetsToCluSet(String cluSetId, List<String> cluSetIdList) |
| 2993 | |
throws CircularRelationshipException, |
| 2994 | |
DoesNotExistException, InvalidParameterException, |
| 2995 | |
MissingParameterException, OperationFailedException, |
| 2996 | |
PermissionDeniedException, UnsupportedActionException { |
| 2997 | |
|
| 2998 | 7 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 2999 | 7 | checkForMissingParameter(cluSetIdList, "cluSetIdList"); |
| 3000 | |
|
| 3001 | |
|
| 3002 | 7 | luDao.fetch(CluSet.class, cluSetId); |
| 3003 | |
|
| 3004 | 7 | for(String cluSetIdToAdd : cluSetIdList) { |
| 3005 | 19 | StatusInfo status = addCluSetToCluSet(cluSetId, cluSetIdToAdd); |
| 3006 | 15 | if (!status.getSuccess()) { |
| 3007 | 0 | return status; |
| 3008 | |
} |
| 3009 | 15 | } |
| 3010 | |
|
| 3011 | 3 | StatusInfo statusInfo = new StatusInfo(); |
| 3012 | 3 | statusInfo.setSuccess(true); |
| 3013 | |
|
| 3014 | 3 | return statusInfo; |
| 3015 | |
} |
| 3016 | |
|
| 3017 | |
@Override |
| 3018 | |
@Transactional(readOnly=false) |
| 3019 | |
public StatusInfo addClusToCluSet(List<String> cluIdList, String cluSetId) |
| 3020 | |
throws DoesNotExistException, InvalidParameterException, |
| 3021 | |
MissingParameterException, OperationFailedException, |
| 3022 | |
PermissionDeniedException, UnsupportedActionException { |
| 3023 | |
|
| 3024 | 4 | checkForMissingParameter(cluIdList, "cluIdList"); |
| 3025 | 4 | checkForMissingParameter(cluSetId, "cluSetId"); |
| 3026 | |
|
| 3027 | 4 | for(String cluId : cluIdList) { |
| 3028 | 11 | StatusInfo status = addCluToCluSet(cluId, cluSetId); |
| 3029 | 8 | if (!status.getSuccess()) { |
| 3030 | 0 | return status; |
| 3031 | |
} |
| 3032 | 8 | } |
| 3033 | |
|
| 3034 | 1 | StatusInfo statusInfo = new StatusInfo(); |
| 3035 | 1 | statusInfo.setSuccess(true); |
| 3036 | |
|
| 3037 | 1 | return statusInfo; |
| 3038 | |
} |
| 3039 | |
|
| 3040 | |
public ValidatorFactory getValidatorFactory() { |
| 3041 | 0 | return validatorFactory; |
| 3042 | |
} |
| 3043 | |
|
| 3044 | |
public void setValidatorFactory(ValidatorFactory validatorFactory) { |
| 3045 | 3 | this.validatorFactory = validatorFactory; |
| 3046 | 3 | } |
| 3047 | |
|
| 3048 | |
|
| 3049 | |
|
| 3050 | |
@Override |
| 3051 | |
@Transactional(readOnly=false) |
| 3052 | |
public CluInfo createNewCluVersion(String versionIndCluId, String versionComment) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException { |
| 3053 | |
Clu latestClu; |
| 3054 | |
Clu currentClu; |
| 3055 | |
try{ |
| 3056 | 18 | latestClu = luDao.getLatestCluVersion(versionIndCluId); |
| 3057 | 0 | }catch(NoResultException e){ |
| 3058 | 0 | throw new DoesNotExistException("There are no matching versions of this clu", e); |
| 3059 | 18 | } |
| 3060 | |
try{ |
| 3061 | 18 | currentClu = luDao.getCurrentCluVersion(versionIndCluId); |
| 3062 | 0 | }catch(NoResultException e){ |
| 3063 | 0 | throw new DoesNotExistException("There is no current version of this clu. Only current clus can be versioned. Use setCurrentCluVersion to make a clu current.", e); |
| 3064 | 18 | } |
| 3065 | |
|
| 3066 | 18 | CluInfo cluInfo = LuServiceAssembler.toCluInfo(currentClu); |
| 3067 | |
|
| 3068 | |
|
| 3069 | 18 | clearCluIds(cluInfo); |
| 3070 | |
|
| 3071 | |
|
| 3072 | 18 | CluInfo newClu = null; |
| 3073 | |
|
| 3074 | |
try { |
| 3075 | 18 | Clu clu = toCluForCreate(cluInfo.getType(), cluInfo); |
| 3076 | |
|
| 3077 | 18 | Version version = new Version(); |
| 3078 | 18 | version.setSequenceNumber(latestClu.getVersion().getSequenceNumber() + 1); |
| 3079 | 18 | version.setVersionIndId(versionIndCluId); |
| 3080 | 18 | version.setCurrentVersionStart(null); |
| 3081 | 18 | version.setCurrentVersionEnd(null); |
| 3082 | 18 | version.setVersionComment(versionComment); |
| 3083 | 18 | version.setVersionedFromId(currentClu.getId()); |
| 3084 | 18 | clu.setVersion(version); |
| 3085 | 18 | luDao.create(clu); |
| 3086 | 18 | newClu = LuServiceAssembler.toCluInfo(clu); |
| 3087 | 0 | } catch (AlreadyExistsException e) { |
| 3088 | 0 | throw new OperationFailedException("Error creating a new clu version", e); |
| 3089 | 18 | } |
| 3090 | |
|
| 3091 | 18 | return newClu; |
| 3092 | |
} |
| 3093 | |
|
| 3094 | |
private void clearCluIds(CluInfo clu) { |
| 3095 | |
|
| 3096 | 18 | clu.setState(LUConstants.LU_STATE_DRAFT); |
| 3097 | 18 | clu.setId(null); |
| 3098 | |
|
| 3099 | 18 | if(clu.getAccountingInfo()!=null){ |
| 3100 | 10 | clu.getAccountingInfo().setId(null); |
| 3101 | |
|
| 3102 | 10 | for(AffiliatedOrgInfo affiliatedOrg:clu.getAccountingInfo().getAffiliatedOrgs()){ |
| 3103 | 16 | affiliatedOrg.setId(null); |
| 3104 | |
} |
| 3105 | |
} |
| 3106 | 18 | for(AccreditationInfo accredation:clu.getAccreditations()){ |
| 3107 | 8 | accredation.setId(null); |
| 3108 | |
} |
| 3109 | 18 | for(AdminOrgInfo adminOrg:clu.getAdminOrgs()){ |
| 3110 | 174 | adminOrg.setId(null); |
| 3111 | |
} |
| 3112 | 18 | for(CluIdentifierInfo alternateIdentifier:clu.getAlternateIdentifiers()){ |
| 3113 | 34 | alternateIdentifier.setId(null); |
| 3114 | |
} |
| 3115 | 18 | if(clu.getFeeInfo()!=null){ |
| 3116 | 10 | clu.getFeeInfo().setId(null); |
| 3117 | 10 | for(CluFeeRecordInfo cluFeeRecord:clu.getFeeInfo().getCluFeeRecords()){ |
| 3118 | 36 | cluFeeRecord.setId(null); |
| 3119 | 36 | for(AffiliatedOrgInfo affiliatedOrg:cluFeeRecord.getAffiliatedOrgs()){ |
| 3120 | 40 | affiliatedOrg.setId(null); |
| 3121 | |
} |
| 3122 | 36 | for(CurrencyAmountInfo feeAmount:cluFeeRecord.getFeeAmounts()){ |
| 3123 | 38 | feeAmount.setId(null); |
| 3124 | |
} |
| 3125 | |
} |
| 3126 | |
} |
| 3127 | 18 | for(LuCodeInfo luCode:clu.getLuCodes()){ |
| 3128 | 36 | luCode.setId(null); |
| 3129 | |
} |
| 3130 | 18 | if(clu.getOfficialIdentifier()!=null){ |
| 3131 | 18 | clu.getOfficialIdentifier().setId(null); |
| 3132 | |
} |
| 3133 | 18 | } |
| 3134 | |
|
| 3135 | |
|
| 3136 | |
|
| 3137 | |
|
| 3138 | |
|
| 3139 | |
|
| 3140 | |
|
| 3141 | |
@Override |
| 3142 | |
@Transactional(readOnly=false) |
| 3143 | |
public StatusInfo setCurrentCluVersion(String cluVersionId, Date currentVersionStart) throws DoesNotExistException, InvalidParameterException, MissingParameterException, IllegalVersionSequencingException, OperationFailedException, PermissionDeniedException { |
| 3144 | |
|
| 3145 | 8 | Date currentDbDate = new Date(); |
| 3146 | 8 | if(currentVersionStart!=null&¤tVersionStart.compareTo(currentDbDate)<0){ |
| 3147 | 1 | throw new InvalidParameterException("currentVersionStart must be in the future."); |
| 3148 | |
} |
| 3149 | |
|
| 3150 | 7 | if(currentVersionStart==null){ |
| 3151 | 5 | currentVersionStart = currentDbDate; |
| 3152 | |
} |
| 3153 | |
|
| 3154 | |
|
| 3155 | 7 | Clu clu = luDao.fetch(Clu.class, cluVersionId); |
| 3156 | 7 | String versionIndId = clu.getVersion().getVersionIndId(); |
| 3157 | |
|
| 3158 | 7 | Clu oldClu = null; |
| 3159 | |
try{ |
| 3160 | 7 | oldClu = luDao.getCurrentCluVersion(versionIndId); |
| 3161 | 7 | }catch(NoResultException e){} |
| 3162 | |
|
| 3163 | |
|
| 3164 | 7 | if(oldClu!=null){ |
| 3165 | 7 | if(clu.getVersion().getSequenceNumber()<=oldClu.getVersion().getSequenceNumber()){ |
| 3166 | 0 | throw new OperationFailedException("Clu to make current must have been versioned from the current Clu"); |
| 3167 | |
} |
| 3168 | |
}else{ |
| 3169 | |
|
| 3170 | 0 | currentVersionStart = currentDbDate; |
| 3171 | |
} |
| 3172 | |
|
| 3173 | |
|
| 3174 | |
|
| 3175 | 7 | List<VersionDisplayInfo> versionsInFuture = luDao.getVersionsInDateRange(versionIndId, null, currentDbDate, null); |
| 3176 | 7 | for(VersionDisplayInfo versionInFuture:versionsInFuture){ |
| 3177 | 0 | if(oldClu==null || !versionInFuture.getId().equals(oldClu.getId())){ |
| 3178 | 0 | VersionEntity futureClu = luDao.fetch(Clu.class, versionInFuture.getId()); |
| 3179 | 0 | futureClu.getVersion().setCurrentVersionStart(null); |
| 3180 | 0 | futureClu.getVersion().setCurrentVersionEnd(null); |
| 3181 | 0 | futureClu = luDao.update(futureClu); |
| 3182 | 0 | } |
| 3183 | |
} |
| 3184 | |
|
| 3185 | |
|
| 3186 | 7 | if(oldClu!=null){ |
| 3187 | 7 | oldClu.getVersion().setCurrentVersionEnd(currentVersionStart); |
| 3188 | 7 | oldClu = luDao.update(oldClu); |
| 3189 | |
} |
| 3190 | |
|
| 3191 | |
|
| 3192 | 7 | clu.getVersion().setCurrentVersionStart(currentVersionStart); |
| 3193 | 7 | clu.getVersion().setCurrentVersionEnd(null); |
| 3194 | 7 | clu = luDao.update(clu); |
| 3195 | |
|
| 3196 | 7 | StatusInfo statusInfo = new StatusInfo(); |
| 3197 | 7 | statusInfo.setSuccess(true); |
| 3198 | 7 | return statusInfo; |
| 3199 | |
} |
| 3200 | |
|
| 3201 | |
@Override |
| 3202 | |
public VersionDisplayInfo getLatestVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3203 | 0 | VersionDisplayInfo versionInfo = null; |
| 3204 | 0 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3205 | |
try{ |
| 3206 | 0 | versionInfo = luDao.getLatestVersion(refObjectId, refObjectTypeURI); |
| 3207 | 0 | }catch(NoResultException e){ |
| 3208 | 0 | throw new DoesNotExistException(); |
| 3209 | 0 | } |
| 3210 | |
}else{ |
| 3211 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3212 | |
} |
| 3213 | 0 | return versionInfo; |
| 3214 | |
} |
| 3215 | |
|
| 3216 | |
@Override |
| 3217 | |
public VersionDisplayInfo getCurrentVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3218 | 25 | VersionDisplayInfo versionInfo = null; |
| 3219 | 25 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3220 | |
try{ |
| 3221 | 25 | versionInfo = luDao.getCurrentCluVersionInfo(refObjectId, refObjectTypeURI); |
| 3222 | 2 | }catch(NoResultException e){ |
| 3223 | 2 | throw new DoesNotExistException(); |
| 3224 | 23 | } |
| 3225 | |
}else{ |
| 3226 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3227 | |
} |
| 3228 | 23 | return versionInfo; |
| 3229 | |
} |
| 3230 | |
|
| 3231 | |
@Override |
| 3232 | |
public VersionDisplayInfo getCurrentVersionOnDate(String refObjectTypeURI, String refObjectId, Date date) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3233 | 3 | VersionDisplayInfo versionInfo = null; |
| 3234 | 3 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3235 | |
try{ |
| 3236 | 3 | versionInfo = luDao.getCurrentVersionOnDate(refObjectId, refObjectTypeURI, date); |
| 3237 | 0 | }catch(NoResultException e){ |
| 3238 | 0 | throw new DoesNotExistException(); |
| 3239 | 3 | } |
| 3240 | |
}else{ |
| 3241 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3242 | |
} |
| 3243 | 3 | return versionInfo; |
| 3244 | |
} |
| 3245 | |
|
| 3246 | |
@Override |
| 3247 | |
public VersionDisplayInfo getFirstVersion(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3248 | 1 | VersionDisplayInfo versionInfo = null; |
| 3249 | 1 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3250 | |
try{ |
| 3251 | 1 | versionInfo = luDao.getFirstVersion(refObjectId, refObjectTypeURI); |
| 3252 | 0 | }catch(NoResultException e){ |
| 3253 | 0 | throw new DoesNotExistException(); |
| 3254 | 1 | } |
| 3255 | |
}else{ |
| 3256 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3257 | |
} |
| 3258 | 1 | return versionInfo; |
| 3259 | |
} |
| 3260 | |
|
| 3261 | |
@Override |
| 3262 | |
public VersionDisplayInfo getVersionBySequenceNumber(String refObjectTypeURI, String refObjectId, Long sequence) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3263 | 1 | VersionDisplayInfo versionInfo = null; |
| 3264 | 1 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3265 | |
try{ |
| 3266 | 1 | versionInfo = luDao.getVersionBySequenceNumber(refObjectId, refObjectTypeURI, sequence); |
| 3267 | 0 | }catch(NoResultException e){ |
| 3268 | 0 | throw new DoesNotExistException(); |
| 3269 | 1 | } |
| 3270 | |
}else{ |
| 3271 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3272 | |
} |
| 3273 | 1 | return versionInfo; |
| 3274 | |
} |
| 3275 | |
|
| 3276 | |
@Override |
| 3277 | |
public List<VersionDisplayInfo> getVersions(String refObjectTypeURI, String refObjectId) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3278 | 2 | List<VersionDisplayInfo> versionInfos = null; |
| 3279 | 2 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3280 | 2 | versionInfos = luDao.getVersions(refObjectId, refObjectTypeURI); |
| 3281 | 2 | if(versionInfos==null){ |
| 3282 | 0 | versionInfos = Collections.emptyList(); |
| 3283 | |
} |
| 3284 | |
}else{ |
| 3285 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3286 | |
} |
| 3287 | 2 | return versionInfos; |
| 3288 | |
} |
| 3289 | |
|
| 3290 | |
@Override |
| 3291 | |
public List<VersionDisplayInfo> getVersionsInDateRange(String refObjectTypeURI, String refObjectId, Date from, Date to) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 3292 | 1 | List<VersionDisplayInfo> versionInfos = null; |
| 3293 | 1 | if(LuServiceConstants.CLU_NAMESPACE_URI.equals(refObjectTypeURI)){ |
| 3294 | 1 | versionInfos = luDao.getVersionsInDateRange(refObjectId, refObjectTypeURI, from, to); |
| 3295 | 1 | if(versionInfos==null){ |
| 3296 | 0 | versionInfos = Collections.emptyList(); |
| 3297 | |
} |
| 3298 | |
}else{ |
| 3299 | 0 | throw new UnsupportedOperationException("This method does not know how to handle object type:"+refObjectTypeURI); |
| 3300 | |
} |
| 3301 | 1 | return versionInfos; |
| 3302 | |
} |
| 3303 | |
} |