Changes for checkstyle 8.32
[policy/apex-pdp.git] / testsuites / integration / integration-common / src / main / java / org / onap / policy / apex / context / test / concepts / TestContextDateLocaleItem.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.apex.context.test.concepts;
23
24 import java.io.Serializable;
25 import java.util.Locale;
26 import java.util.TimeZone;
27 import lombok.Data;
28
29 /**
30  * The Class TestContextDateLocaleItem.
31  */
32 @Data
33 public class TestContextDateLocaleItem implements Serializable {
34     private static final long serialVersionUID = -6579903685538233754L;
35
36     private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
37     private String tzValue = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
38     private boolean dst = false;
39     private int utcOffset = 0;
40     private Locale locale = Locale.ENGLISH;
41
42     /**
43      * The Constructor.
44      */
45     public TestContextDateLocaleItem() {
46     }
47
48     /**
49      * The Constructor.
50      *
51      * @param dateValue the date value
52      * @param tzValue the tz value
53      * @param dst the dst
54      * @param utcOffset the utc offset
55      * @param language the language
56      * @param country the country
57      */
58     public TestContextDateLocaleItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst,
59             final int utcOffset, final String language, final String country) {
60         this.dateValue = dateValue;
61         this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName();
62         this.dst = dst;
63         this.utcOffset = utcOffset;
64
65         this.locale = new Locale(language, country);
66     }
67
68     /**
69      * The Constructor.
70      *
71      * @param original the original
72      */
73     public TestContextDateLocaleItem(final TestContextDateLocaleItem original) {
74         this.dateValue = original.dateValue;
75         this.tzValue = TimeZone.getTimeZone(original.tzValue).getDisplayName();
76         this.dst = original.dst;
77         this.utcOffset = original.utcOffset;
78
79         this.locale = new Locale(original.getLocale().getCountry(), original.getLocale().getLanguage());
80     }
81
82     /**
83      * Sets the TZ value.
84      *
85      * @param tzValue the TZ value
86      */
87     public void setTzValue(final String tzValue) {
88         if (tzValue != null) {
89             this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName();
90         } else {
91             this.tzValue = null;
92         }
93     }
94 }