2 * Copyright (c) 2010-2021 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.ZonedDateTime;
17 import org.openhab.core.items.Item;
18 import org.openhab.core.persistence.HistoricItem;
21 * Represents openHAB Item serialized in a suitable format for the database
23 * @param <T> Type of the state as accepted by the AWS SDK.
25 * @author Sami Salonen - Initial contribution
27 public interface DynamoDBItem<T> {
29 static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
31 static final String ATTRIBUTE_NAME_TIMEUTC = "timeutc";
33 static final String ATTRIBUTE_NAME_ITEMNAME = "itemname";
35 static final String ATTRIBUTE_NAME_ITEMSTATE = "itemstate";
38 * Convert this AbstractDynamoItem as HistoricItem.
40 * @param item Item representing this item. Used to determine item type.
41 * @return HistoricItem representing this DynamoDBItem.
43 HistoricItem asHistoricItem(Item item);
49 ZonedDateTime getTime();
51 void setName(String name);
53 void setState(T state);
55 void setTime(ZonedDateTime time);
57 void accept(DynamoDBItemVisitor visitor);