Skip to content
Permalink
Browse files

Fixed compiler warnings

  • Loading branch information...
Christian Bauer
Christian Bauer committed Jun 4, 2019
1 parent 37d2911 commit 191cd0e5fc2ae7b9a69ecce6494e31f8271f72be
@@ -219,7 +219,7 @@ protected void showAssetInfoItems() {


infoItems.add(0, new MapInfoItem(
"map-marker",
"map-marker-alt",
environment.getMessages().location(),
null,
Values.create(getCoordinatesLabel())
@@ -43,17 +43,17 @@
GEO_COUNTRY,
GEO_POSTAL_CODE),

FLOOR(ASSET_NAMESPACE + ":floor", "server"),
FLOOR(ASSET_NAMESPACE + ":floor", "bars"),

RESIDENCE(ASSET_NAMESPACE + ":residence", "home"),

ROOM(ASSET_NAMESPACE + ":room", "office"),
ROOM(ASSET_NAMESPACE + ":room", "door-open"),

AGENT(ASSET_NAMESPACE + ":agent", "cogs"),

CONSOLE(ASSET_NAMESPACE + ":console", "cellphone-android"),
CONSOLE(ASSET_NAMESPACE + ":console", "bullseye"),

THING(ASSET_NAMESPACE + ":thing", "settings");
THING(ASSET_NAMESPACE + ":thing", "cube");

final protected String type;
final protected String icon;
@@ -42,20 +42,20 @@
*/
public enum AttributeValueType implements AttributeValueDescriptor {

STRING("format-text", ValueType.STRING),
STRING("edit", ValueType.STRING),

NUMBER("numeric", ValueType.NUMBER),
NUMBER("hashtag", ValueType.NUMBER),

BOOLEAN("toggle-switch", ValueType.BOOLEAN),
BOOLEAN("toggle-on", ValueType.BOOLEAN),

OBJECT("cube", ValueType.OBJECT),

ARRAY("code-array", ValueType.ARRAY),
ARRAY("bars", ValueType.ARRAY),

// TODO Implement "Saved Filter/Searches" properly, see AssetResourceImpl
RULES_TEMPLATE_FILTER("filter", ValueType.ARRAY),

PERCENTAGE("percent", ValueType.NUMBER,
PERCENTAGE("percentage", ValueType.NUMBER,
value -> Values.getNumber(value)
.filter(number -> number < 0 || number > 100)
.map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),
@@ -64,7 +64,7 @@
FORMAT.withInitialValue(Values.create("%3d %%"))
),

LEVEL_UINT8("level", ValueType.NUMBER,
LEVEL_UINT8("ruler-vertical", ValueType.NUMBER,
value -> Values.getNumber(value)
.filter(number -> number < 0 || number > 255)
.map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID)),
@@ -73,57 +73,57 @@
FORMAT.withInitialValue(Values.create("%3d"))
),

TIMESTAMP_MILLIS("clock-o", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d ms"))),
TIMESTAMP_MILLIS("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d ms"))),

TIMESTAMP_SECONDS("clock-o", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d s"))),
TIMESTAMP_SECONDS("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d s"))),

TIME_SECONDS("clock-outline", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f s"))),
TIME_SECONDS("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f s"))),

TIME_MINUTES("clock-outline", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f min"))),
TIME_MINUTES("clock", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f min"))),

DATETIME("calendar", ValueType.STRING),
DATETIME("calendar-alt", ValueType.STRING),

COLOR_RGB("brush", ValueType.ARRAY, value -> Values.getArray(value)
COLOR_RGB("palette", ValueType.ARRAY, value -> Values.getArray(value)
.filter(array -> array.length() != 3)
.map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))
),

COLOR_ARGB("brush", ValueType.ARRAY, value -> Values.getArray(value)
COLOR_ARGB("palette", ValueType.ARRAY, value -> Values.getArray(value)
.filter(array -> array.length() != 4)
.map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))
),

COLOR_HEX("brush", ValueType.STRING, value -> Values.getString(value)
COLOR_HEX("palette", ValueType.STRING, value -> Values.getString(value)
.filter(s -> !s.matches("[a-fA-F0-9]{6}"))
.map(array -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_INVALID_COLOR_FORMAT))
),

SOUND_DB("ear-hearing", ValueType.NUMBER, value -> Values.getNumber(value)
SOUND_DB("headphone", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(n -> n < 0)
.map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_SOUND_OUT_OF_RANGE)),
FORMAT.withInitialValue(Values.create("%d dB"))
),

TEMPERATURE_CELCIUS("thermometer", ValueType.NUMBER, value -> Values.getNumber(value)
TEMPERATURE_CELCIUS("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(n -> n < -273.15)
.map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE)),
FORMAT.withInitialValue(Values.create("%0.1f C")
)
),

