diff --git a/bundles/config/org.eclipse.smarthome.config.core.test/src/test/groovy/org/eclipse/smarthome/config/core/test/ConfigDescriptionParameterBuilderTest.groovy b/bundles/config/org.eclipse.smarthome.config.core.test/src/test/groovy/org/eclipse/smarthome/config/core/test/ConfigDescriptionParameterBuilderTest.groovy index 10dc9f558fb..fbd7828b8eb 100644 --- a/bundles/config/org.eclipse.smarthome.config.core.test/src/test/groovy/org/eclipse/smarthome/config/core/test/ConfigDescriptionParameterBuilderTest.groovy +++ b/bundles/config/org.eclipse.smarthome.config.core.test/src/test/groovy/org/eclipse/smarthome/config/core/test/ConfigDescriptionParameterBuilderTest.groovy @@ -28,6 +28,7 @@ class ConfigDescriptionParameterBuilderTest { def max = new BigDecimal(4.0); def stepSize = new BigDecimal(1.0); def pattern = "pattern" + def verify = true; def required = false def readOnly = true def multiple = false @@ -67,6 +68,7 @@ class ConfigDescriptionParameterBuilderTest { .withMultipleLimit(multipleLimit) .withUnit(unit) .withUnitLabel(unitLabel) + .withVerify(verify) .build(); assertThat param.getMinimum(), is(min) assertThat param.getMaximum(), is(max) @@ -85,6 +87,7 @@ class ConfigDescriptionParameterBuilderTest { assertFalse param.isRequired() assertTrue param.isReadOnly() assertFalse param.isMultiple() + assertTrue param.isVerifyable() assertFalse param.isAdvanced() assertTrue param.getLimitToOptions() @@ -102,6 +105,7 @@ class ConfigDescriptionParameterBuilderTest { .withRequired(null) .withReadOnly(null) .withMultiple(null) + .withVerify(null) .withContext(null) .withDefault(null) .withLabel(null) @@ -141,7 +145,7 @@ class ConfigDescriptionParameterBuilderTest { null, null, null, null, null, null, null, null, null, null, null, null, null,null, - null, null, null) + null, null, null, null) assertFalse param2.isRequired() assertFalse param2.isReadOnly() assertFalse param2.isMultiple() diff --git a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameter.java b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameter.java index 6014ec8de2f..6c4623ef81b 100644 --- a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameter.java +++ b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameter.java @@ -25,7 +25,7 @@ * @author Alex Tugarev - Added options, filter criteria, and more parameter * attributes * @author Chris Jackson - Added groupId, limitToOptions, advanced, - * multipleLimit, critical attributes + * multipleLimit, verify attributes * @author Christoph Knauf - Added default constructor, changed Boolean * getter to return primitive types * @author Thomas Höfer - Added unit @@ -90,7 +90,7 @@ public enum Type { private boolean limitToOptions = false; private boolean advanced = false; - private boolean critical = false; + private boolean verify = false; private static final Set UNITS = Collections .unmodifiableSet(new HashSet(Arrays.asList("A", "cd", "K", "kg", "m", "mol", "s", "g", "rad", "sr", @@ -198,7 +198,7 @@ public ConfigDescriptionParameter(String name, Type type) throws IllegalArgument String pattern, Boolean required, Boolean readOnly, Boolean multiple, String context, String defaultValue, String label, String description, List options, List filterCriteria, String groupName, Boolean advanced, Boolean limitToOptions, Integer multipleLimit, String unit, - String unitLabel, Boolean critical) throws IllegalArgumentException { + String unitLabel, Boolean verify) throws IllegalArgumentException { if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("The name must neither be null nor empty!"); @@ -230,8 +230,10 @@ public ConfigDescriptionParameter(String name, Type type) throws IllegalArgument this.multipleLimit = multipleLimit; this.unit = unit; this.unitLabel = unitLabel; - this.critical = critical; + if (verify != null) { + this.verify = verify; + } if (readOnly != null) { this.readOnly = readOnly; } @@ -459,13 +461,13 @@ public String getUnitLabel() { } /** - * Returns the critical flag for this parameter. Critical parameters are considered dangerous and the user should be + * Returns the verify flag for this parameter. Verify parameters are considered dangerous and the user should be * alerted with an "Are you sure" flag in the UI. * - * @return true if the parameter is considered critical + * @return true if the parameter requires verification in the UI */ - public Boolean isCritical() { - return critical; + public Boolean isVerifyable() { + return verify; } @Override @@ -510,6 +512,10 @@ public String toString() { sb.append("required="); sb.append(required); + sb.append(", "); + sb.append("verify="); + sb.append(verify); + sb.append(", "); sb.append("multiple="); sb.append(multiple); diff --git a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilder.java b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilder.java index 4ba0cbfa1e9..f5ac37ea009 100644 --- a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilder.java +++ b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilder.java @@ -45,7 +45,7 @@ public class ConfigDescriptionParameterBuilder { private Boolean limitToOptions; private Boolean advanced; - private Boolean critical; + private Boolean verify; private List options = new ArrayList(); private List filterCriteria = new ArrayList(); @@ -207,12 +207,12 @@ public ConfigDescriptionParameterBuilder withAdvanced(Boolean advanced) { } /** - * Set the configuration parameter as a critical parameter + * Set the configuration parameter as a verifyable parameter * - * @param critical flag + * @param verify flag */ - public ConfigDescriptionParameterBuilder withCritical(Boolean critical) { - this.critical = critical; + public ConfigDescriptionParameterBuilder withVerify(Boolean verify) { + this.verify = verify; return this; } @@ -278,7 +278,7 @@ public ConfigDescriptionParameterBuilder withUnitLabel(String unitLabel) { public ConfigDescriptionParameter build() throws IllegalArgumentException { return new ConfigDescriptionParameter(name, type, min, max, step, pattern, required, readOnly, multiple, context, defaultValue, label, description, options, filterCriteria, groupName, advanced, limitToOptions, - multipleLimit, unit, unitLabel, critical); + multipleLimit, unit, unitLabel, verify); } } diff --git a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistry.java b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistry.java index 57af310a14f..25535a77405 100644 --- a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistry.java +++ b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionRegistry.java @@ -228,7 +228,7 @@ private ConfigDescriptionParameter getConfigOptions(URI uri, ConfigDescriptionPa parameter.getLabel(), parameter.getDescription(), options, parameter.getFilterCriteria(), parameter.getGroupName(), parameter.isAdvanced(), parameter.getLimitToOptions(), parameter.getMultipleLimit(), parameter.getUnit(), parameter.getUnitLabel(), - parameter.isCritical()); + parameter.isVerifyable()); } else { // Otherwise return the original parameter return parameter; diff --git a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/dto/ConfigDescriptionDTOMapper.java b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/dto/ConfigDescriptionDTOMapper.java index 5b3013dc8ab..30ebc502302 100644 --- a/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/dto/ConfigDescriptionDTOMapper.java +++ b/bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/dto/ConfigDescriptionDTOMapper.java @@ -62,7 +62,7 @@ public static List mapParameters(List options, List filterCriteria, String groupName, Boolean advanced, Boolean limitToOptions, - Integer multipleLimit, String unit, String unitLabel, Boolean critical) { + Integer multipleLimit, String unit, String unitLabel, Boolean verify) { this.name = name; this.type = type; this.min = minimum; @@ -76,7 +76,7 @@ public ConfigDescriptionParameterDTO(String name, Type type, BigDecimal minimum, this.multipleLimit = multipleLimit; this.unit = unit; this.unitLabel = unitLabel; - this.critical = critical; + this.verify = verify; } } diff --git a/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/groovy/org/eclipse/smarthome/config/xml/test/ConfigDescriptionsTest.groovy b/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/groovy/org/eclipse/smarthome/config/xml/test/ConfigDescriptionsTest.groovy index b7539abd08f..86eb17026a4 100644 --- a/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/groovy/org/eclipse/smarthome/config/xml/test/ConfigDescriptionsTest.groovy +++ b/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/groovy/org/eclipse/smarthome/config/xml/test/ConfigDescriptionsTest.groovy @@ -105,6 +105,7 @@ class ConfigDescriptionsTest extends OSGiTest { assertThat min, is(8 as BigDecimal) assertThat max, is(16 as BigDecimal) assertThat required, is(true) + assertThat verify, is(true) assertThat multiple, is(false) assertThat readOnly, is(false) assertThat context, is("password") @@ -133,6 +134,7 @@ class ConfigDescriptionsTest extends OSGiTest { assertThat max, is(3 as BigDecimal) assertThat options, is(notNullValue()) assertThat advanced, is(false) + assertThat verify, is(false) assertThat limitToOptions, is(true) assertThat multipleLimit, is(null) assertThat options.join(", "), is("ParameterOption [value=\"key1\", label=\"label1\"], ParameterOption [value=\"key2\", label=\"label2\"]") diff --git a/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/resources/test-bundle-pool/ConfigDescriptionsTest.bundle/ESH-INF/config/config.xml b/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/resources/test-bundle-pool/ConfigDescriptionsTest.bundle/ESH-INF/config/config.xml index 7fa50a7e7cc..ec9bb6a83ff 100644 --- a/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/resources/test-bundle-pool/ConfigDescriptionsTest.bundle/ESH-INF/config/config.xml +++ b/bundles/config/org.eclipse.smarthome.config.xml.test/src/test/resources/test-bundle-pool/ConfigDescriptionsTest.bundle/ESH-INF/config/config.xml @@ -41,6 +41,7 @@ password true + true diff --git a/bundles/config/org.eclipse.smarthome.config.xml/config-description-1.0.0.xsd b/bundles/config/org.eclipse.smarthome.config.xml/config-description-1.0.0.xsd index dba8a31261b..91048f6d5c9 100644 --- a/bundles/config/org.eclipse.smarthome.config.xml/config-description-1.0.0.xsd +++ b/bundles/config/org.eclipse.smarthome.config.xml/config-description-1.0.0.xsd @@ -53,7 +53,7 @@ - + diff --git a/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionParameterConverter.java b/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionParameterConverter.java index 9cf252b6b55..7b410a42429 100644 --- a/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionParameterConverter.java +++ b/bundles/config/org.eclipse.smarthome.config.xml/src/main/java/org/eclipse/smarthome/config/xml/ConfigDescriptionParameterConverter.java @@ -113,7 +113,7 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co String description = valueMap.getString("description"); Boolean advanced = valueMap.getBoolean("advanced", false); - Boolean critical = valueMap.getBoolean("critical", false); + Boolean verify = valueMap.getBoolean("verify", false); Boolean limitToOptions = valueMap.getBoolean("limitToOptions", true); Integer multipleLimit = valueMap.getInteger("multipleLimit"); String unitLabel = null; @@ -131,9 +131,8 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co .withStepSize(step).withPattern(patternString).withRequired(required).withReadOnly(readOnly) .withMultiple(multiple).withContext(parameterContext).withDefault(defaultValue).withLabel(label) .withDescription(description).withOptions(options).withFilterCriteria(filterCriteria) - .withGroupName(groupName).withAdvanced(advanced).withCritical(critical) - .withLimitToOptions(limitToOptions).withMultipleLimit(multipleLimit).withUnit(unit) - .withUnitLabel(unitLabel).build(); + .withGroupName(groupName).withAdvanced(advanced).withVerify(verify).withLimitToOptions(limitToOptions) + .withMultipleLimit(multipleLimit).withUnit(unit).withUnitLabel(unitLabel).build(); return configDescriptionParam; } diff --git a/docs/documentation/development/bindings/xml-reference.md b/docs/documentation/development/bindings/xml-reference.md index 800e9e2059b..a54411c3b7c 100644 --- a/docs/documentation/development/bindings/xml-reference.md +++ b/docs/documentation/development/bindings/xml-reference.md @@ -87,7 +87,7 @@ The following HTML tags are allowed -: ```,
, ,

,

,

,

parameter.groupNameSets a group name for this parameter (optional). parameter.unitSpecifies the unit of measurements. The unit declaration in the parameter definition shown above contains the set of valid units. The unit must only be set if the type of the parameter is either integer or decimal (optional). advancedSpecifies that this is an advanced parameter. Advanced parameters may be hidden by a UI (optional). - criticalSpecifies that this is a critical parameter. Critical parameters may be considered dangerous and should be protected from accidental use by a UI - eg by adding an "Are you sure" prompt (optional). + verifySpecifies that this is parameter requires a verification stage with the user before sending. Parameters flagged with *verify=true* could be considered dangerous and should be protected from accidental use by a UI - eg by adding an "Are you sure" prompt (optional). contextThe context of the configuration parameter (optional). requiredThe flag indicating if the configuration parameter has to be set or not (deprecated, optional, default: false). defaultThe default value of the configuration parameter (optional).