2 * Copyright 2017-2023 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.holmes.common.aai.entity;
22 import java.util.List;
26 public class RelationshipList {
28 private List<Relationship> relationships;
30 public Relationship getRelationship(String relatedTo) {
31 Relationship relationship = null;
32 if(null == relationships || relationships.isEmpty())
34 for(int i = 0; i < relationships.size(); i++) {
35 if (relatedTo.equals(relationships.get(i).getRelatedTo())) {
36 relationship = relationships.get(i);
45 public static class Relationship {
46 private String relatedLink;
47 private String relatedTo;
48 private List<RelatedToProperty> relatedToPropertyList;
49 private List<RelationshipData> relationshipDataList;
51 public String getRelatedToPropertyValue(String key) {
53 if (null == relatedToPropertyList || relatedToPropertyList.isEmpty()) {
56 for(int i = 0; i < relatedToPropertyList.size(); i++) {
57 if (key.equals(relatedToPropertyList.get(i).getPropertyKey())) {
58 value = relatedToPropertyList.get(i).getPropertyValue();
65 public String getRelationshipDataValue(String key) {
67 if (null == relationshipDataList || relationshipDataList.isEmpty()) {
70 for(int i = 0; i < relationshipDataList.size(); i++) {
71 if (key.equals(relationshipDataList.get(i).getRelationshipKey())) {
72 value = relationshipDataList.get(i).getRelationshipValue();
82 public static class RelationshipData {
83 private String relationshipKey;
84 private String relationshipValue;
89 public static class RelatedToProperty {
90 private String propertyKey;
91 private String propertyValue;