aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao')
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java28
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java)30
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java159
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java48
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java87
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoFactoryImpl.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MibDaoFactoryImpl.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java)13
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java26
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateCandidateDaoFactoryImpl.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java)15
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateDaoFactoryImpl.java (renamed from openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java)16
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java23
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java82
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java139
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java92
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java282
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java72
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java244
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDependencyModelDaoZusammenImpl.java201
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementPropertyName.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java171
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java150
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NicDaoZusammenImpl.java257
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java134
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateDaoZusammenImpl.java111
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ProcessDaoZusammenImpl.java229
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java228
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java61
37 files changed, 2226 insertions, 823 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java
new file mode 100644
index 0000000000..45989ddbf0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductCreationFailedBuilder.java
@@ -0,0 +1,28 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.text.MessageFormat;
+
+public class VendorSoftwareProductCreationFailedBuilder {
+ private static final String VSP_CREATION_FAILED = "Failed to create VSP; %s";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Vendor software product creation failed error builder.
+ *
+ */
+ public VendorSoftwareProductCreationFailedBuilder(String reason) {
+ builder.withId(VendorSoftwareProductErrorCodes.FAILED_TO_CREATE_VSP);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder
+ .withMessage(String.format(VSP_CREATION_FAILED, reason));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java
index 2a5d9013bd..ef5b43fad4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java
@@ -18,16 +18,30 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+package org.openecomp.sdc.vendorsoftwareproduct.dao.errors;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory;
-public class ProcessArtifactDaoFactoryImpl extends ProcessArtifactDaoFactory {
- private static final ProcessArtifactDao INSTANCE = new ProcessArtifactDaoCassandraImpl();
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
- @Override
- public ProcessArtifactDao createInterface() {
- return INSTANCE;
+import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_NOT_FOUND;
+
+public class VendorSoftwareProductNotFoundErrorBuilder {
+ private static final String VSP_FOUND_MSG = "Vendor software product with Id %s not found.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Vendor software product not found error builder.
+ *
+ * @param vendorSoftwareProductId the vendor software product id
+ */
+ public VendorSoftwareProductNotFoundErrorBuilder(String vendorSoftwareProductId) {
+ builder.withId(VSP_NOT_FOUND);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(VSP_FOUND_MSG, vendorSoftwareProductId));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java
deleted file mode 100644
index 2525537cef..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoCassandraImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.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;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-
-import java.nio.ByteBuffer;
-import java.util.Collection;
-
-public class ComponentArtifactDaoCassandraImpl extends CassandraBaseDao<ComponentArtifactEntity>
- implements ComponentArtifactDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final ComponentArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ComponentArtifactAccessor.class);
- private static final Mapper<ComponentArtifactEntity> mapper =
- noSqlDb.getMappingManager().mapper(ComponentArtifactEntity.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- // metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata
- // (VendorSoftwareProductConstants.UniqueValues.COMPONENT_ARTIFACT_NAME,
- // Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(), mapper
- // .getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
-
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public ComponentArtifactEntity getArtifactByType(ComponentArtifactEntity entity) {
- return accessor.listByType(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getType().toString()).one();
- }
-
- @Override
- protected Mapper<ComponentArtifactEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(ComponentArtifactEntity entity) {
- return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getType().toString(), entity.getId()};
- }
-
- @Override
- public Collection<ComponentArtifactEntity> list(ComponentArtifactEntity entity) {
- return accessor.listByType(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getType().toString()).all();
- }
-
- @Override
- public void update(ComponentArtifactEntity entity) {
- accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId(), entity.getArtifactName(), entity.getArtifact(),
- entity.getType().toString());
-
- }
-
- @Override
- public void delete(ComponentArtifactEntity entity) {
- accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getType().toString());
- }
-
- @Override
- public Collection<ComponentArtifactEntity> getArtifactNamesAndTypesForComponent(
- ComponentArtifactEntity entity) {
- return accessor.getArtifactNamesAndTypesForComponent(entity.getVspId(),
- versionMapper.toUDT(entity.getVersion()), entity.getComponentId()).all();
- }
-
- @Override
- public void deleteAll(ComponentArtifactEntity entity) {
- accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion()));
- }
-
-
- @Accessor
- interface ComponentArtifactAccessor {
-
- @Query(
- "insert into vsp_component_artifact (vsp_id, version, component_id, artifact_id, name, "
- + "artifact, artifact_type) values (?,?,?,?,?,?,?)")
- ResultSet update(String vspId, UDTValue version, String componentId, String id,
- String artifactName, ByteBuffer artifact, String type);
-
- @Query(
- "select vsp_id, version, component_id, artifact_type, artifact_id, name, artifact from "
- + "vsp_component_artifact where vsp_id=? and version=? and component_id=? and "
- + "artifact_type =?")
- Result<ComponentArtifactEntity> listByType(String vspId, UDTValue version, String componentId,
- String type);
-
- @Query(
- "delete name, artifact from vsp_component_artifact where vsp_id=? and version=? and "
- + "component_id=? and artifact_type=? and artifact_id=?")
- ResultSet delete(String vspId, UDTValue version, String componentId, String type,
- String artifactId);
-
- @Query(
- "delete from vsp_component_artifact where vsp_id=? and version=? and component_id=? "
- + "and artifact_type=?")
- ResultSet delete(String vspId, UDTValue version, String componentId, String artifactType);
-
- @Query("delete from vsp_component_artifact where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, UDTValue version);
-
- @Query(
- "select name, artifact_type from vsp_component_artifact where vsp_id=? and version=? "
- + "and component_id=?")
- Result<ComponentArtifactEntity> getArtifactNamesAndTypesForComponent(String vspId,
- UDTValue version,
- String componentId);
-
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
index 85372380c0..9cdd950a72 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoCassandraImpl.java
@@ -61,10 +61,10 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
mapper.getTableMetadata().getPartitionKey().get(1).getName());
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.COMPONENT_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.COMPONENT_NAME,
+ Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
VersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
@@ -93,9 +93,14 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
}
@Override
- public void updateQuestionnaireData(String vspId, Version version, String id,
+ public ComponentEntity getQuestionnaireData(String vspId, Version version, String componentId) {
+ return accessor.getQuestionnaireData(vspId, versionMapper.toUDT(version), componentId);
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id);
+ accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), componentId);
}
@Override
@@ -104,6 +109,11 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
}
@Override
+ public Collection<ComponentEntity> listCompositionAndQuestionnaire(String vspId, Version version){
+ return accessor.listCompositionAndQuestionnaire(vspId, versionMapper.toUDT(version)).all();
+ }
+
+ @Override
public void deleteAll(String vspId, Version version) {
accessor.deleteAll(vspId, version);
}
@@ -112,24 +122,34 @@ public class ComponentDaoCassandraImpl extends CassandraBaseDao<ComponentEntity>
interface ComponentAccessor {
@Query(
- "select vsp_id, version, component_id, composition_data from vsp_component "
- + "where vsp_id=? and version=?")
+ "select vsp_id, version, component_id, composition_data from vsp_component"
+ + " where vsp_id=? and version=?")
Result<ComponentEntity> list(String vspId, UDTValue version);
@Query(
- "select vsp_id, version, component_id, questionnaire_data from vsp_component "
- + "where vsp_id=? and version=?")
+ "select vsp_id, version, component_id, composition_data, questionnaire_data from vsp_component"
+ + " where vsp_id=? and version=?")
+ Result<ComponentEntity> listCompositionAndQuestionnaire(String vspId, UDTValue version);
+
+ @Query(
+ "select vsp_id, version, component_id, questionnaire_data from vsp_component"
+ + " where vsp_id=? and version=?")
Result<ComponentEntity> listQuestionnaires(String vspId, UDTValue version);
@Query(
- "insert into vsp_component (vsp_id, version, component_id, composition_data) "
- + "values (?,?,?,?)")
+ "select vsp_id, version, component_id, questionnaire_data from vsp_component"
+ + " where vsp_id=? and version=? and component_id=?")
+ ComponentEntity getQuestionnaireData(String vspId, UDTValue version, String id);
+
+ @Query(
+ "insert into vsp_component (vsp_id, version, component_id, composition_data)"
+ + " values (?,?,?,?)")
ResultSet updateCompositionData(String vspId, UDTValue version, String id,
String compositionData);
@Query(
- "update vsp_component set questionnaire_data=? where vsp_id=? and version=? "
- + "and component_id=?")
+ "update vsp_component set questionnaire_data=? where vsp_id=? and version=?"
+ + " and component_id=?")
ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
String id);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java
index 1e57242ce1..1ef0caac0c 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDaoFactoryImpl.java
@@ -20,11 +20,14 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ComponentDaoZusammenImpl;
public class ComponentDaoFactoryImpl extends ComponentDaoFactory {
- private static final ComponentDao INSTANCE = new ComponentDaoCassandraImpl();
+ private static final ComponentDao INSTANCE = new ComponentDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public ComponentDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
new file mode 100644
index 0000000000..b46486eb32
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoCassandraImpl.java
@@ -0,0 +1,87 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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;
+import com.datastax.driver.mapping.UDTMapper;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.dao.impl.CassandraBaseDao;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+public class ComponentDependencyModelDaoCassandraImpl extends CassandraBaseDao
+ <ComponentDependencyModelEntity> implements ComponentDependencyModelDao {
+
+ private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static final Mapper<ComponentDependencyModelEntity> mapper =
+ noSqlDb.getMappingManager().mapper(ComponentDependencyModelEntity.class);
+ private static final ComponentDependencyModelDaoCassandraImpl.ComponentDependencyModelAccessor
+ accessor = noSqlDb.getMappingManager().createAccessor(
+ ComponentDependencyModelDaoCassandraImpl.ComponentDependencyModelAccessor.class);
+ private static final UDTMapper<Version> versionMapper =
+ noSqlDb.getMappingManager().udtMapper(Version.class);
+
+ @Override
+ protected Mapper<ComponentDependencyModelEntity> getMapper() {
+ return mapper;
+ }
+
+ @Override
+ protected Object[] getKeys(ComponentDependencyModelEntity entity) {
+ return new Object[]{entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getId()};
+ }
+
+ @Override
+ public Collection<ComponentDependencyModelEntity> list(ComponentDependencyModelEntity entity) {
+ return accessor
+ .list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, versionMapper.toUDT(version));
+ }
+
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata = new VersionableEntityMetadata(
+ mapper.getTableMetadata().getName(),
+ mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName());
+
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
+ Arrays.asList("vsp_id", "version", "component_id", "name"))));
+
+ VersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+
+ }
+
+ @Accessor
+ interface ComponentDependencyModelAccessor {
+ @Query("delete from vsp_component_dependency_model where vsp_id=? and version=?")
+ ResultSet deleteAll(String vspId, UDTValue version);
+
+ @Query(
+ "select * from vsp_component_dependency_model where vsp_id=? and version=?")
+ Result<ComponentDependencyModelEntity> list(String vspId, UDTValue version);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoFactoryImpl.java
new file mode 100644
index 0000000000..e90e39bbc3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentDependencyModelDaoFactoryImpl.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+
+
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ComponentDependencyModelDaoZusammenImpl;
+
+public class ComponentDependencyModelDaoFactoryImpl extends ComponentDependencyModelDaoFactory {
+
+ private static final ComponentDependencyModelDao INSTANCE = new
+ ComponentDependencyModelDaoZusammenImpl( ZusammenAdaptorFactory.getInstance().createInterface());
+
+ @Override
+ public ComponentDependencyModelDao createInterface() {
+ return INSTANCE;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MibDaoFactoryImpl.java
index 317bc344c4..923744bae7 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/MibDaoFactoryImpl.java
@@ -20,14 +20,17 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDaoFactory;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.MibDaoZusammenImpl;
-public class UploadDataDaoFactoryImpl extends UploadDataDaoFactory {
- private static final UploadDataDao INSTANCE = new UploadDataDaoImpl();
+public class MibDaoFactoryImpl extends MibDaoFactory {
+ private static final MibDao INSTANCE = new MibDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
- public UploadDataDao createInterface() {
+ public MibDao createInterface() {
return INSTANCE;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java
index f7b8f30f0a..83807af5f8 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoCassandraImpl.java
@@ -60,10 +60,10 @@ public class NetworkDaoCassandraImpl extends CassandraBaseDao<NetworkEntity> imp
mapper.getTableMetadata().getPartitionKey().get(1).getName());
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.NETWORK_NAME,
- Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.NETWORK_NAME,
+ Arrays.asList(mapper.getTableMetadata().getPartitionKey().get(0).getName(),
+ mapper.getTableMetadata().getPartitionKey().get(1).getName(), "name"))));
VersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
@@ -86,28 +86,30 @@ public class NetworkDaoCassandraImpl extends CassandraBaseDao<NetworkEntity> imp
entity.getId(), entity.getCompositionData());
}
- @Override
+ /*@Override
public void updateQuestionnaireData(String vspId, Version version, String id,
String questionnaireData) {
accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id);
- }
+ }*/
@Override
- public Collection<NetworkEntity> list(NetworkEntity entity) {
- return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
+ public void deleteAll(String vspId, Version version) {
+ accessor.deleteAll(vspId, version);
}
+
+
@Override
- public void deleteAll(String vspId, Version version) {
- accessor.deleteAll(vspId, version);
+ public Collection<NetworkEntity> list(NetworkEntity entity) {
+ return accessor.list(entity.getVspId(), versionMapper.toUDT(entity.getVersion())).all();
}
@Accessor
interface NetworkAccessor {
@Query(
- "select vsp_id, version, network_id, composition_data from vsp_network where vsp_id=? "
- + "and version=?")
+ "select vsp_id, version, network_id, composition_data from vsp_network where vsp_id=?"
+ + " and version=?")
Result<NetworkEntity> list(String vspId, UDTValue version);
@Query(
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java
index b4360996df..5bccc5ced2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NetworkDaoFactoryImpl.java
@@ -20,11 +20,14 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.NetworkDaoZusammenImpl;
public class NetworkDaoFactoryImpl extends NetworkDaoFactory {
- private static final NetworkDao INSTANCE = new NetworkDaoCassandraImpl();
+ private static final NetworkDao INSTANCE = new NetworkDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public NetworkDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java
index e7e1eed8e0..a84ab38ccc 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoCassandraImpl.java
@@ -60,9 +60,9 @@ public class NicDaoCassandraImpl extends CassandraBaseDao<NicEntity> implements
mapper.getTableMetadata().getPartitionKey().get(1).getName());
- metadata.setUniqueValuesMetadata(Collections
- .singletonList(new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.NIC_NAME,
- Arrays.asList("vsp_id", "version", "component_id", "name"))));
+ metadata.setUniqueValuesMetadata(Collections.singletonList(new UniqueValueMetadata(
+ VendorSoftwareProductConstants.UniqueValues.NIC_NAME,
+ Arrays.asList("vsp_id", "version", "component_id", "name"))));
VersioningManagerFactory.getInstance().createInterface()
.register(versionableEntityType, metadata);
@@ -91,6 +91,12 @@ public class NicDaoCassandraImpl extends CassandraBaseDao<NicEntity> implements
}
@Override
+ public NicEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String nicId) {
+ return null; // TODO: 3/20/2017
+ }
+
+ @Override
public void updateQuestionnaireData(String vspId, Version version, String id, String componentId,
String questionnaireData) {
accessor.updateQuestionnaireData(questionnaireData, vspId, versionMapper.toUDT(version), id,
@@ -102,12 +108,6 @@ public class NicDaoCassandraImpl extends CassandraBaseDao<NicEntity> implements
return accessor.listByVspId(vspId, versionMapper.toUDT(version)).all();
}
- @Override
- public Collection<NicEntity> list(NicEntity entity) {
- return accessor.listByComponentId(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId()).all();
- }
-
public void deleteByComponentId(String vspId, Version version, String componentId) {
accessor.deleteByComponentId(vspId, version, componentId);
}
@@ -116,26 +116,32 @@ public class NicDaoCassandraImpl extends CassandraBaseDao<NicEntity> implements
accessor.deleteByVspId(vspId, versionMapper.toUDT(version));
}
+ @Override
+ public Collection<NicEntity> list(NicEntity entity) {
+ return accessor.listByComponentId(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
+ entity.getComponentId()).all();
+ }
+
@Accessor
interface NicAccessor {
@Query(
- "select vsp_id, version, component_id, nic_id, composition_data "
- + "from vsp_component_nic where vsp_id=? and version=? and component_id=?")
+ "select vsp_id, version, component_id, nic_id, composition_data"
+ + " from vsp_component_nic where vsp_id=? and version=? and component_id=?")
Result<NicEntity> listByComponentId(String vspId, UDTValue version, String componentId);
@Query("select * from vsp_component_nic where vsp_id=? and version=?")
Result<NicEntity> listByVspId(String vspId, UDTValue version);
@Query(
- "insert into vsp_component_nic (vsp_id, version, component_id, nic_id, composition_data) "
- + "values (?,?,?,?,?)")
+ "insert into vsp_component_nic (vsp_id, version, component_id, nic_id, composition_data)"
+ + " values (?,?,?,?,?)")
ResultSet updateCompositionData(String vspId, UDTValue version, String componentId, String id,
String compositionData);
@Query(
- "update vsp_component_nic set questionnaire_data=? where vsp_id=? and version=? "
- + "and component_id=? and nic_id=?")
+ "update vsp_component_nic set questionnaire_data=? where vsp_id=? and version=?"
+ + " and component_id=? and nic_id=?")
ResultSet updateQuestionnaireData(String questionnaireData, String vspId, UDTValue version,
String componentId, String id);
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java
index f4dd8d5a71..76e5d443f2 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/NicDaoFactoryImpl.java
@@ -20,11 +20,14 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.NicDaoZusammenImpl;
public class NicDaoFactoryImpl extends NicDaoFactory {
- private static final NicDao INSTANCE = new NicDaoCassandraImpl();
+ private static final NicDao INSTANCE = new NicDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public NicDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateCandidateDaoFactoryImpl.java
index aa91302ca2..8cc2c6f61f 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateCandidateDaoFactoryImpl.java
@@ -20,14 +20,19 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.OrchestrationTemplateCandidateDaoZusammenImpl;
-public class VspQuestionnaireDaoFactoryImpl extends VspQuestionnaireDaoFactory {
- private static final VspQuestionnaireDao INSTANCE = new VspQuestionnaireDaoCassandraImpl();
+public class OrchestrationTemplateCandidateDaoFactoryImpl
+ extends OrchestrationTemplateCandidateDaoFactory {
+ private static final OrchestrationTemplateCandidateDao INSTANCE =
+ new OrchestrationTemplateCandidateDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
- public VspQuestionnaireDao createInterface() {
+ public OrchestrationTemplateCandidateDao createInterface() {
return INSTANCE;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateDaoFactoryImpl.java
index 07a9f104f4..8b90462131 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ComponentArtifactDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/OrchestrationTemplateDaoFactoryImpl.java
@@ -20,14 +20,20 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.OrchestrationTemplateDaoZusammenImpl;
-public class ComponentArtifactDaoFactoryImpl extends ComponentArtifactDaoFactory {
- private static final ComponentArtifactDao INSTANCE = new ComponentArtifactDaoCassandraImpl();
+
+public class OrchestrationTemplateDaoFactoryImpl
+ extends OrchestrationTemplateDaoFactory {
+ private static final OrchestrationTemplateDao INSTANCE =
+ new OrchestrationTemplateDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
- public ComponentArtifactDao createInterface() {
+ public OrchestrationTemplateDao createInterface() {
return INSTANCE;
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java
index 9b7b81fe52..37917284e0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/PackageInfoDaoImpl.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import com.datastax.driver.core.UDTValue;
import com.datastax.driver.mapping.Mapper;
import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.UDTMapper;
@@ -28,10 +29,13 @@ import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.dao.impl.CassandraBaseDao;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.common.utils.CommonUtil;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
import org.openecomp.sdc.versioning.dao.types.Version;
+import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -46,6 +50,8 @@ public class PackageInfoDaoImpl extends CassandraBaseDao<PackageInfo> implements
private static final UDTMapper<Version> versionMapper =
noSqlDb.getMappingManager().udtMapper(Version.class);
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
@Override
protected Mapper<PackageInfo> getMapper() {
return mapper;
@@ -63,6 +69,8 @@ public class PackageInfoDaoImpl extends CassandraBaseDao<PackageInfo> implements
@Override
public List<PackageInfo> listByCategory(String category, String subCategory) {
+
+ mdcDataDebugMessage.debugEntryMessage(null, null);
Result<PackageInfo> packages = accessor.listInfo();
List<PackageInfo> filteredPackages = new ArrayList<>();
@@ -79,7 +87,7 @@ public class PackageInfoDaoImpl extends CassandraBaseDao<PackageInfo> implements
filteredPackages.add(packageInfo);
}
}
-
+ mdcDataDebugMessage.debugExitMessage(null, null);
return filteredPackages;
}
@@ -88,16 +96,25 @@ public class PackageInfoDaoImpl extends CassandraBaseDao<PackageInfo> implements
accessor.deleteRowTranslateContent(vspId, version);
}
+ @Override
+ public void updateTranslatedContent(String vspId, Version version, ByteBuffer translateContent){
+ accessor.updateTranslateContent(translateContent, vspId, versionMapper.toUDT(version));
+ }
+
@Accessor
interface PackageInfoAccessor {
@Query(
- "SELECT vsp_id,version,display_name,vsp_name,vsp_description,vendor_name,category,"
- + "sub_category,vendor_release,package_checksum,package_type FROM package_details")
+ "SELECT vsp_id,version,display_name,vsp_name,vsp_description,vendor_name,category"
+ + " ,sub_category, vendor_release,package_checksum,package_type FROM package_details")
Result<PackageInfo> listInfo();
@Query("DELETE TRANSLATE_CONTENT FROM package_details WHERE vsp_id=? and version=?")
Result<PackageInfo> deleteRowTranslateContent(String vspId, Version version);
+ @Query("UPDATE package_details set translate_content = ? where vsp_id = ? and version = ?")
+ Result<PackageInfo> updateTranslateContent(ByteBuffer translateContent, String vspId,
+ UDTValue version);
+
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java
deleted file mode 100644
index 0e9fd90a13..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessArtifactDaoCassandraImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.nio.ByteBuffer;
-
-public class ProcessArtifactDaoCassandraImpl implements ProcessArtifactDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final ProcessArtifactAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ProcessArtifactAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void update(ProcessArtifactEntity entity) {
- accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId(), entity.getArtifactName(), entity.getArtifact());
- }
-
- @Override
- public ProcessArtifactEntity get(ProcessArtifactEntity entity) {
- return accessor
- .get(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId(),
- entity.getId());
- }
-
- @Override
- public void delete(ProcessArtifactEntity entity) {
- accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId());
- }
-
- @Accessor
- interface ProcessArtifactAccessor {
-
- @Query(
- "insert into vsp_process (vsp_id, version, component_id, process_id, artifact_name,"
- + " artifact) values (?,?,?,?,?,?)")
- ResultSet update(String vspId, UDTValue version, String componentId, String id,
- String artifactName, ByteBuffer artifact);
-
- @Query(
- "select vsp_id, version, component_id, process_id, artifact_name, artifact "
- + "from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?")
- ProcessArtifactEntity get(String vspId, UDTValue version, String componentId, String id);
-
- @Query(
- "delete artifact_name, artifact from vsp_process where vsp_id=? and version=? and"
- + " component_id=? and process_id=?")
- ResultSet delete(String vspId, UDTValue version, String componentId, String id);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java
deleted file mode 100644
index b8900eb5d3..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoCassandraImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.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;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.UniqueValueMetadata;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-
-public class ProcessDaoCassandraImpl implements ProcessDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<ProcessEntity> mapper =
- noSqlDb.getMappingManager().mapper(ProcessEntity.class);
- private static final ProcessAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(ProcessAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- public void registerVersioning(String versionableEntityType) {
- VersionableEntityMetadata metadata = new VersionableEntityMetadata(
- mapper.getTableMetadata().getName(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName());
-
- metadata.setUniqueValuesMetadata(Collections.singletonList(
- new UniqueValueMetadata(VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME,
- Arrays.asList("vsp_id", "version", "component_id", "name"))));
-
- VersioningManagerFactory.getInstance().createInterface()
- .register(versionableEntityType, metadata);
- }
-
- @Override
- public Collection<ProcessEntity> list(ProcessEntity entity) {
- return accessor
- .list(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId())
- .all();
- }
-
- @Override
- public void create(ProcessEntity entity) {
- accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId(), entity.getName(), entity.getDescription());
- }
-
- @Override
- public void update(ProcessEntity entity) {
- accessor.update(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId(), entity.getName(), entity.getDescription());
- }
-
- @Override
- public ProcessEntity get(ProcessEntity entity) {
- return accessor
- .get(entity.getVspId(), versionMapper.toUDT(entity.getVersion()), entity.getComponentId(),
- entity.getId());
- }
-
- @Override
- public void delete(ProcessEntity entity) {
- if (entity.getId() == null) {
- accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId());
- } else {
- accessor.delete(entity.getVspId(), versionMapper.toUDT(entity.getVersion()),
- entity.getComponentId(), entity.getId());
- }
- }
-
- public void deleteAll(ProcessEntity entity) {
- accessor.deleteAll(entity.getVspId(), versionMapper.toUDT(entity.getVersion()));
- }
-
- @Accessor
- interface ProcessAccessor {
-
- @Query(
- "insert into vsp_process (vsp_id, version, component_id, process_id, name, description) "
- + "values (?,?,?,?,?,?)")
- ResultSet update(String vspId, UDTValue version, String componentId, String id, String name,
- String description);
-
- @Query(
- "select vsp_id, version, component_id, process_id, name, description, artifact_name "
- + "from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?")
- ProcessEntity get(String vspId, UDTValue version, String componentId, String id);
-
- @Query(
- "select vsp_id, version, component_id, process_id, name, description, artifact_name "
- + "from vsp_process where vsp_id=? and version=? and component_id=?")
- Result<ProcessEntity> list(String vspId, UDTValue version, String componentId);
-
- @Query(
- "delete from vsp_process where vsp_id=? and version=? and component_id=? and process_id=?")
- ResultSet delete(String vspId, UDTValue version, String componentId, String id);
-
- @Query("delete from vsp_process where vsp_id=? and version=? and component_id=?")
- ResultSet deleteAll(String vspId, UDTValue version, String componentId);
-
- @Query("delete from vsp_process where vsp_id=? and version=?")
- ResultSet deleteAll(String vspId, UDTValue version);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java
index 4c981d8448..ada76e790a 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/ProcessDaoFactoryImpl.java
@@ -20,11 +20,14 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ProcessDaoZusammenImpl;
public class ProcessDaoFactoryImpl extends ProcessDaoFactory {
- private static final ProcessDao INSTANCE = new ProcessDaoCassandraImpl();
+ private static final ProcessDao INSTANCE = new ProcessDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public ProcessDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java
deleted file mode 100644
index df019a4f53..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/UploadDataDaoImpl.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.Result;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.dao.impl.CassandraBaseDao;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.nio.ByteBuffer;
-import java.util.Collection;
-
-public class UploadDataDaoImpl extends CassandraBaseDao<UploadDataEntity> implements UploadDataDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<UploadDataEntity> mapper =
- noSqlDb.getMappingManager().mapper(UploadDataEntity.class);
- private static final UploadDataAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(UploadDataAccessor.class);
- private static final UDTMapper<Version> versionMapper =
- noSqlDb.getMappingManager().udtMapper(Version.class);
-
- @Override
- protected Mapper<UploadDataEntity> getMapper() {
- return mapper;
- }
-
- @Override
- protected Object[] getKeys(UploadDataEntity entity) {
- return new Object[]{entity.getId(), versionMapper.toUDT(entity.getVersion())};
- }
-
- @Override
- public Collection<UploadDataEntity> list(UploadDataEntity entity) {
- return accessor.listAll().all();
- }
-
- @Override
- public void deleteContentDataAndValidationData(String vspId, Version version) {
- accessor.deleteContentDataAndValidationData(vspId, versionMapper.toUDT(version));
- }
-
- @Override
- public ByteBuffer getContentData(String vspId, Version version) {
- return accessor.getContentData(vspId, version).one().getContentData();
- }
-
-
- @Accessor
- interface UploadDataAccessor {
-
- @Query(
- "SELECT package_name, package_version, content_data, validation_data FROM vsp_information")
- Result<UploadDataEntity> listAll();
-
- @Query(
- "DELETE package_name, package_version, content_data, validation_data FROM vsp_information "
- + "WHERE vsp_id=? and version=?")
- Result<VspDetails> deleteContentDataAndValidationData(String vspId, UDTValue udtValue);
-
- @Query("SELECT CONTENT_DATA FROM vsp_information WHERE vsp_id=? and version=?")
- Result<UploadDataEntity> getContentData(String vspId, Version version);
-
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java
index 587f8ac036..96bb16ca70 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoFactoryImpl.java
@@ -20,9 +20,11 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+
public class VendorSoftwareProductDaoFactoryImpl extends VendorSoftwareProductDaoFactory {
private static final VendorSoftwareProductDao INSTANCE = new VendorSoftwareProductDaoImpl();
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
index f592e63280..c0a215fff5 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductDaoImpl.java
@@ -22,202 +22,97 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
import org.openecomp.core.model.dao.EnrichedServiceArtifactDao;
import org.openecomp.core.model.dao.EnrichedServiceArtifactDaoFactory;
+import org.openecomp.core.model.dao.EnrichedServiceModelDao;
+import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory;
import org.openecomp.core.model.dao.ServiceArtifactDaoFactory;
import org.openecomp.core.model.dao.ServiceArtifactDaoInter;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDaoFactory;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.dao.ServiceModelDaoFactory;
+import org.openecomp.core.model.dao.ServiceTemplateDaoFactory;
+import org.openecomp.core.model.dao.ServiceTemplateDaoInter;
+import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MibDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessArtifactDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.UploadDataDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentArtifactEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessArtifactEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.List;
-import java.util.Objects;
public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
- private static final VendorSoftwareProductInfoDao vspInfoDao =
- VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
+ private static final VendorSoftwareProductInfoDao vspInfoDao = VendorSoftwareProductInfoDaoFactory
+ .getInstance().createInterface();
private static final PackageInfoDao packageInfoDao =
PackageInfoDaoFactory.getInstance().createInterface();
- private static final UploadDataDao uploadDataDao =
- UploadDataDaoFactory.getInstance().createInterface();
- private static final VspQuestionnaireDao vspQuestionnaireDao =
- VspQuestionnaireDaoFactory.getInstance().createInterface();
+ private static final OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDataDao =
+ OrchestrationTemplateCandidateDaoFactory.getInstance().createInterface();
private static final NetworkDao networkDao = NetworkDaoFactory.getInstance().createInterface();
private static final ComponentDao componentDao =
ComponentDaoFactory.getInstance().createInterface();
private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface();
private static final ProcessDao processDao = ProcessDaoFactory.getInstance().createInterface();
- private static final ProcessArtifactDao processArtifactDao =
- ProcessArtifactDaoFactory.getInstance().createInterface();
- private static final ComponentArtifactDao componentArtifactDao =
- ComponentArtifactDaoFactory.getInstance().createInterface();
- private static final ServiceArtifactDaoInter artifactDao =
- ServiceArtifactDaoFactory.getInstance().createInterface();
+ private static final MibDao
+ MIB_DAO = MibDaoFactory.getInstance().createInterface();
+ private static final ServiceArtifactDaoInter
+ artifactDao = ServiceArtifactDaoFactory.getInstance().createInterface();
+ public static final ServiceTemplateDaoInter
+ templateDao = ServiceTemplateDaoFactory.getInstance().createInterface();
private static final EnrichedServiceArtifactDao enrichArtifactDao =
EnrichedServiceArtifactDaoFactory.getInstance().createInterface();
+ private static final EnrichedServiceModelDao enrichedServiceModelDao =
+ EnrichedServiceModelDaoFactory.getInstance().createInterface();
+ private static final ServiceModelDao serviceModelDao =
+ ServiceModelDaoFactory.getInstance().createInterface();
+ private static final ComponentDependencyModelDao componentDependencyModelDao =
+ ComponentDependencyModelDaoFactory.getInstance().createInterface();
@Override
public void registerVersioning(String versionableEntityType) {
vspInfoDao.registerVersioning(versionableEntityType);
- vspQuestionnaireDao.registerVersioning(versionableEntityType);
networkDao.registerVersioning(versionableEntityType);
componentDao.registerVersioning(versionableEntityType);
nicDao.registerVersioning(versionableEntityType);
processDao.registerVersioning(versionableEntityType);
+ orchestrationTemplateCandidateDataDao.registerVersioning(versionableEntityType);
+ componentDependencyModelDao.registerVersioning(versionableEntityType);
}
@Override
- public void createVendorSoftwareProductInfo(VspDetails vspDetails) {
- vspInfoDao.create(vspDetails);
- }
-
- @Override
- public Collection<VspDetails> listVendorSoftwareProductsInfo() {
- return vspInfoDao.list(new VspDetails());
- }
-
- public VspDetails getVendorSoftwareProductInfo(VspDetails vspDetails) {
- return vspInfoDao.get(vspDetails);
- }
-
-
- @Override
- public void updateVendorSoftwareProductInfo(VspDetails vspDetails) {
- vspInfoDao.update(vspDetails);
- }
-
- @Override
- public void deleteVendorSoftwareProductInfo(VspDetails vspDetails) {
- vspInfoDao.delete(vspDetails);
- }
-
- @Override
- public void updateUploadData(UploadDataEntity uploadData) {
- uploadDataDao.update(uploadData);
- }
-
- @Override
- public UploadDataEntity getUploadData(UploadDataEntity uploadData) {
- return uploadDataDao.get(uploadData);
- }
-
- @Override
- public ByteBuffer getContentData(UploadDataEntity uploadDataEntity) {
- return uploadDataDao.getContentData(uploadDataEntity.getId(), uploadDataEntity.getVersion());
- }
-
- @Override
- public void insertPackageDetails(PackageInfo packageInfo) {
- packageInfoDao.update(packageInfo);
- }
-
- @Override
- public PackageInfo getPackageInfo(PackageInfo packageInfo) {
- return packageInfoDao.get(packageInfo);
- }
-
- @Override
- public void deletePackageInfo(PackageInfo packageInfo) {
- packageInfoDao.delete(packageInfo);
- }
-
- @Override
- public Collection<NetworkEntity> listNetworks(String vspId, Version version) {
- return networkDao.list(new NetworkEntity(vspId, version, null));
- }
-
- @Override
- public void createNetwork(NetworkEntity network) {
- networkDao.create(network);
- }
-
- @Override
- public void updateNetwork(NetworkEntity networkEntity) {
- networkDao.update(networkEntity);
- }
-
- @Override
- public NetworkEntity getNetwork(String vspId, Version version, String networkId) {
- return networkDao.get(new NetworkEntity(vspId, version, networkId));
- }
-
- @Override
- public void deleteNetwork(String vspId, Version version) {
- NetworkEntity networkEntity = new NetworkEntity(vspId, version, null);
- networkDao.delete(networkEntity);
- }
-
- @Override
- public List<PackageInfo> listPackages(String category, String subCategory) {
- return packageInfoDao.listByCategory(category, subCategory);
- }
-
-
- @Override
public Collection<ComponentEntity> listComponents(String vspId, Version version) {
return componentDao.list(new ComponentEntity(vspId, version, null));
}
@Override
- public void createComponent(ComponentEntity component) {
- componentDao.create(component);
- }
-
- @Override
- public void updateComponent(ComponentEntity component) {
- componentDao.update(component);
- }
-
- @Override
- public ComponentEntity getComponent(String vspId, Version version, String componentId) {
- return componentDao.get(new ComponentEntity(vspId, version, componentId));
- }
-
- @Override
public Collection<ComponentEntity> listComponentsQuestionnaire(String vspId, Version version) {
return componentDao.listQuestionnaires(vspId, version);
}
@Override
- public void updateComponentQuestionnaire(String vspId, Version version, String componentId,
- String questionnaireData) {
- componentDao.updateQuestionnaireData(vspId, version, componentId, questionnaireData);
- }
-
- @Override
- public void deleteComponent(String vspId, Version version) {
- ComponentEntity componentEntity = new ComponentEntity(vspId, version, null);
- componentDao.delete(componentEntity);
+ public Collection<ComponentEntity> listComponentsCompositionAndQuestionnaire(String vspId,
+ Version version) {
+ return componentDao.listCompositionAndQuestionnaire(vspId, version);
}
@Override
@@ -255,60 +150,25 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
@Override
public void uploadProcessArtifact(String vspId, Version version, String componentId,
String processId, byte[] artifact, String artifactName) {
- ProcessArtifactEntity processArtifact =
- new ProcessArtifactEntity(vspId, version, componentId, processId);
+ ProcessEntity
+ processArtifact = new ProcessEntity(vspId, version, componentId, processId);
+ processArtifact = processDao.get(processArtifact);
processArtifact.setArtifact(ByteBuffer.wrap(artifact));
processArtifact.setArtifactName(artifactName);
- processArtifactDao.update(processArtifact);
+ processDao.update(processArtifact);
}
@Override
- public ProcessArtifactEntity getProcessArtifact(String vspId, Version version, String componentId,
- String processId) {
- return processArtifactDao
- .get(new ProcessArtifactEntity(vspId, version, componentId, processId));
+ public ProcessEntity getProcessArtifact(String vspId, Version version, String componentId,
+ String processId) {
+ return processDao
+ .get(new ProcessEntity(vspId, version, componentId, processId));
}
@Override
public void deleteProcessArtifact(String vspId, Version version, String componentId,
String processId) {
- processArtifactDao.delete(new ProcessArtifactEntity(vspId, version, componentId, processId));
- }
-
- @Override
- public VspQuestionnaireEntity getQuestionnaire(String vspId, Version version) {
- return vspQuestionnaireDao.get(new VspQuestionnaireEntity(vspId, version));
- }
-
- @Override
- public void updateQuestionnaire(String vspId, Version version, String questionnaireData) {
- vspQuestionnaireDao.updateQuestionnaireData(vspId, version, questionnaireData);
- }
-
- @Override
- public Collection<NicEntity> listNics(String vspId, Version version, String componentId) {
- return nicDao.list(new NicEntity(vspId, version, componentId, null));
- }
-
- @Override
- public void createNic(NicEntity nic) {
- nicDao.create(nic);
- }
-
- @Override
- public NicEntity getNic(String vspId, Version version, String componentId, String nicId) {
- return nicDao.get(new NicEntity(vspId, version, componentId, nicId));
- }
-
- @Override
- public void updateNic(NicEntity nicEntity) {
- nicDao.update(nicEntity);
- }
-
- @Override
- public void updateNicQuestionnaire(String vspId, Version version, String componentId,
- String nicId, String questionnaireData) {
- nicDao.updateQuestionnaireData(vspId, version, componentId, nicId, questionnaireData);
+ processDao.delete(new ProcessEntity(vspId, version, componentId, processId));
}
@Override
@@ -317,33 +177,49 @@ public class VendorSoftwareProductDaoImpl implements VendorSoftwareProductDao {
}
@Override
- public void deleteNic(String vspId, Version version, String componentId) {
- NicEntity nicEntity = new NicEntity(vspId, version, componentId, null);
- nicDao.delete(nicEntity);
- }
-
- @Override
public void deleteUploadData(String vspId, Version version) {
+
networkDao.deleteAll(vspId, version);
- nicDao.deleteByVspId(vspId, version);
- artifactDao.delete(vspId, version);
- enrichArtifactDao.delete(vspId, version);
- ComponentArtifactEntity componentArtifactEntity =
- new ComponentArtifactEntity(vspId, version, null, null);
- ProcessEntity processEntity = new ProcessEntity(vspId, version, null, null);
- componentArtifactDao.deleteAll(componentArtifactEntity);
- processDao.deleteAll(processEntity);
+ //nicDao.deleteByVspId(vspId, version);
+ //artifactDao.delete(vspId, version);
+ //templateDao.deleteAll(vspId, version);
+ enrichedServiceModelDao.deleteAll(vspId, version);
+ serviceModelDao.deleteAll(vspId, version);
+ //processDao.deleteVspAll(vspId,version);
componentDao.deleteAll(vspId, version);
- uploadDataDao.deleteContentDataAndValidationData(vspId, version);
+ vspInfoDao.deleteAll(vspId, version);
+
+// uploadDataDao.deleteContentDataAndValidationData(vspId, version);
+
+// enrichArtifactDao.deleteAll(vspId, version);
+// artifactDao.deleteAll(vspId, version);
}
- @Override
- public void updateVspLatestModificationTime(String vspId, Version version) {
- if (Objects.isNull(vspId) || Objects.isNull(version)) {
+ /* @Override
+ public void updateVspLatestModificationTime(String vspId, Version version) {
+ *//* if (Objects.isNull(vspId) || Objects.isNull(version)) {
return;
}
VspDetails retrieved = getVendorSoftwareProductInfo(new VspDetails(vspId, version));
- updateVendorSoftwareProductInfo(retrieved);
+ updateVendorSoftwareProductInfo(retrieved);*//*
+ }
+*/
+ @Override
+ public void createComponentDependencyModel(List<ComponentDependencyModelEntity>
+ componentDependencyModel, String vspId,
+ Version version) {
+ componentDependencyModelDao.deleteAll(vspId, version);
+ for (ComponentDependencyModelEntity entity : componentDependencyModel) {
+ entity.setId(CommonMethods.nextUuId());
+ componentDependencyModelDao.create(entity);
+ }
+ }
+
+ @Override
+ public Collection<ComponentDependencyModelEntity> listComponentDependencies(String vspId,
+ Version version) {
+ return componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version,
+ null));
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java
index 1dcb3f4c66..a5f9d17431 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoFactoryImpl.java
@@ -20,12 +20,15 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
+import org.openecomp.core.zusammen.api.ZusammenAdaptorFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl;
public class VendorSoftwareProductInfoDaoFactoryImpl extends VendorSoftwareProductInfoDaoFactory {
private static final VendorSoftwareProductInfoDao INSTANCE =
- new VendorSoftwareProductInfoDaoImpl();
+ new VendorSoftwareProductInfoDaoZusammenImpl(
+ ZusammenAdaptorFactory.getInstance().createInterface());
@Override
public VendorSoftwareProductInfoDao createInterface() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
index c3096dab29..5a8635cf98 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VendorSoftwareProductInfoDaoImpl.java
@@ -30,6 +30,7 @@ import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
import org.openecomp.sdc.versioning.VersioningManagerFactory;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
@@ -71,13 +72,39 @@ public class VendorSoftwareProductInfoDaoImpl extends CassandraBaseDao<VspDetail
return accessor.listAll().all();
}
+ @Override
+ public void updateOldVersionIndication(VspDetails vspDetails) {
+
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version,
+ String questionnaireData) {
+
+ }
+
+ @Override
+ public String getQuestionnaireData(String vspId, Version version) {
+ return null;
+ }
+
+ @Override
+ public VspQuestionnaireEntity getQuestionnaire(String vspId, Version version) {
+ return null;
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+
+ }
+
+
@Accessor
interface VendorSoftwareProductInfoAccessor {
@Query(
- "SELECT vsp_id,version,name,description,icon,category,sub_category,vendor_id,"
- + "vlm_version,license_agreement,feature_groups FROM vsp_information")
+ "SELECT vsp_id,version,name,description,icon,category,sub_category,vendor_id,vlm_version,"
+ + "license_agreement,feature_groups, is_old_version FROM vsp_information")
Result<VspDetails> listAll();
-
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java
deleted file mode 100644
index ef4dd0de74..0000000000
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/VspQuestionnaireDaoCassandraImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.sdc.vendorsoftwareproduct.dao.impl;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.UDTValue;
-import com.datastax.driver.mapping.Mapper;
-import com.datastax.driver.mapping.UDTMapper;
-import com.datastax.driver.mapping.annotations.Accessor;
-import com.datastax.driver.mapping.annotations.Query;
-import org.openecomp.core.nosqldb.api.NoSqlDb;
-import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VspQuestionnaireDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
-import org.openecomp.sdc.versioning.VersioningManagerFactory;
-import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
-
-public class VspQuestionnaireDaoCassandraImpl implements VspQuestionnaireDao {
-
- private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
- private static final Mapper<VspQuestionnaireEntity> mapper =
- noSqlDb.getMappingManager().mapper(VspQuestionnaireEntity.class);
- private static final VspQuestionnaireAccessor accessor =
- noSqlDb.getMappingManager().createAccessor(VspQuestionnaireAccessor.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(),
- mapper.getTableMetadata().getPartitionKey().get(0).getName(),
- mapper.getTableMetadata().getPartitionKey().get(1).getName()));
- }
-
- @Override
- public VspQuestionnaireEntity get(VspQuestionnaireEntity entity) {
- return mapper.get(entity.getId(), versionMapper.toUDT(entity.getVersion()));
- }
-
- @Override
- public void updateQuestionnaireData(String id, Version version, String questionnaireData) {
- accessor.updateQuestionnaireData(questionnaireData, id, versionMapper.toUDT(version));
- }
-
- @Accessor
- interface VspQuestionnaireAccessor {
-
- @Query("update vsp_information set questionnaire_data=? where vsp_id=? and version=?")
- ResultSet updateQuestionnaireData(String questionnaireData, String id, UDTValue version);
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java
new file mode 100644
index 0000000000..8ef09ada7b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDaoZusammenImpl.java
@@ -0,0 +1,244 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class ComponentDaoZusammenImpl implements ComponentDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public ComponentDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ }
+
+ @Override
+ public Collection<ComponentEntity> list(ComponentEntity component) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(component.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(component.getVersion()));
+
+ return listComponents(zusammenAdaptor, context, elementContext, component.getVspId(),
+ component.getVersion());
+ }
+
+ static Collection<ComponentEntity> listComponents(ZusammenAdaptor zusammenAdaptor,
+ SessionContext context,
+ ElementContext elementContext,
+ String vspId, Version version) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, null, StructureElement.Components.name())
+ .stream().map(elementInfo -> mapElementInfoToComponent(vspId, version, elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private static ComponentEntity mapElementInfoToComponent(String vspId, Version version,
+ ElementInfo elementInfo) {
+ ComponentEntity componentEntity =
+ new ComponentEntity(vspId, version, elementInfo.getId().getValue());
+ componentEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return componentEntity;
+ }
+
+ @Override
+ public void create(ComponentEntity component) {
+ ZusammenElement componentElement = componentToZusammen(component, Action.CREATE);
+ ZusammenElement componentsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Components, null);
+ componentsElement.getSubElements().add(componentElement);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(component.getVspId());
+ Optional<Element> savedElement = zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentsElement, "Create component");
+ savedElement.ifPresent(element ->
+ component.setId(element.getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(ComponentEntity component) {
+ ZusammenElement componentElement = componentToZusammen(component, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(component.getVspId());
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentElement, String.format("Update component with id %s", component.getId()));
+ }
+
+ @Override
+ public ComponentEntity get(ComponentEntity component) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(component.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(component.getVersion()));
+
+ Optional<Element> element =
+ zusammenAdaptor.getElement(context, elementContext, component.getId());
+
+ if (element.isPresent()) {
+ component.setCompositionData(new String(FileUtils.toByteArray(element.get().getData())));
+ return component;
+ }
+ return null;
+ }
+
+ @Override
+ public void delete(ComponentEntity component) {
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(component.getId()));
+ componentElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(component.getVspId());
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentElement, String.format("Delete component with id %s", component.getId()));
+ }
+
+ @Override
+ public ComponentEntity getQuestionnaireData(String vspId, Version version, String componentId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ return getQuestionnaire(context, elementContext,
+ new ComponentEntity(vspId, version, componentId));
+ }
+
+ private ComponentEntity getQuestionnaire(SessionContext context, ElementContext elementContext,
+ ComponentEntity component) {
+ Optional<Element> questionnaireElement = zusammenAdaptor
+ .getElementByName(context, elementContext, new Id(component.getId()),
+ StructureElement.Questionnaire.name());
+ return questionnaireElement.map(
+ element -> element.getData() == null
+ ? null
+ : new String(FileUtils.toByteArray(element.getData())))
+ .map(questionnaireData -> {
+ component.setQuestionnaireData(questionnaireData);
+ return component;
+ })
+ .orElse(null);
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String questionnaireData) {
+ ZusammenElement questionnaireElement =
+ componentQuestionnaireToZusammen(questionnaireData, Action.UPDATE);
+
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setAction(Action.IGNORE);
+ componentElement.setElementId(new Id(componentId));
+ componentElement.setSubElements(Collections.singletonList(questionnaireElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentElement, "Update component questionnaire");
+ }
+
+ @Override
+ public Collection<ComponentEntity> listQuestionnaires(String vspId, Version version) {
+ return listCompositionAndQuestionnaire(vspId, version);
+ }
+
+ @Override
+ public Collection<ComponentEntity> listCompositionAndQuestionnaire(String vspId,
+ Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Collection<ComponentEntity> components =
+ listComponents(zusammenAdaptor, context, elementContext, vspId, version);
+
+ components.forEach(component -> getQuestionnaire(context, elementContext, component));
+ return components;
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ ZusammenElement componentsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Components, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context,
+ new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentsElement, "Delete all components");
+ }
+
+ private ZusammenElement componentToZusammen(ComponentEntity component, Action action) {
+ ZusammenElement componentElement = buildComponentElement(component, action);
+ if (action == Action.CREATE) {
+ componentElement
+ .setSubElements(Arrays.asList(
+ componentQuestionnaireToZusammen(component.getQuestionnaireData(), Action.CREATE),
+ VspZusammenUtil.buildStructuralElement(StructureElement.Nics, Action.CREATE),
+ VspZusammenUtil.buildStructuralElement(StructureElement.Processes, Action.CREATE),
+ VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, Action.CREATE)));
+ }
+ return componentElement;
+ }
+
+ private ZusammenElement componentQuestionnaireToZusammen(String questionnaireData,
+ Action action) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, action);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }
+
+ private ZusammenElement buildComponentElement(ComponentEntity component, Action action) {
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setAction(action);
+ if (component.getId() != null) {
+ componentElement.setElementId(new Id(component.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.Component);
+ info.addProperty(ElementPropertyName.compositionData.name(), component.getCompositionData());
+ componentElement.setInfo(info);
+ componentElement.setData(new ByteArrayInputStream(component.getCompositionData().getBytes()));
+ return componentElement;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDependencyModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDependencyModelDaoZusammenImpl.java
new file mode 100644
index 0000000000..e36b6c7743
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ComponentDependencyModelDaoZusammenImpl.java
@@ -0,0 +1,201 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 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.vendorsoftwareproduct.dao.ComponentDependencyModelDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * Created by ayalaben on 5/16/2017.
+ */
+public class ComponentDependencyModelDaoZusammenImpl implements ComponentDependencyModelDao {
+
+ private static final Logger logger =
+ LoggerFactory.getLogger(OrchestrationTemplateCandidateDaoZusammenImpl.class);
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public ComponentDependencyModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public ComponentDependencyModelEntity get(ComponentDependencyModelEntity entity) {
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(entity.getVspId()); // entity.getId()?
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(entity.getVersion()));
+
+ Optional<ElementInfo> componentDependencyElement =
+ zusammenAdaptor.getElementInfo(context, elementContext, new Id(entity.getId()));
+
+ if (componentDependencyElement.isPresent()) {
+ addComponentDependencyData(entity, componentDependencyElement.get());
+ return entity;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void create(ComponentDependencyModelEntity entity) {
+
+ ZusammenElement componentDependencies =
+ VspZusammenUtil.buildStructuralElement(StructureElement.ComponentDependencies, null);
+
+ ZusammenElement componentDependency = buildComponentDependencyElement(entity);
+ componentDependency.setAction(Action.CREATE);
+
+ Id itemId = new Id(entity.getVspId());
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement = zusammenAdaptor.saveElement(context, elementContext,
+ VspZusammenUtil.aggregateElements(componentDependencies, componentDependency),
+ "Create component dependency model");
+
+ savedElement.ifPresent(element ->
+ entity.setId(element.getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(ComponentDependencyModelEntity entity) {
+ ZusammenElement componentDependencyElement = buildComponentDependencyElement(entity);
+ componentDependencyElement.setAction(Action.UPDATE);
+
+ Id itemId = new Id(entity.getVspId());
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context, elementContext,
+ componentDependencyElement,
+ String.format("Update component dependency model with id %s", entity.getId()));
+ }
+
+ @Override
+ public void delete(ComponentDependencyModelEntity entity) {
+ ZusammenElement componentDependencyElement = new ZusammenElement();
+ componentDependencyElement.setElementId(new Id(entity.getId()));
+ componentDependencyElement.setAction(Action.DELETE);
+
+ Id itemId = new Id(entity.getVspId());
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+
+ zusammenAdaptor.saveElement(context, elementContext,
+ componentDependencyElement,
+ String.format("Delete component dependency model with id %s", entity.getId()));
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ ZusammenElement componentDependenciesElement =
+ VspZusammenUtil
+ .buildStructuralElement(StructureElement.ComponentDependencies, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ zusammenAdaptor.saveElement(context, new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor)),
+ componentDependenciesElement, "Delete all component dependencies");
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ //not implemented?
+ }
+
+ @Override
+ public Collection<ComponentDependencyModelEntity> list(ComponentDependencyModelEntity entity) {
+
+ Id itemId = new Id(entity.getVspId());
+ SessionContext context = ZusammenUtil.createSessionContext();
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(entity.getVersion()));
+
+ return zusammenAdaptor.listElementsByName(context, elementContext,
+ null, StructureElement.ComponentDependencies.name())
+ .stream().map(elementInfo -> mapElementInfoToComponentDependencyModel(entity.getVspId(),
+ entity.getVersion(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private static ComponentDependencyModelEntity mapElementInfoToComponentDependencyModel(
+ String vspId, Version version,
+ ElementInfo elementInfo) {
+ ComponentDependencyModelEntity componentDependencyModelEntity =
+ new ComponentDependencyModelEntity(vspId, version, elementInfo.getId().getValue());
+ componentDependencyModelEntity.setSourceComponentId(elementInfo.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.sourcecomponent_id.name()));
+ componentDependencyModelEntity.setTargetComponentId(elementInfo.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.targetcomponent_id.name()));
+ componentDependencyModelEntity.setRelation(elementInfo.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.relation.name()));
+
+ return componentDependencyModelEntity;
+ }
+
+
+ private ZusammenElement buildComponentDependencyElement(ComponentDependencyModelEntity entity) {
+ ZusammenElement componentDependencyElement = new ZusammenElement();
+
+ if (entity.getId() != null) {
+ componentDependencyElement.setElementId(new Id(entity.getId()));
+ }
+
+ Info info = new Info();
+ info.addProperty(ComponentDependencyModelPropertyName.id.name(), entity.getId());
+ info.addProperty(ComponentDependencyModelPropertyName.relation.name(), entity.getRelation());
+ info.addProperty(ComponentDependencyModelPropertyName.sourcecomponent_id.name(),
+ entity.getSourceComponentId());
+ info.addProperty(ComponentDependencyModelPropertyName.targetcomponent_id.name(),
+ entity.getTargetComponentId());
+
+ componentDependencyElement.setInfo(info);
+
+ return componentDependencyElement;
+ }
+
+ private void addComponentDependencyData(ComponentDependencyModelEntity componentDependency,
+ ElementInfo componentDependencyElement) {
+ componentDependency.setId(componentDependencyElement.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.id.name()));
+ componentDependency.setRelation(componentDependencyElement.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.id.name()));
+ componentDependency.setSourceComponentId(componentDependencyElement.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.sourcecomponent_id.name()));
+ componentDependency.setTargetComponentId(componentDependencyElement.getInfo()
+ .getProperty(ComponentDependencyModelPropertyName.targetcomponent_id.name()));
+ }
+
+
+ private enum ComponentDependencyModelPropertyName {
+ id,
+ relation,
+ sourcecomponent_id,
+ targetcomponent_id,
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementPropertyName.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementPropertyName.java
new file mode 100644
index 0000000000..9ca0bf721a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementPropertyName.java
@@ -0,0 +1,6 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+public enum ElementPropertyName {
+ type,
+ compositionData
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java
new file mode 100644
index 0000000000..b0313f5b14
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ElementType.java
@@ -0,0 +1,9 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+public enum ElementType {
+ Network,
+ Component,
+ Nic,
+ Process,
+ LKG
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java
new file mode 100644
index 0000000000..10cdfbd9da
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/MibDaoZusammenImpl.java
@@ -0,0 +1,171 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 org.openecomp.core.enrichment.types.ArtifactType;
+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.vendorsoftwareproduct.dao.MibDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * @author Avrahamg.
+ * @since March 21, 2017
+ */
+public class MibDaoZusammenImpl implements MibDao {
+
+ private static final String ARTIFACT_NAME = "name";
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public MibDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public Optional<MibEntity> getByType(MibEntity mibEntity) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(mibEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(mibEntity.getVersion()));
+
+ Optional<Element> mibsElement =
+ zusammenAdaptor.getElementByName(context, elementContext, new Id(mibEntity
+ .getComponentId()), StructureElement.Mibs.toString());
+ if (mibsElement.isPresent()) {
+ Optional<Element> mibElement = zusammenAdaptor
+ .getElementByName(context, elementContext, mibsElement.get().getElementId(),
+ getMibStructuralElement(mibEntity.getType()).toString());
+ if (mibElement.isPresent()) {
+ mibEntity.setId(mibElement.get().getElementId().getValue());
+ mibEntity.setArtifactName((String) mibElement.get().getInfo().getProperties().get(ARTIFACT_NAME));
+ mibEntity.setArtifact(ByteBuffer.wrap(FileUtils.toByteArray(mibElement.get().getData())));
+ return Optional.of(mibEntity);
+ }
+ }
+
+ return Optional.empty();
+ }
+
+ @Override
+ public void create(MibEntity mibEntity) {
+ ZusammenElement mibElement = buildMibElement(mibEntity);
+
+ ZusammenElement mibsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, null);
+
+ ZusammenElement componentElement = buildComponentElement(mibEntity);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(mibEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement = zusammenAdaptor.saveElement(context, elementContext,
+ VspZusammenUtil.aggregateElements(componentElement, mibsElement, mibElement),
+ "Create mib");
+ savedElement.ifPresent(element ->
+ mibEntity.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void delete(MibEntity mibEntity) {
+ ZusammenElement mibElement = new ZusammenElement();
+ mibElement.setElementId(new Id(mibEntity.getId()));
+ mibElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(mibEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context, elementContext, mibElement,
+ String.format("Delete mib with id %s", mibEntity.getId()));
+ }
+
+ @Override
+ public Collection<MibEntity> list(MibEntity mib) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(mib.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(mib.getVersion()));
+
+ return zusammenAdaptor.listElementsByName(context, elementContext, new Id(mib.getComponentId()),
+ StructureElement.Mibs.toString()).stream()
+ .map(elementInfo ->
+ mapElementInfoToMib(mib.getVspId(), mib.getVersion(), mib.getComponentId(),
+ elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void deleteAll(MibEntity mibEntity) {
+ ZusammenElement mibsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Mibs, Action.DELETE);
+
+ ZusammenElement componentElement = buildComponentElement(mibEntity);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(mibEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context, elementContext,
+ VspZusammenUtil.aggregateElements(componentElement, mibsElement), "Delete mibs");
+ }
+
+ private ZusammenElement buildComponentElement(MibEntity mibEntity) {
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(mibEntity.getComponentId()));
+ componentElement.setAction(Action.IGNORE);
+ return componentElement;
+ }
+
+ private ZusammenElement buildMibElement(MibEntity mib) {
+ ZusammenElement mibElement = VspZusammenUtil
+ .buildStructuralElement(getMibStructuralElement(mib.getType()), Action.UPDATE);
+ mibElement.getInfo().getProperties().put(ARTIFACT_NAME, mib.getArtifactName());
+ mibElement.setData(new ByteArrayInputStream(mib.getArtifact().array()));
+ return mibElement;
+ }
+
+ private MibEntity mapElementInfoToMib(String vspId, Version version, String componentId,
+ ElementInfo elementInfo) {
+ MibEntity mib = new MibEntity(vspId, version, componentId, elementInfo.getId().getValue());
+ mib.setArtifactName((String) elementInfo.getInfo().getProperties().get(ARTIFACT_NAME));
+ mib.setType(ArtifactType.valueOf(elementInfo.getInfo().getName()));
+ return mib;
+ }
+
+ private StructureElement getMibStructuralElement(ArtifactType type) {
+ switch (type) {
+ case SNMP_POLL:
+ return StructureElement.SNMP_POLL;
+ case SNMP_TRAP:
+ return StructureElement.SNMP_TRAP;
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java
new file mode 100644
index 0000000000..898ee434e8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NetworkDaoZusammenImpl.java
@@ -0,0 +1,150 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
+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.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class NetworkDaoZusammenImpl implements NetworkDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public NetworkDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public Collection<NetworkEntity> list(NetworkEntity network) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(network.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(network.getVersion()));
+
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, null, StructureElement.Networks.name())
+ .stream().map(elementInfo ->
+ mapElementInfoToNetwork(network.getVspId(), network.getVersion(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private NetworkEntity mapElementInfoToNetwork(String vspId, Version version,
+ ElementInfo elementInfo) {
+ NetworkEntity networkEntity =
+ new NetworkEntity(vspId, version, elementInfo.getId().getValue());
+ networkEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return networkEntity;
+ }
+
+ @Override
+ public void create(NetworkEntity network) {
+ ZusammenElement networkElement = buildNetworkElement(network, Action.CREATE);
+ ZusammenElement networksElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Networks, null);
+ networksElement.setSubElements(Collections.singletonList(networkElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(network.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, networksElement, "Create network");
+ savedElement.ifPresent(element ->
+ network.setId(element.getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(NetworkEntity network) {
+ ZusammenElement networkElement = buildNetworkElement(network, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(network.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, networkElement,
+ String.format("Update network with id %s", network.getId()));
+ }
+
+ @Override
+ public NetworkEntity get(NetworkEntity network) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(network.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(network.getVersion()));
+
+ Optional<Element> element =
+ zusammenAdaptor.getElement(context, elementContext, network.getId());
+
+ if (element.isPresent()) {
+ network.setCompositionData(new String(FileUtils.toByteArray(element.get().getData())));
+ return network;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void delete(NetworkEntity network) {
+ ZusammenElement networkElement = new ZusammenElement();
+ networkElement.setElementId(new Id(network.getId()));
+ networkElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(network.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext,
+ networkElement, String.format("Delete network with id %s", network.getId()));
+ }
+
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+ ZusammenElement networksElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Networks, Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, networksElement, "Delete all networks");
+ }
+
+ private ZusammenElement buildNetworkElement(NetworkEntity network, Action action) {
+ ZusammenElement networkElement = new ZusammenElement();
+ networkElement.setAction(action);
+ if (network.getId() != null) {
+ networkElement.setElementId(new Id(network.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.Network);
+ info.addProperty(ElementPropertyName.compositionData.name(), network.getCompositionData());
+ networkElement.setInfo(info);
+ networkElement.setData(new ByteArrayInputStream(network.getCompositionData().getBytes()));
+ return networkElement;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NicDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NicDaoZusammenImpl.java
new file mode 100644
index 0000000000..e597068d87
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/NicDaoZusammenImpl.java
@@ -0,0 +1,257 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+public class NicDaoZusammenImpl implements NicDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public NicDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public Collection<NicEntity> list(NicEntity nic) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(nic.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(nic.getVersion()));
+
+ return listNics(context, elementContext, nic);
+ }
+
+ private Collection<NicEntity> listNics(SessionContext context, ElementContext elementContext,
+ NicEntity nic) {
+ return zusammenAdaptor
+ .listElementsByName(context, elementContext, new Id(nic.getComponentId()),
+ StructureElement.Nics.name())
+ .stream().map(elementInfo -> mapElementInfoToNic(
+ nic.getVspId(), nic.getVersion(), nic.getComponentId(), elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private NicEntity mapElementInfoToNic(String vspId, Version version,
+ String componentId, ElementInfo elementInfo) {
+ NicEntity nicEntity =
+ new NicEntity(vspId, version, componentId, elementInfo.getId().getValue());
+ nicEntity.setCompositionData(
+ elementInfo.getInfo().getProperty(ElementPropertyName.compositionData.name()));
+ return nicEntity;
+ }
+
+ @Override
+ public void create(NicEntity nic) {
+ ZusammenElement nicElement = nicToZusammen(nic, Action.CREATE);
+
+ ZusammenElement nicsElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Nics, null);
+ nicsElement.setSubElements(Collections.singletonList(nicElement));
+
+ ZusammenElement componentElement =
+ buildZusammenElement(new Id(nic.getComponentId()), Action.IGNORE);
+ componentElement.setSubElements(Collections.singletonList(nicsElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(nic.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, componentElement, "Create nic");
+ savedElement.ifPresent(element ->
+ nic.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue()));
+ }
+
+ @Override
+ public void update(NicEntity nic) {
+ ZusammenElement nicElement = nicToZusammen(nic, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(nic.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, nicElement,
+ String.format("Update nic with id %s", nic.getId()));
+ }
+
+ @Override
+ public NicEntity get(NicEntity nic) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(nic.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(nic.getVersion()));
+ Optional<Element> element = zusammenAdaptor.getElement(context, elementContext, nic.getId());
+
+ if (element.isPresent()) {
+ nic.setCompositionData(new String(FileUtils.toByteArray(element.get().getData())));
+ return nic;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void delete(NicEntity nic) {
+ ZusammenElement nicElement = buildZusammenElement(new Id(nic.getId()), Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(nic.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, nicElement,
+ String.format("Delete nic with id %s", nic.getId()));
+ }
+
+ @Override
+ public NicEntity getQuestionnaireData(String vspId, Version version, String componentId,
+ String nicId) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ return getQuestionnaire(context, elementContext,
+ new NicEntity(vspId, version, componentId, nicId));
+ }
+
+ private NicEntity getQuestionnaire(SessionContext context, ElementContext elementContext,
+ NicEntity nic) {
+ Optional<Element> questionnaireElement = zusammenAdaptor
+ .getElementByName(context, elementContext, new Id(nic.getId()),
+ StructureElement.Questionnaire.name());
+ return questionnaireElement.map(
+ element -> element.getData() == null
+ ? null
+ : new String(FileUtils.toByteArray(element.getData())))
+ .map(questionnaireData -> {
+ nic.setQuestionnaireData(questionnaireData);
+ return nic;
+ })
+ .orElse(null);
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String componentId,
+ String nicId, String questionnaireData) {
+ ZusammenElement questionnaireElement =
+ nicQuestionnaireToZusammen(questionnaireData, Action.UPDATE);
+
+ ZusammenElement nicElement = new ZusammenElement();
+ nicElement.setAction(Action.IGNORE);
+ nicElement.setElementId(new Id(nicId));
+ nicElement.setSubElements(Collections.singletonList(questionnaireElement));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, nicElement, "Update nic questionnaire");
+ }
+
+ @Override
+ public Collection<NicEntity> listByVsp(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Collection<ComponentEntity> components = ComponentDaoZusammenImpl
+ .listComponents(zusammenAdaptor, context, elementContext, vspId, version);
+
+ return components.stream()
+ .map(component ->
+ listNics(context, elementContext,
+ new NicEntity(vspId, version, component.getId(), null)).stream()
+ .map(nic -> getQuestionnaire(context, elementContext, nic))
+ .collect(Collectors.toList()))
+ .flatMap(Collection::stream)
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void deleteByComponentId(String vspId, Version version, String componentId) {
+ ZusammenElement componentElement = buildZusammenElement(new Id(componentId), Action.IGNORE);
+ componentElement.setSubElements(Collections.singletonList(
+ VspZusammenUtil.buildStructuralElement(StructureElement.Nics, Action.DELETE)));
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, componentElement,
+ String.format("Delete all nics of component %s", componentId));
+ }
+
+ @Override
+ public void deleteByVspId(String vspId, Version version) {
+
+ }
+
+ private ZusammenElement nicToZusammen(NicEntity nic, Action action) {
+ ZusammenElement nicElement = buildNicElement(nic, action);
+ if (action == Action.CREATE) {
+ nicElement.setSubElements(Collections.singletonList(
+ nicQuestionnaireToZusammen(nic.getQuestionnaireData(), Action.CREATE)));
+ }
+ return nicElement;
+ }
+
+ private ZusammenElement nicQuestionnaireToZusammen(String questionnaireData,
+ Action action) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, action);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }
+
+ private ZusammenElement buildZusammenElement(Id elementId, Action action) {
+ ZusammenElement element = new ZusammenElement();
+ element.setElementId(elementId);
+ element.setAction(action);
+ return element;
+ }
+
+ private ZusammenElement buildNicElement(NicEntity nic, Action action) {
+ ZusammenElement nicElement = new ZusammenElement();
+ nicElement.setAction(action);
+ if (nic.getId() != null) {
+ nicElement.setElementId(new Id(nic.getId()));
+ }
+ Info info = new Info();
+ info.addProperty(ElementPropertyName.type.name(), ElementType.Nic);
+ info.addProperty(ElementPropertyName.compositionData.name(), nic.getCompositionData());
+ nicElement.setInfo(info);
+ nicElement.setData(new ByteArrayInputStream(nic.getCompositionData().getBytes()));
+ return nicElement;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java
new file mode 100644
index 0000000000..c101955292
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java
@@ -0,0 +1,134 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
+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.utils.fileutils.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+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.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+import java.util.Optional;
+
+public class OrchestrationTemplateCandidateDaoZusammenImpl
+ implements OrchestrationTemplateCandidateDao {
+ private static final Logger logger =
+ LoggerFactory.getLogger(OrchestrationTemplateCandidateDaoZusammenImpl.class);
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public OrchestrationTemplateCandidateDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public OrchestrationTemplateCandidateData get(String vspId, Version version) {
+ logger.info("Getting orchestration template for vsp id -> " + vspId);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+ ElementContext elementContext = new ElementContext(itemId, versionId,
+ VspZusammenUtil.getVersionTag(version));
+
+ Optional<Element> candidateElement =
+ zusammenAdaptor.getElementByName(context, elementContext, null,
+ StructureElement.OrchestrationTemplateCandidate.name());
+ if (candidateElement.isPresent()) {
+ OrchestrationTemplateCandidateData candidateData = new OrchestrationTemplateCandidateData();
+ candidateData.setFilesDataStructure(
+ new String(FileUtils.toByteArray(candidateElement.get().getData())));
+
+ zusammenAdaptor
+ .getElementByName(context, elementContext, candidateElement.get().getElementId(),
+ StructureElement.OrchestrationTemplateCandidateContent.name())
+ .ifPresent(candidateContentElement -> candidateData.setContentData(
+ ByteBuffer.wrap(FileUtils.toByteArray(candidateContentElement.getData()))));
+ logger.info("Finished getting orchestration template for vsp id -> " + vspId);
+ return candidateData;
+ }
+ logger.info(String.format("Orchestration template for vsp id %s does not exist", vspId));
+ return null;
+ }
+
+ @Override
+ public void update(String vspId, OrchestrationTemplateCandidateData candidateData) {
+ logger.info("Uploading candidate data entity for vsp id -> " + vspId);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+ ElementContext elementContext = new ElementContext(itemId, versionId);
+
+ ZusammenElement candidateElement = VspZusammenUtil
+ .buildStructuralElement(StructureElement.OrchestrationTemplateCandidate, Action.UPDATE);
+ candidateElement
+ .setData(new ByteArrayInputStream(candidateData.getFilesDataStructure().getBytes()));
+ ZusammenElement candidateContentElement = VspZusammenUtil
+ .buildStructuralElement(StructureElement.OrchestrationTemplateCandidateContent, Action.UPDATE);
+ candidateContentElement
+ .setData(new ByteArrayInputStream(candidateData.getContentData().array()));
+ candidateElement.addSubElement(candidateContentElement);
+
+ zusammenAdaptor.saveElement(context, elementContext, candidateElement,
+ "Update Orchestration Template Candidate");
+ logger.info("Finished uploading candidate data entity for vsp id -> " + vspId);
+ }
+
+ @Override
+ public void updateStructure(String vspId, Version version, FilesDataStructure fileDataStructure) {
+ logger.info("Updating orchestration template for VSP id -> " + vspId);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+ ElementContext elementContext = new ElementContext(itemId, versionId);
+
+ ZusammenElement candidateElement = VspZusammenUtil
+ .buildStructuralElement(StructureElement.OrchestrationTemplateCandidate, Action.UPDATE);
+ candidateElement
+ .setData(new ByteArrayInputStream(JsonUtil.object2Json(fileDataStructure).getBytes()));
+ zusammenAdaptor.saveElement(context, elementContext, candidateElement,
+ "Update Orchestration Template Candidate structure");
+ logger.info("Finished uploading candidate data entity for vsp id -> " + vspId);
+ }
+
+
+ @Override
+ public Optional<String> getStructure(String vspId, Version version) {
+ logger.info("Getting orchestration template structure for vsp id -> " + vspId);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+ ElementContext elementContext = new ElementContext(itemId, versionId,
+ VspZusammenUtil.getVersionTag(version));
+
+ logger.info("Finished getting orchestration template structure for vsp id -> " + vspId);
+ Optional<Element> element = zusammenAdaptor.getElementByName(context, elementContext, null,
+ StructureElement.OrchestrationTemplateCandidate.name());
+ if (element.isPresent()) {
+ return Optional.of(new String(FileUtils.toByteArray(element.get().getData())));
+ } else {
+ return Optional.empty();
+ }
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateDaoZusammenImpl.java
new file mode 100644
index 0000000000..83a78bc705
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateDaoZusammenImpl.java
@@ -0,0 +1,111 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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.ElementContext;
+import com.amdocs.zusammen.utils.fileutils.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+import java.util.Optional;
+
+public class OrchestrationTemplateDaoZusammenImpl implements OrchestrationTemplateDao {
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public OrchestrationTemplateDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public String getValidationData(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Optional<ElementInfo> elementInfo = zusammenAdaptor
+ .getElementInfoByName(context, elementContext, null,
+ StructureElement.OrchestrationTemplate.name());
+ if (elementInfo.isPresent()) {
+ Optional<Element> element =
+ zusammenAdaptor.getElementByName(context, elementContext, elementInfo.get().getId(),
+ StructureElement.OrchestrationTemplateValidationData.name());
+ if (element.isPresent()) {
+ return new String(FileUtils.toByteArray(element.get().getData()));
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public UploadDataEntity getOrchestrationTemplate(String vspId, Version version) {
+
+ UploadDataEntity uploadData = new UploadDataEntity();
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(version));
+
+ Optional<ElementInfo> elementInfo = zusammenAdaptor
+ .getElementInfoByName(context, elementContext, null,
+ StructureElement.OrchestrationTemplate.name());
+ if (elementInfo.isPresent()) {
+ Optional<Element> element =
+ zusammenAdaptor.getElementByName(context, elementContext, elementInfo.get().getId(),
+ StructureElement.OrchestrationTemplateValidationData.name());
+ element.ifPresent(element1 -> uploadData
+ .setValidationData(new String(FileUtils.toByteArray(element1.getData()))));
+ element =
+ zusammenAdaptor.getElementByName(context, elementContext, elementInfo.get().getId(),
+ StructureElement.OrchestrationTemplateContent.name());
+ element.ifPresent(element1 -> uploadData
+ .setContentData(ByteBuffer.wrap(FileUtils.toByteArray(element1.getData()))));
+ }
+ return uploadData;
+ }
+
+ @Override
+ public void updateOrchestrationTemplateData(String vspId, UploadData uploadData) {
+ ZusammenElement orchestrationTemplateElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.OrchestrationTemplate, null);
+ ZusammenElement orchestrationTemplateValidationDataElement =
+ VspZusammenUtil
+ .buildStructuralElement(StructureElement.OrchestrationTemplateValidationData, null);
+ orchestrationTemplateValidationDataElement.setData(new ByteArrayInputStream(uploadData
+ .getValidationData().getBytes()));
+ ZusammenElement orchestrationTemplateContent =
+ VspZusammenUtil.buildStructuralElement(StructureElement.OrchestrationTemplateContent, null);
+ orchestrationTemplateContent
+ .setData(new ByteArrayInputStream(uploadData.getContentData().array()));
+ orchestrationTemplateElement.addSubElement(orchestrationTemplateValidationDataElement);
+ orchestrationTemplateElement.addSubElement(orchestrationTemplateContent);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context, elementContext, orchestrationTemplateElement, "Update " +
+ "Orchestration Template");
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ProcessDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ProcessDaoZusammenImpl.java
new file mode 100644
index 0000000000..ffc9cb2901
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/ProcessDaoZusammenImpl.java
@@ -0,0 +1,229 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+/**
+ * @author Avrahamg.
+ * @since March 23, 2017
+ */
+public class ProcessDaoZusammenImpl implements ProcessDao {
+
+ private static final String NAME = "name";
+ private static final String ELEMENT_TYPE = "type";
+ private static final String ARTIFACT_NAME = "artifactName";
+ private static final String DESCRIPTION = "description";
+ private static final String PROCESS_TYPE = "processType";
+
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public ProcessDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+
+ }
+
+ @Override
+ public void create(ProcessEntity processEntity) {
+ ZusammenElement processElement = buildProcessElement(processEntity, Action.CREATE);
+
+ ZusammenElement processesElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Processes, null);
+ ZusammenElement aggregatedElement = VspZusammenUtil.aggregateElements(processesElement,
+ processElement);
+ ZusammenElement componentElement;
+ if (processEntity.getComponentId() != null) {
+ componentElement = createParentElement(processEntity);
+ aggregatedElement =
+ VspZusammenUtil.aggregateElements(componentElement, aggregatedElement);
+ }
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(processEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> savedElement =
+ zusammenAdaptor.saveElement(context, elementContext, aggregatedElement, "Create process");
+ savedElement.ifPresent(element -> {
+ if (processEntity.getComponentId() == null) {
+ processEntity.setId(element.getSubElements().iterator().next()
+ .getElementId().getValue());
+ } else {
+ processEntity.setId(element.getSubElements().iterator().next()
+ .getSubElements().iterator().next().getElementId().getValue());
+ }
+ });
+ }
+
+ @Override
+ public ProcessEntity get(ProcessEntity process) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(process.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(process.getVersion()));
+
+ Optional<Element> elementOptional =
+ zusammenAdaptor.getElement(context, elementContext, process.getId());
+
+ if (elementOptional.isPresent()) {
+ Element element = elementOptional.get();
+ process.setName(element.getInfo().getProperty(NAME));
+ process.setArtifactName(element.getInfo().getProperty(ARTIFACT_NAME));
+ process.setDescription(element.getInfo().getProperty(DESCRIPTION));
+ process.setType(element.getInfo().getProperty
+ (PROCESS_TYPE) != null ? ProcessType.valueOf(element.getInfo().getProperty
+ (PROCESS_TYPE)) : null);
+
+ process.setArtifact(ByteBuffer.wrap(FileUtils.toByteArray(element.getData())));
+ return process;
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public void update(ProcessEntity processEntity) {
+ ZusammenElement processElement = buildProcessElement(processEntity, Action.UPDATE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(processEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ Optional<Element> element =
+ zusammenAdaptor.saveElement(context, elementContext, processElement, "Create process");
+ System.out.println(element.get().getElementId());
+ }
+
+ @Override
+ public void delete(ProcessEntity processEntity) {
+ ZusammenElement processElement = new ZusammenElement();
+ processElement.setElementId(new Id(processEntity.getId()));
+ processElement.setAction(Action.DELETE);
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(processEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+
+ zusammenAdaptor.saveElement(context, elementContext, processElement,
+ String.format("Delete process with id %s", processEntity.getId()));
+ }
+
+ @Override
+ public void deleteAll(ProcessEntity processEntity) {
+ ZusammenElement aggregatedElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Processes, Action.DELETE);
+
+ if (processEntity.getComponentId() != null) {
+ ZusammenElement componentElement = createParentElement(processEntity);
+ aggregatedElement = VspZusammenUtil.aggregateElements(componentElement,
+ aggregatedElement);
+ }
+
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(processEntity.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor));
+ zusammenAdaptor.saveElement(context, elementContext, aggregatedElement, "Delete All processes");
+ }
+
+ @Override
+ public void deleteVspAll(String vspId, Version version) {
+ ProcessEntity processEntity = new ProcessEntity();
+ processEntity.setVersion(version);
+ processEntity.setVspId(vspId);
+ deleteAll(processEntity);
+ }
+
+ @Override
+ public Collection<ProcessEntity> list(ProcessEntity process) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(process.getVspId());
+ ElementContext elementContext = new ElementContext(itemId,
+ VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor),
+ VspZusammenUtil.getVersionTag(process.getVersion()));
+
+ Optional<ElementInfo> processesOptional =
+ zusammenAdaptor.getElementInfoByName(context, elementContext,
+ extractParentElementId(process), StructureElement.Processes.name());
+ if (!processesOptional.isPresent()) {
+ return new ArrayList<>();
+ }
+ return zusammenAdaptor.listElements(context, elementContext, processesOptional.get().getId())
+ .stream()
+ .map(elementInfo -> mapElementInfoToProcess(
+ process.getVspId(), process.getVersion(), process.getComponentId(),
+ elementInfo))
+ .collect(Collectors.toList());
+ }
+
+ private Id extractParentElementId(ProcessEntity processEntity) {
+ return processEntity.getComponentId() == null ? null : new Id(processEntity.getComponentId());
+ }
+
+ private ProcessEntity mapElementInfoToProcess(String vspId, Version version,
+ String componentId,
+ ElementInfo elementInfo) {
+ ProcessEntity processEntity = new ProcessEntity(vspId, version, componentId, elementInfo
+ .getId().getValue());
+ processEntity.setName((String) elementInfo.getInfo().getProperties().get(NAME));
+ processEntity
+ .setArtifactName((String) elementInfo.getInfo().getProperties().get(ARTIFACT_NAME));
+ processEntity.setDescription((String) elementInfo.getInfo().getProperties().get(DESCRIPTION));
+ return processEntity;
+ }
+
+ private ZusammenElement buildProcessElement(ProcessEntity process, Action action) {
+
+ Info info = new Info();
+ info.setName(process.getName());
+ info.addProperty(NAME, process.getName());
+ info.addProperty(ELEMENT_TYPE, ElementType.Process);
+ info.addProperty(ARTIFACT_NAME, process.getArtifactName());
+ info.addProperty(DESCRIPTION, process.getDescription());
+ info.addProperty(PROCESS_TYPE, process.getType() != null ? process.getType().name() : null);
+
+ ZusammenElement processElement = new ZusammenElement();
+ processElement.setElementId(new Id(process.getId()));
+ processElement.setAction(action);
+ processElement.setInfo(info);
+ if (Objects.nonNull(process.getArtifact())) {
+ processElement.setData(new ByteArrayInputStream(process.getArtifact().array()));
+ }
+ return processElement;
+ }
+
+ private ZusammenElement createParentElement(ProcessEntity entity) {
+ ZusammenElement componentElement = new ZusammenElement();
+ componentElement.setElementId(new Id(entity.getComponentId()));
+ componentElement.setAction(Action.IGNORE);
+ return componentElement;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java
new file mode 100644
index 0000000000..5d53741ebf
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/StructureElement.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
+
+public enum StructureElement {
+ General,
+ OrchestrationTemplateCandidate,
+ OrchestrationTemplate,
+ OrchestrationTemplateValidationData,
+ OrchestrationTemplateContent,
+ OrchestrationTemplateCandidateValidationData,
+ OrchestrationTemplateCandidateContent,
+ Networks,
+ Components,
+ Nics,
+ Processes,
+ Mibs,
+ SNMP_TRAP,
+ SNMP_POLL,
+ Questionnaire,
+ ComponentDependencies,
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
new file mode 100644
index 0000000000..65a41330a7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -0,0 +1,228 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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 com.amdocs.zusammen.datatypes.item.Info;
+import com.amdocs.zusammen.datatypes.item.ItemVersion;
+import com.amdocs.zusammen.utils.fileutils.FileUtils;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
+import org.openecomp.sdc.versioning.VersioningManagerFactory;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.types.VersionableEntityMetadata;
+import org.openecomp.sdc.versioning.types.VersionableEntityStoreType;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.Date;
+import java.util.stream.Collectors;
+
+public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareProductInfoDao {
+ private ZusammenAdaptor zusammenAdaptor;
+
+ public VendorSoftwareProductInfoDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
+ this.zusammenAdaptor = zusammenAdaptor;
+ }
+
+ @Override
+ public void registerVersioning(String versionableEntityType) {
+ VersionableEntityMetadata metadata =
+ new VersionableEntityMetadata(VersionableEntityStoreType.Zusammen, "vsp", null, null);
+
+ VersioningManagerFactory.getInstance().createInterface()
+ .register(versionableEntityType, metadata);
+ }
+
+ @Override
+ public Collection<VspDetails> list(VspDetails entity) {
+ return zusammenAdaptor.listItems(ZusammenUtil.createSessionContext()).stream().filter
+ (vspEntity-> "vsp".equals(vspEntity.getInfo().getProperty("type")))
+ .map(item -> mapInfoToVspDetails(
+ item.getId().getValue(), null, item.getInfo(),
+ item.getModificationTime(), item.getCreationTime()))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ public void create(VspDetails vspDetails) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+
+ Id itemId = zusammenAdaptor.createItem(context, mapVspDetailsToZusammenItemInfo(vspDetails));
+ Id versionId =
+ zusammenAdaptor.createVersion(context, itemId, null, ZusammenUtil.createFirstVersionData());
+
+ ZusammenElement generalElement = mapVspDetailsToZusammenElement(vspDetails, Action.CREATE);
+ zusammenAdaptor.saveElement(context, new ElementContext(itemId, versionId),
+ generalElement, "Create VSP General Info Element");
+
+ vspDetails.setId(itemId.getValue());//set id for caller
+ }
+
+ @Override
+ public void update(VspDetails vspDetails) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspDetails.getId());
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+
+ zusammenAdaptor.updateItem(context, itemId, mapVspDetailsToZusammenItemInfo(vspDetails));
+
+ ZusammenElement generalElement = mapVspDetailsToZusammenElement(vspDetails, Action.UPDATE);
+ zusammenAdaptor.saveElement(context, new ElementContext(itemId, versionId),
+ generalElement, "Update VSP General Info Element");
+ }
+
+ @Override
+ public VspDetails get(VspDetails vspDetails) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspDetails.getId());
+ ItemVersion itemVersion = VspZusammenUtil.getFirstVersion(context, itemId, zusammenAdaptor);
+ ElementContext elementContext = new ElementContext(itemId, itemVersion.getId(),
+ VspZusammenUtil.getVersionTag(vspDetails.getVersion()));
+
+ return zusammenAdaptor
+ .getElementInfoByName(context, elementContext, null, StructureElement.General.name())
+ .map(generalElementInfo -> mapInfoToVspDetails(
+ vspDetails.getId(), vspDetails.getVersion(), generalElementInfo.getInfo(),
+ itemVersion.getModificationTime(), itemVersion.getCreationTime()))
+ .orElse(null);
+ }
+
+
+ @Override
+ public void delete(VspDetails entity) {
+
+ }
+
+ @Override
+ public void updateOldVersionIndication(VspDetails vspDetails) {
+ VspDetails retrieved = get(vspDetails);
+ if (retrieved != null) {
+ retrieved.setOldVersion(vspDetails.getOldVersion());
+ update(retrieved);
+ }
+ }
+
+ @Override
+ public void updateQuestionnaireData(String vspId, Version version, String questionnaireData) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+
+ ZusammenElement questionnaireElement = mapQuestionnaireToZusammenElement(questionnaireData);
+ zusammenAdaptor.saveElement(context, new ElementContext(itemId, versionId),
+ questionnaireElement, "Update VSP Questionnaire");
+ }
+
+
+ @Override
+ public String getQuestionnaireData(String vspId, Version version) {
+ SessionContext context = ZusammenUtil.createSessionContext();
+ Id itemId = new Id(vspId);
+ Id versionId = VspZusammenUtil.getFirstVersionId(context, itemId, zusammenAdaptor);
+
+ return zusammenAdaptor.getElementByName(context,
+ new ElementContext(itemId, versionId, VspZusammenUtil.getVersionTag(version)), null,
+ StructureElement.Questionnaire.name())
+ .map(questionnaireElement ->
+ new String(FileUtils.toByteArray(questionnaireElement.getData())))
+ .orElse(null);
+ }
+
+ @Override
+ public VspQuestionnaireEntity getQuestionnaire(String vspId, Version version) {
+ VspQuestionnaireEntity entity = new VspQuestionnaireEntity();
+ entity.setId(vspId);
+ entity.setVersion(version);
+ entity.setQuestionnaireData(getQuestionnaireData(vspId, version));
+ return entity;
+ }
+
+ @Override
+ public void deleteAll(String vspId, Version version) {
+
+ }
+
+ private Info mapVspDetailsToZusammenItemInfo(VspDetails vspDetails) {
+ Info info = new Info();
+ info.setName(vspDetails.getName());
+ info.setDescription(vspDetails.getDescription());
+ info.addProperty("type", "vsp");
+ addVspDetailsToInfo(info, vspDetails);
+ return info;
+ }
+
+ private ZusammenElement mapVspDetailsToZusammenElement(VspDetails vspDetails, Action action) {
+ ZusammenElement generalElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.General, action);
+ addVspDetailsToInfo(generalElement.getInfo(), vspDetails);
+ return generalElement;
+ }
+
+ private ZusammenElement mapQuestionnaireToZusammenElement(String questionnaireData) {
+ ZusammenElement questionnaireElement =
+ VspZusammenUtil.buildStructuralElement(StructureElement.Questionnaire, Action.UPDATE);
+ questionnaireElement.setData(new ByteArrayInputStream(questionnaireData.getBytes()));
+ return questionnaireElement;
+ }
+
+ private void addVspDetailsToInfo(Info info, VspDetails vspDetails) {
+ info.addProperty(InfoPropertyName.name.name(), vspDetails.getName());
+ info.addProperty(InfoPropertyName.description.name(), vspDetails.getDescription());
+ info.addProperty(InfoPropertyName.icon.name(), vspDetails.getIcon());
+ info.addProperty(InfoPropertyName.category.name(), vspDetails.getCategory());
+ info.addProperty(InfoPropertyName.subCategory.name(), vspDetails.getSubCategory());
+ info.addProperty(InfoPropertyName.vendorId.name(), vspDetails.getVendorId());
+ info.addProperty(InfoPropertyName.vendorName.name(), vspDetails.getVendorName());
+ if (vspDetails.getVlmVersion() != null) {
+ info.addProperty(
+ InfoPropertyName.vendorVersion.name(), vspDetails.getVlmVersion().toString());
+ }
+ info.addProperty(InfoPropertyName.licenseAgreement.name(), vspDetails.getLicenseAgreement());
+ info.addProperty(InfoPropertyName.featureGroups.name(), vspDetails.getFeatureGroups());
+ info.addProperty(InfoPropertyName.oldVersion.name(), vspDetails.getOldVersion());
+ }
+
+ private VspDetails mapInfoToVspDetails(String vspId, Version version, Info info,
+ Date modificationTime, Date creationTime) {
+ VspDetails vspDetails = new VspDetails(vspId, version);
+ vspDetails.setName(info.getProperty(InfoPropertyName.name.name()));
+ vspDetails.setDescription(info.getProperty(InfoPropertyName.description.name()));
+ vspDetails.setCategory(info.getProperty(InfoPropertyName.category.name()));
+ vspDetails.setSubCategory(info.getProperty(InfoPropertyName.subCategory.name()));
+ vspDetails.setVendorId(info.getProperty(InfoPropertyName.vendorId.name()));
+ vspDetails.setVendorName(info.getProperty(InfoPropertyName.vendorName.name()));
+ vspDetails.setVlmVersion(
+ Version.valueOf(info.getProperty(InfoPropertyName.vendorVersion.name())));
+ vspDetails.setLicenseAgreement(info.getProperty(InfoPropertyName.licenseAgreement.name()));
+ vspDetails.setFeatureGroups(info.getProperty(InfoPropertyName.featureGroups.name()));
+ vspDetails.setWritetimeMicroSeconds(
+ modificationTime == null ? creationTime.getTime() : modificationTime.getTime());
+ vspDetails.setVersion(version);
+ String oldVersion = info.getProperty(InfoPropertyName.oldVersion.name());
+
+ //Boolean oldVersion = ind == null || "true".equals( ind.toLowerCase());
+ vspDetails.setOldVersion(oldVersion);
+ return vspDetails;
+ }
+
+ private enum InfoPropertyName {
+ name,
+ description,
+ icon,
+ category,
+ subCategory,
+ vendorId,
+ vendorName,
+ vendorVersion,
+ licenseAgreement,
+ featureGroups,
+ oldVersion
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java
new file mode 100644
index 0000000000..dde3603896
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java
@@ -0,0 +1,61 @@
+package org.openecomp.sdc.vendorsoftwareproduct.dao.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.ItemVersion;
+import org.openecomp.core.zusammen.api.ZusammenAdaptor;
+import org.openecomp.core.zusammen.api.ZusammenUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.errors.VendorSoftwareProductNotFoundErrorBuilder;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+
+import java.util.Objects;
+import java.util.Optional;
+
+class VspZusammenUtil {
+
+ static ItemVersion getFirstVersion(SessionContext context, Id itemId, ZusammenAdaptor
+ zusammenAdaptor) {
+
+ Optional<ItemVersion> itemVersion = zusammenAdaptor.getFirstVersion(context, itemId);
+
+ if (!itemVersion.isPresent()) {
+ throw new CoreException(
+ new VendorSoftwareProductNotFoundErrorBuilder(itemId.getValue()).build());
+ }
+ return itemVersion.get();
+ }
+
+ static Id getFirstVersionId(SessionContext context, Id itemId, ZusammenAdaptor zusammenAdaptor) {
+ return getFirstVersion(context, itemId, zusammenAdaptor).getId();
+ }
+
+ // TODO: 4/25/2017 remove upon working with more than one single version
+ static String getVersionTag(Version version) {
+ return version.getStatus() == VersionStatus.Locked
+ ? null
+ : version.toString();
+ }
+
+ static ZusammenElement buildStructuralElement(StructureElement structureElement, Action action) {
+ return ZusammenUtil.buildStructuralElement(structureElement.name(), action);
+ }
+
+ static ZusammenElement aggregateElements(ZusammenElement... elements) {
+ ZusammenElement head = null;
+ ZusammenElement father = null;
+ for (ZusammenElement element : elements) {
+ if (Objects.isNull(head)) {
+ head = father = element;
+ } else {
+ father.getSubElements().add(element);
+ father = element;
+ }
+ }
+
+ return head;
+ }
+}