1 package org.openecomp.core.migration.convertors;
3 import com.amdocs.zusammen.datatypes.item.ElementContext;
4 import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
5 import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
6 import org.openecomp.core.migration.MigrationMain;
7 import org.openecomp.core.migration.store.ElementHandler;
8 import org.openecomp.sdc.logging.api.Logger;
9 import org.openecomp.sdc.logging.api.LoggerFactory;
10 import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
11 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
12 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity;
14 import java.util.List;
16 public class OrchestrationTemplateCandidateConvertor {
21 private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
23 public static CollaborationElement[] convertOrchestrationTemplateCandidateToElement(
24 OrchestrationTemplateCandidateDataEntity entity) {
27 CollaborationElement[] orchestrationTemplateCandidateElements = new CollaborationElement[2];
28 List<String> orchestrationTemplateCandidateNamespace =
29 getOrchestrationTemplateCandidateNamespace();
33 orchestrationTemplateCandidateElements[0] = ElementHandler.getElementEntity(
34 entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidate.name(),
35 orchestrationTemplateCandidateNamespace,
36 ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidate.name()),
39 entity.getFilesDataStructure().getBytes());
41 orchestrationTemplateCandidateNamespace.add(StructureElement.OrchestrationTemplateCandidate.name());
42 orchestrationTemplateCandidateElements[1] = ElementHandler.getElementEntity(
43 entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidateContent.name(),
44 orchestrationTemplateCandidateNamespace,
45 ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidateContent.name()),
48 entity.getContentData().array());
52 return orchestrationTemplateCandidateElements;
56 private static List<String> getOrchestrationTemplateCandidateNamespace() {
57 return ElementHandler.getElementPath();
60 public static ElementEntityContext convertComponentToElementContext(
61 ComponentEntity componentEntity) {
63 return new ElementEntityContext("GLOBAL_USER", new
64 ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString()));