diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
index 57ebebd95e..082a4817ff 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml
@@ -103,6 +103,10 @@
org.wso2.carbon.governance
org.wso2.carbon.governance.lcm
+
+ javax.ws.rs
+ javax.ws.rs-api
+
@@ -150,6 +154,7 @@
org.wso2.carbon.registry.core.*
+ javax.ws.rs-api,
scribe;scope=compile|runtime;inline=false;
*
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/GadgetDataService.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/GadgetDataService.java
index ea61e05b83..c2b1b55a75 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/GadgetDataService.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/GadgetDataService.java
@@ -18,11 +18,11 @@
package org.wso2.carbon.device.mgt.analytics.dashboard;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.util.List;
@@ -35,222 +35,227 @@ public interface GadgetDataService {
/**
* This method is used to get a count of devices based on a defined filter set.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return An object of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @param extendedFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total device count in the system
+ * wrapped by the defined return format.
+ * @return An object of type DeviceCountByGroup.
+ * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
+ * value of extendedFilterSet is set with some
+ * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException;
+ DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/**
* This method is used to get a count of devices non-compliant upon on a particular feature
* and a defined filter set.
- * @param nonCompliantFeatureCode Code name of the non-compliant feature.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return An object of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
- * This can also occur if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @param featureCode Code name of the non-compliant feature.
+ * @param basicFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total non-compliant device count in the system
+ * for the given feature-code, wrapped by the defined return format.
+ * @return An object of type DeviceCountByGroup.
+ * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
+ DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
+ throws InvalidFeatureCodeValueException, DataAccessLayerException;
/**
* This method is used to get total count of devices currently enrolled under a particular tenant.
- * @return An object of type DeviceCountByGroupEntry.
+ * @return An object of type DeviceCountByGroup.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException;
+ DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException;
/**
* This method is used to get device counts classified by connectivity statuses.
- * @return A list of objects of type DeviceCountByGroupEntry.
+ * @return A list of objects of type DeviceCountByGroup.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
+ List getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
/**
* This method is used to get device counts classified by potential vulnerabilities.
- * @return A list of objects of type DeviceCountByGroupEntry.
+ * @return A list of objects of type DeviceCountByGroup.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
+ List getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
/**
* This method is used to get non-compliant device counts classified by individual features.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
- * @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values
- * lesser than their minimums.
+ * @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
+ * @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, DataAccessLayerException;
+ PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
+ InvalidStartIndexValueException, InvalidResultCountValueException, DataAccessLayerException;
/**
* This method is used to get device counts classified by platforms.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return An object of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values
- * lesser than their minimums.
+ * @param extendedFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total device counts per each platform in
+ * the system, wrapped by the defined return format.
+ * @return An object of type DeviceCountByGroup.
+ * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
+ * value of extendedFilterSet is set with some
+ * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getDeviceCountsByPlatforms(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException;
+ List getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/**
* This method is used to get device counts non-compliant upon a particular feature classified by platforms.
- * @param nonCompliantFeatureCode Code name of the non-compliant feature.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return A list of objects of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @param featureCode Code name of the non-compliant feature.
+ * @param basicFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total non-compliant device counts per each platform
+ * in the system, wrapped by the defined return format.
+ * @return A list of objects of type DeviceCountByGroup.
+ * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
+ List getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException;
/**
* This method is used to get device counts classified by ownership types.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return A list of objects of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
- * This can also occur if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @param extendedFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total device counts per each ownership
+ * type in the system, wrapped by the defined return format.
+ * @return A list of objects of type DeviceCountByGroup.
+ * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
+ * value of extendedFilterSet is set with some
+ * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getDeviceCountsByOwnershipTypes(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException;
+ List getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/**
- * This method is used to get device counts non-compliant upon a particular feature classified by ownership types.
- * @param nonCompliantFeatureCode Code name of the non-compliant feature.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return A list of objects of type DeviceCountByGroupEntry.
- * @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * This method is used to get device counts non-compliant upon a particular feature
+ * classified by ownership types.
+ * @param featureCode Code name of the non-compliant feature.
+ * @param basicFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total non-compliant device counts per each
+ * ownership type in the system, wrapped by the defined return format.
+ * @return A list of objects of type DeviceCountByGroup.
+ * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
+ List getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException;
/**
* This method is used to get a paginated list of devices with details, based on a defined filter set.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
+ * @param extendedFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined
+ * filtering options, this method would return a paginated device list in the
+ * system specified by result count, starting from specified start index, and
+ * wrapped by the defined return format.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
- * @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
- * This can also occur if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
+ * value of extendedFilterSet is set with some
+ * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
+ * @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
+ * @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
*/
@SuppressWarnings("unused")
- PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, DataAccessLayerException;
+ PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
+ InvalidStartIndexValueException, InvalidResultCountValueException;
/**
- * This method is used to get a paginated list of non-compliant devices with details, upon a particular feature.
- * @param nonCompliantFeatureCode Code name of the non-compliant feature.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
+ * This method is used to get a paginated list of non-compliant devices with details,
+ * upon a particular feature.
+ * @param featureCode Code name of the non-compliant feature.
+ * @param basicFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return a paginated device list in the system,
+ * non-compliant by specified feature-code, result count, starting from specified
+ * start index, and wrapped by the defined return format.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
- * @throws InvalidParameterValueException This can occur if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
- * This can also occur if startIndex or resultCount is set to values
- * lesser than their minimums.
+ * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
+ * @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
+ * @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
*/
@SuppressWarnings("unused")
- PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, DataAccessLayerException;
+ PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
+ int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException, InvalidStartIndexValueException,
+ InvalidResultCountValueException;
/**
* This method is used to get a list of devices with details, based on a defined filter set.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return A list of objects of type DetailedDeviceEntry.
- * @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
- * This can occur if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
- * This can also occur if startIndex or resultCount is set to values
- * lesser than their minimums.
+ * @param extendedFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total device list in the system
+ * wrapped by the defined return format.
+ * @return A list of objects of type DeviceWithDetails.
+ * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
+ * value of extendedFilterSet is set with some
+ * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getDevicesWithDetails(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException;
+ List getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/**
* This method is used to get a list of non-compliant devices with details, upon a particular feature.
- * @param nonCompliantFeatureCode Code name of the non-compliant feature.
- * @param filterSet An abstract representation of possible filtering options.
- * if this value is simply "null" or no values are set for the defined filtering options,
- * this method would return total device count in the system
- * wrapped with in the defined return format.
- * @return A list of objects of type DetailedDeviceEntry.
- * @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
- * is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
+ * @param featureCode Code name of the non-compliant feature.
+ * @param basicFilterSet An abstract representation of possible filtering options.
+ * if this value is simply "null" or no values are set for the defined filtering
+ * options, this method would return total set of non-compliant devices in the
+ * system upon given feature-code, wrapped by the defined return format.
+ * @return A list of objects of type DeviceWithDetails.
+ * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused")
- List getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
+ List getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/FilterSet.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/BasicFilterSet.java
similarity index 82%
rename from components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/FilterSet.java
rename to components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/BasicFilterSet.java
index 701b571877..901949ea84 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/FilterSet.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/BasicFilterSet.java
@@ -18,10 +18,9 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
-public class FilterSet {
+public class BasicFilterSet {
private String connectivityStatus;
- private String potentialVulnerability;
private String platform;
private String ownership;
@@ -33,14 +32,6 @@ public class FilterSet {
this.connectivityStatus = connectivityStatus;
}
- public String getPotentialVulnerability() {
- return potentialVulnerability;
- }
-
- public void setPotentialVulnerability(String potentialVulnerability) {
- this.potentialVulnerability = potentialVulnerability;
- }
-
public String getPlatform() {
return platform;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroupEntry.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroup.java
similarity index 97%
rename from components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroupEntry.java
rename to components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroup.java
index 85ecfe349c..43076fb0de 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroupEntry.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceCountByGroup.java
@@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
-public class DeviceCountByGroupEntry {
+public class DeviceCountByGroup {
private String group;
private String displayNameForGroup;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DetailedDeviceEntry.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceWithDetails.java
similarity index 98%
rename from components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DetailedDeviceEntry.java
rename to components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceWithDetails.java
index b12c242a11..becadff9c9 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DetailedDeviceEntry.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/DeviceWithDetails.java
@@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
-public class DetailedDeviceEntry {
+public class DeviceWithDetails {
private int deviceId;
private String deviceIdentification;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/ExtendedFilterSet.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/ExtendedFilterSet.java
new file mode 100644
index 0000000000..b68a441a90
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/bean/ExtendedFilterSet.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * you may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
+
+public class ExtendedFilterSet extends BasicFilterSet {
+
+ /*
+ * Following property is an abstract filter, introduced @ service layer,
+ * wrapping few (actual) low level database properties.
+ */
+ private String potentialVulnerability;
+
+ public String getPotentialVulnerability() {
+ return potentialVulnerability;
+ }
+
+ public void setPotentialVulnerability(String potentialVulnerability) {
+ this.potentialVulnerability = potentialVulnerability;
+ }
+
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java
index 177b7868e3..9781512064 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/AbstractGadgetDataServiceDAO.java
@@ -19,10 +19,12 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidFeatureCodeValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidPotentialVulnerabilityValueException;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import java.sql.Connection;
@@ -37,40 +39,40 @@ import java.util.Map;
public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO {
@Override
- public DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException {
+ public DeviceCountByGroup getTotalDeviceCount() throws SQLException {
int totalDeviceCount;
try {
totalDeviceCount = this.getFilteredDeviceCount(null);
- } catch (InvalidParameterValueException e) {
+ } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e);
}
- DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
- deviceCountByGroupEntry.setGroup("total");
- deviceCountByGroupEntry.setDisplayNameForGroup("Total");
- deviceCountByGroupEntry.setDeviceCount(totalDeviceCount);
+ DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
+ deviceCountByGroup.setGroup("total");
+ deviceCountByGroup.setDisplayNameForGroup("Total");
+ deviceCountByGroup.setDeviceCount(totalDeviceCount);
- return deviceCountByGroupEntry;
+ return deviceCountByGroup;
}
@Override
- public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException {
+ public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException {
- int filteredDeviceCount = this.getFilteredDeviceCount(filterSet);
+ int filteredDeviceCount = this.getFilteredDeviceCount(extendedFilterSet);
- DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
- deviceCountByGroupEntry.setGroup("filtered");
- deviceCountByGroupEntry.setDisplayNameForGroup("Filtered");
- deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount);
+ DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
+ deviceCountByGroup.setGroup("filtered");
+ deviceCountByGroup.setDisplayNameForGroup("Filtered");
+ deviceCountByGroup.setDeviceCount(filteredDeviceCount);
- return deviceCountByGroupEntry;
+ return deviceCountByGroup;
}
- private int getFilteredDeviceCount(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException {
+ private int getFilteredDeviceCount(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException {
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
@@ -115,14 +117,14 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException {
+ public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
@@ -143,7 +145,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -165,21 +167,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
- DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
- deviceCountByGroupEntry.setGroup("feature-non-compliant-and-filtered");
- deviceCountByGroupEntry.setDisplayNameForGroup("Feature-non-compliant-and-filtered");
- deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount);
+ DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
+ deviceCountByGroup.setGroup("feature-non-compliant-and-filtered");
+ deviceCountByGroup.setDisplayNameForGroup("Feature-non-compliant-and-filtered");
+ deviceCountByGroup.setDeviceCount(filteredDeviceCount);
- return deviceCountByGroupEntry;
+ return deviceCountByGroup;
}
@Override
- public List getDeviceCountsByConnectivityStatuses() throws SQLException {
+ public List getDeviceCountsByConnectivityStatuses() throws SQLException {
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List deviceCountsByConnectivityStatuses = new ArrayList<>();
+ List deviceCountsByConnectivityStatuses = new ArrayList<>();
try {
con = this.getConnection();
String sql = "SELECT CONNECTIVITY_STATUS, COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
@@ -191,9 +193,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry deviceCountByConnectivityStatus;
+ DeviceCountByGroup deviceCountByConnectivityStatus;
while (rs.next()) {
- deviceCountByConnectivityStatus = new DeviceCountByGroupEntry();
+ deviceCountByConnectivityStatus = new DeviceCountByGroup();
deviceCountByConnectivityStatus.setGroup(rs.getString("CONNECTIVITY_STATUS"));
deviceCountByConnectivityStatus.setDisplayNameForGroup(rs.getString("CONNECTIVITY_STATUS"));
deviceCountByConnectivityStatus.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -206,20 +208,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List getDeviceCountsByPotentialVulnerabilities() throws SQLException {
+ public List getDeviceCountsByPotentialVulnerabilities() throws SQLException {
// getting non-compliant device count
- DeviceCountByGroupEntry nonCompliantDeviceCount = new DeviceCountByGroupEntry();
+ DeviceCountByGroup nonCompliantDeviceCount = new DeviceCountByGroup();
nonCompliantDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
nonCompliantDeviceCount.setDisplayNameForGroup("Non-compliant");
nonCompliantDeviceCount.setDeviceCount(getNonCompliantDeviceCount());
// getting unmonitored device count
- DeviceCountByGroupEntry unmonitoredDeviceCount = new DeviceCountByGroupEntry();
+ DeviceCountByGroup unmonitoredDeviceCount = new DeviceCountByGroup();
unmonitoredDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
unmonitoredDeviceCount.setDisplayNameForGroup("Unmonitored");
unmonitoredDeviceCount.setDeviceCount(getUnmonitoredDeviceCount());
- List deviceCountsByPotentialVulnerabilities = new ArrayList<>();
+ List deviceCountsByPotentialVulnerabilities = new ArrayList<>();
deviceCountsByPotentialVulnerabilities.add(nonCompliantDeviceCount);
deviceCountsByPotentialVulnerabilities.add(unmonitoredDeviceCount);
@@ -227,36 +229,38 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
private int getNonCompliantDeviceCount() throws SQLException {
- FilterSet filterSet = new FilterSet();
- filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
+ ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
+ extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
+ PotentialVulnerability.NON_COMPLIANT);
try {
- return this.getFilteredDeviceCount(filterSet);
- } catch (InvalidParameterValueException e) {
+ return this.getFilteredDeviceCount(extendedFilterSet);
+ } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e);
}
}
private int getUnmonitoredDeviceCount() throws SQLException {
- FilterSet filterSet = new FilterSet();
- filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
+ ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
+ extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
+ PotentialVulnerability.UNMONITORED);
try {
- return this.getFilteredDeviceCount(filterSet);
- } catch (InvalidParameterValueException e) {
+ return this.getFilteredDeviceCount(extendedFilterSet);
+ } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e);
}
}
@Override
- public List getDeviceCountsByPlatforms(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException {
+ public List getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException {
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDeviceCountsByPlatforms = new ArrayList<>();
+ List filteredDeviceCountsByPlatforms = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@@ -286,9 +290,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredDeviceCountByPlatform;
+ DeviceCountByGroup filteredDeviceCountByPlatform;
while (rs.next()) {
- filteredDeviceCountByPlatform = new DeviceCountByGroupEntry();
+ filteredDeviceCountByPlatform = new DeviceCountByGroup();
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -301,21 +305,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List
- getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException {
+ public List
+ getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDeviceCountsByPlatforms = new ArrayList<>();
+ List filteredDeviceCountsByPlatforms = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@@ -332,7 +336,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -347,9 +351,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredDeviceCountByPlatform;
+ DeviceCountByGroup filteredDeviceCountByPlatform;
while (rs.next()) {
- filteredDeviceCountByPlatform = new DeviceCountByGroupEntry();
+ filteredDeviceCountByPlatform = new DeviceCountByGroup();
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -362,16 +366,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List getDeviceCountsByOwnershipTypes(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException {
+ public List getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException {
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
+ List filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@@ -402,9 +406,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredDeviceCountByOwnershipType;
+ DeviceCountByGroup filteredDeviceCountByOwnershipType;
while (rs.next()) {
- filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry();
+ filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -417,21 +421,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List
- getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException {
+ public List
+ getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
+ List filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@@ -448,7 +452,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -463,9 +467,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredDeviceCountByOwnershipType;
+ DeviceCountByGroup filteredDeviceCountByOwnershipType;
while (rs.next()) {
- filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry();
+ filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -478,16 +482,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List getDevicesWithDetails(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException {
+ public List getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException {
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
try {
con = this.getConnection();
String sql;
@@ -517,9 +521,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -534,20 +538,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
- public List getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException {
+ public List getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
try {
con = this.getConnection();
String sql;
@@ -564,7 +568,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -579,9 +583,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -595,46 +599,56 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
return filteredDevicesWithDetails;
}
- protected Map extractDatabaseFiltersFromBean(FilterSet filterSet)
- throws InvalidParameterValueException {
- if (filterSet == null) {
+ protected Map extractDatabaseFiltersFromBean(BasicFilterSet basicFilterSet) {
+ if (basicFilterSet == null) {
return null;
}
Map filters = new LinkedHashMap<>();
- String connectivityStatus = filterSet.getConnectivityStatus();
- if (connectivityStatus != null) {
+ String connectivityStatus = basicFilterSet.getConnectivityStatus();
+ if (connectivityStatus != null && !connectivityStatus.isEmpty()) {
filters.put("CONNECTIVITY_STATUS", connectivityStatus);
}
- String potentialVulnerability = filterSet.getPotentialVulnerability();
- if (potentialVulnerability != null) {
+ String platform = basicFilterSet.getPlatform();
+ if (platform != null && !platform.isEmpty()) {
+ filters.put("PLATFORM", platform);
+ }
+
+ String ownership = basicFilterSet.getOwnership();
+ if (ownership != null && !ownership.isEmpty()) {
+ filters.put("OWNERSHIP", ownership);
+ }
+
+ return filters;
+ }
+
+ protected Map extractDatabaseFiltersFromBean(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException {
+ if (extendedFilterSet == null) {
+ return null;
+ }
+
+ Map filters = this.extractDatabaseFiltersFromBean((BasicFilterSet) extendedFilterSet);
+
+ String potentialVulnerability = extendedFilterSet.getPotentialVulnerability();
+ if (potentialVulnerability != null && !potentialVulnerability.isEmpty()) {
if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability) ||
- GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) {
+ GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) {
if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability)) {
filters.put("IS_COMPLIANT", 0);
} else {
filters.put("POLICY_ID", -1);
}
} else {
- throw new InvalidParameterValueException("Invalid use of value for potential vulnerability. " +
- "Value of potential vulnerability could only be either " +
+ throw new InvalidPotentialVulnerabilityValueException("Invalid use of value for potential " +
+ "vulnerability. Value of potential vulnerability could only be either " +
GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT + " or " +
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED + ".");
}
}
- String platform = filterSet.getPlatform();
- if (platform != null) {
- filters.put("PLATFORM", platform);
- }
-
- String ownership = filterSet.getOwnership();
- if (ownership != null) {
- filters.put("OWNERSHIP", ownership);
- }
-
return filters;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/GadgetDataServiceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/GadgetDataServiceDAO.java
index 9a727df1e2..c5c1638fba 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/GadgetDataServiceDAO.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/GadgetDataServiceDAO.java
@@ -18,10 +18,11 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.sql.SQLException;
@@ -29,44 +30,45 @@ import java.util.List;
public interface GadgetDataServiceDAO {
- DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException;
+ DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException;
- DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, FilterSet filterSet)
- throws InvalidParameterValueException, SQLException;
+ DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
+ throws InvalidFeatureCodeValueException, SQLException;
- DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException;
+ DeviceCountByGroup getTotalDeviceCount() throws SQLException;
- List getDeviceCountsByConnectivityStatuses() throws SQLException;
+ List getDeviceCountsByConnectivityStatuses() throws SQLException;
- List getDeviceCountsByPotentialVulnerabilities() throws SQLException;
+ List getDeviceCountsByPotentialVulnerabilities() throws SQLException;
- PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException;
+ PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
- List getDeviceCountsByPlatforms(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException;
+ List getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException;
- List getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException;
+ List getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
- List getDeviceCountsByOwnershipTypes(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException;
+ List getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException;
- List getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException;
+ List getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
- PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException;
+ PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException,
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
- PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException;
+ PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
+ int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
- List getDevicesWithDetails(FilterSet filterSet)
- throws InvalidParameterValueException, SQLException;
+ List getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, SQLException;
- List getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, SQLException;
+ List getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java
index 87e48e363f..4a0deb7d24 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/GenericGadgetDataServiceDAOImpl.java
@@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@@ -40,15 +41,15 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
@@ -56,7 +57,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
+ List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -71,9 +72,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
+ DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) {
- filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
+ filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -103,26 +104,27 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
}
@Override
- public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex,
+ int resultCount) throws InvalidPotentialVulnerabilityValueException,
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -159,9 +161,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -193,31 +195,32 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
}
@Override
- public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet, int startIndex, int resultCount)
+ throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
+ InvalidResultCountValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -236,7 +239,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -256,9 +259,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -273,7 +276,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
// executing query
rs = stmt.executeQuery();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java
index 528cef64df..396a596c9b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/MSSQLGadgetDataServiceDAOImpl.java
@@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@@ -40,15 +41,15 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
@@ -56,7 +57,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
+ List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -71,9 +72,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
+ DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) {
- filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
+ filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -103,26 +104,29 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
- public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException,
+ InvalidStartIndexValueException,
+ InvalidResultCountValueException,
+ SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -159,9 +163,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -193,31 +197,32 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
- public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet, int startIndex, int resultCount)
+ throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
+ InvalidResultCountValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -236,7 +241,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -256,9 +261,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -273,7 +278,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
// executing query
rs = stmt.executeQuery();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java
index a600059196..7fdc731b47 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/OracleGadgetDataServiceDAOImpl.java
@@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@@ -40,15 +41,15 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
@@ -56,7 +57,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
+ List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -73,9 +74,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
+ DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) {
- filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
+ filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -105,26 +106,27 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
- public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
+ InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -163,9 +165,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -197,31 +199,31 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
- public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
+ int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -240,7 +242,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -260,9 +262,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -277,7 +279,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
// executing query
rs = stmt.executeQuery();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java
index 34b90bafa7..d44ad929ee 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/dao/impl/PostgreSQLGadgetDataServiceDAOImpl.java
@@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@@ -40,15 +41,15 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
@@ -56,7 +57,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
+ List filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -72,9 +73,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query
rs = stmt.executeQuery();
// fetching query results
- DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
+ DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) {
- filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
+ filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@@ -104,26 +105,27 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
}
@Override
- public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
+ InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -161,9 +163,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -195,31 +197,31 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
}
@Override
- public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, SQLException {
+ public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
+ int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
+ InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
- if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
- throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
+ if (featureCode == null || featureCode.isEmpty()) {
+ throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
}
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
- throw new InvalidParameterValueException("Start index should be equal to " +
+ throw new InvalidStartIndexValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
}
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
- throw new InvalidParameterValueException("Result count should be equal to " +
+ throw new InvalidResultCountValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
}
- Map filters = this.extractDatabaseFiltersFromBean(filterSet);
+ Map filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
- List filteredDevicesWithDetails = new ArrayList<>();
+ List filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@@ -238,7 +240,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) {
int i = 3;
for (Object value : filters.values()) {
@@ -258,9 +260,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query
rs = stmt.executeQuery();
// fetching query results
- DetailedDeviceEntry filteredDeviceWithDetails;
+ DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) {
- filteredDeviceWithDetails = new DetailedDeviceEntry();
+ filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@@ -275,7 +277,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId);
- stmt.setString(2, nonCompliantFeatureCode);
+ stmt.setString(2, featureCode);
// executing query
rs = stmt.executeQuery();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidFeatureCodeValueException.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidFeatureCodeValueException.java
new file mode 100644
index 0000000000..0ba644a611
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidFeatureCodeValueException.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * you may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
+
+/**
+ * Custom exception class for catching invalid parameter values,
+ * relevant to Gadget Data Service DAO layer.
+ */
+public class InvalidFeatureCodeValueException extends Exception {
+
+ private String errorMessage;
+ private static final long serialVersionUID = 2021891706072918864L;
+
+ /**
+ * Constructs a new exception with the specific error message and nested exception.
+ * @param errorMessage specific error message.
+ * @param nestedException Nested exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidFeatureCodeValueException(String errorMessage, Exception nestedException) {
+ super(errorMessage, nestedException);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param errorMessage Specific error message.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidFeatureCodeValueException(String errorMessage, Throwable cause) {
+ super(errorMessage, cause);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message.
+ * @param errorMessage Specific error message.
+ */
+ public InvalidFeatureCodeValueException(String errorMessage) {
+ super(errorMessage);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidFeatureCodeValueException(Throwable cause) {
+ super(cause);
+ }
+
+ @SuppressWarnings("unused")
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+}
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidPotentialVulnerabilityValueException.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidPotentialVulnerabilityValueException.java
new file mode 100644
index 0000000000..a31b68f8fa
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidPotentialVulnerabilityValueException.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * you may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
+
+/**
+ * Custom exception class for catching invalid parameter values,
+ * relevant to Gadget Data Service DAO layer.
+ */
+public class InvalidPotentialVulnerabilityValueException extends Exception {
+
+ private String errorMessage;
+ private static final long serialVersionUID = 2021891706072918864L;
+
+ /**
+ * Constructs a new exception with the specific error message and nested exception.
+ * @param errorMessage specific error message.
+ * @param nestedException Nested exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidPotentialVulnerabilityValueException(String errorMessage, Exception nestedException) {
+ super(errorMessage, nestedException);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param errorMessage Specific error message.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidPotentialVulnerabilityValueException(String errorMessage, Throwable cause) {
+ super(errorMessage, cause);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message.
+ * @param errorMessage Specific error message.
+ */
+ public InvalidPotentialVulnerabilityValueException(String errorMessage) {
+ super(errorMessage);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidPotentialVulnerabilityValueException(Throwable cause) {
+ super(cause);
+ }
+
+ @SuppressWarnings("unused")
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidResultCountValueException.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidResultCountValueException.java
new file mode 100644
index 0000000000..9d20a6971d
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidResultCountValueException.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * you may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
+
+/**
+ * Custom exception class for catching invalid parameter values,
+ * relevant to Gadget Data Service DAO layer.
+ */
+public class InvalidResultCountValueException extends Exception {
+
+ private String errorMessage;
+ private static final long serialVersionUID = 2021891706072918864L;
+
+ /**
+ * Constructs a new exception with the specific error message and nested exception.
+ * @param errorMessage specific error message.
+ * @param nestedException Nested exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidResultCountValueException(String errorMessage, Exception nestedException) {
+ super(errorMessage, nestedException);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param errorMessage Specific error message.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidResultCountValueException(String errorMessage, Throwable cause) {
+ super(errorMessage, cause);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message.
+ * @param errorMessage Specific error message.
+ */
+ public InvalidResultCountValueException(String errorMessage) {
+ super(errorMessage);
+ setErrorMessage(errorMessage);
+ }
+
+ /**
+ * Constructs a new exception with the specific error message and cause.
+ * @param cause Cause of this exception.
+ */
+ @SuppressWarnings("unused")
+ public InvalidResultCountValueException(Throwable cause) {
+ super(cause);
+ }
+
+ @SuppressWarnings("unused")
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+}
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidParameterValueException.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidStartIndexValueException.java
similarity index 83%
rename from components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidParameterValueException.java
rename to components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidStartIndexValueException.java
index 1cf485b4d5..39370c0ab1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidParameterValueException.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/exception/InvalidStartIndexValueException.java
@@ -19,10 +19,10 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
/**
- * Custom exception class for catching invalid parameter issues,
+ * Custom exception class for catching invalid parameter values,
* relevant to Gadget Data Service DAO layer.
*/
-public class InvalidParameterValueException extends Exception {
+public class InvalidStartIndexValueException extends Exception {
private String errorMessage;
private static final long serialVersionUID = 2021891706072918864L;
@@ -33,7 +33,7 @@ public class InvalidParameterValueException extends Exception {
* @param nestedException Nested exception.
*/
@SuppressWarnings("unused")
- public InvalidParameterValueException(String errorMessage, Exception nestedException) {
+ public InvalidStartIndexValueException(String errorMessage, Exception nestedException) {
super(errorMessage, nestedException);
setErrorMessage(errorMessage);
}
@@ -44,7 +44,7 @@ public class InvalidParameterValueException extends Exception {
* @param cause Cause of this exception.
*/
@SuppressWarnings("unused")
- public InvalidParameterValueException(String errorMessage, Throwable cause) {
+ public InvalidStartIndexValueException(String errorMessage, Throwable cause) {
super(errorMessage, cause);
setErrorMessage(errorMessage);
}
@@ -53,7 +53,7 @@ public class InvalidParameterValueException extends Exception {
* Constructs a new exception with the specific error message.
* @param errorMessage Specific error message.
*/
- public InvalidParameterValueException(String errorMessage) {
+ public InvalidStartIndexValueException(String errorMessage) {
super(errorMessage);
setErrorMessage(errorMessage);
}
@@ -63,7 +63,7 @@ public class InvalidParameterValueException extends Exception {
* @param cause Cause of this exception.
*/
@SuppressWarnings("unused")
- public InvalidParameterValueException(Throwable cause) {
+ public InvalidStartIndexValueException(Throwable cause) {
super(cause);
}
@@ -77,3 +77,4 @@ public class InvalidParameterValueException extends Exception {
}
}
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/impl/GadgetDataServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/impl/GadgetDataServiceImpl.java
index e92dee1d31..495172e3e0 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/impl/GadgetDataServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/src/main/java/org/wso2/carbon/device/mgt/analytics/dashboard/impl/GadgetDataServiceImpl.java
@@ -19,12 +19,12 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.impl;
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOFactory;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
-import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
-import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
+import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
+import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.sql.SQLException;
@@ -36,12 +36,13 @@ import java.util.List;
public class GadgetDataServiceImpl implements GadgetDataService {
@Override
- public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException {
- DeviceCountByGroupEntry filteredDeviceCount;
+ public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
+ DeviceCountByGroup filteredDeviceCount;
try {
GadgetDataServiceDAOFactory.openConnection();
- filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filterSet);
+ filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
+ getDeviceCount(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -52,13 +53,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
- DeviceCountByGroupEntry featureNonCompliantDeviceCount;
+ public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
+ throws InvalidFeatureCodeValueException, DataAccessLayerException {
+ DeviceCountByGroup featureNonCompliantDeviceCount;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
- getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet);
+ getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -69,8 +70,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException {
- DeviceCountByGroupEntry totalDeviceCount;
+ public DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException {
+ DeviceCountByGroup totalDeviceCount;
try {
GadgetDataServiceDAOFactory.openConnection();
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
@@ -84,8 +85,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
- List deviceCountsByConnectivityStatuses;
+ public List getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
+ List deviceCountsByConnectivityStatuses;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory.
@@ -100,8 +101,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
- List deviceCountsByPotentialVulnerabilities;
+ public List getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
+ List deviceCountsByPotentialVulnerabilities;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
@@ -117,7 +118,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
- throws InvalidParameterValueException, DataAccessLayerException {
+ throws InvalidStartIndexValueException, InvalidResultCountValueException,
+ DataAccessLayerException {
PaginationResult paginationResult;
try {
GadgetDataServiceDAOFactory.openConnection();
@@ -133,13 +135,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getDeviceCountsByPlatforms(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException {
- List deviceCountsByPlatforms;
+ public List getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
+ List deviceCountsByPlatforms;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getDeviceCountsByPlatforms(filterSet);
+ getDeviceCountsByPlatforms(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -150,13 +152,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
- List featureNonCompliantDeviceCountsByPlatforms;
+ public List getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException {
+ List featureNonCompliantDeviceCountsByPlatforms;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
+ getFeatureNonCompliantDeviceCountsByPlatforms(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -167,13 +170,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getDeviceCountsByOwnershipTypes(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException {
- List deviceCountsByOwnershipTypes;
+ public List getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException,
+ DataAccessLayerException {
+ List deviceCountsByOwnershipTypes;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getDeviceCountsByOwnershipTypes(filterSet);
+ getDeviceCountsByOwnershipTypes(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -184,14 +188,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List
- getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
- List featureNonCompliantDeviceCountsByOwnershipTypes;
+ public List
+ getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode, BasicFilterSet basicFilterSet)
+ throws InvalidFeatureCodeValueException, DataAccessLayerException {
+ List featureNonCompliantDeviceCountsByOwnershipTypes;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
+ getFeatureNonCompliantDeviceCountsByOwnershipTypes(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -202,13 +206,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public PaginationResult getDevicesWithDetails(FilterSet filterSet,
- int startIndex, int resultCount) throws InvalidParameterValueException, DataAccessLayerException {
+ public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
+ InvalidStartIndexValueException, InvalidResultCountValueException {
PaginationResult paginationResult;
try {
GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getDevicesWithDetails(filterSet, startIndex, resultCount);
+ getDevicesWithDetails(extendedFilterSet, startIndex, resultCount);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -219,14 +224,15 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet, int startIndex, int resultCount)
- throws InvalidParameterValueException, DataAccessLayerException {
+ public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
+ int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException, InvalidStartIndexValueException,
+ InvalidResultCountValueException {
PaginationResult paginationResult;
try {
GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet, startIndex, resultCount);
+ getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet, startIndex, resultCount);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -237,13 +243,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getDevicesWithDetails(FilterSet filterSet)
- throws InvalidParameterValueException, DataAccessLayerException {
- List devicesWithDetails;
+ public List getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
+ throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
+ List devicesWithDetails;
try {
GadgetDataServiceDAOFactory.openConnection();
devicesWithDetails = GadgetDataServiceDAOFactory.
- getGadgetDataServiceDAO().getDevicesWithDetails(filterSet);
+ getGadgetDataServiceDAO().getDevicesWithDetails(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
@@ -254,13 +260,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
- public List getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
- FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
- List featureNonCompliantDevicesWithDetails;
+ public List getFeatureNonCompliantDevicesWithDetails(String featureCode,
+ BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
+ DataAccessLayerException {
+ List featureNonCompliantDevicesWithDetails;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
- getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet);
+ getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
diff --git a/pom.xml b/pom.xml
index daac4ef724..7ad4fc14b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1116,6 +1116,11 @@
jsr311-api
${jsr311.version}
+
+ javax.ws.rs
+ javax.ws.rs-api
+ ${javax.ws.rs.version}
+
commons-logging
commons-logging
@@ -1856,6 +1861,8 @@
2.26.1.wso2v3
[2.26.1, 3.0.0)
+
+ 2.0.1
1.5.8
2.5