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
Model descriptor cleanup and icon fixes (using Material Design Icons)
Rich Turnerb7905e31f537
diff --git a/model/src/main/java/org/openremote/model/asset/AssetDescriptor.java b/model/src/main/java/org/openremote/model/asset/AssetDescriptor.javaindex 80fb6ac82..4521f8a47 100644--- a/model/src/main/java/org/openremote/model/asset/AssetDescriptor.java+++ b/model/src/main/java/org/openremote/model/asset/AssetDescriptor.java@@ -24,6 +24,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;import com.fasterxml.jackson.databind.annotation.JsonDeserialize;import org.openremote.model.attribute.AttributeDescriptor;+/**+ * Describes an {@link Asset} that can be added to the manager; the {@link #getType()} is the unique identifier.+ * <p>+ * A custom project can add its own descriptors through {@link org.openremote.model.asset.AssetModelProvider}.+ * <p>+ */@JsonFormat(shape = JsonFormat.Shape.OBJECT)@JsonDeserialize(as = AssetDescriptorImpl.class)public interface AssetDescriptor {@@ -32,10 +38,6 @@ public interface AssetDescriptor {String getName();@JsonPropertyString getType();-- /**- * A HEX RGB color value {@link org.openremote.model.attribute.AttributeValueType#COLOR_HEX}- */@JsonPropertyString getIcon();@JsonPropertydiff --git a/model/src/main/java/org/openremote/model/asset/AssetTreeNode.java b/model/src/main/java/org/openremote/model/asset/AssetTreeNode.javaindex e29ab0c14..9a11e44b9 100644--- a/model/src/main/java/org/openremote/model/asset/AssetTreeNode.java+++ b/model/src/main/java/org/openremote/model/asset/AssetTreeNode.java@@ -24,9 +24,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;import java.util.Arrays;-/**- * This is used to store {@link Asset} hierarchy information before {@link Asset}s have been assigned IDs- */public class AssetTreeNode {public Asset asset;diff --git a/model/src/main/java/org/openremote/model/asset/AssetType.java b/model/src/main/java/org/openremote/model/asset/AssetType.javaindex a81f83512..139ba0e4f 100644--- a/model/src/main/java/org/openremote/model/asset/AssetType.java+++ b/model/src/main/java/org/openremote/model/asset/AssetType.java@@ -36,24 +36,24 @@ public enum AssetType implements AssetDescriptor {CUSTOM(null, "cube", null),- BUILDING(ASSET_NAMESPACE + ":building", "building", null,+ BUILDING(ASSET_NAMESPACE + ":building", "office-building", null,SURFACE_AREA,GEO_STREET,GEO_CITY,GEO_COUNTRY,GEO_POSTAL_CODE),- FLOOR(ASSET_NAMESPACE + ":floor", "bars", null),+ FLOOR(ASSET_NAMESPACE + ":floor", "stairs", null),RESIDENCE(ASSET_NAMESPACE + ":residence", "home", null),- ROOM(ASSET_NAMESPACE + ":room", "door-open", null),+ ROOM(ASSET_NAMESPACE + ":room", "door", null),AGENT(ASSET_NAMESPACE + ":agent", "cogs", null),- CONSOLE(ASSET_NAMESPACE + ":console", "bullseye", null),+ CONSOLE(ASSET_NAMESPACE + ":console", "monitor-cellphone", null),- THING(ASSET_NAMESPACE + ":thing", "cube", null);+ THING(ASSET_NAMESPACE + ":thing", "cube-outline", null);final protected String type;final protected String icon;diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeDescriptor.java b/model/src/main/java/org/openremote/model/attribute/AttributeDescriptor.javaindex b2c8433bb..5c23a4e85 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeDescriptor.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeDescriptor.java@@ -24,6 +24,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;import com.fasterxml.jackson.databind.annotation.JsonDeserialize;import org.openremote.model.value.Value;+/**+ * Describes an {@link Attribute} that can be added to an {@link org.openremote.model.asset.Asset};+ * the {@link #getAttributeName} is the unique identifier.+ * <p>+ * A custom project can add its own descriptors through {@link org.openremote.model.asset.AssetModelProvider}.+ * <p>+ */@JsonDeserialize(as = AttributeDescriptorImpl.class)@JsonFormat(shape = JsonFormat.Shape.OBJECT)public interface AttributeDescriptor {diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeType.java b/model/src/main/java/org/openremote/model/attribute/AttributeType.javaindex 6689568a8..2cc053f4b 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeType.java@@ -20,10 +20,16 @@package org.openremote.model.attribute;import org.openremote.model.value.Value;+import org.openremote.model.value.ValueType;import org.openremote.model.value.Values;+import static org.openremote.model.Constants.ASSET_META_NAMESPACE;+import static org.openremote.model.attribute.MetaItemDescriptorImpl.metaItemObject;import static org.openremote.model.attribute.MetaItemType.*;+/**+ * This describes generic {@link Attribute}s that can be used on any {@link org.openremote.model.asset.Asset}.+ */public enum AttributeType implements AttributeDescriptor {CONSOLE_NAME("consoleName", AttributeValueType.STRING),@@ -37,30 +43,37 @@ public enum AttributeType implements AttributeDescriptor {EMAIL("email", AttributeValueType.EMAIL, LABEL.withInitialValue(Values.create("Email"))),GEO_CITY("city", AttributeValueType.STRING,- LABEL.withInitialValue(Values.create("City")),- ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoCity"))),+ LABEL.withInitialValue(Values.create("City")),+ ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoCity"))),GEO_COUNTRY("country", AttributeValueType.STRING,- LABEL.withInitialValue(Values.create("Country")),- ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoCountry"))),+ LABEL.withInitialValue(Values.create("Country")),+ ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoCountry"))),GEO_POSTAL_CODE("postalCode", AttributeValueType.NUMBER,- LABEL.withInitialValue(Values.create("Postal Code")),- ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoPostalCode"))),+ LABEL.withInitialValue(Values.create("Postal Code")),+ ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoPostalCode"))),GEO_STREET("street", AttributeValueType.STRING,- LABEL.withInitialValue(Values.create("Street")),- ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoStreet"))),+ LABEL.withInitialValue(Values.create("Street")),+ ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/geoStreet"))),LOCATION("location", AttributeValueType.GEO_JSON_POINT, LABEL.withInitialValue(Values.create("Location"))),- SURFACE_AREA(- "surfaceArea",- AttributeValueType.NUMBER,- LABEL.withInitialValue(Values.create("Surface Area")),- DESCRIPTION.withInitialValue(Values.create("Floor area of building measured in m²")),- ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/area")));-+ SURFACE_AREA("surfaceArea", AttributeValueType.NUMBER,+ LABEL.withInitialValue(Values.create("Surface Area")),+ DESCRIPTION.withInitialValue(Values.create("Floor area of building measured in m²")),+ ABOUT.withInitialValue(Values.create("http://project-haystack.org/tag/area"))),++ STATUS(+ "status", AttributeValueType.ASSET_STATUS,+ LABEL.withInitialValue(Values.create("Asset Status")),+ DESCRIPTION.withInitialValue(Values.create("Defines an arbitrary status for the containing asset")),+ metaItemObject(+ ASSET_META_NAMESPACE + ":assetStatusColors",+ new Access(true, false, true),+ false,+ null));final protected String attributeName;final protected AttributeValueDescriptor valueDescriptor;diff --git a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.javaindex 04e820019..b47fbf252 100644--- a/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java+++ b/model/src/main/java/org/openremote/model/attribute/AttributeValueType.java@@ -202,7 +202,9 @@ public enum AttributeValueType implements AttributeValueDescriptor {),// TODO Implement "Saved Filter/Searches" properly, see AssetResourceImpl- RULES_TEMPLATE_FILTER("filter", ValueType.ARRAY);+ RULES_TEMPLATE_FILTER("filter", ValueType.ARRAY),++ ASSET_STATUS("heart-pulse", ValueType.STRING);public enum AttributeValueTypeFailureReason implements ValidationFailure.Reason {diff --git a/model/src/main/java/org/openremote/model/attribute/MetaItemDescriptor.java b/model/src/main/java/org/openremote/model/attribute/MetaItemDescriptor.javaindex fa5912aa3..82d32a415 100644--- a/model/src/main/java/org/openremote/model/attribute/MetaItemDescriptor.java+++ b/model/src/main/java/org/openremote/model/attribute/MetaItemDescriptor.java@@ -34,7 +34,14 @@ import org.openremote.model.value.ValueType;import java.util.Objects;import java.util.Optional;import java.util.function.Function;-+/**+ * Describes a {@link MetaItem} that can be added to an {@link Attribute}; the URN should be URI and is the unique+ * identifier.+ * <p>+ * A custom project can add its own descriptors through {@link org.openremote.model.asset.AssetModelProvider}.+ * <p>+ * TODO https://people.eecs.berkeley.edu/~arka/papers/buildsys2015_metadatasurvey.pdf+ */@JsonFormat(shape = JsonFormat.Shape.OBJECT)@JsonDeserialize(as = MetaItemDescriptorImpl.class)public interface MetaItemDescriptor extends HasUniqueResourceName {diff --git a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java b/model/src/main/java/org/openremote/model/attribute/MetaItemType.javaindex 8ff6cb4e6..d91735f8e 100644--- a/model/src/main/java/org/openremote/model/attribute/MetaItemType.java+++ b/model/src/main/java/org/openremote/model/attribute/MetaItemType.java@@ -39,12 +39,7 @@ import static org.openremote.model.util.TextUtil.REGEXP_PATTERN_DOUBLE;import static org.openremote.model.util.TextUtil.REGEXP_PATTERN_INTEGER_POSITIVE_NON_ZERO;/**- * Asset attribute meta item name is an arbitrary string. It should be URI. This enum contains the well-known URIs for- * functionality we can depend on in our platform.- * <p>- * A custom project can add its own asset meta items through {@link AssetModelProvider}.- * <p>- * TODO https://people.eecs.berkeley.edu/~arka/papers/buildsys2015_metadatasurvey.pdf+ * This describes generic {@link MetaItem}s that can be used on any {@link Attribute}.*/public enum MetaItemType implements MetaItemDescriptor {