Improve nbi status
[externalapi/nbi.git] / src / main / java / org / onap / nbi / apis / status / model / ApplicationStatus.java
1 /**
2  *     Copyright (c) 2018 Orange
3  *
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
7  *
8  *         http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package org.onap.nbi.apis.status.model;
17
18 import java.util.HashSet;
19 import java.util.Set;
20 import org.onap.nbi.commons.Resource;
21
22 public class ApplicationStatus implements Resource {
23
24     private String name;
25
26     private StatusType status;
27
28     private String version;
29
30     private Set<ApplicationStatus> components = new HashSet<>();
31
32     /**
33      * Builds a new {@code ApplicationStatus} with the following attributes :
34      *
35      * @param name name of the service
36      * @param status status of the service ({@code OK} | {@code KO})
37      * @param version version of the service ({@code x.y.z})
38      */
39     public ApplicationStatus(final String name, final StatusType status, final String version) {
40         this.name = name;
41         this.status = status;
42         this.version = version;
43     }
44
45     public String getName() {
46         return this.name;
47     }
48
49     public StatusType getStatus() {
50         return this.status;
51     }
52
53     public String getVersion() {
54         return this.version;
55     }
56
57     public Set<ApplicationStatus> getComponents() {
58         return this.components;
59     }
60
61     public ApplicationStatus addComponent(final ApplicationStatus componentStatus) {
62         this.components.add(componentStatus);
63         return this;
64     }
65
66     @Override
67     public String getId() {
68         return null;
69     }
70 }