aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/pomba/contextbuilder/aai/datatype/Vserver.java
blob: 948aaa767fc9395154a435151ab12a45fac92788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
 * ============LICENSE_START===================================================
 * Copyright (c) 2018 Amdocs
 * ============================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=====================================================
 */
package org.onap.pomba.contextbuilder.aai.datatype;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.util.List;

import javax.validation.Valid;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.onap.pomba.contextbuilder.aai.exception.AuditError;
import org.onap.pomba.contextbuilder.aai.exception.AuditException;

public class Vserver {

    @SerializedName("vserver-id")
    @Expose
    private String vserverId;
    @SerializedName("vserver-name")
    @Expose
    private String vserverName;
    @SerializedName("vserver-name2")
    @Expose
    private String vserverName2;
    @SerializedName("prov-status")
    @Expose
    private String provStatus;
    @SerializedName("vserver-selflink")
    @Expose
    private String vserverSelflink;
    @SerializedName("in-maint")
    @Expose
    private Boolean inMaint;
    @SerializedName("is-closed-loop-disabled")
    @Expose
    private Boolean isClosedLoopDisabled;
    @SerializedName("resource-version")
    @Expose
    private String resourceVersion;
    @SerializedName("relationship-list")
    @Expose
    private RelationshipList relationshipList;

    @SerializedName("l-interfaces")
    @Expose
    private LInterfaceInstanceList lInterfaceInstanceList;


    private List<PserverInstance> pserverInstanceList;

    public List<PserverInstance> getPserverInstanceList() {
        return pserverInstanceList;
    }

    public void setPserverInstanceList(List<PserverInstance> pserverInstanceList) {
        this.pserverInstanceList = pserverInstanceList;
    }

    private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();

    public String toJson() {
        return gson.toJson(this);
    }

    public static Vserver fromJson(String payload) throws AuditException {
        try {
            if (payload == null || payload.isEmpty()) {
                throw new AuditException("Empty Json response");
            }
            return gson.fromJson(payload, Vserver.class);
        } catch (Exception ex) {
            throw new AuditException(AuditError.JSON_READER_PARSE_ERROR, ex);
        }
    }

    /**
     * No args constructor for use in serialization
     *
     */
    public Vserver() {
    }

    /**
     *
     * @param relationshipList
     * @param provStatus
     * @param inMaint
     * @param vserverName2
     * @param resourceVersion
     * @param vserverSelflink
     * @param vserverName
     * @param vserverId
     * @param isClosedLoopDisabled
     */
    public Vserver(String vserverId, String vserverName, String vserverName2, String provStatus, String vserverSelflink, Boolean inMaint, Boolean isClosedLoopDisabled, String resourceVersion, RelationshipList relationshipList, LInterfaceInstanceList lInterfaceInstanceList) {
        super();
        this.vserverId = vserverId;
        this.vserverName = vserverName;
        this.vserverName2 = vserverName2;
        this.provStatus = provStatus;
        this.vserverSelflink = vserverSelflink;
        this.inMaint = inMaint;
        this.isClosedLoopDisabled = isClosedLoopDisabled;
        this.resourceVersion = resourceVersion;
        this.relationshipList = relationshipList;
        this.lInterfaceInstanceList = lInterfaceInstanceList;
    }

    public String getVserverId() {
        return vserverId;
    }

    public void setVserverId(String vserverId) {
        this.vserverId = vserverId;
    }

    public String getVserverName() {
        return vserverName;
    }

    public void setVserverName(String vserverName) {
        this.vserverName = vserverName;
    }

    public String getVserverName2() {
        return vserverName2;
    }

    public void setVserverName2(String vserverName2) {
        this.vserverName2 = vserverName2;
    }

    public String getProvStatus() {
        return provStatus;
    }

    public void setProvStatus(String provStatus) {
        this.provStatus = provStatus;
    }

    public String getVserverSelflink() {
        return vserverSelflink;
    }

    public void setVserverSelflink(String vserverSelflink) {
        this.vserverSelflink = vserverSelflink;
    }

    public Boolean getInMaint() {
        return inMaint;
    }

    public void setInMaint(Boolean inMaint) {
        this.inMaint = inMaint;
    }

    public Boolean getIsClosedLoopDisabled() {
        return isClosedLoopDisabled;
    }

    public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {
        this.isClosedLoopDisabled = isClosedLoopDisabled;
    }

    public String getResourceVersion() {
        return resourceVersion;
    }

    public void setResourceVersion(String resourceVersion) {
        this.resourceVersion = resourceVersion;
    }

    public RelationshipList getRelationshipList() {
        return relationshipList;
    }

    public void setRelationshipList(RelationshipList relationshipList) {
        this.relationshipList = relationshipList;
    }

    public LInterfaceInstanceList getLInterfaceInstanceList() {
        return lInterfaceInstanceList;
    }

    public void setLInterfaceInstanceList(LInterfaceInstanceList lInterfaceInstanceList) {
        this.lInterfaceInstanceList = lInterfaceInstanceList;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).append("vserverId", vserverId).append("vserverName", vserverName).append("vserverName2", vserverName2).append("provStatus", provStatus).append("vserverSelflink", vserverSelflink).append("inMaint", inMaint).append("isClosedLoopDisabled", isClosedLoopDisabled).append("resourceVersion", resourceVersion).append("relationshipList", relationshipList).append("lInterfaceInstanceList", lInterfaceInstanceList).toString();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(relationshipList).append(lInterfaceInstanceList).append(provStatus).append(inMaint).append(vserverName2).append(resourceVersion).append(vserverSelflink).append(vserverName).append(vserverId).append(isClosedLoopDisabled).toHashCode();
    }

    @Override
    public boolean equals(Object other) {
        if (other == this) {
            return true;
        }
        if ((other instanceof Vserver) == false) {
            return false;
        }
        Vserver rhs = ((Vserver) other);
        return new EqualsBuilder().append(relationshipList, rhs.relationshipList).append(lInterfaceInstanceList, rhs.lInterfaceInstanceList).append(provStatus, rhs.provStatus).append(inMaint, rhs.inMaint).append(vserverName2, rhs.vserverName2).append(resourceVersion, rhs.resourceVersion).append(vserverSelflink, rhs.vserverSelflink).append(vserverName, rhs.vserverName).append(vserverId, rhs.vserverId).append(isClosedLoopDisabled, rhs.isClosedLoopDisabled).isEquals();
    }

}