aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-model-lib
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-model-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml20
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup51
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java4
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java13
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java16
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java3
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java14
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/resources/factoryConfiguration.json12
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml35
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup56
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java78
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml41
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup49
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java32
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoFactoryImpl.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java54
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoFactoryImpl.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java53
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ElementType.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java51
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java208
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/StructureElement.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/pom.xml12
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup44
38 files changed, 759 insertions, 201 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml
index a1659d0201..562a0f4a1a 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml
@@ -1,7 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <name>openecomp-sdc-model-api</name>
+ <artifactId>openecomp-sdc-model-api</artifactId>
+
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-lib</artifactId>
@@ -9,12 +14,9 @@
<relativePath>../..</relativePath>
</parent>
- <name>openecomp-sdc-model-api</name>
- <artifactId>openecomp-sdc-model-api</artifactId>
-
<dependencies>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-facade-core</artifactId>
<version>${project.version}</version>
</dependency>
@@ -31,19 +33,19 @@
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
- <version>1.5.3</version>
+ <version>${swagger.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-heat-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-tosca-lib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup
new file mode 100644
index 0000000000..eba0f207e4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/pom.xml.versionsBackup
@@ -0,0 +1,51 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-model-api</name>
+ <artifactId>openecomp-sdc-model-api</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-validation-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>1.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-heat-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java
index d547316ebf..aa8cbee7d4 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java
@@ -26,17 +26,11 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.List;
-public interface EnrichedServiceModelDao<M, E> extends VersionableDao {
-
- M getServiceModel(String vspId, Version version);
-
- void storeServiceModel(String vspId, Version version, M serviceModel);
+public interface EnrichedServiceModelDao<M, E> extends VersionableDao,ServiceModelDao<M, E>{
void storeExternalArtifact(ServiceArtifact serviceArtifact);
- List<ServiceArtifact> getExternalArtifacts(String vspId, Version version);
-
- E getServiceModelInfo(String vspId, Version version, String name);
+ //List<ServiceArtifact> getExternalArtifacts(String vspId, Version version);
- List<String> getServiceModelContentNames();
+ //List<String> getServiceModelContentNames();
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java
index 5ea2de7fd9..631d10a9ee 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java
@@ -20,7 +20,6 @@
package org.openecomp.core.model.dao;
-
public interface EnrichedServiceTemplateDao extends ServiceTemplateDaoInter {
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java
index 20d0c56c1b..30677b70a3 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java
@@ -41,4 +41,6 @@ public interface ServiceArtifactDaoInter extends VersionableDao {
Object[] getKeys(String vspId, Version version);
ServiceArtifact getArtifactInfo(String vspId, Version version, String name);
+
+ void deleteAll(String vspId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java
index 30bb79c100..1c13fbe760 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java
@@ -34,7 +34,5 @@ public interface ServiceModelDao<M, E> extends VersionableDao {
E getServiceModelInfo(String vspId, Version version, String name);
- void storeExternalArtifact(ServiceArtifact serviceArtifact);
-
- List<String> getServiceModelContentNames();
+ void deleteAll(String vspId, Version version);
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java
index c4c4cb19b7..d132a5158b 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java
@@ -43,4 +43,6 @@ public interface ServiceTemplateDaoInter extends VersionableDao {
String getBase(String vspId, Version version);
+ void deleteAll(String vspId, Version version);
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java
index 87e25613fc..0e30c749fc 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java
@@ -27,6 +27,13 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
@@ -70,7 +77,11 @@ public class EnrichedServiceArtifactEntity implements ServiceElementEntity {
try {
this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent()));
- } catch (IOException ioException) {
+ } catch (IOException ioException) { //todo fix typo in Traget
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_SERVICE_ENRICH_ARTIFACT, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(),
+ LoggerErrorDescription.CREATE_ENRICH_SERVICE_ARTIFACT);
throw new RuntimeException(ioException);
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java
index 526a901e47..0ebd27fe40 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java
@@ -27,6 +27,13 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
@@ -56,13 +63,13 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity {
@Column(name = "content_data")
public ByteBuffer contentData;
-
@Column(name = "base_name")
private String baseName;
public EnrichedServiceTemplateEntity() {
}
+
/**
* Instantiates a new Enriched service template entity.
*
@@ -76,12 +83,15 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity {
try {
this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent()));
} catch (IOException ioException) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_ENRICH_SERVICE_TEMPLATE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(),
+ LoggerErrorDescription.CREATE_ENRICH_SERVICE_TEMPLATE);
throw new RuntimeException(ioException);
}
}
-
public String getBaseName() {
return baseName;
}
@@ -90,7 +100,6 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity {
this.baseName = baseName;
}
-
@Override
public String getEntityType() {
return ENTITY_TYPE;
@@ -135,7 +144,6 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity {
this.contentData = contentData;
}
-
/**
* Gets service template.
*
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java
index fad3e604d6..7d1df0e91b 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java
@@ -20,8 +20,8 @@
package org.openecomp.core.model.types;
-public class ServiceArtifact extends ServiceElement {
+public class ServiceArtifact extends ServiceElement {
public ServiceArtifact() {
super();
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java
index c5dfeced8a..8abbbd3c82 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java
@@ -27,6 +27,12 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
@@ -71,6 +77,10 @@ public class ServiceArtifactEntity implements ServiceElementEntity {
try {
this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent()));
} catch (IOException ioException) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_SERVICE_ARTIFACT, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(),
+ LoggerErrorDescription.CREATE_SERVICE_ARTIFACT);
throw new RuntimeException(ioException);
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java
index 114cf03a39..541a66f77d 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java
@@ -25,6 +25,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+
public class ServiceElement {
private String vspId;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java
index aa0285d6a9..9560ba306c 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java
@@ -20,18 +20,17 @@
package org.openecomp.core.model.types;
+
public class ServiceTemplate extends ServiceElement {
private String baseName;
public ServiceTemplate() {
}
-
public String getBaseName() {
return baseName;
}
-
public void setBaseName(String baseName) {
this.baseName = baseName;
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java
index f29334678f..4897c2f076 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java
@@ -27,6 +27,13 @@ import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.Frozen;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
+
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerErrorDescription;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.io.IOException;
@@ -56,7 +63,6 @@ public class ServiceTemplateEntity implements ServiceElementEntity {
@Column(name = "content_data")
public ByteBuffer contentData;
-
@Column(name = "base_name")
private String baseName;
@@ -76,12 +82,15 @@ public class ServiceTemplateEntity implements ServiceElementEntity {
try {
this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent()));
} catch (IOException ioException) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.CREATE_SERVICE_TEMPLATE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(),
+ LoggerErrorDescription.CREATE_SERVICE_TEMPLATE);
throw new RuntimeException(ioException);
}
}
-
public String getBaseName() {
return baseName;
}
@@ -90,7 +99,6 @@ public class ServiceTemplateEntity implements ServiceElementEntity {
this.baseName = baseName;
}
-
@Override
public String getEntityType() {
return ENTITY_TYPE;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/resources/factoryConfiguration.json
index c228b29c57..4a56c8c716 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/resources/factoryConfiguration.json
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/resources/factoryConfiguration.json
@@ -1,8 +1,8 @@
{
- "org.openecomp.core.model.dao.ServiceModelDaoFactory":"org.openecomp.sdc.model.impl.ServiceModelDaoFactoryImpl",
- "org.openecomp.core.model.dao.ServiceTemplateDaoFactory":"org.openecomp.sdc.model.impl.ServiceTemplateDaoCassandraFactoryImpl",
- "org.openecomp.core.model.dao.ServiceArtifactDaoFactory":"org.openecomp.sdc.model.impl.ServiceArtifactDaoCassandraFactoryImpl",
- "org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory":"org.openecomp.sdc.model.impl.EnrichedServiceModelDaoFactoryImpl",
- "org.openecomp.core.model.dao.EnrichedServiceTemplateDaoFactory":"org.openecomp.sdc.model.impl.EnrichedServiceTemplateDaoCassandraFactoryImpl",
- "org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory":"org.openecomp.sdc.model.impl.EnrichedServiceArtifactDaoCassandraFactoryImpl"
+ "org.openecomp.core.model.dao.ServiceModelDaoFactory": "org.openecomp.sdc.model.impl.ServiceModelDaoFactoryImpl",
+ "org.openecomp.core.model.dao.ServiceTemplateDaoFactory": "org.openecomp.sdc.model.impl.ServiceTemplateDaoCassandraFactoryImpl",
+ "org.openecomp.core.model.dao.ServiceArtifactDaoFactory": "org.openecomp.sdc.model.impl.ServiceArtifactDaoCassandraFactoryImpl",
+ "org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory": "org.openecomp.sdc.model.impl.EnrichedServiceModelDaoFactoryImpl",
+ "org.openecomp.core.model.dao.EnrichedServiceTemplateDaoFactory": "org.openecomp.sdc.model.impl.EnrichedServiceTemplateDaoCassandraFactoryImpl",
+ "org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory": "org.openecomp.sdc.model.impl.EnrichedServiceArtifactDaoCassandraFactoryImpl"
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml
index 0c1fc94a97..e1fb942102 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml
@@ -1,7 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <name>openecomp-sdc-model-core</name>
+ <artifactId>openecomp-sdc-model-core</artifactId>
+
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-lib</artifactId>
@@ -9,26 +14,14 @@
<relativePath>../..</relativePath>
</parent>
- <name>openecomp-sdc-model-core</name>
- <artifactId>openecomp-sdc-model-core</artifactId>
-
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
-
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.1.2</version>
-
+ <version>${logback.version}</version>
</dependency>
-
-
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-utilities-lib</artifactId>
<version>${project.version}</version>
</dependency>
@@ -42,7 +35,6 @@
<artifactId>openecomp-sdc-versioning-core</artifactId>
<version>${project.version}</version>
</dependency>
-
<dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-datatypes-lib</artifactId>
@@ -52,14 +44,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
- <version>1.10.19</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>19.0</version>
+ <version>${mockito.all.version}</version>
</dependency>
-
-
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup
new file mode 100644
index 0000000000..d62437122a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/pom.xml.versionsBackup
@@ -0,0 +1,56 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-model-core</name>
+ <artifactId>openecomp-sdc-model-core</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-versioning-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ <version>1.10.19</version>
+ </dependency>
+
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java
index eb993f6fb1..6863e04991 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-core/src/main/java/org/openecomp/sdc/model/impl/AbstractServiceModelDao.java
@@ -28,12 +28,17 @@ import org.openecomp.core.model.types.ServiceTemplate;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.Import;
+import org.openecomp.sdc.tosca.datatypes.model.Old1610ServiceTemplate;
import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
import org.openecomp.sdc.versioning.dao.VersionableDao;
import org.openecomp.sdc.versioning.dao.types.Version;
+import sun.misc.IOUtils;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -49,7 +54,6 @@ public class AbstractServiceModelDao implements VersionableDao {
artifactDao.registerVersioning(versionableEntityType);
}
-
/**
* Gets service model.
*
@@ -59,22 +63,20 @@ public class AbstractServiceModelDao implements VersionableDao {
*/
public ToscaServiceModel getServiceModel(String vspId, Version version) {
if (vspId == null || version == null) {
- //throw new CoreException()
throw new RuntimeException("missing service model key");
}
-
FileContentHandler artifactFiles = getArtifacts(vspId, version);
+
Map<String, org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate> serviceTemplates =
- getTemplates(vspId, version);
+ getTemplates(vspId,
+ version);
String entryDefinitionServiceTemplate = getServiceBase(vspId, version);
return new ToscaServiceModel(artifactFiles, serviceTemplates, entryDefinitionServiceTemplate);
}
-
public void storeExternalArtifact(ServiceArtifact serviceArtifact) {
artifactDao.create(serviceArtifact);
- //TODO: update last modification time
}
@@ -103,8 +105,7 @@ public class AbstractServiceModelDao implements VersionableDao {
ServiceTemplate entityTmp;
String yaml;
for (Map.Entry<String, org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate>
- entryTemplate : toscaServiceModel
- .getServiceTemplates().entrySet()) {
+ entryTemplate : toscaServiceModel.getServiceTemplates().entrySet()) {
entityTmp = new ServiceTemplate();
yaml = new ToscaExtensionYamlUtil().objectToYaml(entryTemplate.getValue());
@@ -116,8 +117,6 @@ public class AbstractServiceModelDao implements VersionableDao {
templateDao.create(entityTmp);
}
-
- //TODO: update last modification time
}
@@ -142,25 +141,18 @@ public class AbstractServiceModelDao implements VersionableDao {
return null;
}
-
- /**
- * Gets service model content names.
- *
- * @return the service model content names
- */
public List<String> getServiceModelContentNames() {
-
return null;
}
-
private String getServiceBase(String vspId, Version version) {
return templateDao.getBase(vspId, version);
}
private Map<String, org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate> getTemplates(
- String vspId, Version version) {
+ String vspId,
+ Version version) {
Collection<ServiceTemplate> templates = templateDao.list(vspId, version);
if (templates == null) {
@@ -172,8 +164,47 @@ public class AbstractServiceModelDao implements VersionableDao {
private org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate getServiceTemplate(
InputStream content) {
- return new ToscaExtensionYamlUtil()
- .yamlToObject(content, org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate.class);
+ String serviceTemplateContent = new String(FileUtils.toByteArray(content));
+
+ try{
+ return new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent,
+ org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate.class);
+ }catch (Exception e){
+ System.out.println("Found vsp with old-versioned tosca service template");
+ Old1610ServiceTemplate old1610ServiceTemplate =
+ new ToscaExtensionYamlUtil().yamlToObject(serviceTemplateContent,
+ Old1610ServiceTemplate.class);
+
+ return mapOldSTToCurrentST(old1610ServiceTemplate);
+ }
+ }
+
+ private static org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate mapOldSTToCurrentST(Old1610ServiceTemplate oldServiceTemplate){
+ org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate
+ serviceTemplate = new org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate();
+
+ serviceTemplate.setArtifact_types(oldServiceTemplate.getArtifact_types());
+ serviceTemplate.setCapability_types(oldServiceTemplate.getCapability_types());
+ serviceTemplate.setData_types(oldServiceTemplate.getData_types());
+ serviceTemplate.setDescription(oldServiceTemplate.getDescription());
+ serviceTemplate.setGroup_types(oldServiceTemplate.getGroup_types());
+ serviceTemplate.setInterface_types(oldServiceTemplate.getInterface_types());
+ serviceTemplate.setMetadata(oldServiceTemplate.getMetadata());
+ serviceTemplate.setNode_types(oldServiceTemplate.getNode_types());
+ serviceTemplate.setPolicy_types(oldServiceTemplate.getPolicy_types());
+ serviceTemplate.setRelationship_types(oldServiceTemplate.getRelationship_types());
+ serviceTemplate.setTopology_template(oldServiceTemplate.getTopology_template());
+
+ List<Map<String, Import>> imports = new ArrayList<>();
+ for(Map.Entry<String, Import> importEntry : oldServiceTemplate.getImports().entrySet()){
+ Map<String, Import> importMap = new HashMap<>();
+ importMap.put(importEntry.getKey(), importEntry.getValue());
+ imports.add(importMap);
+ }
+ serviceTemplate.setImports(imports);
+
+ return serviceTemplate;
+
}
private FileContentHandler getArtifacts(String vspId, Version version) {
@@ -183,8 +214,9 @@ public class AbstractServiceModelDao implements VersionableDao {
}
FileContentHandler fileContentHandler = new FileContentHandler();
- templates.stream().forEach(serviceArtifact -> fileContentHandler
- .addFile(serviceArtifact.getName(), serviceArtifact.getContent()));
+ templates.stream().forEach(
+ serviceArtifact -> fileContentHandler
+ .addFile(serviceArtifact.getName(), serviceArtifact.getContent()));
return fileContentHandler;
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
index 708756d2cd..d08ac46973 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
@@ -1,7 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <name>openecomp-sdc-model-impl</name>
+ <artifactId>openecomp-sdc-model-impl</artifactId>
+
+
<parent>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-lib</artifactId>
@@ -9,26 +14,14 @@
<relativePath>../..</relativePath>
</parent>
- <name>openecomp-sdc-model-impl</name>
- <artifactId>openecomp-sdc-model-impl</artifactId>
-
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.10</version>
-
- </dependency>
- <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.1.2</version>
-
+ <version>${logback.version}</version>
</dependency>
-
-
<dependency>
- <groupId>org.openecomp.sdc</groupId>
+ <groupId>org.openecomp.core</groupId>
<artifactId>openecomp-utilities-lib</artifactId>
<version>${project.version}</version>
</dependency>
@@ -37,8 +30,11 @@
<artifactId>openecomp-sdc-model-core</artifactId>
<version>${project.version}</version>
</dependency>
-
-
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-zusammen-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-datatypes-lib</artifactId>
@@ -48,14 +44,7 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
- <version>1.10.19</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>19.0</version>
+ <version>${mockito.all.version}</version>
</dependency>
-
-
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup
new file mode 100644
index 0000000000..b8db689bd5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml.versionsBackup
@@ -0,0 +1,49 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-model-impl</name>
+ <artifactId>openecomp-sdc-model-impl</artifactId>
+
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <scope>test</scope>
+ <version>1.10.19</version>
+ </dependency>
+
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java
index 13e351c257..479668ec0c 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraFactoryImpl.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.EnrichedServiceArtifactDao;
import org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
index d9ebe849e3..2a0b964066 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceArtifactDaoCassandraImpl.java
@@ -44,17 +44,18 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static final Mapper<EnrichedServiceArtifactEntity> mapper =
- noSqlDb.getMappingManager().mapper(EnrichedServiceArtifactEntity.class);
+ noSqlDb.getMappingManager().mapper(
+ EnrichedServiceArtifactEntity.class);
private static final VspServiceArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VspServiceArtifactAccessor.class);
+ noSqlDb.getMappingManager().createAccessor(
+ VspServiceArtifactAccessor.class);
private static final UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
+ VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
}
@@ -103,8 +104,8 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
@Override
public ServiceArtifact getArtifactInfo(String vspId, Version version, String name) {
- EnrichedServiceArtifactEntity enrichedServiceArtifactEntity =
- accessor.getArtifactInfo(vspId, versionMapper.toUDT(version), name).one();
+ EnrichedServiceArtifactEntity enrichedServiceArtifactEntity = accessor.getArtifactInfo(vspId,
+ versionMapper.toUDT(version), name).one();
if (enrichedServiceArtifactEntity == null) {
return null;
}
@@ -112,6 +113,10 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
return enrichedServiceArtifactEntity.getServiceArtifact();
}
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, versionMapper.toUDT(version));
+ }
@Accessor
interface VspServiceArtifactAccessor {
@@ -120,18 +125,21 @@ public class EnrichedServiceArtifactDaoCassandraImpl implements EnrichedServiceA
Result<EnrichedServiceArtifactEntity> listAll();
@Query(
- "SELECT vsp_id, version, name ,content_data FROM vsp_enriched_service_artifact "
- + "where vsp_id=? and version=? ")
+ "SELECT vsp_id, version, name ,content_data FROM "
+ + "vsp_enriched_service_artifact where vsp_id=? and version=? ")
Result<EnrichedServiceArtifactEntity> list(String vspId, UDTValue version);
-
@Query(
- "SELECT vsp_id,version,name,content_data FROM vsp_enriched_service_artifact "
- + "where vsp_id=? and version=? and name=?")
+ "SELECT vsp_id,version,name,content_data FROM "
+ + "vsp_enriched_service_artifact where vsp_id=? and version=? and name=?")
Result<EnrichedServiceArtifactEntity> getArtifactInfo(String vspId, UDTValue version,
String name);
@Query("DELETE from vsp_enriched_service_artifact where vsp_id=? and version=?")
ResultSet delete(String vspId, UDTValue version);
+
+ @Query("DELETE FROM vsp_enriched_service_artifact where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, UDTValue version);
}
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoFactoryImpl.java
index 326e5e78fc..98cb8724df 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoFactoryImpl.java
@@ -20,12 +20,14 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.EnrichedServiceModelDao;
import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.model.impl.zusammen.EnrichedServiceModelDaoZusammenImpl;
public class EnrichedServiceModelDaoFactoryImpl extends EnrichedServiceModelDaoFactory {
- private static final EnrichedServiceModelDao INSTANCE = new EnrichedServiceModelDaoImpl();
+ private static final EnrichedServiceModelDao INSTANCE = new EnrichedServiceModelDaoZusammenImpl( ZusammenAdaptorFactory
+ .getInstance().createInterface());
@Override
public EnrichedServiceModelDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java
index 9e784c7fef..14eda9ee4d 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceModelDaoImpl.java
@@ -37,8 +37,15 @@ public class EnrichedServiceModelDaoImpl extends AbstractServiceModelDao
artifactDao = EnrichedServiceArtifactDaoFactory.getInstance().createInterface();
}
- @Override
+ /*@Override
public List<ServiceArtifact> getExternalArtifacts(String vspId, Version version) {
return (List<ServiceArtifact>) artifactDao.list(vspId, version);
}
+*/
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ templateDao.deleteAll(vspId, version);
+ artifactDao.deleteAll(vspId, version);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java
index 8103b2cea6..14aa986bd8 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraFactoryImpl.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.EnrichedServiceTemplateDao;
import org.openecomp.core.model.dao.EnrichedServiceTemplateDaoFactory;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
index f0d4b56204..ab13e6a9f0 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/EnrichedServiceTemplateDaoCassandraImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.model.impl;
+import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.UDTValue;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
@@ -43,30 +44,23 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
private static final Mapper<EnrichedServiceTemplateEntity> mapper =
- noSqlDb.getMappingManager().mapper(EnrichedServiceTemplateEntity.class);
+ noSqlDb.getMappingManager().mapper(
+ EnrichedServiceTemplateEntity.class);
private static final VspServiceTemplateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VspServiceTemplateAccessor.class);
+ noSqlDb.getMappingManager().createAccessor(
+ VspServiceTemplateAccessor.class);
private static final UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
+ VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
}
@Override
- public Collection<ServiceTemplate> list(String vspId, Version version) {
-
- List<EnrichedServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
- return entityList.stream().map(entity -> entity.getServiceTemplate())
- .collect(Collectors.toList());
- }
-
- @Override
public void create(ServiceTemplate entity) {
EnrichedServiceTemplateEntity vspEnrichedServiceTemplateEntity =
new EnrichedServiceTemplateEntity(entity);
@@ -90,7 +84,6 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
mapper.delete(vspId, version);
}
-
@Override
public Object[] getKeys(String vspId, Version version) {
return new Object[]{vspId, versionMapper.toUDT(version)};
@@ -98,8 +91,8 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
@Override
public ServiceTemplate getTemplateInfo(String vspId, Version version, String name) {
- EnrichedServiceTemplateEntity enrichedServiceTemplateEntity =
- accessor.getTemplateInfo(vspId, versionMapper.toUDT(version), name).one();
+ EnrichedServiceTemplateEntity enrichedServiceTemplateEntity = accessor.getTemplateInfo(vspId,
+ versionMapper.toUDT(version), name).one();
if (enrichedServiceTemplateEntity == null) {
return null;
}
@@ -107,6 +100,14 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
}
@Override
+ public Collection<ServiceTemplate> list(String vspId, Version version) {
+
+ List<EnrichedServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
+ return entityList.stream().map(entity -> entity.getServiceTemplate())
+ .collect(Collectors.toList());
+ }
+
+ @Override
public String getBase(String vspId, Version version) {
Result<EnrichedServiceTemplateEntity> element =
accessor.getBase(vspId, versionMapper.toUDT(version));
@@ -119,6 +120,10 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
return null;
}
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, versionMapper.toUDT(version));
+ }
@Accessor
interface VspServiceTemplateAccessor {
@@ -128,20 +133,23 @@ public class EnrichedServiceTemplateDaoCassandraImpl implements EnrichedServiceT
Result<EnrichedServiceTemplateEntity> listAll();
@Query(
- "SELECT vsp_id, version, name, base_name ,content_data FROM vsp_enriched_service_template "
- + "where vsp_id=? and version=?")
+ "SELECT vsp_id, version, name, base_name ,content_data FROM "
+ + "vsp_enriched_service_template where vsp_id=? and version=?")
Result<EnrichedServiceTemplateEntity> list(String vspId, Version version);
-
@Query(
- "SELECT vsp_id, version, name, base_name ,content_data FROM vsp_enriched_service_template "
- + "where vsp_id=? and version=? and name=?")
+ "SELECT vsp_id, version, name, base_name ,content_data FROM "
+ + "vsp_enriched_service_template where vsp_id=? and version=? and name=?")
Result<EnrichedServiceTemplateEntity> getTemplateInfo(String vspId, UDTValue version,
String name);
@Query(
- "SELECT vsp_id, version, name, base_name FROM vsp_enriched_service_template "
- + "where vsp_id=? and version=?")
+ "SELECT vsp_id, version, name, base_name FROM "
+ + "vsp_enriched_service_template where vsp_id=? and version=?")
Result<EnrichedServiceTemplateEntity> getBase(String vspId, UDTValue version);
+
+ @Query("DELETE FROM vsp_enriched_service_template where vsp_id = ? and version = ?")
+ ResultSet deleteAll(String vspId, UDTValue version);
}
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java
index f24fb1b475..ee40dad385 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraFactoryImpl.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.ServiceArtifactDao;
import org.openecomp.core.model.dao.ServiceArtifactDaoFactory;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
index c7851c0fd9..15aae0f710 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceArtifactDaoCassandraImpl.java
@@ -43,18 +43,18 @@ import java.util.stream.Collectors;
public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ServiceArtifactEntity> mapper =
- noSqlDb.getMappingManager().mapper(ServiceArtifactEntity.class);
+ private static final Mapper<ServiceArtifactEntity> mapper = noSqlDb.getMappingManager().mapper(
+ ServiceArtifactEntity.class);
private static final VspServiceArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VspServiceArtifactAccessor.class);
+ noSqlDb.getMappingManager().createAccessor(
+ VspServiceArtifactAccessor.class);
private static final UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
+ VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
}
@@ -94,10 +94,10 @@ public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
accessor.delete(vspId, versionMapper.toUDT(version));
}
- // @Override
- // public void deleteArtifacts(String vspId, Version version){
- // accessor.delete(vspId, versionMapper.toUDT(version));
- // }
+ // @Override
+ // public void deleteArtifacts(String vspId, Version version){
+ // accessor.delete(vspId, versionMapper.toUDT(version));
+ // }
@Override
public Object[] getKeys(String vspId, Version version) {
@@ -107,7 +107,8 @@ public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
@Override
public ServiceArtifact getArtifactInfo(String vspId, Version version, String name) {
ServiceArtifactEntity serviceArtifactEntity =
- accessor.getArtifactInfo(vspId, versionMapper.toUDT(version), name).one();
+ accessor.getArtifactInfo(vspId, versionMapper.toUDT(version),
+ name).one();
if (serviceArtifactEntity == null) {
return null;
}
@@ -115,6 +116,10 @@ public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
return serviceArtifactEntity.getServiceArtifact();
}
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, versionMapper.toUDT(version));
+ }
@Accessor
interface VspServiceArtifactAccessor {
@@ -124,16 +129,19 @@ public class ServiceArtifactDaoCassandraImpl implements ServiceArtifactDao {
@Query(
"SELECT vsp_id, version, name ,content_data "
- + "FROM vsp_service_artifact where vsp_id=? and version=? ")
+ + "FROM vsp_service_artifact where vsp_id=? and version=? ")
Result<ServiceArtifactEntity> list(String vspId, UDTValue version);
@Query(
- "SELECT vsp_id,version,name,content_data FROM "
- + "vsp_service_artifact where vsp_id=? and version=? and name=?")
+ "SELECT vsp_id,version,name,content_data FROM"
+ + " vsp_service_artifact where vsp_id=? and version=? and name=?")
Result<ServiceArtifactEntity> getArtifactInfo(String vspId, UDTValue version, String name);
@Query("DELETE from vsp_service_artifact where vsp_id=? and version=?")
ResultSet delete(String vspId, UDTValue version);
+
+ @Query("DELETE FROM vsp_service_artifact where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, UDTValue version);
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoFactoryImpl.java
index 1347636bf1..85508670aa 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoFactoryImpl.java
@@ -20,12 +20,14 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.dao.ServiceModelDaoFactory;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.model.impl.zusammen.ServiceModelDaoZusammenImpl;
public class ServiceModelDaoFactoryImpl extends ServiceModelDaoFactory {
- private static final ServiceModelDao INSTANCE = new ServiceModelDaoImpl();
+ private static final ServiceModelDao INSTANCE = new ServiceModelDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public ServiceModelDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java
index c397aec61d..4ad8d7c98a 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceModelDaoImpl.java
@@ -25,14 +25,18 @@ import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.dao.ServiceTemplateDaoFactory;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
public class ServiceModelDaoImpl extends AbstractServiceModelDao
implements ServiceModelDao<ToscaServiceModel, ServiceElement> {
-
public ServiceModelDaoImpl() {
templateDao = ServiceTemplateDaoFactory.getInstance().createInterface();
artifactDao = ServiceArtifactDaoFactory.getInstance().createInterface();
}
+ @Override
+ public void deleteAll(String vspId, Version version) {
+
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java
index 23c43b76d3..bc249701f2 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraFactoryImpl.java
@@ -20,7 +20,6 @@
package org.openecomp.sdc.model.impl;
-
import org.openecomp.core.model.dao.ServiceTemplateDao;
import org.openecomp.core.model.dao.ServiceTemplateDaoFactory;
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
index ffc9a24677..71334ce8d3 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/ServiceTemplateDaoCassandraImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.model.impl;
+import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.UDTValue;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
@@ -41,33 +42,24 @@ import java.util.stream.Collectors;
public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
-
private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ServiceTemplateEntity> mapper =
- noSqlDb.getMappingManager().mapper(ServiceTemplateEntity.class);
+ private static final Mapper<ServiceTemplateEntity> mapper = noSqlDb.getMappingManager().mapper(
+ ServiceTemplateEntity.class);
private static final VspServiceTemplateAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VspServiceTemplateAccessor.class);
+ noSqlDb.getMappingManager().createAccessor(
+ VspServiceTemplateAccessor.class);
private static final UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
@Override
public void registerVersioning(String versionableEntityType) {
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
+ VersioningManagerFactory.getInstance().createInterface().register(versionableEntityType,
+ new VersionableEntityMetadata(mapper.getTableMetadata().getName(),
mapper.getTableMetadata().getPartitionKey().get(0).getName(),
mapper.getTableMetadata().getPartitionKey().get(1).getName()));
}
@Override
- public Collection<ServiceTemplate> list(String vspId, Version version) {
-
- List<ServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
- return entityList.stream().map(entity -> entity.getServiceTemplate())
- .collect(Collectors.toList());
- }
-
- @Override
public void create(ServiceTemplate entity) {
ServiceTemplateEntity vspServiceTemplateEntity = new ServiceTemplateEntity(entity);
mapper.save(vspServiceTemplateEntity);
@@ -89,7 +81,6 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
mapper.delete(vspId, version);
}
-
@Override
public Object[] getKeys(String vspId, Version version) {
return new Object[]{vspId, versionMapper.toUDT(version)};
@@ -98,7 +89,8 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
@Override
public ServiceTemplate getTemplateInfo(String vspId, Version version, String name) {
ServiceTemplateEntity serviceTemplateEntity =
- accessor.getTemplateInfo(vspId, versionMapper.toUDT(version), name).one();
+ accessor.getTemplateInfo(vspId, versionMapper.toUDT(version),
+ name).one();
if (serviceTemplateEntity == null) {
return null;
}
@@ -106,6 +98,14 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
}
@Override
+ public Collection<ServiceTemplate> list(String vspId, Version version) {
+
+ List<ServiceTemplateEntity> entityList = accessor.list(vspId, version).all();
+ return entityList.stream().map(entity -> entity.getServiceTemplate())
+ .collect(Collectors.toList());
+ }
+
+ @Override
public String getBase(String vspId, Version version) {
Result<ServiceTemplateEntity> element = accessor.getBase(vspId, versionMapper.toUDT(version));
if (element != null) {
@@ -117,6 +117,10 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
return null;
}
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, versionMapper.toUDT(version));
+ }
@Accessor
interface VspServiceTemplateAccessor {
@@ -126,20 +130,21 @@ public class ServiceTemplateDaoCassandraImpl implements ServiceTemplateDao {
@Query(
"SELECT vsp_id, version, name, base_name ,content_data"
- + " FROM vsp_service_template where vsp_id=? and version=?")
+ + " FROM vsp_service_template where vsp_id=? and version=?")
Result<ServiceTemplateEntity> list(String vspId, Version version);
-
@Query(
- "SELECT vsp_id, version, name, base_name ,content_data "
- + "FROM vsp_service_template where vsp_id=? and version=? and name=?")
+ "SELECT vsp_id, version, name, base_name ,content_data"
+ + " FROM vsp_service_template where vsp_id=? and version=? and name=?")
Result<ServiceTemplateEntity> getTemplateInfo(String vspId, UDTValue version, String name);
@Query(
- "SELECT vsp_id, version, name, base_name "
- + "FROM vsp_service_template where vsp_id=? and version=?")
+ "SELECT vsp_id, version, name, base_name"
+ + " FROM vsp_service_template where vsp_id=? and version=?")
Result<ServiceTemplateEntity> getBase(String vspId, UDTValue version);
- }
+ @Query("DELETE FROM vsp_service_template where vsp_id = ? and version = ?")
+ ResultSet deleteAll(String vspId, UDTValue version);
+ }
}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ElementType.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ElementType.java
new file mode 100644
index 0000000000..e51d7e0c45
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ElementType.java
@@ -0,0 +1,7 @@
+package org.openecomp.sdc.model.impl.zusammen;
+
+public enum ElementType {
+ Servicetemplate,Artifact;
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java
new file mode 100644
index 0000000000..b038c70372
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java
@@ -0,0 +1,51 @@
+package org.openecomp.sdc.model.impl.zusammen;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import org.openecomp.core.model.dao.EnrichedServiceModelDao;
+import org.openecomp.core.model.types.ServiceArtifact;
+import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public class EnrichedServiceModelDaoZusammenImpl extends ServiceModelDaoZusammenImpl implements
+ EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> {
+
+ private static final Logger logger =
+ LoggerFactory.getLogger(EnrichedServiceModelDaoZusammenImpl.class);
+
+ public EnrichedServiceModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ super(zusammenAdaptor);
+ this.name = StructureElement.EnrichedServiceModel.name();
+ }
+
+ @Override
+ public void storeExternalArtifact(ServiceArtifact serviceArtifact) {
+ ZusammenElement artifactElement = buildArtifactElement(serviceArtifact.getName(),
+ FileUtils.toByteArray(serviceArtifact.getContent()), Action.CREATE);
+
+ ZusammenElement artifactsElement =
+ buildStructuralElement(StructureElement.Artifacts.name(), null);
+ artifactsElement.addSubElement(artifactElement);
+
+ ZusammenElement enrichedServiceModelElement = buildStructuralElement(name, null);
+ enrichedServiceModelElement.addSubElement(artifactsElement);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(serviceArtifact.getVspId());
+ ElementContext elementContext = new ElementContext(itemId, getFirstVersionId(context, itemId));
+ zusammenAdaptor
+ .saveElement(context, elementContext, enrichedServiceModelElement, "add service artifact.");
+
+ logger.info("Finished adding artifact to service model for vsp id -> " +
+ elementContext.getItemId().getValue());
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
new file mode 100644
index 0000000000..530ad44574
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
@@ -0,0 +1,208 @@
+package org.openecomp.sdc.model.impl.zusammen;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Action;
+import com.amdocs.zusammen.datatypes.item.ElementContext;
+import com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.ItemVersion;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class ServiceModelDaoZusammenImpl
+ implements ServiceModelDao<ToscaServiceModel, ServiceElement> {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceModelDaoZusammenImpl.class);
+
+ protected ZusammenAdaptor zusammenAdaptor;
+ protected String name;
+
+ public ServiceModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ this.name = StructureElement.ServiceModel.name();
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public ToscaServiceModel getServiceModel(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId, getFirstVersionId(context, itemId),
+ version.getStatus() == VersionStatus.Locked ? null : version.toString());
+
+ Optional<ElementInfo> serviceModelElement = zusammenAdaptor
+ .getElementInfoByName(context, elementContext, null, name);
+
+ if (serviceModelElement.isPresent()) {
+ String entryDefinitionServiceTemplate =
+ serviceModelElement.get().getInfo().getProperty("base");
+ Id serviceModelElementId = serviceModelElement.get().getId();
+ Map<String, ServiceTemplate> serviceTemplates =
+ getTemplates(context, elementContext, serviceModelElementId);
+ if (serviceTemplates == null) {
+ return null;
+ }
+ FileContentHandler artifacts = getArtifacts(context, elementContext, serviceModelElementId);
+
+
+ return new ToscaServiceModel(
+ artifacts, serviceTemplates, entryDefinitionServiceTemplate);
+ } else {
+ return null;
+ }
+ }
+
+ protected Map<String, ServiceTemplate> getTemplates(SessionContext context,
+ ElementContext elementContext,
+ Id serviceModelElementId) {
+ Optional<ElementInfo> templatesElementInfo = zusammenAdaptor.getElementInfoByName(
+ context, elementContext, serviceModelElementId, StructureElement.Templates.name());
+
+ if (templatesElementInfo.isPresent()) {
+
+ //Map<String, ServiceTemplate> serviceTemplateMap = new HashMap<>();
+ Collection<Element> elements = zusammenAdaptor.listElementData(context, elementContext,
+ templatesElementInfo.get().getId());
+
+ return elements.stream().collect(Collectors.toMap(
+ element -> element.getInfo().getName(),
+ this::elementToServiceTemplate));
+
+ /*elements.stream().forEach(element ->serviceTemplateMap.put(element.getInfo().getName(),
+ elementToServiceTemplate(element)));
+ return serviceTemplateMap;*/
+ }
+ return null;
+ }
+
+ protected FileContentHandler getArtifacts(SessionContext context, ElementContext elementContext,
+ Id serviceModelElementId) {
+ Optional<ElementInfo> artifactsElement = zusammenAdaptor.getElementInfoByName(
+ context, elementContext, serviceModelElementId, StructureElement.Artifacts.name());
+
+ if (artifactsElement.isPresent()) {
+
+ Collection<Element> elements = zusammenAdaptor.listElementData(context, elementContext,
+ artifactsElement.get().getId());
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ elements.forEach(element -> fileContentHandler.addFile(element.getInfo().getName(),
+ element.getData()));
+ return fileContentHandler;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void storeServiceModel(String vspId, Version version, ToscaServiceModel serviceModel) {
+ logger.info("Storing service model for vsp id -> " + vspId);
+
+ ZusammenElement templatesElement =
+ buildStructuralElement(StructureElement.Templates.name(), null);
+ serviceModel.getServiceTemplates().entrySet().forEach(entry -> templatesElement.addSubElement(
+ buildServiceTemplateElement(entry.getKey(), entry.getValue(),
+ serviceModel.getEntryDefinitionServiceTemplate(), Action.CREATE)));
+
+ ZusammenElement artifactsElement =
+ buildStructuralElement(StructureElement.Artifacts.name(), Action.UPDATE);
+ serviceModel.getArtifactFiles().getFiles().entrySet().forEach(entry -> artifactsElement
+ .addSubElement(buildArtifactElement(entry.getKey(), entry.getValue(), Action.CREATE)));
+
+ ZusammenElement serviceModelElement = buildStructuralElement(name, Action.UPDATE);
+ serviceModelElement.getInfo()
+ .addProperty("base", serviceModel.getEntryDefinitionServiceTemplate());
+
+ serviceModelElement.addSubElement(templatesElement);
+ serviceModelElement.addSubElement(artifactsElement);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId, getFirstVersionId(context, itemId));
+ zusammenAdaptor
+ .saveElement(context, elementContext, serviceModelElement, "Store service model");
+
+ logger.info("Finished storing service model for vsp id -> " + vspId);
+ }
+
+ @Override
+ public ServiceElement getServiceModelInfo(String vspId, Version version, String name) {
+ return null;
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ logger.info("started deleting service model for vsp id -> " + vspId);
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId, getFirstVersionId(context, itemId));
+
+ ZusammenElement zusammenElement = ZusammenUtil.buildStructuralElement(name, Action.DELETE);
+ zusammenAdaptor.saveElement(context, elementContext, zusammenElement, "delete:" + name + ".");
+ logger.info("Finished deleting service model for vsp id -> " + vspId);
+ }
+
+ protected ZusammenElement buildArtifactElement(String name, byte[] artifact, Action action) {
+ ZusammenElement artifactElement = new ZusammenElement();
+ artifactElement.setAction(action);
+ Info info = new Info();
+ info.setName(name);
+ info.addProperty("type", ElementType.Artifact.name());
+ artifactElement.setInfo(info);
+ artifactElement.setData(new ByteArrayInputStream(artifact));
+
+ return artifactElement;
+ }
+
+ private ServiceTemplate elementToServiceTemplate(Element element) {
+ return new ToscaExtensionYamlUtil().yamlToObject(element.getData(), ServiceTemplate.class);
+ }
+
+ private Element buildServiceTemplateElement(String name, ServiceTemplate serviceTemplate,
+ String entryDefinitionServiceTemplate,
+ Action action) {
+ ZusammenElement zusammenElement = new ZusammenElement();
+ zusammenElement.setAction(action);
+ Info info = new Info();
+ info.setName(name);
+ info.setDescription(serviceTemplate.getDescription());
+ info.addProperty("type", ElementType.Servicetemplate.name());
+ info.addProperty("base", entryDefinitionServiceTemplate);
+ String yaml = new ToscaExtensionYamlUtil().objectToYaml(serviceTemplate);
+ zusammenElement.setData(new ByteArrayInputStream(yaml.getBytes()));
+ zusammenElement.setInfo(info);
+ return zusammenElement;
+ }
+
+ protected Id getFirstVersionId(SessionContext context, Id vspId) {
+ Optional<ItemVersion> itemVersionOptional = zusammenAdaptor.getFirstVersion(context, vspId);
+ ItemVersion itemVersion = itemVersionOptional.orElseThrow(() ->
+ new RuntimeException(String.format("Vsp %s does not contain any version.", vspId))); //todo
+ return itemVersion.getId();
+ }
+
+ protected ZusammenElement buildStructuralElement(String structureElement, Action action) {
+ return ZusammenUtil.buildStructuralElement(structureElement, action);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/StructureElement.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/StructureElement.java
new file mode 100644
index 0000000000..212c754b5d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/StructureElement.java
@@ -0,0 +1,10 @@
+package org.openecomp.sdc.model.impl.zusammen;
+
+public enum StructureElement {
+ ServiceModel,
+ EnrichedServiceModel,
+ Artifacts,
+ Templates,
+ EntryDefinition,
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml
index e62bd1d7c2..138ebf3d77 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml
@@ -1,17 +1,19 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <name>openecomp-sdc-model-lib</name>
+ <artifactId>openecomp-sdc-model-lib</artifactId>
<packaging>pom</packaging>
+
<parent>
<artifactId>openecomp-sdc-lib</artifactId>
<groupId>org.openecomp.sdc</groupId>
<version>1.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
</parent>
- <name>openecomp-sdc-model-lib</name>
- <artifactId>openecomp-sdc-model-lib</artifactId>
-
<modules>
<module>openecomp-sdc-model-api</module>
<module>openecomp-sdc-model-core</module>
@@ -40,4 +42,4 @@
<version>${project.version}</version>
</dependency-->
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup
new file mode 100644
index 0000000000..d49cbd7069
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/pom.xml.versionsBackup
@@ -0,0 +1,44 @@
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>openecomp-sdc-model-lib</name>
+ <artifactId>openecomp-sdc-model-lib</artifactId>
+
+ <packaging>pom</packaging>
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>openecomp-sdc-model-api</module>
+ <module>openecomp-sdc-model-core</module>
+ <module>openecomp-sdc-model-impl</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency-->
+ </dependencies>
+</project> \ No newline at end of file