2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.dynamodb.internal;
15 import java.time.ZoneId;
16 import java.time.ZonedDateTime;
17 import java.time.format.DateTimeFormatter;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.persistence.HistoricItem;
21 import org.openhab.core.types.State;
24 * This is a Java bean used to return historic items from Dynamodb.
26 * @author Sami Salonen - Initial contribution
29 public class DynamoDBHistoricItem implements HistoricItem {
30 private static final ZoneId UTC = ZoneId.of("UTC");
31 private static final DateTimeFormatter DATEFORMATTER = DateTimeFormatter.ofPattern(DynamoDBItem.DATE_FORMAT)
34 private final String name;
35 private final State state;
36 private final ZonedDateTime timestamp;
38 public DynamoDBHistoricItem(String name, State state, ZonedDateTime timestamp) {
41 this.timestamp = timestamp;
45 public String getName() {
50 public ZonedDateTime getTimestamp() {
55 public State getState() {
60 public String toString() {
61 return name + ": " + DATEFORMATTER.format(timestamp) + ": " + state.toString();