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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.context.test.concepts;
24 import java.io.Serializable;
25 import java.util.Locale;
26 import java.util.TimeZone;
30 * The Class TestContextDateLocaleItem.
33 public class TestContextDateLocaleItem implements Serializable {
34 private static final long serialVersionUID = -6579903685538233754L;
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;
45 public TestContextDateLocaleItem() {
51 * @param dateValue the date value
52 * @param tzValue the tz value
54 * @param utcOffset the utc offset
55 * @param language the language
56 * @param country the country
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();
63 this.utcOffset = utcOffset;
65 this.locale = new Locale(language, country);
71 * @param original the original
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;
79 this.locale = new Locale(original.getLocale().getCountry(), original.getLocale().getLanguage());
85 * @param tzValue the TZ value
87 public void setTzValue(final String tzValue) {
88 if (tzValue != null) {
89 this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName();