revert-70aa11f8
Rasika Perera 9 years ago
commit d7f4a39075

@ -17,20 +17,18 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -17,18 +17,16 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -17,18 +17,17 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -17,20 +17,18 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>
@ -105,6 +103,10 @@
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
</dependencies>
@ -152,6 +154,7 @@
org.wso2.carbon.registry.core.*
</Import-Package>
<Embed-Dependency>
javax.ws.rs-api,
scribe;scope=compile|runtime;inline=false;
</Embed-Dependency>
<DynamicImport-Package>*</DynamicImport-Package>

@ -25,9 +25,17 @@ import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.webapp.publisher.internal.APIPublisherDataHolder;
import org.wso2.carbon.core.ServerStartupObserver;
import java.util.Stack;
public class APIPublisherStartupHandler implements ServerStartupObserver {
private static final Log log = LogFactory.getLog(APIPublisherStartupHandler.class);
private static int retryTime = 2000;
private static final int CONNECTION_RETRY_FACTOR = 2;
private static Stack<API> failedAPIsStack = new Stack<>();
private static Stack<API> currentAPIsStack;
private APIPublisherService publisher;
@Override
public void completingServerStartup() {
@ -36,32 +44,45 @@ public class APIPublisherStartupHandler implements ServerStartupObserver {
@Override
public void completedServerStartup() {
// adding temporary due to a bug in the platform
APIPublisherDataHolder.getInstance().setServerStarted(true);
currentAPIsStack = APIPublisherDataHolder.getInstance().getUnpublishedApis();
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
log.error("Error occurred while sleeping", e);
}
APIPublisherDataHolder.getInstance().setServerStarted(true);
log.info("Server has just started, hence started publishing unpublished APIs");
if (log.isDebugEnabled()) {
log.debug("Server has just started, hence started publishing unpublished APIs");
log.debug("Total number of unpublished APIs: "
+ APIPublisherDataHolder.getInstance().getUnpublishedApis().size());
}
APIPublisherService publisher = APIPublisherDataHolder.getInstance().getApiPublisherService();
while (!APIPublisherDataHolder.getInstance().getUnpublishedApis().isEmpty()) {
API api = APIPublisherDataHolder.getInstance().getUnpublishedApis().pop();
publisher = APIPublisherDataHolder.getInstance().getApiPublisherService();
while (!failedAPIsStack.isEmpty() || !currentAPIsStack.isEmpty()) {
try {
publisher.publishAPI(api);
} catch (java.lang.Exception e) {
log.error("Error occurred while publishing API '" + api.getId().getApiName(), e);
retryTime = retryTime * CONNECTION_RETRY_FACTOR;
Thread.sleep(retryTime);
} catch (InterruptedException te) {
log.error("Error occurred while sleeping", te);
}
if (!APIPublisherDataHolder.getInstance().getUnpublishedApis().isEmpty()) {
publishAPIs(currentAPIsStack, failedAPIsStack);
} else {
publishAPIs(failedAPIsStack, currentAPIsStack);
}
}
}
});
t.start();
}
private void publishAPIs(Stack<API> apis, Stack<API> failedStack) {
while (!apis.isEmpty()) {
API api = apis.pop();
try {
publisher.publishAPI(api);
} catch (Exception e) {
log.error("Error occurred while publishing API '" + api.getId().getApiName() + "'");
failedStack.push(api);
}
}
}
}

