diff options
author | leventecsanyi <levente.csanyi@est.tech> | 2024-09-17 12:07:32 +0200 |
---|---|---|
committer | leventecsanyi <levente.csanyi@est.tech> | 2024-09-17 17:28:32 +0200 |
commit | 4310430012a1bd939d406ec8a53045a128505ec9 (patch) | |
tree | 8cc09de92521cd4351f75aa5edca26a7f4532e27 /cps-ri | |
parent | 3cf653576440e233d195e2e54851aec833ee9922 (diff) |
Refactored cps-ri package structure
- fixed import order and moved package structure
Issue-ID: CPS-2293
Change-Id: Ie2f9f057f261577054530feee7480850ba4b41e1
Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
Diffstat (limited to 'cps-ri')
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java) | 14 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java) | 16 | ||||
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java) | 18 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/SchemaSetEntity.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceModuleReference.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceModuleReference.java) | 2 | ||||
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java) | 8 | ||||
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/ri/repository/DataspaceRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java) | 4 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepository.java) | 4 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepositoryImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java) | 6 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java) | 10 | ||||
-rwxr-xr-x | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java) | 280 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQuery.java) | 8 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQueryImpl.java) | 8 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceQuery.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceQuery.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java) | 4 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepositoryImpl.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java) | 6 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepositoryImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/TempTableCreator.java) | 4 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepositoryImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java) | 6 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/utils/CpsSessionFactory.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/config/CpsSessionFactory.java) | 10 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/utils/CpsValidatorImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/utils/CpsValidatorImpl.java) | 4 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/utils/EscapeUtils.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/utils/EscapeUtils.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java) | 11 | ||||
-rw-r--r-- | cps-ri/src/main/java/org/onap/cps/ri/utils/TimeLimiterProvider.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/utils/TimeLimiterProvider.java) | 2 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/CpsDataPersistenceServiceImplSpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy) | 20 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceConcurrencySpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceConcurrencySpec.groovy) | 14 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceSpec.groovy) | 15 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/utils/CpsValidatorImplSpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy) | 5 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/utils/EscapeUtilsSpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/utils/EscapeUtilsSpec.groovy) | 2 | ||||
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/ri/utils/SessionManagerSpec.groovy (renamed from cps-ri/src/test/groovy/org/onap/cps/spi/utils/SessionManagerSpec.groovy) | 12 |
38 files changed, 258 insertions, 259 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java index 13710dbec0..b85b0f9b98 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsAdminPersistenceServiceImpl.java @@ -21,24 +21,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import jakarta.transaction.Transactional; import java.util.Collection; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.SchemaSetRepository; import org.onap.cps.spi.CpsAdminPersistenceService; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.DataspaceInUseException; import org.onap.cps.spi.model.Anchor; import org.onap.cps.spi.model.Dataspace; -import org.onap.cps.spi.repository.AnchorRepository; -import org.onap.cps.spi.repository.DataspaceRepository; -import org.onap.cps.spi.repository.SchemaSetRepository; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java index fd47793a7a..ec46fea4cb 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsDataPersistenceServiceImpl.java @@ -21,7 +21,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import static org.onap.cps.spi.PaginationOption.NO_PAGINATION; @@ -48,12 +48,16 @@ import org.hibernate.StaleStateException; import org.onap.cps.cpspath.parser.CpsPathQuery; import org.onap.cps.cpspath.parser.CpsPathUtil; import org.onap.cps.cpspath.parser.PathParsingException; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.FragmentRepository; +import org.onap.cps.ri.utils.SessionManager; import org.onap.cps.spi.CpsDataPersistenceService; import org.onap.cps.spi.FetchDescendantsOption; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.ConcurrencyException; import org.onap.cps.spi.exceptions.CpsAdminException; @@ -62,10 +66,6 @@ import org.onap.cps.spi.exceptions.DataNodeNotFoundException; import org.onap.cps.spi.exceptions.DataNodeNotFoundExceptionBatch; import org.onap.cps.spi.model.DataNode; import org.onap.cps.spi.model.DataNodeBuilder; -import org.onap.cps.spi.repository.AnchorRepository; -import org.onap.cps.spi.repository.DataspaceRepository; -import org.onap.cps.spi.repository.FragmentRepository; -import org.onap.cps.spi.utils.SessionManager; import org.onap.cps.utils.JsonObjectMapper; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.stereotype.Service; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java index 2c4cc7486b..6f491ba3b7 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/CpsModulePersistenceServiceImpl.java @@ -21,7 +21,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl; +package org.onap.cps.ri; import static com.google.common.base.Preconditions.checkNotNull; @@ -48,21 +48,21 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.hibernate.exception.ConstraintViolationException; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.models.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceModuleReference; +import org.onap.cps.ri.repository.DataspaceRepository; +import org.onap.cps.ri.repository.ModuleReferenceRepository; +import org.onap.cps.ri.repository.SchemaSetRepository; +import org.onap.cps.ri.repository.YangResourceRepository; import org.onap.cps.spi.CpsModulePersistenceService; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; -import org.onap.cps.spi.entities.YangResourceEntity; -import org.onap.cps.spi.entities.YangResourceModuleReference; import org.onap.cps.spi.exceptions.AlreadyDefinedException; import org.onap.cps.spi.exceptions.DuplicatedYangResourceException; import org.onap.cps.spi.exceptions.ModelValidationException; import org.onap.cps.spi.model.ModuleDefinition; import org.onap.cps.spi.model.ModuleReference; import org.onap.cps.spi.model.SchemaSet; -import org.onap.cps.spi.repository.DataspaceRepository; -import org.onap.cps.spi.repository.ModuleReferenceRepository; -import org.onap.cps.spi.repository.SchemaSetRepository; -import org.onap.cps.spi.repository.YangResourceRepository; import org.opendaylight.yangtools.yang.common.Revision; import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java index ac06b0b5a4..bf9e25daf1 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/AnchorEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/AnchorEntity.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java index ddfb09c942..689ae2c000 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/DataspaceEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/DataspaceEntity.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java index c763f61f8f..2c851b60a5 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/FragmentEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/FragmentEntity.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/SchemaSetEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java index e07f766ed0..e99f79e330 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/SchemaSetEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/SchemaSetEntity.java @@ -17,7 +17,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java index 0c54baa4df..2b2d7924db 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceEntity.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceModuleReference.java b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceModuleReference.java index 3c39c6baac..28ef56d38a 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceModuleReference.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/models/YangResourceModuleReference.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.entities; +package org.onap.cps.ri.models; import org.springframework.beans.factory.annotation.Value; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java index d78a016c2e..7fe14b3173 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/AnchorRepository.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.Optional; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; import org.onap.cps.spi.exceptions.AnchorNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/DataspaceRepository.java index b1ce127c4a..b79d802d95 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/DataspaceRepository.java @@ -18,10 +18,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Optional; -import org.onap.cps.spi.entities.DataspaceEntity; +import org.onap.cps.ri.models.DataspaceEntity; import org.onap.cps.spi.exceptions.DataspaceNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepository.java index 2460db869a..6813995d99 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepository.java @@ -18,11 +18,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.FetchDescendantsOption; -import org.onap.cps.spi.entities.FragmentEntity; public interface FragmentPrefetchRepository { Collection<FragmentEntity> prefetchDescendantsOfFragmentEntities( diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepositoryImpl.java index c187f20ea9..bcf01b3d76 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentPrefetchRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.sql.Connection; import java.util.Collection; @@ -29,9 +29,9 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; import lombok.RequiredArgsConstructor; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.FetchDescendantsOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.PreparedStatementSetter; import org.springframework.jdbc.core.RowMapper; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java index eb61d56632..b8bbf59c23 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentQueryBuilder.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentQueryBuilder.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -32,12 +32,12 @@ import java.util.Queue; import lombok.RequiredArgsConstructor; import org.onap.cps.cpspath.parser.CpsPathPrefixType; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.utils.EscapeUtils; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; import org.onap.cps.spi.exceptions.CpsPathException; -import org.onap.cps.spi.utils.EscapeUtils; import org.springframework.stereotype.Component; @RequiredArgsConstructor diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java index 1a31d2b499..8edc3f2311 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepository.java @@ -1,140 +1,140 @@ -/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
- * Modifications Copyright (C) 2020-2021 Bell Canada.
- * Modifications Copyright (C) 2020-2021 Pantheon.tech.
- * Modifications Copyright (C) 2023 TechMahindra Ltd.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.cps.spi.repository;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Optional;
-import org.onap.cps.spi.entities.AnchorEntity;
-import org.onap.cps.spi.entities.DataspaceEntity;
-import org.onap.cps.spi.entities.FragmentEntity;
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
-import org.onap.cps.spi.utils.EscapeUtils;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-@Repository
-public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, FragmentRepositoryCpsPathQuery,
- FragmentPrefetchRepository {
-
- Optional<FragmentEntity> findByAnchorAndXpath(AnchorEntity anchorEntity, String xpath);
-
- default FragmentEntity getByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) {
- return findByAnchorAndXpath(anchorEntity, xpath).orElseThrow(() ->
- new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)",
- nativeQuery = true)
- List<FragmentEntity> findByAnchorIdAndXpathIn(@Param("anchorId") long anchorId,
- @Param("xpaths") String[] xpaths);
-
- default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity,
- final Collection<String> xpaths) {
- return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId \n"
- + "AND xpath LIKE :escapedXpath||'[@%]' AND xpath NOT LIKE :escapedXpath||'[@%]/%[@%]'",
- nativeQuery = true)
- List<FragmentEntity> findListByAnchorIdAndEscapedXpath(@Param("anchorId") long anchorId,
- @Param("escapedXpath") String escapedXpath);
-
- default List<FragmentEntity> findListByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) {
- final String escapedXpath = EscapeUtils.escapeForSqlLike(xpath);
- return findListByAnchorIdAndEscapedXpath(anchorEntity.getId(), escapedXpath);
- }
-
- @Query(value = "SELECT fragment.* FROM fragment JOIN anchor ON anchor.id = fragment.anchor_id "
- + "WHERE dataspace_id = :dataspaceId AND xpath = ANY (:xpaths)", nativeQuery = true)
- List<FragmentEntity> findByDataspaceIdAndXpathIn(@Param("dataspaceId") int dataspaceId,
- @Param("xpaths") String[] xpaths);
-
- default List<FragmentEntity> findByDataspaceAndXpathIn(final DataspaceEntity dataspaceEntity,
- final Collection<String> xpaths) {
- return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id IN (:anchorIds)"
- + " AND xpath = ANY (:xpaths)", nativeQuery = true)
- List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Long[] anchorIds,
- @Param("xpaths") String[] xpaths);
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId LIMIT 1", nativeQuery = true)
- Optional<FragmentEntity> findOneByAnchorId(@Param("anchorId") long anchorId);
-
- @Modifying
- @Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true)
- void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds);
-
- default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) {
- deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray());
- }
-
- @Modifying
- @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true)
- void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths);
-
- default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) {
- deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0]));
- }
-
- @Modifying
- @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)",
- nativeQuery = true)
- void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId,
- @Param("xpathPatterns") String[] xpathPatterns);
-
- default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) {
- deleteByAnchorIdAndXpathLikeAny(anchorId,
- xpaths.stream().map(xpath -> EscapeUtils.escapeForSqlLike(xpath) + "[@%").toArray(String[]::new));
- }
-
- @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)",
- nativeQuery = true)
- List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId,
- @Param("xpaths") String[] xpaths);
-
- default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity,
- final Collection<String> xpaths) {
- return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0]));
- }
-
- @Query(value = "SELECT EXISTS(SELECT 1 FROM fragment WHERE anchor_id = :anchorId"
- + " AND xpath LIKE :xpathPattern LIMIT 1)", nativeQuery = true)
- boolean existsByAnchorIdAndParentXpathAndXpathLike(@Param("anchorId") long anchorId,
- @Param("xpathPattern") String xpathPattern);
-
- default boolean existsByAnchorAndXpathStartsWith(final AnchorEntity anchorEntity, final String xpath) {
- return existsByAnchorIdAndParentXpathAndXpathLike(anchorEntity.getId(),
- EscapeUtils.escapeForSqlLike(xpath) + "%");
- }
-
- @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND parent_id IS NULL", nativeQuery = true)
- List<FragmentEntity> findRootsByAnchorId(@Param("anchorId") long anchorId);
-
-}
+/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2023 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Bell Canada. + * Modifications Copyright (C) 2020-2021 Pantheon.tech. + * Modifications Copyright (C) 2023 TechMahindra Ltd. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ri.repository; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; +import org.onap.cps.ri.utils.EscapeUtils; +import org.onap.cps.spi.exceptions.DataNodeNotFoundException; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +@Repository +public interface FragmentRepository extends JpaRepository<FragmentEntity, Long>, FragmentRepositoryCpsPathQuery, + FragmentPrefetchRepository { + + Optional<FragmentEntity> findByAnchorAndXpath(AnchorEntity anchorEntity, String xpath); + + default FragmentEntity getByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) { + return findByAnchorAndXpath(anchorEntity, xpath).orElseThrow(() -> + new DataNodeNotFoundException(anchorEntity.getDataspace().getName(), anchorEntity.getName(), xpath)); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + nativeQuery = true) + List<FragmentEntity> findByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, + @Param("xpaths") String[] xpaths); + + default List<FragmentEntity> findByAnchorAndXpathIn(final AnchorEntity anchorEntity, + final Collection<String> xpaths) { + return findByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId \n" + + "AND xpath LIKE :escapedXpath||'[@%]' AND xpath NOT LIKE :escapedXpath||'[@%]/%[@%]'", + nativeQuery = true) + List<FragmentEntity> findListByAnchorIdAndEscapedXpath(@Param("anchorId") long anchorId, + @Param("escapedXpath") String escapedXpath); + + default List<FragmentEntity> findListByAnchorAndXpath(final AnchorEntity anchorEntity, final String xpath) { + final String escapedXpath = EscapeUtils.escapeForSqlLike(xpath); + return findListByAnchorIdAndEscapedXpath(anchorEntity.getId(), escapedXpath); + } + + @Query(value = "SELECT fragment.* FROM fragment JOIN anchor ON anchor.id = fragment.anchor_id " + + "WHERE dataspace_id = :dataspaceId AND xpath = ANY (:xpaths)", nativeQuery = true) + List<FragmentEntity> findByDataspaceIdAndXpathIn(@Param("dataspaceId") int dataspaceId, + @Param("xpaths") String[] xpaths); + + default List<FragmentEntity> findByDataspaceAndXpathIn(final DataspaceEntity dataspaceEntity, + final Collection<String> xpaths) { + return findByDataspaceIdAndXpathIn(dataspaceEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id IN (:anchorIds)" + + " AND xpath = ANY (:xpaths)", nativeQuery = true) + List<FragmentEntity> findByAnchorIdsAndXpathIn(@Param("anchorIds") Long[] anchorIds, + @Param("xpaths") String[] xpaths); + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId LIMIT 1", nativeQuery = true) + Optional<FragmentEntity> findOneByAnchorId(@Param("anchorId") long anchorId); + + @Modifying + @Query(value = "DELETE FROM fragment WHERE anchor_id = ANY (:anchorIds)", nativeQuery = true) + void deleteByAnchorIdIn(@Param("anchorIds") long[] anchorIds); + + default void deleteByAnchorIn(final Collection<AnchorEntity> anchorEntities) { + deleteByAnchorIdIn(anchorEntities.stream().map(AnchorEntity::getId).mapToLong(id -> id).toArray()); + } + + @Modifying + @Query(value = "DELETE FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", nativeQuery = true) + void deleteByAnchorIdAndXpaths(@Param("anchorId") long anchorId, @Param("xpaths") String[] xpaths); + + default void deleteByAnchorIdAndXpaths(final long anchorId, final Collection<String> xpaths) { + deleteByAnchorIdAndXpaths(anchorId, xpaths.toArray(new String[0])); + } + + @Modifying + @Query(value = "DELETE FROM fragment f WHERE anchor_id = :anchorId AND xpath LIKE ANY (:xpathPatterns)", + nativeQuery = true) + void deleteByAnchorIdAndXpathLikeAny(@Param("anchorId") long anchorId, + @Param("xpathPatterns") String[] xpathPatterns); + + default void deleteListsByAnchorIdAndXpaths(long anchorId, Collection<String> xpaths) { + deleteByAnchorIdAndXpathLikeAny(anchorId, + xpaths.stream().map(xpath -> EscapeUtils.escapeForSqlLike(xpath) + "[@%").toArray(String[]::new)); + } + + @Query(value = "SELECT xpath FROM fragment WHERE anchor_id = :anchorId AND xpath = ANY (:xpaths)", + nativeQuery = true) + List<String> findAllXpathByAnchorIdAndXpathIn(@Param("anchorId") long anchorId, + @Param("xpaths") String[] xpaths); + + default List<String> findAllXpathByAnchorAndXpathIn(final AnchorEntity anchorEntity, + final Collection<String> xpaths) { + return findAllXpathByAnchorIdAndXpathIn(anchorEntity.getId(), xpaths.toArray(new String[0])); + } + + @Query(value = "SELECT EXISTS(SELECT 1 FROM fragment WHERE anchor_id = :anchorId" + + " AND xpath LIKE :xpathPattern LIMIT 1)", nativeQuery = true) + boolean existsByAnchorIdAndParentXpathAndXpathLike(@Param("anchorId") long anchorId, + @Param("xpathPattern") String xpathPattern); + + default boolean existsByAnchorAndXpathStartsWith(final AnchorEntity anchorEntity, final String xpath) { + return existsByAnchorIdAndParentXpathAndXpathLike(anchorEntity.getId(), + EscapeUtils.escapeForSqlLike(xpath) + "%"); + } + + @Query(value = "SELECT * FROM fragment WHERE anchor_id = :anchorId AND parent_id IS NULL", nativeQuery = true) + List<FragmentEntity> findRootsByAnchorId(@Param("anchorId") long anchorId); + +} diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQuery.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java index 9c279618b0..49c8e76ab5 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQuery.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQuery.java @@ -19,14 +19,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.List; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; public interface FragmentRepositoryCpsPathQuery { List<FragmentEntity> findByAnchorAndCpsPath(AnchorEntity anchorEntity, CpsPathQuery cpsPathQuery); diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQueryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java index 9c98f7f7d9..01b2813cd3 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentRepositoryCpsPathQueryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/FragmentRepositoryCpsPathQueryImpl.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.Query; import jakarta.transaction.Transactional; @@ -27,10 +27,10 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.cpspath.parser.CpsPathQuery; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.FragmentEntity; import org.onap.cps.spi.PaginationOption; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.FragmentEntity; @RequiredArgsConstructor @Slf4j diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceQuery.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceQuery.java index 4082307384..ad0f9c5c61 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceQuery.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceQuery.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.Map; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepository.java index 15ffa372f9..e9b866cc19 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepository.java @@ -18,9 +18,9 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; -import org.onap.cps.spi.entities.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java index 6cc8234c90..c160fb1e38 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleReferenceRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/ModuleReferenceRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java index 3c5f973cb0..9357a5c6a7 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetRepository.java @@ -19,13 +19,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; import java.util.Optional; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; import org.onap.cps.spi.exceptions.SchemaSetNotFoundException; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepository.java index aacebd63b3..8350d5728c 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepository.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.List; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepositoryImpl.java index c786a62d0c..287bcda01b 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetYangResourceRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/SchemaSetYangResourceRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/TempTableCreator.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java index 5804b2dc5d..cc83ab7d94 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/TempTableCreator.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/TempTableCreator.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; @@ -31,7 +31,7 @@ import java.util.UUID; import java.util.stream.Collectors; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.onap.cps.spi.utils.EscapeUtils; +import org.onap.cps.ri.utils.EscapeUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepository.java index 9ae32b3e78..ef7b12dc9c 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepository.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepositoryImpl.java index c84ff427e6..c65ab7d6fa 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceNativeRepositoryImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java index 8be0d9a33b..9a11592310 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/repository/YangResourceRepository.java @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.repository; +package org.onap.cps.ri.repository; import java.util.Collection; import java.util.List; import java.util.Set; -import org.onap.cps.spi.entities.YangResourceEntity; -import org.onap.cps.spi.entities.YangResourceModuleReference; +import org.onap.cps.ri.models.YangResourceEntity; +import org.onap.cps.ri.models.YangResourceModuleReference; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/config/CpsSessionFactory.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsSessionFactory.java index 5241ea0096..c0291176f4 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/config/CpsSessionFactory.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsSessionFactory.java @@ -18,15 +18,15 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.config; +package org.onap.cps.ri.utils; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; -import org.onap.cps.spi.entities.SchemaSetEntity; -import org.onap.cps.spi.entities.YangResourceEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.models.SchemaSetEntity; +import org.onap.cps.ri.models.YangResourceEntity; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/utils/CpsValidatorImpl.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsValidatorImpl.java index c727388b25..4f942a37ea 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/utils/CpsValidatorImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/CpsValidatorImpl.java @@ -18,16 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl.utils; +package org.onap.cps.ri.utils; import com.google.common.collect.Lists; import java.util.Arrays; import java.util.Collection; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.onap.cps.impl.utils.CpsValidator; import org.onap.cps.spi.PaginationOption; import org.onap.cps.spi.exceptions.DataValidationException; -import org.onap.cps.spi.utils.CpsValidator; import org.springframework.stereotype.Component; @Slf4j diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/EscapeUtils.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/EscapeUtils.java index 2b61d39503..5323ae6bc9 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/EscapeUtils.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/EscapeUtils.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import lombok.AccessLevel; import lombok.NoArgsConstructor; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java index 6150bf9dbe..b81a0bd39d 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/SessionManager.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/SessionManager.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import com.google.common.util.concurrent.TimeLimiter; import com.google.common.util.concurrent.UncheckedExecutionException; @@ -36,13 +36,12 @@ import lombok.extern.slf4j.Slf4j; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.Session; -import org.onap.cps.spi.config.CpsSessionFactory; -import org.onap.cps.spi.entities.AnchorEntity; -import org.onap.cps.spi.entities.DataspaceEntity; +import org.onap.cps.ri.models.AnchorEntity; +import org.onap.cps.ri.models.DataspaceEntity; +import org.onap.cps.ri.repository.AnchorRepository; +import org.onap.cps.ri.repository.DataspaceRepository; import org.onap.cps.spi.exceptions.SessionManagerException; import org.onap.cps.spi.exceptions.SessionTimeoutException; -import org.onap.cps.spi.repository.AnchorRepository; -import org.onap.cps.spi.repository.DataspaceRepository; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; diff --git a/cps-ri/src/main/java/org/onap/cps/spi/utils/TimeLimiterProvider.java b/cps-ri/src/main/java/org/onap/cps/ri/utils/TimeLimiterProvider.java index 2bd7ac3763..10031c0b28 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/utils/TimeLimiterProvider.java +++ b/cps-ri/src/main/java/org/onap/cps/ri/utils/TimeLimiterProvider.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils; +package org.onap.cps.ri.utils; import com.google.common.util.concurrent.SimpleTimeLimiter; import com.google.common.util.concurrent.TimeLimiter; diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsDataPersistenceServiceImplSpec.groovy index c72c3046e8..36bf55e2db 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceServiceSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsDataPersistenceServiceImplSpec.groovy @@ -18,29 +18,29 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import com.fasterxml.jackson.databind.ObjectMapper import org.hibernate.StaleStateException +import org.onap.cps.ri.models.AnchorEntity +import org.onap.cps.ri.models.DataspaceEntity +import org.onap.cps.ri.models.FragmentEntity +import org.onap.cps.ri.repository.AnchorRepository +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.FragmentRepository +import org.onap.cps.ri.utils.SessionManager import org.onap.cps.spi.FetchDescendantsOption -import org.onap.cps.spi.entities.AnchorEntity -import org.onap.cps.spi.entities.DataspaceEntity -import org.onap.cps.spi.entities.FragmentEntity - import org.onap.cps.spi.exceptions.ConcurrencyException import org.onap.cps.spi.exceptions.DataValidationException import org.onap.cps.spi.model.DataNode import org.onap.cps.spi.model.DataNodeBuilder -import org.onap.cps.spi.repository.AnchorRepository -import org.onap.cps.spi.repository.DataspaceRepository -import org.onap.cps.spi.repository.FragmentRepository -import org.onap.cps.spi.utils.SessionManager import org.onap.cps.utils.JsonObjectMapper import org.springframework.dao.DataIntegrityViolationException import spock.lang.Specification + import java.util.stream.Collectors -class CpsDataPersistenceServiceSpec extends Specification { +class CpsDataPersistenceServiceImplSpec extends Specification { def mockDataspaceRepository = Mock(DataspaceRepository) def mockAnchorRepository = Mock(AnchorRepository) diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceConcurrencySpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceConcurrencySpec.groovy index 2e4dba2e9b..b892fe4dae 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceConcurrencySpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceConcurrencySpec.groovy @@ -18,19 +18,19 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import org.hibernate.exception.ConstraintViolationException +import org.onap.cps.ri.models.DataspaceEntity +import org.onap.cps.ri.models.SchemaSetEntity +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.ModuleReferenceRepository +import org.onap.cps.ri.repository.SchemaSetRepository +import org.onap.cps.ri.repository.YangResourceRepository import org.onap.cps.spi.CpsAdminPersistenceService import org.onap.cps.spi.CpsModulePersistenceService -import org.onap.cps.spi.entities.DataspaceEntity -import org.onap.cps.spi.entities.SchemaSetEntity import org.onap.cps.spi.exceptions.DuplicatedYangResourceException import org.onap.cps.spi.model.ModuleReference -import org.onap.cps.spi.repository.DataspaceRepository -import org.onap.cps.spi.repository.ModuleReferenceRepository -import org.onap.cps.spi.repository.SchemaSetRepository -import org.onap.cps.spi.repository.YangResourceRepository import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy index 3447a1c599..1b61ff39c0 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsModulePersistenceServiceSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/CpsModulePersistenceServiceImplSpec.groovy @@ -17,25 +17,26 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl +package org.onap.cps.ri import org.hibernate.exception.ConstraintViolationException +import org.onap.cps.ri.models.SchemaSetEntity +import org.onap.cps.ri.repository.DataspaceRepository +import org.onap.cps.ri.repository.ModuleReferenceRepository +import org.onap.cps.ri.repository.SchemaSetRepository +import org.onap.cps.ri.repository.YangResourceRepository import org.onap.cps.spi.CpsModulePersistenceService -import org.onap.cps.spi.entities.SchemaSetEntity import org.onap.cps.spi.exceptions.DuplicatedYangResourceException import org.onap.cps.spi.model.ModuleReference -import org.onap.cps.spi.repository.DataspaceRepository -import org.onap.cps.spi.repository.ModuleReferenceRepository -import org.onap.cps.spi.repository.SchemaSetRepository -import org.onap.cps.spi.repository.YangResourceRepository import org.springframework.dao.DataIntegrityViolationException import spock.lang.Specification + import java.sql.SQLException /** * Specification unit test class for CPS module persistence service. */ -class CpsModulePersistenceServiceSpec extends Specification { +class CpsModulePersistenceServiceImplSpec extends Specification { CpsModulePersistenceService objectUnderTest diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/CpsValidatorImplSpec.groovy index 8d348443c7..d57bf25058 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/utils/CpsValidatorSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/CpsValidatorImplSpec.groovy @@ -18,13 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.impl.utils +package org.onap.cps.ri.utils + import org.onap.cps.spi.PaginationOption import org.onap.cps.spi.exceptions.DataValidationException import spock.lang.Specification -class CpsValidatorSpec extends Specification { +class CpsValidatorImplSpec extends Specification { def objectUnderTest = new CpsValidatorImpl() diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/EscapeUtilsSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/EscapeUtilsSpec.groovy index 52330e6251..8afd9695a7 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/EscapeUtilsSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/EscapeUtilsSpec.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils +package org.onap.cps.ri.utils import spock.lang.Specification diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/SessionManagerSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/SessionManagerSpec.groovy index feda338b80..b50a20c124 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/utils/SessionManagerSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/ri/utils/SessionManagerSpec.groovy @@ -18,20 +18,18 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.spi.utils +package org.onap.cps.ri.utils import com.google.common.util.concurrent.TimeLimiter import com.google.common.util.concurrent.UncheckedExecutionException import org.hibernate.HibernateException +import org.hibernate.Session import org.hibernate.Transaction -import org.onap.cps.spi.config.CpsSessionFactory -import org.onap.cps.spi.entities.AnchorEntity +import org.onap.cps.ri.models.AnchorEntity +import org.onap.cps.ri.repository.AnchorRepository +import org.onap.cps.ri.repository.DataspaceRepository import org.onap.cps.spi.exceptions.SessionManagerException -import org.onap.cps.spi.repository.AnchorRepository -import org.onap.cps.spi.repository.DataspaceRepository import spock.lang.Specification -import org.hibernate.Session -import java.util.concurrent.ExecutionException class SessionManagerSpec extends Specification { |