100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Work on asset type system
Christian Bauer9bfb3fd5a0d1
diff --git a/container/src/main/java/org/openremote/container/util/LogUtil.java b/container/src/main/java/org/openremote/container/util/LogUtil.javaindex d796dd618..83b169375 100644--- a/container/src/main/java/org/openremote/container/util/LogUtil.java+++ b/container/src/main/java/org/openremote/container/util/LogUtil.java@@ -30,7 +30,15 @@ public class LogUtil {public static final String LOGGING_CONFIG_FILE = "LOGGING_CONFIG_FILE";- public static void configureLogging(String defaultLoggingProperties) {+ /**+ * If system property <code>java.util.logging.config.file</code> has not been set, try to load the+ * logging configuration specified in environment variable <code>LOGGING_CONFIG_FILE</code> as a file.+ * If this also wasn't set, load the given default logging configuration from the classpath.+ *+ * This method should be called in a <code>static { ... }</code> block in the "first" class of your+ * application (typically where your <code>main()</code> method is located).+ */+ public static void configureLogging(String defaultLoggingProperties) throws ExceptionInInitializerError {// If no JUL configuration is providedif (System.getProperty("java.util.logging.config.file") == null) {// Load the logging configuration file specified with an environment variablediff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.java b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.javaindex bf3f871d8..0e60c3be9 100644--- a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.java+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.java@@ -70,7 +70,7 @@ public class AssetViewImpl extends FormViewImpl implements AssetView {String attributeIntegerEditor();- String attributeFloatEditor();+ String attributeDecimalEditor();String attributeStringEditor();@@ -81,7 +81,7 @@ public class AssetViewImpl extends FormViewImpl implements AssetView {String attributeIntegerEditor();- String attributeFloatEditor();+ String attributeDecimalEditor();String attributeStringEditor();diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.ui.xml b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.ui.xmlindex ff0811a8f..a2e9b9dda 100644--- a/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.ui.xml+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/asset/AssetViewImpl.ui.xml@@ -35,7 +35,7 @@width: 5em;}- .attributeFloatEditor {+ .attributeDecimalEditor {width: 5em;}@@ -53,7 +53,7 @@width: 5em;}- .attributeFloatEditor {+ .attributeDecimalEditor {width: 5em;}diff --git a/manager/client/src/main/java/org/openremote/manager/client/assets/device/DeviceAttributesEditor.java b/manager/client/src/main/java/org/openremote/manager/client/assets/device/DeviceAttributesEditor.javaindex 50b0dba33..698e556cc 100644--- a/manager/client/src/main/java/org/openremote/manager/client/assets/device/DeviceAttributesEditor.java+++ b/manager/client/src/main/java/org/openremote/manager/client/assets/device/DeviceAttributesEditor.java@@ -210,8 +210,8 @@ public class DeviceAttributesEditor extends AttributesEditor<DeviceAttributesEdi}@Override- protected FormInputText createFloatEditor(Style style, Attribute attribute, boolean readOnly) {- return super.createFloatEditor(style, attribute, readOnly || DeviceResource.isDeviceResource(attribute));+ protected FormInputText createDecimalEditor(Style style, Attribute attribute, boolean readOnly) {+ return super.createDecimalEditor(style, attribute, readOnly || DeviceResource.isDeviceResource(attribute));}@Overridediff --git a/manager/client/src/main/java/org/openremote/manager/client/widget/AttributesEditor.java b/manager/client/src/main/java/org/openremote/manager/client/widget/AttributesEditor.javaindex 5bd152f26..1cece23eb 100644--- a/manager/client/src/main/java/org/openremote/manager/client/widget/AttributesEditor.java+++ b/manager/client/src/main/java/org/openremote/manager/client/widget/AttributesEditor.java@@ -61,7 +61,7 @@ public class AttributesEditor<S extends AttributesEditor.Style> {String attributeIntegerEditor();- String attributeFloatEditor();+ String attributeDecimalEditor();String attributeBooleanEditor();}@@ -160,8 +160,8 @@ public class AttributesEditor<S extends AttributesEditor.Style> {formGroup.getFormField().add(createStringEditor(container.getStyle(), attribute, isDefaultReadOnly(attribute)));} else if (attribute.getType().equals(AttributeType.INTEGER)) {formGroup.getFormField().add(createIntegerEditor(container.getStyle(), attribute, isDefaultReadOnly(attribute)));- } else if (attribute.getType().equals(AttributeType.FLOAT)) {- formGroup.getFormField().add(createFloatEditor(container.getStyle(), attribute, isDefaultReadOnly(attribute)));+ } else if (attribute.getType().equals(AttributeType.DECIMAL)) {+ formGroup.getFormField().add(createDecimalEditor(container.getStyle(), attribute, isDefaultReadOnly(attribute)));} else if (attribute.getType().equals(AttributeType.BOOLEAN)) {formGroup.getFormField().add(createBooleanEditor(container.getStyle(), attribute, isDefaultReadOnly(attribute)));} else {@@ -255,8 +255,8 @@ public class AttributesEditor<S extends AttributesEditor.Style> {return input;}- protected FormInputText createFloatEditor(S style, Attribute attribute, boolean readOnly) {- FormInputText input = createFormInputText(style.attributeFloatEditor());+ protected FormInputText createDecimalEditor(S style, Attribute attribute, boolean readOnly) {+ FormInputText input = createFormInputText(style.attributeDecimalEditor());MetadataItem defaultValue;if (attribute.getValue() != null) {diff --git a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.propertiesindex b58939981..173cff4f8 100644--- a/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties+++ b/manager/client/src/main/resources/org/openremote/manager/client/i18n/ManagerMessages.properties@@ -98,11 +98,13 @@ showHistory=Show historysort=SortassetTypeLabel = Unknown asset typeassetTypeLabel[CUSTOM] = Custom-assetTypeLabel[AGENT] = Agent-assetTypeLabel[DEVICE] = Device+assetTypeLabel[TENANT] = Tenant+assetTypeLabel[GROUP] = GroupassetTypeLabel[BUILDING] = BuildingassetTypeLabel[FLOOR] = FloorassetTypeLabel[ROOM] = Room+assetTypeLabel[AGENT] = Agent+assetTypeLabel[THING] = ThingnoTypeSelected= No type selectedenterCustomAssetType=Enter a custom type valuedeviceKey= Device keydiff --git a/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetAttributeMeta.java b/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetAttributeMeta.javaindex 39db6d0f8..8df624897 100644--- a/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetAttributeMeta.java+++ b/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetAttributeMeta.java@@ -42,7 +42,12 @@ public enum AssetAttributeMeta {LABEL("urn:openremote:asset:meta:label", false),/**- * A human-friendly string describing the purpose of an attribute.+ * Format string that can be used to render the attribute value, see {@link java.util.Formatter}.+ */+ FORMAT("urn:openremote:asset:meta:format", true),++ /**+ * A human-friendly string describing the purpose of an attribute, useful when rendering editors.*/DESCRIPTION("urn:openremote:asset:meta:description", false),@@ -51,10 +56,35 @@ public enum AssetAttributeMeta {*/ABOUT("urn:openremote:asset:meta:about"),+ /**+ * Marks the attribute as read-only.+ */+ READ_ONLY("urn:openremote:asset:meta:readOnly", true),+/*** Default value that might be used when editing an attribute.*/- DEFAULT("urn:openremote:asset:meta:default", false);+ DEFAULT("urn:openremote:asset:meta:default", false),++ /**+ * Minimum range constraint for numeric attribute values.+ */+ RANGE_MIN("urn:openremote:asset:meta:rangeMin", true),++ /**+ * Maximum range constraint for numeric attribute values.+ */+ RANGE_MAX("urn:openremote:asset:meta:rangeMax", true),++ /**+ * Step increment/decrement constraint for numeric attribute values.+ */+ STEP("urn:openremote:asset:meta:step", true),++ /**+ * Regex (Java syntax) constraint for string attribute values.+ */+ PATTERN("urn:openremote:asset:meta:pattern", true);final protected String name;final protected boolean editable;diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetType.java b/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetType.javaindex 71a301ad9..832d2832b 100644--- a/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetType.java+++ b/manager/shared/src/main/java/org/openremote/manager/shared/asset/AssetType.java@@ -79,7 +79,11 @@ public enum AssetType {FLOOR("urn:openremote:asset:floor", true, null),- ROOM("urn:openremote:asset:room", true, null);+ ROOM("urn:openremote:asset:room", true, null),++ AGENT("urn:openremote:asset:agent", true, null),++ THING("urn:openremote:asset:thing", true, null);final protected String value;final protected boolean editable;diff --git a/manager/shared/src/main/java/org/openremote/manager/shared/attribute/AttributeType.java b/manager/shared/src/main/java/org/openremote/manager/shared/attribute/AttributeType.javaindex 1508a5a3a..523bdb5eb 100644--- a/manager/shared/src/main/java/org/openremote/manager/shared/attribute/AttributeType.java+++ b/manager/shared/src/main/java/org/openremote/manager/shared/attribute/AttributeType.java@@ -26,14 +26,16 @@ public enum AttributeType {OBJECT("Object", JsonType.OBJECT),STRING("String", JsonType.STRING),INTEGER("Integer", JsonType.NUMBER),- FLOAT("Float", JsonType.NUMBER),+ DECIMAL("Decimal", JsonType.NUMBER),BOOLEAN("Boolean", JsonType.BOOLEAN),OBJECT_ARRAY("Object[]", JsonType.ARRAY),STRING_ARRAY("String[]", JsonType.ARRAY),INTEGER_ARRAY("Integer[]", JsonType.ARRAY),- FLOAT_ARRAY("Float[]", JsonType.ARRAY),+ DECIMAL_ARRAY("Decimal[]", JsonType.ARRAY),BOOLEAN_ARRAY("Boolean[]", JsonType.ARRAY),- DATETIME("DateTime", JsonType.STRING);+ TIMESTAMP("Timestamp", JsonType.STRING), // Unix timestamp+ DATE("Date", JsonType.STRING), // ISO 8601, e.g. "2012-04-23T18:25:43.511Z"+ COLOR("Color", JsonType.OBJECT); // RGB integersprivate String value;private JsonType jsonType;