1 package org.openecomp.core.migration.convertors;
3 import com.amdocs.zusammen.datatypes.item.ElementContext;
4 import com.amdocs.zusammen.datatypes.item.Info;
5 import com.amdocs.zusammen.datatypes.item.ItemVersionData;
6 import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
7 import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement;
8 import org.openecomp.core.migration.store.ElementHandler;
9 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
10 import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement;
12 import java.util.HashSet;
13 import java.util.List;
16 public class VlmConvertor {
18 private static Set<String> compNicLoaded = new HashSet<>();
20 public static CollaborationElement[] convertVlmToElement(VendorLicenseModelEntity vendorLicenseModel) {
22 CollaborationElement[] vspElements = new CollaborationElement[1];
23 List<String> vspNamespace = getVlmNamespace(vendorLicenseModel);
26 String vspEntityId = StructureElement.General.name();
28 vspElements[0] = ElementHandler.getElementEntity(
29 vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString(),
32 getVlmGeneralInfo(vendorLicenseModel),
40 public static ItemVersionData getItemVersionData(
41 VendorLicenseModelEntity vendorLicenseModel) {
42 ItemVersionData itemVersionData = new ItemVersionData();
43 Info info = new Info();
44 info.setName("main version");
45 itemVersionData.setInfo(info);
46 return itemVersionData;
49 public static Info getVlmInfo(VendorLicenseModelEntity vendorLicenseModel) {
51 Info info = new Info();
52 info.setName(vendorLicenseModel.getVendorName());
53 info.setDescription(vendorLicenseModel.getDescription());
54 info.addProperty("type", "vlm");
55 info.addProperty("version", vendorLicenseModel.getVersion());
56 info.addProperty("iconRef", vendorLicenseModel.getIconRef());
60 private static List<String> getVlmNamespace(VendorLicenseModelEntity vlmEntity) {
61 return ElementHandler.getElementPath("");
64 private static Info getVlmGeneralInfo(VendorLicenseModelEntity vendorLicenseModel) {
67 Info info = new Info();
68 info.setName(StructureElement.General.name());
69 info.addProperty(InfoPropertyName.type.name(), InfoPropertyName.vlm.name());
70 info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef());
71 info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName());
72 info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription());
76 public static ElementEntityContext convertVlmToElementContext(VendorLicenseModelEntity
79 return new ElementEntityContext("GLOBAL_USER", new
80 ElementContext(vendorLicenseModel.getId(), vendorLicenseModel.getVersion().toString()));
84 private enum InfoPropertyName {