029719afbeec451f79fed5292dcd2ec2fea72b81
[policy/apex-pdp.git] / testsuites / integration / integration-common / src / main / java / org / onap / policy / apex / context / test / concepts / TestContextDateTzItem.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.TimeZone;
26
27 import lombok.Data;
28
29 /**
30  * The Class TestContextDateTzItem.
31  */
32 @Data
33 public class TestContextDateTzItem implements Serializable {
34     private static final long serialVersionUID = 5604426823170331706L;
35
36     private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis());
37     private String tzValue = TimeZone.getTimeZone("Europe/Dublin").getDisplayName();
38     private boolean dst = false;
39
40     /**
41      * The Constructor.
42      */
43     public TestContextDateTzItem() {
44         dst = true;
45     }
46
47     /**
48      * The Constructor.
49      *
50      * @param dateValue the date value
51      * @param tzValue the tz value
52      * @param dst the dst
53      */
54     public TestContextDateTzItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst) {
55         this.dateValue = dateValue;
56         this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName();
57         this.dst = dst;
58     }
59
60     /**
61      * The Constructor.
62      *
63      * @param original the original
64      */
65     public TestContextDateTzItem(final TestContextDateTzItem original) {
66         this.dateValue = original.dateValue;
67         this.tzValue = original.tzValue;
68         this.dst = original.dst;
69     }
70
71     /**
72      * Sets the TZ value.
73      *
74      * @param tzValue the TZ value
75      */
76     public void setTzValue(final String tzValue) {
77         if (tzValue != null) {
78             this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName();
79         } else {
80             this.tzValue = null;
81         }
82     }
83 }