]> git.basschouten.com Git - openhab-addons.git/commitdiff
[jdbc] Increased size of column type for Location Item (#10542)
authorChristoph Weitkamp <github@christophweitkamp.de>
Sat, 24 Apr 2021 10:39:05 +0000 (12:39 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Apr 2021 10:39:05 +0000 (12:39 +0200)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
17 files changed:
bundles/org.openhab.persistence.jdbc/README.md
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcBaseDAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcDerbyDAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcH2DAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcHsqldbDAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcPostgresqlDAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/db/JdbcSqliteDAO.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemVO.java [new file with mode: 0644]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemsVO.java [new file with mode: 0644]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcHistoricItem.java [new file with mode: 0644]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcPersistenceItemInfo.java [new file with mode: 0644]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/internal/JdbcMapper.java
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemVO.java [deleted file]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemsVO.java [deleted file]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcHistoricItem.java [deleted file]
bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcPersistenceItemInfo.java [deleted file]
bundles/org.openhab.persistence.jdbc/src/main/resources/OH-INF/config/config.xml

index e6461c908bb9bf6bfb6212e6d73667bed4144b96..e13645d7e28d166d078cc020bfc514dc2585c90a 100644 (file)
@@ -48,8 +48,10 @@ This service can be configured in the file `services/jdbc.cfg`.
 | sqltype.CONTACT           | `VARCHAR(6)`                                                 |    No     | see above                                                    |
 | sqltype.DATETIME          | `DATETIME`                                                   |    No     | see above                                                    |
 | sqltype.DIMMER            | `TINYINT`                                                    |    No     | see above                                                    |
-| sqltype.LOCATION          | `VARCHAR(30)`                                                |    No     | see above                                                    |
+| sqltype.IMAGE             | `VARCHAR(65500)`                                             |    No     | see above                                                    |
+| sqltype.LOCATION          | `VARCHAR(50)`                                                |    No     | see above                                                    |
 | sqltype.NUMBER            | `DOUBLE`                                                     |    No     | see above                                                    |
+| sqltype.PLAYER            | `VARCHAR(20)`                                                |    No     | see above                                                    |
 | sqltype.ROLLERSHUTTER     | `TINYINT`                                                    |    No     | see above                                                    |
 | sqltype.STRING            | `VARCHAR(65500)`                                             |    No     | see above                                                    |
 | sqltype.SWITCH            | `VARCHAR(6)`                                                 |    No     | see above                                                    |
index 65c37983ed95313af4858b65c9aaad0f82cf02fc..72f8407b72dde80087b6af2ceb5bcd160720ac02 100644 (file)
@@ -50,9 +50,9 @@ import org.openhab.core.persistence.FilterCriteria.Ordering;
 import org.openhab.core.persistence.HistoricItem;
 import org.openhab.core.types.State;
 import org.openhab.core.types.TypeParser;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
-import org.openhab.persistence.jdbc.model.JdbcHistoricItem;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
+import org.openhab.persistence.jdbc.dto.JdbcHistoricItem;
 import org.openhab.persistence.jdbc.utils.DbMetaData;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
@@ -155,7 +155,7 @@ public class JdbcBaseDAO {
         sqlTypes.put("DATETIMEITEM", "TIMESTAMP");
         sqlTypes.put("DIMMERITEM", "TINYINT");
         sqlTypes.put("IMAGEITEM", "VARCHAR(65500)");// jdbc max 21845
-        sqlTypes.put("LOCATIONITEM", "VARCHAR(30)");
+        sqlTypes.put("LOCATIONITEM", "VARCHAR(50)");
         sqlTypes.put("NUMBERITEM", "DOUBLE");
         sqlTypes.put("PLAYERITEM", "VARCHAR(20)");
         sqlTypes.put("ROLLERSHUTTERITEM", "TINYINT");
index 973cdc125ed358696f30d63b3b692ab61df9bb1f..c2e07d2bec9a19eeadf08d92dd46aca397c1d863 100644 (file)
@@ -25,9 +25,9 @@ import org.openhab.core.library.items.NumberItem;
 import org.openhab.core.persistence.FilterCriteria;
 import org.openhab.core.persistence.FilterCriteria.Ordering;
 import org.openhab.core.persistence.HistoricItem;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
-import org.openhab.persistence.jdbc.model.JdbcHistoricItem;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
+import org.openhab.persistence.jdbc.dto.JdbcHistoricItem;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 084b309d10c17d658ecb49261ee914b8749f30fe..f088c56a74af71f73855589e52831da9b9ba8e25 100644 (file)
@@ -14,7 +14,7 @@ package org.openhab.persistence.jdbc.db;
 
 import org.knowm.yank.Yank;
 import org.openhab.core.items.Item;
-import org.openhab.persistence.jdbc.model.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemVO;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 326080e26637cfc4165fe306534788489b42ccae..5b5dd436d773c884fc6eb772d731a254e45f1838 100644 (file)
@@ -14,8 +14,8 @@ package org.openhab.persistence.jdbc.db;
 
 import org.knowm.yank.Yank;
 import org.openhab.core.items.Item;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 8a7ef69cca713114efd27776e330578280baf719..45e50b84ace8dce24c94f9e863f234f409b9d73f 100644 (file)
@@ -19,8 +19,8 @@ import org.knowm.yank.Yank;
 import org.openhab.core.items.Item;
 import org.openhab.core.persistence.FilterCriteria;
 import org.openhab.core.persistence.FilterCriteria.Ordering;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 564d73c01bbcded332d327a51d702e72e4c30f64..1f99dec1c922576c14692b7af21b55eef61f9c8d 100644 (file)
@@ -14,8 +14,8 @@ package org.openhab.persistence.jdbc.db;
 
 import org.knowm.yank.Yank;
 import org.openhab.core.items.Item;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
 import org.openhab.persistence.jdbc.utils.StringUtilsExt;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemVO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemVO.java
new file mode 100644 (file)
index 0000000..a7cec89
--- /dev/null
@@ -0,0 +1,164 @@
+/**
+ * Copyright (c) 2010-2021 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.persistence.jdbc.dto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents the Item-data on the part of MyBatis/database.
+ *
+ * @author Helmut Lehmeyer - Initial contribution
+ */
+public class ItemVO implements Serializable {
+    private final Logger logger = LoggerFactory.getLogger(ItemVO.class);
+
+    private static final long serialVersionUID = 1871441039821454890L;
+
+    private String tableName;
+    private String newTableName;
+    private String dbType;
+    private String jdbcType;
+    private String itemType;
+    private Class<?> javaType;
+    private Date time;
+    private Object value;
+
+    public ItemVO(String tableName, String newTableName) {
+        logger.debug("JDBC:ItemVO tableName={}; newTableName={}; ", tableName, newTableName);
+        this.tableName = tableName;
+        this.newTableName = newTableName;
+    }
+
+    public ItemVO() {
+    }
+
+    public void setValueTypes(String dbType, Class<?> javaType) {
+        logger.debug("JDBC:ItemVO setValueTypes dbType={}; javaType={};", dbType, javaType);
+        this.dbType = dbType;
+        this.javaType = javaType;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getNewTableName() {
+        return newTableName;
+    }
+
+    public void setNewTableName(String newTableName) {
+        this.newTableName = newTableName;
+    }
+
+    public String getDbType() {
+        return dbType;
+    }
+
+    public void setDbType(String dbType) {
+        this.dbType = dbType;
+    }
+
+    public String getJdbcType() {
+        return jdbcType;
+    }
+
+    public void setJdbcType(String jdbcType) {
+        this.jdbcType = jdbcType;
+    }
+
+    public String getItemType() {
+        return itemType;
+    }
+
+    public void setItemType(String itemType) {
+        this.itemType = itemType;
+    }
+
+    public String getJavaType() {
+        return javaType.getName();
+    }
+
+    public void setJavaType(Class<?> javaType) {
+        this.javaType = javaType;
+    }
+
+    public Date getTime() {
+        return time;
+    }
+
+    public void setTime(Date time) {
+        this.time = time;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    /**
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ItemVO other = (ItemVO) obj;
+        if (value == null) {
+            if (other.value != null) {
+                return false;
+            }
+        } else if (!value.equals(other.value)) {
+            return false;
+        }
+        return time == other.time;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("ItemVO [tableName=");
+        builder.append(tableName);
+        builder.append(", newTableName=");
+        builder.append(newTableName);
+        builder.append(", dbType=");
+        builder.append(dbType);
+        builder.append(", javaType=");
+        builder.append(javaType);
+        builder.append(", time=");
+        builder.append(time);
+        builder.append(", value=");
+        builder.append(value);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemsVO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/ItemsVO.java
new file mode 100644 (file)
index 0000000..2ed2c40
--- /dev/null
@@ -0,0 +1,151 @@
+/**
+ * Copyright (c) 2010-2021 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.persistence.jdbc.dto;
+
+import java.io.Serializable;
+
+/**
+ * Represents the table naming data.
+ *
+ * @author Helmut Lehmeyer - Initial contribution
+ */
+public class ItemsVO implements Serializable {
+
+    private static final long serialVersionUID = 2871961811177601520L;
+
+    private static final String STR_FILTER = "[^a-zA-Z0-9]";
+
+    private String coltype = "VARCHAR(500)";
+    private String colname = "itemname";
+    private String itemsManageTable = "items";
+    private int itemid;
+    private String itemname;
+    private String table_name;
+    private String jdbcUriDatabaseName;
+
+    public String getColtype() {
+        return coltype;
+    }
+
+    public void setColtype(String coltype) {
+        this.coltype = coltype.replaceAll(STR_FILTER, "");
+    }
+
+    public String getColname() {
+        return colname;
+    }
+
+    public void setColname(String colname) {
+        this.colname = colname.replaceAll(STR_FILTER, "");
+    }
+
+    public String getItemsManageTable() {
+        return itemsManageTable;
+    }
+
+    public void setItemsManageTable(String itemsManageTable) {
+        this.itemsManageTable = itemsManageTable.replaceAll(STR_FILTER, "");
+    }
+
+    public int getItemid() {
+        return itemid;
+    }
+
+    public void setItemid(int itemid) {
+        this.itemid = itemid;
+    }
+
+    public String getItemname() {
+        return itemname;
+    }
+
+    public void setItemname(String itemname) {
+        this.itemname = itemname;
+    }
+
+    public String getTable_name() {
+        return table_name;
+    }
+
+    public void setTable_name(String table_name) {
+        this.table_name = table_name;
+    }
+
+    public String getJdbcUriDatabaseName() {
+        return jdbcUriDatabaseName;
+    }
+
+    public void setJdbcUriDatabaseName(String jdbcUriDatabaseName) {
+        this.jdbcUriDatabaseName = jdbcUriDatabaseName;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((itemname == null) ? 0 : itemname.hashCode());
+        result = prime * result + (itemid ^ (itemid >>> 32));
+        return result;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        ItemsVO other = (ItemsVO) obj;
+        if (itemname == null) {
+            if (other.itemname != null) {
+                return false;
+            }
+        } else if (!itemname.equals(other.itemname)) {
+            return false;
+        }
+        return itemid == other.itemid;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("ItemsVO [coltype=");
+        builder.append(coltype);
+        builder.append(", colname=");
+        builder.append(colname);
+        builder.append(", itemsManageTable=");
+        builder.append(itemsManageTable);
+        builder.append(", itemid=");
+        builder.append(itemid);
+        builder.append(", itemname=");
+        builder.append(itemname);
+        builder.append(", table_name=");
+        builder.append(table_name);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcHistoricItem.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcHistoricItem.java
new file mode 100644 (file)
index 0000000..87de1ca
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2010-2021 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.persistence.jdbc.dto;
+
+import java.time.ZonedDateTime;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.core.persistence.HistoricItem;
+import org.openhab.core.types.State;
+
+/**
+ * Represents the data on the part of openHAB.
+ *
+ * @author Helmut Lehmeyer - Initial contribution
+ */
+@NonNullByDefault
+public class JdbcHistoricItem implements HistoricItem {
+
+    private final String name;
+    private final State state;
+    private final ZonedDateTime timestamp;
+
+    public JdbcHistoricItem(String name, State state, ZonedDateTime timestamp) {
+        this.name = name;
+        this.state = state;
+        this.timestamp = timestamp;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    @Override
+    public ZonedDateTime getTimestamp() {
+        return timestamp;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append("JdbcItem [name=");
+        builder.append(name);
+        builder.append(", state=");
+        builder.append(state);
+        builder.append(", timestamp=");
+        builder.append(timestamp);
+        builder.append("]");
+        return builder.toString();
+    }
+}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcPersistenceItemInfo.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/dto/JdbcPersistenceItemInfo.java
new file mode 100644 (file)
index 0000000..4690ef5
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2010-2021 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.persistence.jdbc.dto;
+
+import java.util.Date;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.core.persistence.PersistenceItemInfo;
+
+/**
+ * Represents the item info for openHAB.
+ *
+ * @author Christoph Weitkamp - Initial contribution
+ */
+@NonNullByDefault
+public class JdbcPersistenceItemInfo implements PersistenceItemInfo {
+
+    private final String name;
+    private final @Nullable Integer count;
+    private final @Nullable Date earliest;
+    private final @Nullable Date latest;
+
+    public JdbcPersistenceItemInfo(String name) {
+        this(name, null, null, null);
+    }
+
+    public JdbcPersistenceItemInfo(String name, @Nullable Integer count, @Nullable Date earliest,
+            @Nullable Date latest) {
+        this.name = name;
+        this.count = count;
+        this.earliest = earliest;
+        this.latest = latest;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public @Nullable Integer getCount() {
+        return count;
+    }
+
+    @Override
+    public @Nullable Date getEarliest() {
+        return earliest;
+    }
+
+    @Override
+    public @Nullable Date getLatest() {
+        return latest;
+    }
+}
index c89389ce61c354f2650a878c308aeac4a377174c..956020681c994adbd203b1cc66f0656843edeb64 100644 (file)
@@ -25,9 +25,9 @@ import org.openhab.core.items.Item;
 import org.openhab.core.persistence.FilterCriteria;
 import org.openhab.core.persistence.HistoricItem;
 import org.openhab.core.persistence.PersistenceItemInfo;
-import org.openhab.persistence.jdbc.model.ItemVO;
-import org.openhab.persistence.jdbc.model.ItemsVO;
-import org.openhab.persistence.jdbc.model.JdbcPersistenceItemInfo;
+import org.openhab.persistence.jdbc.dto.ItemVO;
+import org.openhab.persistence.jdbc.dto.ItemsVO;
+import org.openhab.persistence.jdbc.dto.JdbcPersistenceItemInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemVO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemVO.java
deleted file mode 100644 (file)
index 7b8d368..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Copyright (c) 2010-2021 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.persistence.jdbc.model;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Represents the Item-data on the part of MyBatis/database.
- *
- * @author Helmut Lehmeyer - Initial contribution
- */
-public class ItemVO implements Serializable {
-    private final Logger logger = LoggerFactory.getLogger(ItemVO.class);
-
-    private static final long serialVersionUID = 1871441039821454890L;
-
-    private String tableName;
-    private String newTableName;
-    private String dbType;
-    private String jdbcType;
-    private String itemType;
-    private Class<?> javaType;
-    private Date time;
-    private Object value;
-
-    public ItemVO(String tableName, String newTableName) {
-        logger.debug("JDBC:ItemVO tableName={}; newTableName={}; ", tableName, newTableName);
-        this.tableName = tableName;
-        this.newTableName = newTableName;
-    }
-
-    public ItemVO() {
-    }
-
-    public void setValueTypes(String dbType, Class<?> javaType) {
-        logger.debug("JDBC:ItemVO setValueTypes dbType={}; javaType={};", dbType, javaType);
-        this.dbType = dbType;
-        this.javaType = javaType;
-    }
-
-    public String getTableName() {
-        return tableName;
-    }
-
-    public void setTableName(String tableName) {
-        this.tableName = tableName;
-    }
-
-    public String getNewTableName() {
-        return newTableName;
-    }
-
-    public void setNewTableName(String newTableName) {
-        this.newTableName = newTableName;
-    }
-
-    public String getDbType() {
-        return dbType;
-    }
-
-    public void setDbType(String dbType) {
-        this.dbType = dbType;
-    }
-
-    public String getJdbcType() {
-        return jdbcType;
-    }
-
-    public void setJdbcType(String jdbcType) {
-        this.jdbcType = jdbcType;
-    }
-
-    public String getItemType() {
-        return itemType;
-    }
-
-    public void setItemType(String itemType) {
-        this.itemType = itemType;
-    }
-
-    public String getJavaType() {
-        return javaType.getName();
-    }
-
-    public void setJavaType(Class<?> javaType) {
-        this.javaType = javaType;
-    }
-
-    public Date getTime() {
-        return time;
-    }
-
-    public void setTime(Date time) {
-        this.time = time;
-    }
-
-    public Object getValue() {
-        return value;
-    }
-
-    public void setValue(Object value) {
-        this.value = value;
-    }
-
-    /**
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ItemVO other = (ItemVO) obj;
-        if (value == null) {
-            if (other.value != null) {
-                return false;
-            }
-        } else if (!value.equals(other.value)) {
-            return false;
-        }
-        if (time != other.time) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("ItemVO [tableName=");
-        builder.append(tableName);
-        builder.append(", newTableName=");
-        builder.append(newTableName);
-        builder.append(", dbType=");
-        builder.append(dbType);
-        builder.append(", javaType=");
-        builder.append(javaType);
-        builder.append(", time=");
-        builder.append(time);
-        builder.append(", value=");
-        builder.append(value);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemsVO.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/ItemsVO.java
deleted file mode 100644 (file)
index 4c72ebe..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- * Copyright (c) 2010-2021 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.persistence.jdbc.model;
-
-import java.io.Serializable;
-
-/**
- * Represents the table naming data.
- *
- * @author Helmut Lehmeyer - Initial contribution
- */
-public class ItemsVO implements Serializable {
-
-    private static final long serialVersionUID = 2871961811177601520L;
-
-    private static final String STR_FILTER = "[^a-zA-Z0-9]";
-
-    private String coltype = "VARCHAR(500)";
-    private String colname = "itemname";
-    private String itemsManageTable = "items";
-    private int itemid;
-    private String itemname;
-    private String table_name;
-    private String jdbcUriDatabaseName;
-
-    public String getColtype() {
-        return coltype;
-    }
-
-    public void setColtype(String coltype) {
-        this.coltype = coltype.replaceAll(STR_FILTER, "");
-    }
-
-    public String getColname() {
-        return colname;
-    }
-
-    public void setColname(String colname) {
-        this.colname = colname.replaceAll(STR_FILTER, "");
-    }
-
-    public String getItemsManageTable() {
-        return itemsManageTable;
-    }
-
-    public void setItemsManageTable(String itemsManageTable) {
-        this.itemsManageTable = itemsManageTable.replaceAll(STR_FILTER, "");
-    }
-
-    public int getItemid() {
-        return itemid;
-    }
-
-    public void setItemid(int itemid) {
-        this.itemid = itemid;
-    }
-
-    public String getItemname() {
-        return itemname;
-    }
-
-    public void setItemname(String itemname) {
-        this.itemname = itemname;
-    }
-
-    public String getTable_name() {
-        return table_name;
-    }
-
-    public void setTable_name(String table_name) {
-        this.table_name = table_name;
-    }
-
-    public String getJdbcUriDatabaseName() {
-        return jdbcUriDatabaseName;
-    }
-
-    public void setJdbcUriDatabaseName(String jdbcUriDatabaseName) {
-        this.jdbcUriDatabaseName = jdbcUriDatabaseName;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#hashCode()
-     */
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((itemname == null) ? 0 : itemname.hashCode());
-        result = prime * result + (itemid ^ (itemid >>> 32));
-        return result;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        ItemsVO other = (ItemsVO) obj;
-        if (itemname == null) {
-            if (other.itemname != null) {
-                return false;
-            }
-        } else if (!itemname.equals(other.itemname)) {
-            return false;
-        }
-        if (itemid != other.itemid) {
-            return false;
-        }
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("ItemsVO [coltype=");
-        builder.append(coltype);
-        builder.append(", colname=");
-        builder.append(colname);
-        builder.append(", itemsManageTable=");
-        builder.append(itemsManageTable);
-        builder.append(", itemid=");
-        builder.append(itemid);
-        builder.append(", itemname=");
-        builder.append(itemname);
-        builder.append(", table_name=");
-        builder.append(table_name);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcHistoricItem.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcHistoricItem.java
deleted file mode 100644 (file)
index 0a9a72e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * Copyright (c) 2010-2021 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.persistence.jdbc.model;
-
-import java.time.ZonedDateTime;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.openhab.core.persistence.HistoricItem;
-import org.openhab.core.types.State;
-
-/**
- * Represents the data on the part of openHAB.
- *
- * @author Helmut Lehmeyer - Initial contribution
- */
-@NonNullByDefault
-public class JdbcHistoricItem implements HistoricItem {
-
-    private final String name;
-    private final State state;
-    private final ZonedDateTime timestamp;
-
-    public JdbcHistoricItem(String name, State state, ZonedDateTime timestamp) {
-        this.name = name;
-        this.state = state;
-        this.timestamp = timestamp;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public State getState() {
-        return state;
-    }
-
-    @Override
-    public ZonedDateTime getTimestamp() {
-        return timestamp;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("JdbcItem [name=");
-        builder.append(name);
-        builder.append(", state=");
-        builder.append(state);
-        builder.append(", timestamp=");
-        builder.append(timestamp);
-        builder.append("]");
-        return builder.toString();
-    }
-}
diff --git a/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcPersistenceItemInfo.java b/bundles/org.openhab.persistence.jdbc/src/main/java/org/openhab/persistence/jdbc/model/JdbcPersistenceItemInfo.java
deleted file mode 100644 (file)
index c9568d0..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright (c) 2010-2021 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.persistence.jdbc.model;
-
-import java.util.Date;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.jdt.annotation.Nullable;
-import org.openhab.core.persistence.PersistenceItemInfo;
-
-/**
- * Represents the item info for openHAB.
- *
- * @author Christoph Weitkamp - Initial contribution
- */
-@NonNullByDefault
-public class JdbcPersistenceItemInfo implements PersistenceItemInfo {
-
-    private final String name;
-    private final @Nullable Integer count;
-    private final @Nullable Date earliest;
-    private final @Nullable Date latest;
-
-    public JdbcPersistenceItemInfo(String name) {
-        this(name, null, null, null);
-    }
-
-    public JdbcPersistenceItemInfo(String name, @Nullable Integer count, @Nullable Date earliest,
-            @Nullable Date latest) {
-        this.name = name;
-        this.count = count;
-        this.earliest = earliest;
-        this.latest = latest;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public @Nullable Integer getCount() {
-        return count;
-    }
-
-    @Override
-    public @Nullable Date getEarliest() {
-        return earliest;
-    }
-
-    @Override
-    public @Nullable Date getLatest() {
-        return latest;
-    }
-}
index fb0e06c762134bebaa519598507cb3d396969544..31d16a61bdcaa093e1c11ffd90e7f291f80b2aac 100644 (file)
@@ -71,7 +71,7 @@
                        #sqltype.CONTACT = VARCHAR(6)
                        #sqltype.DATETIME = DATETIME
                        #sqltype.DIMMER = TINYINT
-                       #sqltype.LOCATION = VARCHAR(30)
+                       #sqltype.LOCATION = VARCHAR(50)
                        #sqltype.NUMBER = DOUBLE
                        #sqltype.ROLLERSHUTTER = TINYINT
                        #sqltype.STRING = VARCHAR(65500)
                </parameter>
                <parameter name="sqltype.LOCATION" type="text">
                        <label>SqlType LOCATION</label>
-                       <description><![CDATA[Overrides used JDBC/SQL datatype for LOCATION <br>(optional, default: "VARCHAR(30)").]]></description>
+                       <description><![CDATA[Overrides used JDBC/SQL datatype for LOCATION <br>(optional, default: "VARCHAR(50)").]]></description>
                </parameter>
                <parameter name="sqltype.NUMBER" type="text">
                        <label>SqlType NUMBER</label>