summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main/java/org
diff options
context:
space:
mode:
authorDylanB95EST <dylan.byrne@est.tech>2022-08-04 18:07:24 +0100
committerDylanB95EST <dylan.byrne@est.tech>2022-08-05 09:52:55 +0100
commite038e5b3c33348fa691765220476bfe3acba955c (patch)
treede35edbb9b39c011d9a6765f960447c69701aa79 /cps-ri/src/main/java/org
parent18cd7ed56f0afa07312694510f8e21fbcc32b993 (diff)
Rename name column in yang resource table
- Rename name column in yang_resource table to file_name - Refactor instances where it occures in code and tests - Add new changelog file to rename occurance Issue-ID: CPS-529 Change-Id: I2aff97410bdb041b90d8ceaeff75e562ef8d9238 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-ri/src/main/java/org')
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java4
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java2
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java6
3 files changed, 6 insertions, 6 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
index 032745b5e..7a864a921 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/YangResourceEntity.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Pantheon.tech
- * Modifications Copyright (C) 2021 Nordix Foundation
+ * Modifications Copyright (C) 2021-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public class YangResourceEntity implements Serializable {
@NotNull
@Column
- private String name;
+ private String fileName;
@NotNull
@Column
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
index 117cb43b4..944335598 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java
@@ -263,7 +263,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
final SchemaSetEntity schemaSetEntity = fragmentEntity.getAnchor().getSchemaSet();
final Map<String, String> yangResourceNameToContent =
schemaSetEntity.getYangResources().stream().collect(
- Collectors.toMap(YangResourceEntity::getName, YangResourceEntity::getContent));
+ Collectors.toMap(YangResourceEntity::getFileName, YangResourceEntity::getContent));
final SchemaContext schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent)
.getSchemaContext();
return schemaContext.getModules().iterator().next().getName();
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 806e7ccab..647d6cdef 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
@@ -96,7 +96,7 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
final var schemaSetEntity =
schemaSetRepository.getByDataspaceAndName(dataspaceEntity, schemaSetName);
return schemaSetEntity.getYangResources().stream().collect(
- Collectors.toMap(YangResourceEntity::getName, YangResourceEntity::getContent));
+ Collectors.toMap(YangResourceEntity::getFileName, YangResourceEntity::getContent));
}
@Override
@@ -203,7 +203,7 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
final Map<String, String> moduleNameAndRevisionMap = createModuleNameAndRevisionMap(entry.getKey(),
entry.getValue());
final var yangResourceEntity = new YangResourceEntity();
- yangResourceEntity.setName(entry.getKey());
+ yangResourceEntity.setFileName(entry.getKey());
yangResourceEntity.setContent(entry.getValue());
yangResourceEntity.setModuleName(moduleNameAndRevisionMap.get("moduleName"));
yangResourceEntity.setRevision(moduleNameAndRevisionMap.get("revision"));
@@ -328,7 +328,7 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
yangResourceEntities.stream()
.filter(entity -> StringUtils.equals(checksum, (entity.getChecksum())))
.findFirst()
- .map(YangResourceEntity::getName)
+ .map(YangResourceEntity::getFileName)
.orElse(null);
}