fix incorrect dependency
[sdc.git] / openecomp-be / tools / migration / 1702_to_1707_zusammen / src / main / java / org / openecomp / core / migration / convertors / OrchestrationTemplateCandidateConvertor.java
1 package org.openecomp.core.migration.convertors;
2
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;
13
14 import java.util.List;
15
16 public class OrchestrationTemplateCandidateConvertor {
17
18
19
20
21   private static Logger logger = LoggerFactory.getLogger(MigrationMain.class);
22
23   public static CollaborationElement[] convertOrchestrationTemplateCandidateToElement(
24       OrchestrationTemplateCandidateDataEntity entity) {
25
26
27     CollaborationElement[] orchestrationTemplateCandidateElements = new CollaborationElement[2];
28     List<String> orchestrationTemplateCandidateNamespace =
29         getOrchestrationTemplateCandidateNamespace();
30
31
32
33     orchestrationTemplateCandidateElements[0] = ElementHandler.getElementEntity(
34         entity.getId(), entity.getVersion().toString(), StructureElement.OrchestrationTemplateCandidate.name(),
35         orchestrationTemplateCandidateNamespace,
36         ElementHandler.getStructuralElementInfo(StructureElement.OrchestrationTemplateCandidate.name()),
37         null,
38         null,
39         entity.getFilesDataStructure().getBytes());
40
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()),
46         null,
47         null,
48         entity.getContentData().array());
49
50
51
52     return orchestrationTemplateCandidateElements;
53   }
54
55
56   private static List<String> getOrchestrationTemplateCandidateNamespace() {
57     return ElementHandler.getElementPath();
58   }
59
60   public static ElementEntityContext convertComponentToElementContext(
61       ComponentEntity componentEntity) {
62
63     return new ElementEntityContext("GLOBAL_USER", new
64         ElementContext(componentEntity.getVspId(), componentEntity.getVersion().toString()));
65   }
66
67
68
69
70 }