Code formatting of configuration framework
[sdc.git] / common / onap-common-configuration-management / onap-configuration-management-core / src / main / java / org / onap / config / type / ConfigurationQuery.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
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.config.type;
18
19 import org.onap.config.Constants;
20
21 public class ConfigurationQuery {
22
23     private String tenant = Constants.DEFAULT_TENANT;
24     private String namespace = Constants.DEFAULT_NAMESPACE;
25     private String key;
26     private boolean fallback;
27     private boolean externalLookup;
28     private boolean latest;
29     private boolean nodeSpecific;
30
31     public ConfigurationQuery fallback(boolean fallback) {
32         this.fallback = fallback;
33         return this;
34     }
35
36     public ConfigurationQuery latest(boolean val) {
37         this.latest = val;
38         return this;
39     }
40
41     public ConfigurationQuery nodeSpecific(boolean val) {
42         this.nodeSpecific = val;
43         return this;
44     }
45
46     public ConfigurationQuery externalLookup(boolean val) {
47         this.externalLookup = val;
48         return this;
49     }
50
51     public ConfigurationQuery tenant(String id) {
52         if (id != null) {
53             tenant = id;
54         }
55         return this;
56     }
57
58
59     public ConfigurationQuery namespace(String id) {
60         if (id != null) {
61             namespace = id;
62         }
63         return this;
64     }
65
66     public ConfigurationQuery key(String id) {
67         key = id;
68         return this;
69     }
70
71     public String getTenant() {
72         return tenant.toUpperCase();
73     }
74
75     public String getNamespace() {
76         return namespace.toUpperCase();
77     }
78
79     public String getKey() {
80         return key;
81     }
82
83     public boolean isFallback() {
84         return fallback;
85     }
86
87     public boolean isNodeSpecific() {
88         return nodeSpecific;
89     }
90
91     public boolean isExternalLookup() {
92         return externalLookup;
93     }
94
95     public boolean isLatest() {
96         return latest;
97     }
98 }