diff options
Diffstat (limited to 'cps-ri/src/main')
5 files changed, 22 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 032745b5ee..7a864a9216 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 117cb43b4f..9443355981 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 806e7ccaba..647d6cdefb 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); } diff --git a/cps-ri/src/main/resources/changelog/changelog-master.yaml b/cps-ri/src/main/resources/changelog/changelog-master.yaml index aa1b49d8b8..218e78b85c 100644 --- a/cps-ri/src/main/resources/changelog/changelog-master.yaml +++ b/cps-ri/src/main/resources/changelog/changelog-master.yaml @@ -44,3 +44,5 @@ databaseChangeLog: file: changelog/db/changes/13-insert-dmi-registry-2022-02-10-schema-set.yaml - include: file: changelog/db/changes/14-loadData-dmi-registry-2022-05-10-schema-set.yaml + - include: + file: changelog/db/changes/15-rename-column-yang-resource-table.yaml
\ No newline at end of file diff --git a/cps-ri/src/main/resources/changelog/db/changes/15-rename-column-yang-resource-table.yaml b/cps-ri/src/main/resources/changelog/db/changes/15-rename-column-yang-resource-table.yaml new file mode 100644 index 0000000000..71f11a5382 --- /dev/null +++ b/cps-ri/src/main/resources/changelog/db/changes/15-rename-column-yang-resource-table.yaml @@ -0,0 +1,14 @@ +databaseChangeLog: + - changeSet: + author: cps + label: yang-resource-rename-column + id: 15 + changes: + - renameColumn: + tableName: yang_resource + columnDataType: TEXT + oldColumnName: name + newColumnName: file_name + rollback: + - sql: + sql: alter table yang_resource rename column file_name to name
\ No newline at end of file |