summaryrefslogtreecommitdiffstats
path: root/cps-ri/src/main
diff options
context:
space:
mode:
authorRishi.Chail <rishi.chail@est.tech>2020-11-19 06:18:26 +0000
committerRishi Chail <rishi.chail@est.tech>2020-11-19 09:11:08 +0000
commit5a1b4b66b68776e0a13c98d2f41fe39f957fdf4b (patch)
treef692e7b2d3a95d7098efe53f65fd1979f8a86217 /cps-ri/src/main
parent87c74a1456c395d29f51f35b6e9a1f526114cef7 (diff)
Fix name inconsistency of classes
Issue-ID: CPS-90 Signed-off-by: Rishi.Chail <rishi.chail@est.tech> Change-Id: I13196084a6ff4a7c4cd23e9e8ba58fa8fffd43bf
Diffstat (limited to 'cps-ri/src/main')
-rwxr-xr-x[-rw-r--r--]cps-ri/src/main/java/org/onap/cps/spi/entities/Fragment.java2
-rwxr-xr-x[-rw-r--r--]cps-ri/src/main/java/org/onap/cps/spi/entities/Module.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/entities/ModuleEntity.java)7
-rwxr-xr-x[-rw-r--r--]cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistenceServiceImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java)4
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/FragmentPersistenceServiceImpl.java6
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistenceServiceImpl.java (renamed from cps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistencyServiceImpl.java)12
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/repository/ModuleRepository.java14
6 files changed, 24 insertions, 21 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/Fragment.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/Fragment.java
index 4d8a90b733..7afdb3e092 100644..100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/Fragment.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/Fragment.java
@@ -85,5 +85,5 @@ public class Fragment implements Serializable {
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "module_id")
- private ModuleEntity module;
+ private Module module;
}
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/entities/ModuleEntity.java b/cps-ri/src/main/java/org/onap/cps/spi/entities/Module.java
index d2130aeec1..ef6895c7d4 100644..100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/entities/ModuleEntity.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/entities/Module.java
@@ -20,6 +20,7 @@
package org.onap.cps.spi.entities;
+import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -45,7 +46,9 @@ import lombok.Setter;
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "module")
-public class ModuleEntity {
+public class Module implements Serializable {
+
+ private static final long serialVersionUID = -748666970938314895L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@@ -75,7 +78,7 @@ public class ModuleEntity {
* @param revision the revision number of the module.
* @param dataspace the dataspace related to the module.
*/
- public ModuleEntity(String namespace, String moduleContent, String revision, Dataspace dataspace) {
+ public Module(String namespace, String moduleContent, String revision, Dataspace dataspace) {
this.namespace = namespace;
this.moduleContent = moduleContent;
this.revision = revision;
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistenceServiceImpl.java
index 2b4f1357de..9ed111271a 100644..100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistencyServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/DataPersistenceServiceImpl.java
@@ -19,7 +19,7 @@
package org.onap.cps.spi.impl;
-import org.onap.cps.spi.DataPersistencyService;
+import org.onap.cps.spi.DataPersistenceService;
import org.onap.cps.spi.entities.JsonDataEntity;
import org.onap.cps.spi.repository.DataRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
@Component
-public class DataPersistencyServiceImpl implements DataPersistencyService {
+public class DataPersistenceServiceImpl implements DataPersistenceService {
@Autowired
private DataRepository dataRepository;
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/FragmentPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/FragmentPersistenceServiceImpl.java
index 47d98c92b5..0ecf72d772 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/FragmentPersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/FragmentPersistenceServiceImpl.java
@@ -26,7 +26,7 @@ import org.onap.cps.exceptions.CpsValidationException;
import org.onap.cps.spi.FragmentPersistenceService;
import org.onap.cps.spi.entities.Dataspace;
import org.onap.cps.spi.entities.Fragment;
-import org.onap.cps.spi.entities.ModuleEntity;
+import org.onap.cps.spi.entities.Module;
import org.onap.cps.spi.repository.DataspaceRepository;
import org.onap.cps.spi.repository.FragmentRepository;
import org.onap.cps.spi.repository.ModuleRepository;
@@ -50,13 +50,13 @@ public class FragmentPersistenceServiceImpl implements FragmentPersistenceServic
public String createAnchor(final AnchorDetails anchorDetails) {
try {
final Dataspace dataspace = dataspaceRepository.getByName(anchorDetails.getDataspace());
- final ModuleEntity moduleEntity =
+ final Module module =
moduleRepository.getByDataspaceAndNamespaceAndRevision(dataspace,
anchorDetails.getNamespace(), anchorDetails.getRevision());
final Fragment fragment = Fragment.builder().xpath(anchorDetails.getAnchorName())
.anchorName(anchorDetails.getAnchorName())
- .dataspace(dataspace).module(moduleEntity).build();
+ .dataspace(dataspace).module(module).build();
fragmentRepository.save(fragment);
return anchorDetails.getAnchorName();
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistencyServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistenceServiceImpl.java
index 56bba04b73..a54e506466 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistencyServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/ModelPersistenceServiceImpl.java
@@ -20,16 +20,16 @@
package org.onap.cps.spi.impl;
-import org.onap.cps.spi.ModelPersistencyService;
+import org.onap.cps.spi.ModelPersistenceService;
import org.onap.cps.spi.entities.Dataspace;
-import org.onap.cps.spi.entities.ModuleEntity;
+import org.onap.cps.spi.entities.Module;
import org.onap.cps.spi.repository.DataspaceRepository;
import org.onap.cps.spi.repository.ModuleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
-public class ModelPersistencyServiceImpl implements ModelPersistencyService {
+public class ModelPersistenceServiceImpl implements ModelPersistenceService {
@Autowired
private ModuleRepository moduleRepository;
@@ -45,7 +45,7 @@ public class ModelPersistencyServiceImpl implements ModelPersistencyService {
dataspaceRepository.save(dataspace);
}
dataspace.setId(dataspaceRepository.getByName(dataspaceName).getId());
- final ModuleEntity moduleEntity = new ModuleEntity(namespace, moduleContent, revision, dataspace);
- moduleRepository.save(moduleEntity);
+ final Module module = new Module(namespace, moduleContent, revision, dataspace);
+ moduleRepository.save(module);
}
-}
+} \ No newline at end of file
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleRepository.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleRepository.java
index fe27c8ec3e..d3a8bc1f09 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleRepository.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/ModuleRepository.java
@@ -24,27 +24,27 @@ import java.util.Optional;
import javax.validation.constraints.NotNull;
import org.onap.cps.exceptions.CpsNotFoundException;
import org.onap.cps.spi.entities.Dataspace;
-import org.onap.cps.spi.entities.ModuleEntity;
+import org.onap.cps.spi.entities.Module;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ModuleRepository extends JpaRepository<ModuleEntity, Integer> {
+public interface ModuleRepository extends JpaRepository<Module, Integer> {
- Optional<ModuleEntity> findByDataspaceAndNamespaceAndRevision(@NotNull Dataspace dataspace,
+ Optional<Module> findByDataspaceAndNamespaceAndRevision(@NotNull Dataspace dataspace,
@NotNull String namespace,
@NotNull String revision);
/**
- * This method gets a ModuleEntity by dataspace, namespace and revision.
+ * This method gets a Module by dataspace, namespace and revision.
*
* @param dataspace the dataspace
* @param namespace the namespace
* @param revision the revision
- * @return the ModuleEntity
- * @throws CpsNotFoundException if ModuleEntity not found
+ * @return the Module
+ * @throws CpsNotFoundException if Module not found
*/
- default ModuleEntity getByDataspaceAndNamespaceAndRevision(@NotNull Dataspace dataspace, @NotNull String namespace,
+ default Module getByDataspaceAndNamespaceAndRevision(@NotNull Dataspace dataspace, @NotNull String namespace,
@NotNull String revision) {
return findByDataspaceAndNamespaceAndRevision(dataspace, namespace,
revision)