2 * ========================LICENSE_START=================================
5 * Copyright (C) 2020 AT&T Intellectual Property
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===================================
21 package org.oransc.ric.portal.dashboard.model;
23 import java.util.ArrayList;
24 import java.util.List;
25 import java.util.Objects;
28 * Transport model for RIC region which has a list of instances.
30 public class RicRegion implements IDashboardResponse {
33 private List<RicInstance> instances;
36 * Builds an empty object.
43 * Convenience constructor for minimal value set.
48 public RicRegion(String name) {
52 public String getName() {
56 public void setName(String s) {
60 public RicRegion name(String name) {
65 public List<RicInstance> getInstances() {
69 public void setInstances(List<RicInstance> instances) {
70 this.instances = instances;
74 * Gets a list of key-name pairs.
76 * @return List of RicInstanceKeyName objects.
78 public List<RicInstanceKeyName> getKeyNameList() {
79 List<RicInstanceKeyName> list = new ArrayList<>();
80 for (RicInstance i : instances)
81 list.add(i.toKeyName());
86 public String toString() {
87 return this.getClass().getSimpleName() + "[name=" + getName() + ", instances=" + instances + "]";
91 public int hashCode() {
94 result = prime * result + ((name == null) ? 0 : name.hashCode());
95 result = result * result + ((instances == null) ? 0 : instances.hashCode());
100 public boolean equals(Object obj) {
105 if (getClass() != obj.getClass())
107 RicRegion other = (RicRegion) obj;
108 return Objects.equals(name, other.name) && instances.size() == other.instances.size();