Added oparent to sdc main
[sdc.git] / openecomp-be / lib / openecomp-sdc-versioning-lib / openecomp-sdc-versioning-core / src / main / java / org / openecomp / sdc / versioning / dao / impl / zusammen / convertor / ItemVersionToVersionConvertor.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.versioning.dao.impl.zusammen.convertor;
21
22 import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
23 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
24 import com.amdocs.zusammen.datatypes.item.Item;
25 import com.amdocs.zusammen.datatypes.item.ItemVersion;
26 import org.openecomp.convertor.ElementConvertor;
27 import org.openecomp.sdc.versioning.dao.impl.zusammen.VersionZusammenDaoImpl;
28 import org.openecomp.sdc.versioning.dao.types.Version;
29 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
30
31 public class ItemVersionToVersionConvertor extends ElementConvertor {
32   @Override
33   public Object convert(Element element) {
34     return null;
35   }
36
37   @Override
38   public Object convert(Item item) {
39     return null;
40   }
41
42   @Override
43   public Object convert(ElementInfo elementInfo) {
44     return null;
45   }
46
47   @Override
48   public Version convert(ItemVersion itemVersion) {
49     if (itemVersion == null) {
50       return null;
51     }
52     Version version = Version.valueOf(
53         itemVersion.getData().getInfo().getProperty(VersionZusammenDaoImpl.ZusammenProperty.LABEL));
54     version.setStatus(VersionStatus.valueOf(itemVersion.getData().getInfo()
55         .getProperty(VersionZusammenDaoImpl.ZusammenProperty.STATUS)));
56     version.setName(itemVersion.getData().getInfo().getName());
57     version.setDescription(itemVersion.getData().getInfo().getDescription());
58
59     version.setId(itemVersion.getId().getValue());
60     if (itemVersion.getBaseId() != null) {
61       version.setBaseId(itemVersion.getBaseId().getValue());
62     }
63     version.setCreationTime(itemVersion.getCreationTime());
64     version.setModificationTime(itemVersion.getModificationTime());
65     return version;
66   }
67
68 }