a47032563de3cc7df11b0be390975c51c601141d
[cli.git] / framework / src / main / java / org / onap / cli / fw / schema / OnapCommandSchemaInfo.java
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
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
17 package org.onap.cli.fw.schema;
18
19 import java.util.ArrayList;
20 import java.util.List;
21 import java.util.Objects;
22
23 import org.onap.cli.fw.cmd.OnapCommandType;
24 import org.onap.cli.fw.conf.OnapCommandConstants;
25 import org.onap.cli.fw.info.OnapCommandState;
26
27 /**
28  * OnapCommandSchemaInfo is used in discovery caching.
29  *
30  */
31 public class OnapCommandSchemaInfo implements Comparable<OnapCommandSchemaInfo> {
32
33     /**
34      * Name of the schema file name
35      */
36     private String schemaName;
37
38     /**
39      * Schema location in complete path
40      */
41     private String schemaURI;
42
43     private String cmdName;
44
45     private String product;
46
47     private List<String> sampleFiles = new ArrayList();
48
49     /**
50      * OCS version
51      */
52     private String version;
53
54     private String type = OnapCommandType.CMD.name();
55
56     private String schemaProfile = OnapCommandConstants.BASIC_SCHEMA_PROFILE;
57
58     private String ignore = OnapCommandConstants.BOOLEAN_FALSE;
59
60     private String state = OnapCommandState.STABLE.name();
61
62     public String getSchemaName() {
63         return schemaName;
64     }
65
66     public void setSchemaName(String schemaName) {
67         this.schemaName = schemaName;
68     }
69
70     public String getCmdName() {
71         return cmdName;
72     }
73
74     public void setCmdName(String cmdName) {
75         this.cmdName = cmdName;
76     }
77
78     public String getVersion() {
79         return version;
80     }
81
82     public void setVersion(String version) {
83         this.version = version;
84     }
85
86     public String getProduct() {
87         return product;
88     }
89
90     public void setProduct(String cmdVersion) {
91         this.product = cmdVersion;
92     }
93
94     public String getSchemaURI() {
95         return schemaURI;
96     }
97
98     public void setSchemaURI(String schemaURI) {
99         this.schemaURI = schemaURI;
100     }
101
102     public String getSchemaProfile() {
103         return schemaProfile;
104     }
105
106     public void setSchemaProfile(String internal) {
107         this.schemaProfile = internal;
108     }
109
110     public String getType() {
111         return type;
112     }
113
114     public void setType(String type) {
115         this.type = type;
116     }
117
118     public boolean isIgnore() {
119         return OnapCommandConstants.BOOLEAN_TRUE.equalsIgnoreCase(this.getIgnore());
120     }
121
122     public String getIgnore() {
123         return ignore;
124     }
125
126     public void setIgnore(String ignore) {
127         this.ignore = ignore;
128     }
129
130     public List<String> getSampleFiles() {
131         return sampleFiles;
132     }
133
134     public String getState() {
135         return state;
136     }
137
138     public void setState(String state) {
139         this.state = state;
140     }
141
142     @Override
143     public int compareTo(OnapCommandSchemaInfo o) {
144         return this.cmdName.compareTo(o.getCmdName());
145     }
146
147     @Override
148     public boolean equals(Object obj) {
149         if (obj == null)
150             return false;
151
152         if (this.getClass() != obj.getClass())
153             return false;
154
155         return this.compareTo((OnapCommandSchemaInfo) obj) == 0;
156     }
157
158
159     @Override
160     public int hashCode() {
161         return Objects.hashCode(this.cmdName);
162     }
163 }