TEMPERATURE_KELVIN("thermometer", ValueType.NUMBER, value -> Values.getNumber(value)
TEMPERATURE_KELVIN("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(n -> n < 0)
.map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE))
),

TEMPERATURE_FAHRENHEIT("thermometer", ValueType.NUMBER, value -> Values.getNumber(value)
TEMPERATURE_FAHRENHEIT("temperature-high", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(n -> n < -459.67)
.map(n -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_TEMPERATURE_OUT_OF_RANGE))
),

RAINFALL("water", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f mm/h"))),

BRIGHTNESS_LUX("white-balance-sunny", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d lx"))),
BRIGHTNESS_LUX("lightbulb", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%d lx"))),

DISTANCE_M("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f m"))),

@@ -137,61 +137,61 @@

DISTANCE_YARD("ruler", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f yd"))),

SPEED_MS("speedometer", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.3f m/s"))),
SPEED_MS("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.3f m/s"))),

SPEED_KPH("speedometer", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f km/h"))),
SPEED_KPH("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f km/h"))),

SPEED_MPH("speedometer", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f mi/h"))),
SPEED_MPH("circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f mi/h"))),

CO2_PPM("leaf", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%4d ppm"))),

HUMIDITY_PERCENTAGE("water-percent", ValueType.NUMBER, value -> Values.getNumber(value)
HUMIDITY_PERCENTAGE("water", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(number -> number < 0 || number > 100)
.map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),
RANGE_MIN.withInitialValue(Values.create(0)),
RANGE_MAX.withInitialValue(Values.create(100)),
FORMAT.withInitialValue(Values.create("%3d %%"))
),

HUMIDITY_GPCM("water-percent", ValueType.NUMBER),
HUMIDITY_GPCM("water", ValueType.NUMBER),

POWER_WATT("flash", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f W"))),
POWER_WATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f W"))),

POWER_KILOWATT("flash", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KW"))),
POWER_KILOWATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KW"))),

POWER_MEGAWATT("flash", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MW"))),
POWER_MEGAWATT("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MW"))),

POWER_PERCENTAGE("flash", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%3d %%"))),
POWER_PERCENTAGE("bolt", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%3d %%"))),

CHARGE_PERCENTAGE("battery", ValueType.NUMBER, value -> Values.getNumber(value)
CHARGE_PERCENTAGE("battery-half", ValueType.NUMBER, value -> Values.getNumber(value)
.filter(number -> number < 0 || number > 100)
.map(number -> new ValidationFailure(ValueHolder.ValueFailureReason.VALUE_PERCENTAGE_OUT_OF_RANGE)),
RANGE_MIN.withInitialValue(Values.create(0)),
RANGE_MAX.withInitialValue(Values.create(100)),
FORMAT.withInitialValue(Values.create("%3d %%"))
),

CHARGE_KWH("battery", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),
CHARGE_KWH("battery-half", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),

ENERGY_KWH("power-plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),
ENERGY_KWH("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f KWh"))),

ENERGY_JOULE("power-plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f J"))),
ENERGY_JOULE("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f J"))),

ENERGY_MEGAJOULE("power-plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MJ"))),
ENERGY_MEGAJOULE("plug", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f MJ"))),

FLOW_LPM("gauge", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f L/m"))),
FLOW_LPM("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f L/m"))),

FLOW_CMPS("gauge", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f m³/s"))),
FLOW_CMPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f m³/s"))),

FLOW_CCMPS("gauge", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cm³/s"))),
FLOW_CCMPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cm³/s"))),

FLOW_CFPS("gauge", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cfs"))),
FLOW_CFPS("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f cfs"))),

FLOW_GPM("gauge", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f gpm"))),
FLOW_GPM("dot-circle", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.5f gpm"))),

DIRECTION_DECIMAL_DEGREES("compass", ValueType.NUMBER, FORMAT.withInitialValue(Values.create("%0.1f deg"))),

GEO_JSON_POINT("map-marker", ValueType.OBJECT),
GEO_JSON_POINT("map-marker-alt", ValueType.OBJECT),

EMAIL("at", ValueType.STRING, value -> Values.getString(value)
.filter(s -> !s.matches("(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"))
@@ -201,7 +201,7 @@
public enum AttributeValueTypeFailureReason implements ValidationFailure.Reason {
ATTRIBUTE_TYPE_VALUE_DOES_NOT_MATCH
}
public static final String DEFAULT_ICON = "circle-thin";
public static final String DEFAULT_ICON = "circle";
final protected String icon;
final protected ValueType valueType;
@JsonIgnore

0 comments on commit 191cd0e

Please sign in to comment.
You can’t perform that action at this time.