Test many POJOs getters/setters
[vid.git] / vid-app-common / src / main / java / org / onap / vid / aai / model / AaiGetNetworkCollectionDetails / CloudRegion.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 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
21 package org.onap.vid.aai.model.AaiGetNetworkCollectionDetails;
22
23 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import org.apache.commons.lang3.ObjectUtils;
26
27 import java.util.List;
28
29 import static java.util.Collections.emptyList;
30
31 @JsonIgnoreProperties(ignoreUnknown = true)
32 public class CloudRegion {
33
34     private final String cloudOwner;
35     private final String cloudRegionId;
36
37     public CloudRegion(
38             @JsonProperty("cloud-owner") String cloudOwner,
39             @JsonProperty("cloud-region-id") String cloudRegionId
40     ) {
41         this.cloudOwner = cloudOwner;
42         this.cloudRegionId = cloudRegionId;
43     }
44
45     public String getCloudOwner() {
46         return cloudOwner;
47     }
48
49     public String getCloudRegionId() {
50         return cloudRegionId;
51     }
52
53     /*
54     This will handle container like:
55         {
56           "cloud-region": [{
57               "cloud-owner": "alfi",
58               "cloud-region-id": "foo",
59               . . .
60           }, {
61               "cloud-owner": "alba",
62               "cloud-region-id": "bar",
63      */
64     public static class Collection {
65         private final List<CloudRegion> cloudRegions;
66
67         public Collection(@JsonProperty("cloud-region") List<CloudRegion> cloudRegions) {
68             this.cloudRegions = ObjectUtils.defaultIfNull(cloudRegions, emptyList());
69         }
70
71         public List<CloudRegion> getCloudRegions() {
72             return cloudRegions;
73         }
74     }
75 }