2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.openecomp.sdc.versioning.dao.impl.zusammen.convertor;
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;
31 public class ItemVersionToVersionConvertor extends ElementConvertor {
33 public Object convert(Element element) {
38 public Object convert(Item item) {
43 public Object convert(ElementInfo elementInfo) {
48 public Version convert(ItemVersion itemVersion) {
49 if (itemVersion == null) {
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());
59 version.setId(itemVersion.getId().getValue());
60 if (itemVersion.getBaseId() != null) {
61 version.setBaseId(itemVersion.getBaseId().getValue());
63 version.setCreationTime(itemVersion.getCreationTime());
64 version.setModificationTime(itemVersion.getModificationTime());