1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment;
20 import java.util.ArrayList;
21 import java.util.List;
22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.EsObject;
23 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
24 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolder;
25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ManufacturedThing;
26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentInstance;
27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.EquipmentType;
28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.manufactured.thing.g.ManufacturerProperties;
30 public class EsEquipment extends EsObject {
32 public static final String ESDATATYPENAME = "inventoryequipment";
38 List<String> containedHolder;
39 String manufacturerName;
40 String manufacturerIdentifier;
46 String modelIdentifier;
50 public EsEquipment set( String mountpoint, ExtendedEquipment extendedEquipment ) {
52 Equipment equipment = extendedEquipment.getEquipment();
54 this.parentUuid = extendedEquipment.getParentUuid();
55 this.treeLevel = extendedEquipment.getTreeLevel();
56 this.mountpoint = mountpoint;
57 this.uuid = equipment.getUuid().getValue();
58 this.setEsId(this.mountpoint+"/"+this.uuid);
60 this.containedHolder = new ArrayList<>();
61 List<ContainedHolder> containedHolderList = equipment.getContainedHolder();
62 if (containedHolderList != null && !containedHolderList.isEmpty()) {
63 for (ContainedHolder containedHolderElement: containedHolderList) {
64 this.containedHolder.add(containedHolderElement.key().getUuid().getValue());
67 ManufacturedThing manufacturedThing = equipment.getManufacturedThing();
68 if (manufacturedThing != null) {
69 ManufacturerProperties manufacturedProperties = manufacturedThing.getManufacturerProperties();
70 if (manufacturedProperties != null) {
71 this.manufacturerName = manufacturedProperties.getManufacturerName();
72 this.manufacturerIdentifier = manufacturedProperties.getManufacturerIdentifier();
74 EquipmentInstance equipmentInstance = manufacturedThing.getEquipmentInstance();
75 if (equipmentInstance != null) {
76 this.serial = equipmentInstance.getSerialNumber();
77 this.date = equipmentInstance.getManufactureDate();
79 EquipmentType equipmentType = manufacturedThing.getEquipmentType();
80 if (equipmentType != null) {
81 this.version = equipmentType.getVersion();
82 this.description = equipmentType.getDescription();
83 this.partTypeId = equipmentType.getPartTypeIdentifier();
84 this.modelIdentifier = equipmentType.getModelIdentifier();
85 this.typeName = equipmentType.getTypeName();