summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/java/org
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-04-13 17:27:03 +0100
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-04-14 16:17:26 +0000
commitfb5f5c24db5c9fefa40a6d489ab533d3ad2b602f (patch)
treed9aac694f4cfbe6e8b8253592427073e41f75a48 /cps-ri/src/main/java/org
parent375f84708e981d5943d170913dec08d3365a0b1f (diff)
Remove @NotNull from repository methods
Issue-ID: CPS-1573 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I55312bdc5454ed9ca60441b3968d19a61028eb66
Diffstat (limited to 'cps-ri/src/main/java/org')
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java24
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java6
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java17
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java5
4 files changed, 23 insertions, 29 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
index 46b0fec1c2..f7b586d7b3 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/AnchorRepository.java
@@ -22,7 +22,6 @@ package org.onap.cps.spi.repository;
import java.util.Collection;
import java.util.Optional;
-import javax.validation.constraints.NotNull;
import org.onap.cps.spi.entities.AnchorEntity;
import org.onap.cps.spi.entities.DataspaceEntity;
import org.onap.cps.spi.entities.SchemaSetEntity;
@@ -35,25 +34,24 @@ import org.springframework.stereotype.Repository;
@Repository
public interface AnchorRepository extends JpaRepository<AnchorEntity, Integer> {
- Optional<AnchorEntity> findByDataspaceAndName(@NotNull DataspaceEntity dataspaceEntity, @NotNull String name);
+ Optional<AnchorEntity> findByDataspaceAndName(DataspaceEntity dataspaceEntity, String name);
- default AnchorEntity getByDataspaceAndName(@NotNull DataspaceEntity dataspace,
- @NotNull String anchorName) {
+ default AnchorEntity getByDataspaceAndName(DataspaceEntity dataspace, String anchorName) {
return findByDataspaceAndName(dataspace, anchorName)
.orElseThrow(() -> new AnchorNotFoundException(anchorName, dataspace.getName()));
}
- Collection<AnchorEntity> findAllByDataspace(@NotNull DataspaceEntity dataspaceEntity);
+ Collection<AnchorEntity> findAllByDataspace(DataspaceEntity dataspaceEntity);
- Collection<AnchorEntity> findAllBySchemaSet(@NotNull SchemaSetEntity schemaSetEntity);
+ Collection<AnchorEntity> findAllBySchemaSet(SchemaSetEntity schemaSetEntity);
- Collection<AnchorEntity> findAllByDataspaceAndNameIn(@NotNull DataspaceEntity dataspaceEntity,
- @NotNull Collection<String> anchorNames);
+ Collection<AnchorEntity> findAllByDataspaceAndNameIn(DataspaceEntity dataspaceEntity,
+ Collection<String> anchorNames);
- Collection<AnchorEntity> findAllByDataspaceAndSchemaSetNameIn(@NotNull DataspaceEntity dataspaceEntity,
- @NotNull Collection<String> schemaSetNames);
+ Collection<AnchorEntity> findAllByDataspaceAndSchemaSetNameIn(DataspaceEntity dataspaceEntity,
+ Collection<String> schemaSetNames);
- Integer countByDataspace(@NotNull DataspaceEntity dataspaceEntity);
+ Integer countByDataspace(DataspaceEntity dataspaceEntity);
@Query(value = "SELECT anchor.* FROM yang_resource\n"
+ "JOIN schema_set_yang_resources ON schema_set_yang_resources.yang_resource_id = yang_resource.id\n"
@@ -65,6 +63,6 @@ public interface AnchorRepository extends JpaRepository<AnchorEntity, Integer> {
Collection<AnchorEntity> getAnchorsByDataspaceIdAndModuleNames(@Param("dataspaceId") int dataspaceId,
@Param("moduleNames") Collection<String> moduleNames, @Param("sizeOfModuleNames") int sizeOfModuleNames);
- void deleteAllByDataspaceAndNameIn(@NotNull DataspaceEntity dataspaceEntity,
- @NotNull Collection<String> anchorNames);
+ void deleteAllByDataspaceAndNameIn(DataspaceEntity dataspaceEntity,
+ Collection<String> anchorNames);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java
index 10c6541d0c..b1ce127c4a 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/DataspaceRepository.java
@@ -1,6 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,6 @@
package org.onap.cps.spi.repository;
import java.util.Optional;
-import javax.validation.constraints.NotNull;
import org.onap.cps.spi.entities.DataspaceEntity;
import org.onap.cps.spi.exceptions.DataspaceNotFoundException;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface DataspaceRepository extends JpaRepository<DataspaceEntity, Integer> {
- Optional<DataspaceEntity> findByName(@NotNull String name);
+ Optional<DataspaceEntity> findByName(String name);
/**
* Get a dataspace by name.
@@ -38,7 +38,7 @@ public interface DataspaceRepository extends JpaRepository<DataspaceEntity, Inte
* @param name the name of the dataspace
* @return the Dataspace found
*/
- default DataspaceEntity getByName(@NotNull final String name) {
+ default DataspaceEntity getByName(final String name) {
return findByName(name).orElseThrow(() -> new DataspaceNotFoundException(name));
}
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java
index 98d4420101..3263f34473 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/SchemaSetRepository.java
@@ -25,7 +25,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-import javax.validation.constraints.NotNull;
import org.onap.cps.spi.entities.DataspaceEntity;
import org.onap.cps.spi.entities.SchemaSetEntity;
import org.onap.cps.spi.exceptions.SchemaSetNotFoundException;
@@ -38,17 +37,16 @@ import org.springframework.stereotype.Repository;
@Repository
public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Integer> {
- Optional<SchemaSetEntity> findByDataspaceAndName(@NotNull DataspaceEntity dataspaceEntity,
- @NotNull String schemaSetName);
+ Optional<SchemaSetEntity> findByDataspaceAndName(DataspaceEntity dataspaceEntity, String schemaSetName);
/**
* Gets schema sets by dataspace.
* @param dataspaceEntity dataspace entity
* @return list of schema set entity
*/
- Collection<SchemaSetEntity> findByDataspace(@NotNull DataspaceEntity dataspaceEntity);
+ Collection<SchemaSetEntity> findByDataspace(DataspaceEntity dataspaceEntity);
- Integer countByDataspace(@NotNull DataspaceEntity dataspaceEntity);
+ Integer countByDataspace(DataspaceEntity dataspaceEntity);
/**
* Gets a schema set by dataspace and schema set name.
@@ -58,8 +56,7 @@ public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Inte
* @return schema set entity
* @throws SchemaSetNotFoundException if SchemaSet not found
*/
- default SchemaSetEntity getByDataspaceAndName(@NotNull final DataspaceEntity dataspaceEntity,
- @NotNull final String schemaSetName) {
+ default SchemaSetEntity getByDataspaceAndName(final DataspaceEntity dataspaceEntity, final String schemaSetName) {
return findByDataspaceAndName(dataspaceEntity, schemaSetName)
.orElseThrow(() -> new SchemaSetNotFoundException(dataspaceEntity.getName(), schemaSetName));
}
@@ -71,7 +68,7 @@ public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Inte
* @return list of schema set entity
* @throws SchemaSetNotFoundException if SchemaSet not found
*/
- default List<SchemaSetEntity> getByDataspace(@NotNull final DataspaceEntity dataspaceEntity) {
+ default List<SchemaSetEntity> getByDataspace(final DataspaceEntity dataspaceEntity) {
return findByDataspace(dataspaceEntity).stream().collect(Collectors.toList());
}
@@ -82,6 +79,6 @@ public interface SchemaSetRepository extends JpaRepository<SchemaSetEntity, Inte
*/
@Modifying
@Query("DELETE FROM SchemaSetEntity s WHERE s.dataspace = :dataspaceEntity AND s.name IN (:schemaSetNames)")
- void deleteByDataspaceAndNameIn(@NotNull @Param("dataspaceEntity") final DataspaceEntity dataspaceEntity,
- @NotNull @Param("schemaSetNames") final Collection<String> schemaSetNames);
+ void deleteByDataspaceAndNameIn(@Param("dataspaceEntity") DataspaceEntity dataspaceEntity,
+ @Param("schemaSetNames") Collection<String> schemaSetNames);
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
index 6ca4fff4f4..fff0a6a037 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceRepository.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2021-2022 Nordix Foundation
+ * Modifications Copyright (C) 2021-2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ package org.onap.cps.spi.repository;
import java.util.Collection;
import java.util.List;
import java.util.Set;
-import javax.validation.constraints.NotNull;
import org.onap.cps.spi.entities.YangResourceEntity;
import org.onap.cps.spi.entities.YangResourceModuleReference;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -36,7 +35,7 @@ import org.springframework.stereotype.Repository;
public interface YangResourceRepository extends JpaRepository<YangResourceEntity, Long>,
YangResourceNativeRepository, SchemaSetYangResourceRepository {
- List<YangResourceEntity> findAllByChecksumIn(@NotNull Set<String> checksum);
+ List<YangResourceEntity> findAllByChecksumIn(Set<String> checksum);
@Query(value = "SELECT DISTINCT\n"
+ "yang_resource.module_name AS module_name,\n"