e0542369c4046a2ba250eae78fb00c41853bdb3f
[sdc.git] /
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 import lombok.Getter;
21 import lombok.ToString;
22
23 @ToString
24 @Getter
25 public class ConfigurationQuery {
26
27     private String tenant = Constants.DEFAULT_TENANT;
28     private String namespace = Constants.DEFAULT_NAMESPACE;
29     private String key;
30     private boolean fallback;
31     private boolean externalLookup;
32     private boolean latest;
33     private boolean nodeSpecific;
34
35     public ConfigurationQuery fallback(boolean fallback) {
36         this.fallback = fallback;
37         return this;
38     }
39
40     public ConfigurationQuery latest(boolean val) {
41         this.latest = val;
42         return this;
43     }
44
45     public ConfigurationQuery nodeSpecific(boolean val) {
46         this.nodeSpecific = val;
47         return this;
48     }
49
50     public ConfigurationQuery externalLookup(boolean val) {
51         this.externalLookup = val;
52         return this;
53     }
54
55     public ConfigurationQuery tenant(String id) {
56         if (id != null) {
57             tenant = id;
58         }
59         return this;
60     }
61
62
63     public ConfigurationQuery namespace(String id) {
64         if (id != null) {
65             namespace = id;
66         }
67         return this;
68     }
69
70     public ConfigurationQuery key(String id) {
71         key = id;
72         return this;
73     }
74
75     public String getTenant() {
76         return tenant.toUpperCase();
77     }
78
79     public String getNamespace() {
80         return namespace.toUpperCase();
81     }
82 }