aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ri/src/main/java')
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java8
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java4
2 files changed, 8 insertions, 4 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
index e9e945a49e..400e9b3e83 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
@@ -162,14 +162,14 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
@Backoff(random = true, delay = 200, maxDelay = 2000, multiplier = 2))
public void storeSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
final Map<String, String> newModuleNameToContentMap,
- final Collection<ModuleReference> moduleReferences) {
+ final Collection<ModuleReference> allModuleReferences) {
storeSchemaSet(dataspaceName, schemaSetName, newModuleNameToContentMap);
final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
final SchemaSetEntity schemaSetEntity =
schemaSetRepository.getByDataspaceAndName(dataspaceEntity, schemaSetName);
- final List<Long> listOfYangResourceIds =
- yangResourceRepository.getResourceIdsByModuleReferences(moduleReferences);
- yangResourceRepository.insertSchemaSetIdYangResourceId(schemaSetEntity.getId(), listOfYangResourceIds);
+ final List<Long> allYangResourceIds =
+ yangResourceRepository.getResourceIdsByModuleReferences(allModuleReferences);
+ yangResourceRepository.insertSchemaSetIdYangResourceId(schemaSetEntity.getId(), allYangResourceIds);
}
@Override
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
index 485f839bf6..850b274c91 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/YangResourceNativeRepositoryImpl.java
@@ -21,6 +21,7 @@
package org.onap.cps.spi.repository;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.StringJoiner;
import javax.persistence.EntityManager;
@@ -42,6 +43,9 @@ public class YangResourceNativeRepositoryImpl implements YangResourceNativeRepos
@Override
@Transactional
public List<Long> getResourceIdsByModuleReferences(final Collection<ModuleReference> moduleReferences) {
+ if (moduleReferences.isEmpty()) {
+ return Collections.emptyList();
+ }
final Query query = entityManager.createNativeQuery(getCombinedSelectSqlQuery(moduleReferences))
.unwrap(org.hibernate.query.NativeQuery.class)
.addScalar("id", StandardBasicTypes.LONG);