@ -55,6 +55,7 @@ public class AnnotationProcessor {
private static final String PACKAGE_ORG_APACHE = "org.apache";
private static final String PACKAGE_ORG_CODEHAUS = "org.codehaus";
private static final String PACKAGE_ORG_SPRINGFRAMEWORK = "org.springframework";
private static final String WILD_CARD = "/*";
private static final String AUTH_TYPE = "Any";
private static final String PROTOCOL_HTTP = "http";
@ -227,7 +228,7 @@ public class AnnotationProcessor {
if (methodContextAnno != null) {
subCtx = invokeMethod(pathClazzMethods[0], methodContextAnno, STRING);
} else {
subCtx = "/*";
subCtx = WILD_CARD;
}
resource.setUriTemplate(makeContextURLReady(subCtx));

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -0,0 +1,22 @@
/*
* 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.extensions.push.notification.provider.mqtt;
public class InvalidConfigurationException {
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -64,8 +62,8 @@
</Private-Package>
<Export-Package>
org.wso2.carbon.device.mgt.analytics.dashboard,
org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception,
org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean
org.wso2.carbon.device.mgt.analytics.dashboard.exception,
org.wso2.carbon.device.mgt.analytics.dashboard.bean
</Export-Package>
<Import-Package>
org.osgi.framework,

@ -18,11 +18,11 @@
package org.wso2.carbon.device.mgt.analytics.dashboard;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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,214 +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 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 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<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
List<DeviceCountByGroup> 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<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
List<DeviceCountByGroup> 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 and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @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 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 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<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> 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<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> 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 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 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<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> 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<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> 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 and only 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 and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @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 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 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<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceWithDetails> 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<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException;
}

@ -16,12 +16,11 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
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;
}

@ -16,9 +16,9 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
public class DeviceCountByGroupEntry {
public class DeviceCountByGroup {
private String group;
private String displayNameForGroup;

@ -16,9 +16,9 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
public class DetailedDeviceEntry {
public class DeviceWithDetails {
private int deviceId;
private String deviceIdentification;

@ -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;
}
}

@ -19,11 +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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
@ -38,40 +39,40 @@ import java.util.Map;
public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO {
@Override
public DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException {
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, DataAccessLayerException {
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, DataAccessLayerException {
private int getFilteredDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
@ -80,8 +81,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
int filteredDeviceCount = 0;
try {
con = this.getConnection();
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " + GadgetDataServiceDAOConstants.DatabaseView.
DEVICES_VIEW_1 + " WHERE TENANT_ID = ?";
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
GadgetDataServiceDAOConstants.DatabaseView.DEVICES_VIEW_1 + " WHERE TENANT_ID = ?";
// appending filters to support advanced filtering options
// [1] appending filter columns
if (filters != null && filters.size() > 0) {
@ -109,9 +110,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
while (rs.next()) {
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -119,14 +117,14 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
@ -135,8 +133,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
int filteredDeviceCount = 0;
try {
con = this.getConnection();
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " + GadgetDataServiceDAOConstants.DatabaseView.
DEVICES_VIEW_2 + " WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
GadgetDataServiceDAOConstants.DatabaseView.DEVICES_VIEW_2 + " WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
// appending filters to support advanced filtering options
// [1] appending filter columns
if (filters != null && filters.size() > 0) {
@ -147,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,28 +163,25 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
while (rs.next()) {
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
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<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws SQLException {
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses = new ArrayList<>();
List<DeviceCountByGroup> deviceCountsByConnectivityStatuses = new ArrayList<>();
try {
con = this.getConnection();
String sql = "SELECT CONNECTIVITY_STATUS, COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
@ -198,17 +193,14 @@ 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"));
deviceCountsByConnectivityStatuses.add(deviceCountByConnectivityStatus);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -216,57 +208,59 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
public List<DeviceCountByGroup> 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<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities = new ArrayList<>();
List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities = new ArrayList<>();
deviceCountsByPotentialVulnerabilities.add(nonCompliantDeviceCount);
deviceCountsByPotentialVulnerabilities.add(unmonitoredDeviceCount);
return deviceCountsByPotentialVulnerabilities;
}
private int getNonCompliantDeviceCount() throws DataAccessLayerException {
FilterSet filterSet = new FilterSet();
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
private int getNonCompliantDeviceCount() throws SQLException {
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 DataAccessLayerException {
FilterSet filterSet = new FilterSet();
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
private int getUnmonitoredDeviceCount() throws SQLException {
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<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>();
List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@ -296,17 +290,14 @@ 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"));
filteredDeviceCountsByPlatforms.add(filteredDeviceCountByPlatform);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -314,21 +305,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DeviceCountByGroupEntry>
getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceCountByGroup>
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>();
List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@ -345,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()) {
@ -360,17 +351,14 @@ 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"));
filteredDeviceCountsByPlatforms.add(filteredDeviceCountByPlatform);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -378,16 +366,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@ -418,17 +406,14 @@ 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"));
filteredDeviceCountsByOwnershipTypes.add(filteredDeviceCountByOwnershipType);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -436,21 +421,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DeviceCountByGroupEntry>
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceCountByGroup>
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try {
con = this.getConnection();
String sql, advancedSqlFiltering = "";
@ -467,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()) {
@ -482,17 +467,14 @@ 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"));
filteredDeviceCountsByOwnershipTypes.add(filteredDeviceCountByOwnershipType);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -500,16 +482,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
try {
con = this.getConnection();
String sql;
@ -539,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"));
@ -549,9 +531,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -559,20 +538,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
}
@Override
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
public List<DeviceWithDetails> 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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
try {
con = this.getConnection();
String sql;
@ -589,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()) {
@ -604,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"));
@ -614,55 +593,62 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
return filteredDevicesWithDetails;
}
protected Map<String, Object> extractDatabaseFiltersFromBean(FilterSet filterSet)
throws InvalidParameterValueException {
if (filterSet == null) {
protected Map<String, Object> extractDatabaseFiltersFromBean(BasicFilterSet basicFilterSet) {
if (basicFilterSet == null) {
return null;
}
Map<String, Object> 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<String, Object> extractDatabaseFiltersFromBean(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException {
if (extendedFilterSet == null) {
return null;
}
Map<String, Object> 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;
}

@ -18,55 +18,57 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
import java.util.List;
public interface GadgetDataServiceDAO {
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException;
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
throws InvalidFeatureCodeValueException, SQLException;
DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException;
DeviceCountByGroup getTotalDeviceCount() throws SQLException;
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws SQLException;
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws SQLException;
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException;
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException;
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException;
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException;
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, DataAccessLayerException;
PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, SQLException;
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
}

@ -90,11 +90,7 @@ public class GadgetDataServiceDAOFactory {
"this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " +
"transaction is already active is a sign of improper transaction handling.");
}
try {
conn = dataSource.getConnection();
} catch (SQLException e) {
}
conn = dataSource.getConnection();
currentConnection.set(conn);
}

@ -19,13 +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.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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
@ -41,15 +41,15 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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.");
}
@ -57,7 +57,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -72,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"));
@ -94,9 +94,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
while (rs.next()) {
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -107,26 +104,27 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
}
@Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -163,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"));
@ -187,9 +185,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -200,31 +195,32 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
}
@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, 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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -243,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()) {
@ -263,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"));
@ -280,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();
@ -288,9 +284,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}

@ -19,13 +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.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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
@ -41,15 +41,15 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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.");
}
@ -57,7 +57,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -72,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"));
@ -94,9 +94,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -107,26 +104,29 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -163,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"));
@ -187,9 +187,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -200,31 +197,32 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@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, 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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -243,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()) {
@ -263,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"));
@ -280,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();
@ -288,9 +286,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}

@ -19,13 +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.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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
@ -41,15 +41,15 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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.");
}
@ -57,7 +57,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -74,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"));
@ -96,9 +96,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -109,26 +106,27 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -167,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"));
@ -191,9 +189,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -204,31 +199,31 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
}
@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,
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -247,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()) {
@ -267,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"));
@ -284,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();
@ -292,9 +287,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}

@ -19,13 +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.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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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;
@ -41,15 +41,15 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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.");
}
@ -57,7 +57,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -73,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"));
@ -95,9 +95,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
while (rs.next()) {
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -108,26 +105,27 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
}
@Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException {
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -165,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"));
@ -189,9 +187,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
@ -202,31 +197,31 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
}
@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,
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<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
Connection con;
PreparedStatement stmt = null;
ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0;
try {
con = this.getConnection();
@ -245,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()) {
@ -265,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"));
@ -282,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();
@ -290,9 +285,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
while (rs.next()) {
totalRecordsCount = rs.getInt("DEVICE_COUNT");
}
} catch (SQLException e) {
throw new DataAccessLayerException("Error in either getting database connection, " +
"running SQL query or fetching results.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}

@ -16,7 +16,7 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception;
package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
/**
* Custom exception class for communicating data access layer issues

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

@ -16,13 +16,13 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception;
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 {
}
}

@ -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.dao.bean.DetailedDeviceEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.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,14 +36,16 @@ 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 opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -51,15 +53,16 @@ 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 opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -67,13 +70,14 @@ 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();
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -81,14 +85,15 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses;
public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
List<DeviceCountByGroup> deviceCountsByConnectivityStatuses;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getDeviceCountsByConnectivityStatuses();
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -96,14 +101,15 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities;
public List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByPotentialVulnerabilities();
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -112,14 +118,16 @@ 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();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getNonCompliantDeviceCountsByFeatures(startIndex, resultCount);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -127,15 +135,16 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByPlatforms;
public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
List<DeviceCountByGroup> deviceCountsByPlatforms;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByPlatforms(filterSet);
getDeviceCountsByPlatforms(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -143,15 +152,17 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByPlatforms;
public List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException {
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByPlatforms;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
getFeatureNonCompliantDeviceCountsByPlatforms(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -159,15 +170,17 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByOwnershipTypes;
public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException,
DataAccessLayerException {
List<DeviceCountByGroup> deviceCountsByOwnershipTypes;
try {
GadgetDataServiceDAOFactory.openConnection();
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByOwnershipTypes(filterSet);
getDeviceCountsByOwnershipTypes(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -175,16 +188,17 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DeviceCountByGroupEntry>
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByOwnershipTypes;
public List<DeviceCountByGroup>
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode, BasicFilterSet basicFilterSet)
throws InvalidFeatureCodeValueException, DataAccessLayerException {
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByOwnershipTypes;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
getFeatureNonCompliantDeviceCountsByOwnershipTypes(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -192,15 +206,17 @@ 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 opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -208,16 +224,18 @@ 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 opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -225,15 +243,16 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException {
List<DetailedDeviceEntry> devicesWithDetails;
public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
List<DeviceWithDetails> devicesWithDetails;
try {
GadgetDataServiceDAOFactory.openConnection();
devicesWithDetails = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getDevicesWithDetails(filterSet);
getGadgetDataServiceDAO().getDevicesWithDetails(extendedFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}
@ -241,15 +260,17 @@ public class GadgetDataServiceImpl implements GadgetDataService {
}
@Override
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
List<DetailedDeviceEntry> featureNonCompliantDevicesWithDetails;
public List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException {
List<DeviceWithDetails> featureNonCompliantDevicesWithDetails;
try {
GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet);
getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet);
} catch (SQLException e) {
throw new DataAccessLayerException("Error in opening database connection.", e);
throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e);
} finally {
GadgetDataServiceDAOFactory.closeConnection();
}

@ -17,14 +17,12 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -17,14 +17,12 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -72,10 +70,9 @@
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true">
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target">
<include name="devicemgt_admin.war"/>
<include name="devicemgt_admin.war" />
</fileset>
</copy>
</tasks>

@ -186,7 +186,9 @@ public interface Operation {
@ApiResponses(value = {@ApiResponse(code = 200, message = "Activity details provided successfully.."),
@ApiResponse(code = 500, message = "Error occurred while fetching the activity for the supplied id.")})
@Permission(scope = "operation-view", permissions = {"/permission/admin/device-mgt/admin/devices/view"})
Response getActivity(@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
Response getActivity(
@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
required = true) @PathParam("id") String id)
throws MDMAPIException;
}

@ -249,4 +249,5 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
}
return Response.status(Response.Status.OK).entity(operation).build();
}
}

@ -17,12 +17,11 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -17,13 +17,12 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -21,14 +21,14 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web-proxy</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web Proxy</description>
<packaging>war</packaging>

@ -21,14 +21,14 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web</description>
<packaging>war</packaging>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client registration service</name>
<description>WSO2 Carbon - Dynamic Client Registration Service</description>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.web.app.registration</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client web app registration</name>
<description>WSO2 Carbon - Dynamic Client Web-app Registration Service</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic client registration</name>
<url>http://wso2.org</url>

@ -17,19 +17,18 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.simple.policy.decision.point</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Simple Policy Decision Point</name>
<description>WSO2 Carbon - Simple Policy Decision Point</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -17,20 +17,18 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - GCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -1,17 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard.feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management Dashboard Analytics Feature</name>
<description>WSO2 Carbon - Device Management Dashboard Analytics Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -17,14 +17,12 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -17,14 +17,12 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Dynamic Client Registration Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains dynamic client registration features</description>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic Client Registration Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.email.sender.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for email sender related functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Email Sender Feature</name>
<url>http://wso2.org</url>

@ -18,20 +18,19 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>jwt-client-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.jwt.client.extension.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - JWT Client Feature</name>
<url>http://wso2.org</url>
<description>This feature contains jwt client implementation from which we can get a access token using the jwt

@ -18,19 +18,18 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jwt-client-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic Client Registration Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Mgt OAuth Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains devicemgt related OAuth extensions</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>oauth-extensions-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon Device Management - OAuth Extensions Feature</name>
<url>http://wso2.org</url>

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.policy.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Policy Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -23,14 +23,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.webapp.authenticator.framework.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework-feature</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework Feature</name>
<url>http://wso2.org</url>

@ -17,14 +17,13 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<packaging>pom</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management - Parent</name>
<url>http://wso2.org</url>
<description>WSO2 Connected Device Manager Components</description>
@ -1117,6 +1116,11 @@
<artifactId>jsr311-api</artifactId>
<version>${jsr311.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax.ws.rs.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@ -1777,7 +1781,7 @@
<axiom.wso2.version>1.2.11.wso2v5</axiom.wso2.version>
<!-- Carbon Device Management -->
<carbon.device.mgt.version>1.1.0-SNAPSHOT</carbon.device.mgt.version>
<carbon.device.mgt.version>1.1.1-SNAPSHOT</carbon.device.mgt.version>
<!-- Carbon Commons -->
<carbon.commons.version>4.4.8</carbon.commons.version>
@ -1857,6 +1861,8 @@
<nimbus.orbit.version>2.26.1.wso2v3</nimbus.orbit.version>
<nimbus.orbit.version.range>[2.26.1, 3.0.0)</nimbus.orbit.version.range>
<!--javax ws rs version-->
<javax.ws.rs.version>2.0.1</javax.ws.rs.version>
<swagger.version>1.5.8</swagger.version>
<servlet-api.version>2.5</servlet-api.version>
</properties>

Loading…
Cancel
Save