From 59056cc8ff06550ca0d5dcd9af69fe9007a0ff14 Mon Sep 17 00:00:00 2001 From: "osh.silva" Date: Tue, 3 Sep 2024 00:40:45 +0530 Subject: [PATCH] Add tooltip component to features --- .../mgt/core/device/mgt/common/Feature.java | 17 +++++++++++ .../HTTPDeviceTypeManagerService.java | 3 ++ .../device/type/template/config/Feature.java | 29 +++++++++++++++++++ .../ConfigurationBasedFeatureManager.java | 3 ++ 4 files changed, 52 insertions(+) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java index 399389271e..800d142c3e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Feature.java @@ -58,6 +58,13 @@ public class Feature implements Serializable { ) private String description; + @ApiModelProperty( + name = "tooltip", + value = "Provides a tooltip for the features.", + required = false + ) + private String tooltip; + @ApiModelProperty( name = "type", value = "Type of the feature.", @@ -139,6 +146,16 @@ public class Feature implements Serializable { this.description = description; } + @XmlElement + public String getTooltip() { + return tooltip; + } + + public void setTooltip(String tooltip) { + this.tooltip = tooltip; + } + + @XmlAttribute public String getType() { return type; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java index 1956962d08..25e3664adc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java @@ -68,6 +68,9 @@ public class HTTPDeviceTypeManagerService extends DeviceTypeManagerService imple if (feature.getCode() != null && feature.getName() != null) { configFeature.setCode(feature.getCode()); configFeature.setDescription(feature.getDescription()); + if (feature.getTooltip() != null) { + configFeature.setTooltip(feature.getTooltip()); + } configFeature.setName(feature.getName()); if (feature.getMetadataEntries() != null && feature.getMetadataEntries().size() > 0) { List metaValues = new ArrayList<>(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java index 92797621fd..4f20701ef3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java @@ -45,6 +45,7 @@ import java.util.List; @XmlType(name = "Feature", propOrder = { "name", "description", + "tooltip", "operation", "metaData" }) @@ -56,6 +57,9 @@ public class Feature { @XmlElement(name = "Description", required = true) protected String description; + @XmlElement(name = "Tooltip", required = false) + protected String tooltip; + @XmlElement(name = "Operation") protected Operation operation; @@ -117,6 +121,31 @@ public class Feature { this.description = value; } + /** + * Gets the value of the tooltip property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTooltip() { + return tooltip; + } + + /** + * Sets the value of the tooltip property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTooltip(String value) { + this.tooltip = value; + } + + /** * Gets the value of the operation property. * diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java index 4db0d7d108..461eba7776 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java @@ -60,6 +60,9 @@ public class ConfigurationBasedFeatureManager implements FeatureManager { deviceFeature.setCode(feature.getCode()); deviceFeature.setName(feature.getName()); deviceFeature.setDescription(feature.getDescription()); + if (feature.getTooltip() != null) { + deviceFeature.setTooltip(feature.getTooltip()); + } deviceFeature.setType(feature.getType()); Operation operation = feature.getOperation(); List metadataEntries = null;