fixed code conflicts

This commit is contained in:
hasuniea 2016-05-25 13:51:46 +05:30
commit ad1a4cbd6a
178 changed files with 2830 additions and 987 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,36 +22,14 @@
<parent> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId> <artifactId>carbon-devicemgt</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.user.api</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.axis2.wso2</groupId>
<artifactId>axis2-client</artifactId>
<version>1.6.1.wso2v14</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
<version>1.2.11.wso2v6</version>
</dependency>
<dependency>
<groupId>org.wso2.orbit.com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>3.5.0.wso2v1</version>
</dependency>
</dependencies>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name> <name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url> <url>http://wso2.org</url>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" <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">
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> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -18,11 +18,11 @@
package org.wso2.carbon.device.mgt.analytics.dashboard; package org.wso2.carbon.device.mgt.analytics.dashboard;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.util.List; import java.util.List;
@ -35,222 +35,227 @@ public interface GadgetDataService {
/** /**
* This method is used to get a count of devices based on a defined filter set. * 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. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total device count in the system
* wrapped with in the defined return format. * wrapped by the defined return format.
* @return An object of type DeviceCountByGroupEntry. * @return An object of type DeviceCountByGroup.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED". * 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet) DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/** /**
* This method is used to get a count of devices non-compliant upon on a particular feature * This method is used to get a count of devices non-compliant upon on a particular feature
* and a defined filter set. * and a defined filter set.
* @param nonCompliantFeatureCode Code name of the non-compliant feature. * @param featureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total non-compliant device count in the system
* wrapped with in the defined return format. * for the given feature-code, wrapped by the defined return format.
* @return An object of type DeviceCountByGroupEntry. * @return An object of type DeviceCountByGroup.
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty. * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* This can also occur if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; throws InvalidFeatureCodeValueException, DataAccessLayerException;
/** /**
* This method is used to get total count of devices currently enrolled under a particular tenant. * 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException; DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException;
/** /**
* This method is used to get device counts classified by connectivity statuses. * 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException; List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
/** /**
* This method is used to get device counts classified by potential vulnerabilities. * 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @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. * 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 startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved. * @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult. * @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values * @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
* lesser than their minimums. * @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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
throws InvalidParameterValueException, DataAccessLayerException; InvalidStartIndexValueException, InvalidResultCountValueException, DataAccessLayerException;
/** /**
* This method is used to get device counts classified by platforms. * This method is used to get device counts classified by platforms.
* @param filterSet An abstract representation of possible filtering options. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total device counts per each platform in
* wrapped with in the defined return format. * the system, wrapped by the defined return format.
* @return An object of type DeviceCountByGroupEntry. * @return An object of type DeviceCountByGroup.
* @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
* lesser than their minimums. * 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet) List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/** /**
* This method is used to get device counts non-compliant upon a particular feature classified by platforms. * 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 featureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total non-compliant device counts per each platform
* wrapped with in the defined return format. * in the system, wrapped by the defined return format.
* @return A list of objects of type DeviceCountByGroupEntry. * @return A list of objects of type DeviceCountByGroup.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException;
/** /**
* This method is used to get device counts classified by ownership types. * This method is used to get device counts classified by ownership types.
* @param filterSet An abstract representation of possible filtering options. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total device counts per each ownership
* wrapped with in the defined return format. * type in the system, wrapped by the defined return format.
* @return A list of objects of type DeviceCountByGroupEntry. * @return A list of objects of type DeviceCountByGroup.
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty. * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
* This can also occur if potentialVulnerability value of filterSet * value of extendedFilterSet is set with some
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED". * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet) List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/** /**
* This method is used to get device counts non-compliant upon a particular feature classified by ownership types. * This method is used to get device counts non-compliant upon a particular feature
* @param nonCompliantFeatureCode Code name of the non-compliant feature. * classified by ownership types.
* @param filterSet An abstract representation of possible filtering options. * @param featureCode Code name of the non-compliant feature.
* if this value is simply "null" or no values are set for the defined filtering options, * @param basicFilterSet An abstract representation of possible filtering options.
* this method would return total device count in the system * if this value is simply "null" or no values are set for the defined filtering
* wrapped with in the defined return format. * options, this method would return total non-compliant device counts per each
* @return A list of objects of type DeviceCountByGroupEntry. * ownership type in the system, wrapped by the defined return format.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet * @return A list of objects of type DeviceCountByGroup.
* 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, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException;
/** /**
* This method is used to get a paginated list of devices with details, based on a defined filter set. * 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. * @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, * if this value is simply "null" or no values are set for the defined
* this method would return total device count in the system * filtering options, this method would return a paginated device list in the
* wrapped with in the defined return format. * 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 startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved. * @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult. * @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty. * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
* This can also occur if potentialVulnerability value of filterSet * value of extendedFilterSet is set with some
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED". * value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * 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") @SuppressWarnings("unused")
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
InvalidStartIndexValueException, InvalidResultCountValueException;
/** /**
* This method is used to get a paginated list of non-compliant devices with details, upon a particular feature. * This method is used to get a paginated list of non-compliant devices with details,
* @param nonCompliantFeatureCode Code name of the non-compliant feature. * upon a particular feature.
* @param filterSet An abstract representation of possible filtering options. * @param featureCode Code name of the non-compliant feature.
* if this value is simply "null" or no values are set for the defined filtering options, * @param basicFilterSet An abstract representation of possible filtering options.
* this method would return total device count in the system * if this value is simply "null" or no values are set for the defined filtering
* wrapped with in the defined return format. * 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 startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved. * @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult. * @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if potentialVulnerability value of filterSet * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* This can also occur if startIndex or resultCount is set to values
* lesser than their minimums.
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * 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") @SuppressWarnings("unused")
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
FilterSet filterSet, int startIndex, int resultCount) int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
throws InvalidParameterValueException, DataAccessLayerException; DataAccessLayerException, InvalidStartIndexValueException,
InvalidResultCountValueException;
/** /**
* This method is used to get a list of devices with details, based on a defined filter set. * 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. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total device list in the system
* wrapped with in the defined return format. * wrapped by the defined return format.
* @return A list of objects of type DetailedDeviceEntry. * @return A list of objects of type DeviceWithDetails.
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty. * @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
* This can occur if potentialVulnerability value of filterSet * value of extendedFilterSet is set with some
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED". * value other than "NON_COMPLIANT" or "UNMONITORED".
* This can also occur if startIndex or resultCount is set to values
* lesser than their minimums.
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet) List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
/** /**
* This method is used to get a list of non-compliant devices with details, upon a particular feature. * 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 featureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options. * @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, * if this value is simply "null" or no values are set for the defined filtering
* this method would return total device count in the system * options, this method would return total set of non-compliant devices in the
* wrapped with in the defined return format. * system upon given feature-code, wrapped by the defined return format.
* @return A list of objects of type DetailedDeviceEntry. * @return A list of objects of type DeviceWithDetails.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet * @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database, * @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data. * executing SQL query and retrieving data.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
DataAccessLayerException;
} }

View File

@ -18,10 +18,9 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean; package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
public class FilterSet { public class BasicFilterSet {
private String connectivityStatus; private String connectivityStatus;
private String potentialVulnerability;
private String platform; private String platform;
private String ownership; private String ownership;
@ -33,14 +32,6 @@ public class FilterSet {
this.connectivityStatus = connectivityStatus; this.connectivityStatus = connectivityStatus;
} }
public String getPotentialVulnerability() {
return potentialVulnerability;
}
public void setPotentialVulnerability(String potentialVulnerability) {
this.potentialVulnerability = potentialVulnerability;
}
public String getPlatform() { public String getPlatform() {
return platform; return platform;
} }

View File

@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean; package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
public class DeviceCountByGroupEntry { public class DeviceCountByGroup {
private String group; private String group;
private String displayNameForGroup; private String displayNameForGroup;

View File

@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.bean; package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
public class DetailedDeviceEntry { public class DeviceWithDetails {
private int deviceId; private int deviceId;
private String deviceIdentification; private String deviceIdentification;

View File

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

View File

@ -19,10 +19,12 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao; package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; 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 org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import java.sql.Connection; import java.sql.Connection;
@ -37,40 +39,40 @@ import java.util.Map;
public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO { public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO {
@Override @Override
public DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException { public DeviceCountByGroup getTotalDeviceCount() throws SQLException {
int totalDeviceCount; int totalDeviceCount;
try { try {
totalDeviceCount = this.getFilteredDeviceCount(null); totalDeviceCount = this.getFilteredDeviceCount(null);
} catch (InvalidParameterValueException e) { } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry(); DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
deviceCountByGroupEntry.setGroup("total"); deviceCountByGroup.setGroup("total");
deviceCountByGroupEntry.setDisplayNameForGroup("Total"); deviceCountByGroup.setDisplayNameForGroup("Total");
deviceCountByGroupEntry.setDeviceCount(totalDeviceCount); deviceCountByGroup.setDeviceCount(totalDeviceCount);
return deviceCountByGroupEntry; return deviceCountByGroup;
} }
@Override @Override
public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet) public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, SQLException {
int filteredDeviceCount = this.getFilteredDeviceCount(filterSet); int filteredDeviceCount = this.getFilteredDeviceCount(extendedFilterSet);
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry(); DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
deviceCountByGroupEntry.setGroup("filtered"); deviceCountByGroup.setGroup("filtered");
deviceCountByGroupEntry.setDisplayNameForGroup("Filtered"); deviceCountByGroup.setDisplayNameForGroup("Filtered");
deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount); deviceCountByGroup.setDeviceCount(filteredDeviceCount);
return deviceCountByGroupEntry; return deviceCountByGroup;
} }
private int getFilteredDeviceCount(FilterSet filterSet) private int getFilteredDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -115,14 +117,14 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, SQLException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -143,7 +145,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -165,21 +167,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry(); DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
deviceCountByGroupEntry.setGroup("feature-non-compliant-and-filtered"); deviceCountByGroup.setGroup("feature-non-compliant-and-filtered");
deviceCountByGroupEntry.setDisplayNameForGroup("Feature-non-compliant-and-filtered"); deviceCountByGroup.setDisplayNameForGroup("Feature-non-compliant-and-filtered");
deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount); deviceCountByGroup.setDeviceCount(filteredDeviceCount);
return deviceCountByGroupEntry; return deviceCountByGroup;
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws SQLException { public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws SQLException {
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses = new ArrayList<>(); List<DeviceCountByGroup> deviceCountsByConnectivityStatuses = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql = "SELECT CONNECTIVITY_STATUS, COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " + String sql = "SELECT CONNECTIVITY_STATUS, COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
@ -191,9 +193,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry deviceCountByConnectivityStatus; DeviceCountByGroup deviceCountByConnectivityStatus;
while (rs.next()) { while (rs.next()) {
deviceCountByConnectivityStatus = new DeviceCountByGroupEntry(); deviceCountByConnectivityStatus = new DeviceCountByGroup();
deviceCountByConnectivityStatus.setGroup(rs.getString("CONNECTIVITY_STATUS")); deviceCountByConnectivityStatus.setGroup(rs.getString("CONNECTIVITY_STATUS"));
deviceCountByConnectivityStatus.setDisplayNameForGroup(rs.getString("CONNECTIVITY_STATUS")); deviceCountByConnectivityStatus.setDisplayNameForGroup(rs.getString("CONNECTIVITY_STATUS"));
deviceCountByConnectivityStatus.setDeviceCount(rs.getInt("DEVICE_COUNT")); deviceCountByConnectivityStatus.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -206,20 +208,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws SQLException { public List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws SQLException {
// getting non-compliant device count // getting non-compliant device count
DeviceCountByGroupEntry nonCompliantDeviceCount = new DeviceCountByGroupEntry(); DeviceCountByGroup nonCompliantDeviceCount = new DeviceCountByGroup();
nonCompliantDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT); nonCompliantDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
nonCompliantDeviceCount.setDisplayNameForGroup("Non-compliant"); nonCompliantDeviceCount.setDisplayNameForGroup("Non-compliant");
nonCompliantDeviceCount.setDeviceCount(getNonCompliantDeviceCount()); nonCompliantDeviceCount.setDeviceCount(getNonCompliantDeviceCount());
// getting unmonitored device count // getting unmonitored device count
DeviceCountByGroupEntry unmonitoredDeviceCount = new DeviceCountByGroupEntry(); DeviceCountByGroup unmonitoredDeviceCount = new DeviceCountByGroup();
unmonitoredDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED); unmonitoredDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
unmonitoredDeviceCount.setDisplayNameForGroup("Unmonitored"); unmonitoredDeviceCount.setDisplayNameForGroup("Unmonitored");
unmonitoredDeviceCount.setDeviceCount(getUnmonitoredDeviceCount()); unmonitoredDeviceCount.setDeviceCount(getUnmonitoredDeviceCount());
List<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities = new ArrayList<>(); List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities = new ArrayList<>();
deviceCountsByPotentialVulnerabilities.add(nonCompliantDeviceCount); deviceCountsByPotentialVulnerabilities.add(nonCompliantDeviceCount);
deviceCountsByPotentialVulnerabilities.add(unmonitoredDeviceCount); deviceCountsByPotentialVulnerabilities.add(unmonitoredDeviceCount);
@ -227,36 +229,38 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
private int getNonCompliantDeviceCount() throws SQLException { private int getNonCompliantDeviceCount() throws SQLException {
FilterSet filterSet = new FilterSet(); ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT); extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
PotentialVulnerability.NON_COMPLIANT);
try { try {
return this.getFilteredDeviceCount(filterSet); return this.getFilteredDeviceCount(extendedFilterSet);
} catch (InvalidParameterValueException e) { } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
} }
private int getUnmonitoredDeviceCount() throws SQLException { private int getUnmonitoredDeviceCount() throws SQLException {
FilterSet filterSet = new FilterSet(); ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED); extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
PotentialVulnerability.UNMONITORED);
try { try {
return this.getFilteredDeviceCount(filterSet); return this.getFilteredDeviceCount(extendedFilterSet);
} catch (InvalidParameterValueException e) { } catch (InvalidPotentialVulnerabilityValueException e) {
throw new AssertionError(e); throw new AssertionError(e);
} }
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet) public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>(); List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql, advancedSqlFiltering = ""; String sql, advancedSqlFiltering = "";
@ -286,9 +290,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredDeviceCountByPlatform; DeviceCountByGroup filteredDeviceCountByPlatform;
while (rs.next()) { while (rs.next()) {
filteredDeviceCountByPlatform = new DeviceCountByGroupEntry(); filteredDeviceCountByPlatform = new DeviceCountByGroup();
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM")); filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase()); filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -301,21 +305,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DeviceCountByGroupEntry> public List<DeviceCountByGroup>
getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, SQLException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>(); List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql, advancedSqlFiltering = ""; String sql, advancedSqlFiltering = "";
@ -332,7 +336,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -347,9 +351,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredDeviceCountByPlatform; DeviceCountByGroup filteredDeviceCountByPlatform;
while (rs.next()) { while (rs.next()) {
filteredDeviceCountByPlatform = new DeviceCountByGroupEntry(); filteredDeviceCountByPlatform = new DeviceCountByGroup();
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM")); filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase()); filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -362,16 +366,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet) public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>(); List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql, advancedSqlFiltering = ""; String sql, advancedSqlFiltering = "";
@ -402,9 +406,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredDeviceCountByOwnershipType; DeviceCountByGroup filteredDeviceCountByOwnershipType;
while (rs.next()) { while (rs.next()) {
filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry(); filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP")); filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP")); filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -417,21 +421,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DeviceCountByGroupEntry> public List<DeviceCountByGroup>
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, SQLException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>(); List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql, advancedSqlFiltering = ""; String sql, advancedSqlFiltering = "";
@ -448,7 +452,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -463,9 +467,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredDeviceCountByOwnershipType; DeviceCountByGroup filteredDeviceCountByOwnershipType;
while (rs.next()) { while (rs.next()) {
filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry(); filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP")); filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP")); filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -478,16 +482,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet) public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, SQLException {
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql; String sql;
@ -517,9 +521,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -534,20 +538,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
} }
@Override @Override
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, SQLException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
try { try {
con = this.getConnection(); con = this.getConnection();
String sql; String sql;
@ -564,7 +568,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -579,9 +583,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -595,46 +599,56 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
return filteredDevicesWithDetails; return filteredDevicesWithDetails;
} }
protected Map<String, Object> extractDatabaseFiltersFromBean(FilterSet filterSet) protected Map<String, Object> extractDatabaseFiltersFromBean(BasicFilterSet basicFilterSet) {
throws InvalidParameterValueException { if (basicFilterSet == null) {
if (filterSet == null) {
return null; return null;
} }
Map<String, Object> filters = new LinkedHashMap<>(); Map<String, Object> filters = new LinkedHashMap<>();
String connectivityStatus = filterSet.getConnectivityStatus(); String connectivityStatus = basicFilterSet.getConnectivityStatus();
if (connectivityStatus != null) { if (connectivityStatus != null && !connectivityStatus.isEmpty()) {
filters.put("CONNECTIVITY_STATUS", connectivityStatus); filters.put("CONNECTIVITY_STATUS", connectivityStatus);
} }
String potentialVulnerability = filterSet.getPotentialVulnerability(); String platform = basicFilterSet.getPlatform();
if (potentialVulnerability != null) { 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) || if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability) ||
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) { GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) {
if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability)) { if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability)) {
filters.put("IS_COMPLIANT", 0); filters.put("IS_COMPLIANT", 0);
} else { } else {
filters.put("POLICY_ID", -1); filters.put("POLICY_ID", -1);
} }
} else { } else {
throw new InvalidParameterValueException("Invalid use of value for potential vulnerability. " + throw new InvalidPotentialVulnerabilityValueException("Invalid use of value for potential " +
"Value of potential vulnerability could only be either " + "vulnerability. Value of potential vulnerability could only be either " +
GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT + " or " + GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT + " or " +
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED + "."); 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; return filters;
} }

View File

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

View File

@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl; package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; 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.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants; import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@ -40,15 +41,15 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
@ -56,7 +57,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>(); List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -71,9 +72,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature; DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) { while (rs.next()) {
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry(); filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -103,26 +104,27 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
} }
@Override @Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex,
throws InvalidParameterValueException, SQLException { int resultCount) throws InvalidPotentialVulnerabilityValueException,
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -159,9 +161,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -193,31 +195,32 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
} }
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
FilterSet filterSet, int startIndex, int resultCount) BasicFilterSet basicFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
InvalidResultCountValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
} }
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -236,7 +239,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -256,9 +259,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -273,7 +276,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();

View File

@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl; package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; 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.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants; import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@ -40,15 +41,15 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
@ -56,7 +57,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>(); List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -71,9 +72,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature; DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) { while (rs.next()) {
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry(); filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -103,26 +104,29 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
} }
@Override @Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException,
InvalidStartIndexValueException,
InvalidResultCountValueException,
SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -159,9 +163,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -193,31 +197,32 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
} }
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
FilterSet filterSet, int startIndex, int resultCount) BasicFilterSet basicFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
InvalidResultCountValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
} }
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -236,7 +241,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -256,9 +261,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -273,7 +278,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();

View File

@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl; package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; 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.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants; import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@ -40,15 +41,15 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
@ -56,7 +57,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>(); List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -73,9 +74,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature; DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) { while (rs.next()) {
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry(); filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -105,26 +106,27 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
} }
@Override @Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -163,9 +165,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -197,31 +199,31 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
} }
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
FilterSet filterSet, int startIndex, int resultCount) int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
throws InvalidParameterValueException, SQLException { InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
} }
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -240,7 +242,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -260,9 +262,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -277,7 +279,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();

View File

@ -19,12 +19,13 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl; package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet; 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.AbstractGadgetDataServiceDAO;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants; import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
@ -40,15 +41,15 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
@ -56,7 +57,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>(); List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -72,9 +73,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature; DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
while (rs.next()) { while (rs.next()) {
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry(); filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE")); filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT")); filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
@ -104,26 +105,27 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
} }
@Override @Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, SQLException { throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
InvalidResultCountValueException, SQLException {
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -161,9 +163,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -195,31 +197,31 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
} }
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
FilterSet filterSet, int startIndex, int resultCount) int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
throws InvalidParameterValueException, SQLException { InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) { if (featureCode == null || featureCode.isEmpty()) {
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
} }
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) { 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."); GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) { 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."); 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; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>(); List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
int totalRecordsCount = 0; int totalRecordsCount = 0;
try { try {
con = this.getConnection(); con = this.getConnection();
@ -238,7 +240,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
// [2] appending filter column values, if exist // [2] appending filter column values, if exist
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
if (filters != null && filters.values().size() > 0) { if (filters != null && filters.values().size() > 0) {
int i = 3; int i = 3;
for (Object value : filters.values()) { for (Object value : filters.values()) {
@ -258,9 +260,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();
// fetching query results // fetching query results
DetailedDeviceEntry filteredDeviceWithDetails; DeviceWithDetails filteredDeviceWithDetails;
while (rs.next()) { while (rs.next()) {
filteredDeviceWithDetails = new DetailedDeviceEntry(); filteredDeviceWithDetails = new DeviceWithDetails();
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID")); filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION")); filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM")); filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
@ -275,7 +277,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
stmt = con.prepareStatement(sql); stmt = con.prepareStatement(sql);
stmt.setInt(1, tenantId); stmt.setInt(1, tenantId);
stmt.setString(2, nonCompliantFeatureCode); stmt.setString(2, featureCode);
// executing query // executing query
rs = stmt.executeQuery(); rs = stmt.executeQuery();

View File

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

View File

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

View File

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

View File

@ -19,10 +19,10 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.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. * relevant to Gadget Data Service DAO layer.
*/ */
public class InvalidParameterValueException extends Exception { public class InvalidStartIndexValueException extends Exception {
private String errorMessage; private String errorMessage;
private static final long serialVersionUID = 2021891706072918864L; private static final long serialVersionUID = 2021891706072918864L;
@ -33,7 +33,7 @@ public class InvalidParameterValueException extends Exception {
* @param nestedException Nested exception. * @param nestedException Nested exception.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public InvalidParameterValueException(String errorMessage, Exception nestedException) { public InvalidStartIndexValueException(String errorMessage, Exception nestedException) {
super(errorMessage, nestedException); super(errorMessage, nestedException);
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
} }
@ -44,7 +44,7 @@ public class InvalidParameterValueException extends Exception {
* @param cause Cause of this exception. * @param cause Cause of this exception.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public InvalidParameterValueException(String errorMessage, Throwable cause) { public InvalidStartIndexValueException(String errorMessage, Throwable cause) {
super(errorMessage, cause); super(errorMessage, cause);
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
} }
@ -53,7 +53,7 @@ public class InvalidParameterValueException extends Exception {
* Constructs a new exception with the specific error message. * Constructs a new exception with the specific error message.
* @param errorMessage Specific error message. * @param errorMessage Specific error message.
*/ */
public InvalidParameterValueException(String errorMessage) { public InvalidStartIndexValueException(String errorMessage) {
super(errorMessage); super(errorMessage);
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
} }
@ -63,7 +63,7 @@ public class InvalidParameterValueException extends Exception {
* @param cause Cause of this exception. * @param cause Cause of this exception.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public InvalidParameterValueException(Throwable cause) { public InvalidStartIndexValueException(Throwable cause) {
super(cause); super(cause);
} }
@ -77,3 +77,4 @@ public class InvalidParameterValueException extends Exception {
} }
} }

View File

@ -19,12 +19,12 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.impl; 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.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.GadgetDataServiceDAOFactory;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry; import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.sql.SQLException; import java.sql.SQLException;
@ -36,12 +36,13 @@ import java.util.List;
public class GadgetDataServiceImpl implements GadgetDataService { public class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet) public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
DeviceCountByGroupEntry filteredDeviceCount; DeviceCountByGroup filteredDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filterSet); filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCount(extendedFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -52,13 +53,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException { throws InvalidFeatureCodeValueException, DataAccessLayerException {
DeviceCountByGroupEntry featureNonCompliantDeviceCount; DeviceCountByGroup featureNonCompliantDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory. featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet); getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(featureCode, basicFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -69,8 +70,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException { public DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException {
DeviceCountByGroupEntry totalDeviceCount; DeviceCountByGroup totalDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount(); totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
@ -84,8 +85,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException { public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses; List<DeviceCountByGroup> deviceCountsByConnectivityStatuses;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory. deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory.
@ -100,8 +101,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException { public List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities; List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
@ -117,7 +118,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidStartIndexValueException, InvalidResultCountValueException,
DataAccessLayerException {
PaginationResult paginationResult; PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
@ -133,13 +135,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet) public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> deviceCountsByPlatforms; List<DeviceCountByGroup> deviceCountsByPlatforms;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByPlatforms(filterSet); getDeviceCountsByPlatforms(extendedFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -150,13 +152,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, public List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByPlatforms; DataAccessLayerException {
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByPlatforms;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet); getFeatureNonCompliantDeviceCountsByPlatforms(featureCode, basicFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -167,13 +170,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet) public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidPotentialVulnerabilityValueException,
List<DeviceCountByGroupEntry> deviceCountsByOwnershipTypes; DataAccessLayerException {
List<DeviceCountByGroup> deviceCountsByOwnershipTypes;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByOwnershipTypes(filterSet); getDeviceCountsByOwnershipTypes(extendedFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -184,14 +188,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DeviceCountByGroupEntry> public List<DeviceCountByGroup>
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode, BasicFilterSet basicFilterSet)
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException { throws InvalidFeatureCodeValueException, DataAccessLayerException {
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByOwnershipTypes; List<DeviceCountByGroup> featureNonCompliantDeviceCountsByOwnershipTypes;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet); getFeatureNonCompliantDeviceCountsByOwnershipTypes(featureCode, basicFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -202,13 +206,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public PaginationResult getDevicesWithDetails(FilterSet filterSet, public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
int startIndex, int resultCount) throws InvalidParameterValueException, DataAccessLayerException { throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
InvalidStartIndexValueException, InvalidResultCountValueException {
PaginationResult paginationResult; PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDevicesWithDetails(filterSet, startIndex, resultCount); getDevicesWithDetails(extendedFilterSet, startIndex, resultCount);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -219,14 +224,15 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
FilterSet filterSet, int startIndex, int resultCount) int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
throws InvalidParameterValueException, DataAccessLayerException { DataAccessLayerException, InvalidStartIndexValueException,
InvalidResultCountValueException {
PaginationResult paginationResult; PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet, startIndex, resultCount); getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet, startIndex, resultCount);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -237,13 +243,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet) public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
List<DetailedDeviceEntry> devicesWithDetails; List<DeviceWithDetails> devicesWithDetails;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
devicesWithDetails = GadgetDataServiceDAOFactory. devicesWithDetails = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getDevicesWithDetails(filterSet); getGadgetDataServiceDAO().getDevicesWithDetails(extendedFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);
@ -254,13 +260,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException { BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
List<DetailedDeviceEntry> featureNonCompliantDevicesWithDetails; DataAccessLayerException {
List<DeviceWithDetails> featureNonCompliantDevicesWithDetails;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet); getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet);
} catch (SQLException e) { } catch (SQLException e) {
throw new DataAccessLayerException("Error in either opening a database connection or " + throw new DataAccessLayerException("Error in either opening a database connection or " +
"accessing the database to fetch corresponding results.", e); "accessing the database to fetch corresponding results.", e);

View File

@ -17,14 +17,12 @@
~ under the License. ~ under the License.
--> -->
<project xmlns="http://maven.apache.org/POM/4.0.0" <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">
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> <parent>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<version>1.1.0-SNAPSHOT</version> <version>1.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

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

View File

@ -180,14 +180,13 @@ public interface Operation {
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
httpMethod = "POST", httpMethod = "GET",
value = "Retrieving the operation details.", value = "Retrieving the operation details.",
notes = "This will return the operation details including the responses from the devices") notes = "This will return the operation details including the responses from the devices")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Activity details provided successfully.."), @ApiResponses(value = {@ApiResponse(code = 200, message = "Activity details provided successfully.."),
@ApiResponse(code = 500, message = "Error occurred while fetching the activity for the supplied id.")}) @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"}) @Permission(scope = "operation-view", permissions = {"/permission/admin/device-mgt/admin/devices/view"})
Response getActivity( Response getActivity(@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
required = true) @PathParam("id") String id) required = true) @PathParam("id") String id)
throws MDMAPIException; throws MDMAPIException;

View File

@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.jaxrs.api.impl;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException; import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
import org.wso2.carbon.device.mgt.jaxrs.api.context.DeviceOperationContext; import org.wso2.carbon.device.mgt.jaxrs.api.context.DeviceOperationContext;
import org.wso2.carbon.device.mgt.jaxrs.api.util.MDMIOSOperationUtil; import org.wso2.carbon.device.mgt.jaxrs.api.util.MDMIOSOperationUtil;
@ -135,12 +136,12 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
if (deviceIdentifiers.size() > 0) { if (deviceIdentifiers.size() > 0) {
type = deviceIdentifiers.get(0).getType(); type = deviceIdentifiers.get(0).getType();
} }
int operationId = dmService.addOperation(type, operationContext.getOperation(), operationContext.getDevices()); Activity activity = dmService.addOperation(type, operationContext.getOperation(), operationContext.getDevices());
if (operationId > 0) { if (activity != null) {
responseMsg.setStatusCode(HttpStatus.SC_CREATED); responseMsg.setStatusCode(HttpStatus.SC_CREATED);
responseMsg.setMessageFromServer("Operation has added successfully."); responseMsg.setMessageFromServer("Operation has added successfully.");
} }
return Response.status(Response.Status.CREATED).entity(responseMsg).build(); return Response.status(Response.Status.CREATED).entity(activity).build();
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String msg = "Error occurred while saving the operation"; String msg = "Error occurred while saving the operation";
log.error(msg, e); log.error(msg, e);
@ -176,6 +177,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
ResponsePayload responseMsg = new ResponsePayload(); ResponsePayload responseMsg = new ResponsePayload();
ApplicationManager appManagerConnector; ApplicationManager appManagerConnector;
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null; org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null;
Activity activity = null;
try { try {
appManagerConnector = DeviceMgtAPIUtils.getAppManagementService(); appManagerConnector = DeviceMgtAPIUtils.getAppManagementService();
MobileApp mobileApp = applicationWrapper.getApplication(); MobileApp mobileApp = applicationWrapper.getApplication();
@ -188,11 +190,11 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp); operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp);
} }
} }
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); activity = appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
} }
responseMsg.setStatusCode(HttpStatus.SC_CREATED); responseMsg.setStatusCode(HttpStatus.SC_CREATED);
responseMsg.setMessageFromServer("Authentication installation request has been sent to the device."); responseMsg.setMessageFromServer("Authentication installation request has been sent to the device.");
return Response.status(Response.Status.CREATED).entity(responseMsg).build(); return Response.status(Response.Status.CREATED).entity(activity).build();
} catch (ApplicationManagementException | MDMAPIException e) { } catch (ApplicationManagementException | MDMAPIException e) {
String msg = "Error occurred while saving the operation"; String msg = "Error occurred while saving the operation";
log.error(msg, e); log.error(msg, e);
@ -208,6 +210,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
ResponsePayload responseMsg = new ResponsePayload(); ResponsePayload responseMsg = new ResponsePayload();
ApplicationManager appManagerConnector; ApplicationManager appManagerConnector;
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null; org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null;
Activity activity = null;
try { try {
appManagerConnector = DeviceMgtAPIUtils.getAppManagementService(); appManagerConnector = DeviceMgtAPIUtils.getAppManagementService();
MobileApp mobileApp = applicationWrapper.getApplication(); MobileApp mobileApp = applicationWrapper.getApplication();
@ -220,11 +223,11 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
operation = MDMIOSOperationUtil.createAppUninstallOperation(mobileApp); operation = MDMIOSOperationUtil.createAppUninstallOperation(mobileApp);
} }
} }
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); activity = appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
} }
responseMsg.setStatusCode(HttpStatus.SC_CREATED); responseMsg.setStatusCode(HttpStatus.SC_CREATED);
responseMsg.setMessageFromServer("Authentication removal request has been sent to the device."); responseMsg.setMessageFromServer("Authentication removal request has been sent to the device.");
return Response.status(Response.Status.CREATED).entity(responseMsg).build(); return Response.status(Response.Status.CREATED).entity(activity).build();
} catch (ApplicationManagementException | MDMAPIException e) { } catch (ApplicationManagementException | MDMAPIException e) {
String msg = "Error occurred while saving the operation"; String msg = "Error occurred while saving the operation";
log.error(msg, e); log.error(msg, e);
@ -235,7 +238,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
@Override @Override
@GET @GET
@Path("activity/{id}") @Path("activity/{id}")
public Response getActivity(@PathParam("id") String id) public Response getActivity( @PathParam("id") String id)
throws MDMAPIException { throws MDMAPIException {
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation; org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation;
DeviceManagementProviderService dmService; DeviceManagementProviderService dmService;

View File

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

View File

@ -20,6 +20,7 @@
package org.wso2.carbon.device.mgt.common.app.mgt; package org.wso2.carbon.device.mgt.common.app.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List; import java.util.List;
@ -66,12 +67,12 @@ public interface ApplicationManager {
throws ApplicationManagementException; throws ApplicationManagementException;
void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers) Activity installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws ApplicationManagementException; throws ApplicationManagementException;
void installApplicationForUsers(Operation operation, List<String> userNameList) Activity installApplicationForUsers(Operation operation, List<String> userNameList)
throws ApplicationManagementException; throws ApplicationManagementException;
void installApplicationForUserRoles(Operation operation, List<String> userRoleList) Activity installApplicationForUserRoles(Operation operation, List<String> userRoleList)
throws ApplicationManagementException; throws ApplicationManagementException;
} }

View File

@ -0,0 +1,65 @@
/*
* 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.common.operation.mgt;
public class Activity {
public enum Type {
CONFIG, MESSAGE, INFO, COMMAND, PROFILE, POLICY
}
private String activityId;
private String code;
private Type type;
private String createdTimeStamp;
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public String getCreatedTimeStamp() {
return createdTimeStamp;
}
public void setCreatedTimeStamp(String createdTimeStamp) {
this.createdTimeStamp = createdTimeStamp;
}
}

View File

@ -0,0 +1,68 @@
/*
* 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.common.operation.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import java.util.List;
public class ActivityStatus {
public enum Status {
IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED
}
private DeviceIdentifier deviceIdentifier;
private Status status;
private List<OperationResponse> responses;
private String updatedTimestamp;
public DeviceIdentifier getDeviceIdentifier() {
return deviceIdentifier;
}
public void setDeviceIdentifier(DeviceIdentifier deviceIdentifier) {
this.deviceIdentifier = deviceIdentifier;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public List<OperationResponse> getResponses() {
return responses;
}
public void setResponses(List<OperationResponse> responses) {
this.responses = responses;
}
public String getUpdatedTimestamp() {
return updatedTimestamp;
}
public void setUpdatedTimestamp(String updatedTimestamp) {
this.updatedTimestamp = updatedTimestamp;
}
}

View File

@ -38,7 +38,7 @@ public interface OperationManager {
* @throws OperationManagementException If some unusual behaviour is observed while adding the * @throws OperationManagementException If some unusual behaviour is observed while adding the
* operation * operation
*/ */
int addOperation(Operation operation, List<DeviceIdentifier> devices) throws OperationManagementException; Activity addOperation(Operation operation, List<DeviceIdentifier> devices) throws OperationManagementException;
/** /**
* Method to retrieve the list of all operations to a device. * Method to retrieve the list of all operations to a device.

View File

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

View File

@ -30,6 +30,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.TransactionManagementException; import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
@ -91,7 +92,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
} }
@Override @Override
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIds) public Activity installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIds)
throws ApplicationManagementException { throws ApplicationManagementException {
try { try {
//TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()" //TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()"
@ -99,10 +100,11 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
if (deviceIds.size() > 0) { if (deviceIds.size() > 0) {
type = deviceIds.get(0).getType(); type = deviceIds.get(0).getType();
} }
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation, Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
deviceIds); addOperation(type, operation, deviceIds);
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().notifyOperationToDevices DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().notifyOperationToDevices
(operation, deviceIds); (operation, deviceIds);
return activity;
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
throw new ApplicationManagementException("Error in add operation at app installation", e); throw new ApplicationManagementException("Error in add operation at app installation", e);
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
@ -111,7 +113,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
} }
@Override @Override
public void installApplicationForUsers(Operation operation, List<String> userNameList) public Activity installApplicationForUsers(Operation operation, List<String> userNameList)
throws ApplicationManagementException { throws ApplicationManagementException {
String userName = null; String userName = null;
@ -138,9 +140,10 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
if (deviceIdentifierList.size() > 0) { if (deviceIdentifierList.size() > 0) {
type = deviceIdentifierList.get(0).getType(); type = deviceIdentifierList.get(0).getType();
} }
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider() Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.addOperation(type, operation, deviceIdentifierList); .addOperation(type, operation, deviceIdentifierList);
return activity;
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
throw new ApplicationManagementException("Error in get devices for user: " + userName + throw new ApplicationManagementException("Error in get devices for user: " + userName +
" in app installation", e); " in app installation", e);
@ -152,7 +155,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
} }
@Override @Override
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList) public Activity installApplicationForUserRoles(Operation operation, List<String> userRoleList)
throws ApplicationManagementException { throws ApplicationManagementException {
String userRole = null; String userRole = null;
@ -178,9 +181,9 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
if (deviceIdentifierList.size() > 0) { if (deviceIdentifierList.size() > 0) {
type = deviceIdentifierList.get(0).getType(); type = deviceIdentifierList.get(0).getType();
} }
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation, Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation,
deviceIdentifierList); deviceIdentifierList);
return activity;
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
throw new ApplicationManagementException("Error in get devices for user role " + userRole + throw new ApplicationManagementException("Error in get devices for user role " + userRole +
" in app installation", e); " in app installation", e);

View File

@ -24,6 +24,7 @@ import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.*; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException; import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
@ -47,6 +48,7 @@ import org.wso2.carbon.device.mgt.core.task.impl.DeviceTaskManagerImpl;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -83,8 +85,8 @@ public class OperationManagerImpl implements OperationManager {
} }
@Override @Override
public int addOperation(Operation operation, public Activity addOperation(Operation operation,
List<DeviceIdentifier> deviceIds) throws OperationManagementException { List<DeviceIdentifier> deviceIds) throws OperationManagementException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("operation:[" + operation.toString() + "]"); log.debug("operation:[" + operation.toString() + "]");
for (DeviceIdentifier deviceIdentifier : deviceIds) { for (DeviceIdentifier deviceIdentifier : deviceIds) {
@ -96,7 +98,7 @@ public class OperationManagerImpl implements OperationManager {
List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds); List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds);
if (authorizedDeviceList.size() <= 0) { if (authorizedDeviceList.size() <= 0) {
log.info("User : " + getUser() + " is not authorized to perform operations on given device-list."); log.info("User : " + getUser() + " is not authorized to perform operations on given device-list.");
return -1; return null;
} }
List<EnrolmentInfo> enrolments = this.getEnrollmentsByStatus(deviceIds); List<EnrolmentInfo> enrolments = this.getEnrollmentsByStatus(deviceIds);
@ -128,7 +130,12 @@ public class OperationManagerImpl implements OperationManager {
} }
} }
OperationManagementDAOFactory.commitTransaction(); OperationManagementDAOFactory.commitTransaction();
return operationId; Activity activity = new Activity();
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
activity.setCode(operationDto.getCode());
activity.setCreatedTimeStamp(new Date().toString());
activity.setType(Activity.Type.valueOf(operationDto.getType().toString()));
return activity;
} catch (OperationManagementDAOException e) { } catch (OperationManagementDAOException e) {
OperationManagementDAOFactory.rollbackTransaction(); OperationManagementDAOFactory.rollbackTransaction();
throw new OperationManagementException("Error occurred while adding operation", e); throw new OperationManagementException("Error occurred while adding operation", e);

View File

@ -22,6 +22,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
@ -43,9 +44,9 @@ public class PushNotificationBasedOperationManager implements OperationManager {
} }
@Override @Override
public int addOperation(Operation operation, public Activity addOperation(Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException { List<DeviceIdentifier> devices) throws OperationManagementException {
int operationId = this.operationManager.addOperation(operation, devices); Activity activity = this.operationManager.addOperation(operation, devices);
for (DeviceIdentifier deviceId : devices) { for (DeviceIdentifier deviceId : devices) {
try { try {
this.notificationProvider.execute(new NotificationContext(deviceId)); this.notificationProvider.execute(new NotificationContext(deviceId));
@ -53,7 +54,7 @@ public class PushNotificationBasedOperationManager implements OperationManager {
throw new OperationManagementException("Error occurred while sending push notification to device", e); throw new OperationManagementException("Error occurred while sending push notification to device", e);
} }
} }
return operationId; return activity;
} }
@Override @Override

View File

@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
@ -216,8 +217,8 @@ public interface DeviceManagementProviderService {
void notifyOperationToDevices(Operation operation, void notifyOperationToDevices(Operation operation,
List<DeviceIdentifier> deviceIds) throws DeviceManagementException; List<DeviceIdentifier> deviceIds) throws DeviceManagementException;
int addOperation(String type, Operation operation, Activity addOperation(String type, Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException; List<DeviceIdentifier> devices) throws OperationManagementException;
List<? extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException; List<? extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException;

View File

@ -33,6 +33,7 @@ import org.wso2.carbon.device.mgt.common.TransactionManagementException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
@ -816,8 +817,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
} }
@Override @Override
public int addOperation(String type, Operation operation, public Activity addOperation(String type, Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException { List<DeviceIdentifier> devices) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getOperationManager().addOperation(operation, devices); return DeviceManagementDataHolder.getInstance().getOperationManager().addOperation(operation, devices);
} }

View File

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

View File

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

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Dashboard"}} {{unit "cdmf.unit.ui.title" pageTitle="Dashboard"}}
{{unit "cdmf.unit.ui.content.title" pageHeader="Dashboard"}} {{unit "cdmf.unit.ui.content.title" pageHeader="Dashboard"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss"}} {{#zone "topCss"}}
{{css "css/analytics.css"}} {{css "css/analytics.css"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Device Types"}} {{unit "cdmf.unit.ui.title" pageTitle="Device Types"}}
{{unit "cdmf.unit.ui.content.title" pageHeader="Device List"}} {{unit "cdmf.unit.ui.content.title" pageHeader="Device List"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Device"}} {{unit "cdmf.unit.ui.title" pageTitle="Device"}}
{{! unit "cdmf.unit.ui.content.title" pageHeader="Device Download"}} {{! unit "cdmf.unit.ui.content.title" pageHeader="Device Download"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Device Details"}} {{unit "cdmf.unit.ui.title" pageTitle="Device Details"}}
{{unit "cdmf.unit.lib.service-invoker-utility"}} {{unit "cdmf.unit.lib.service-invoker-utility"}}
{{unit "cdmf.unit.lib.handlebars"}} {{unit "cdmf.unit.lib.handlebars"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Device Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Device Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} {{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss"}} {{#zone "topCss"}}
{{css "css/analytics.css"}} {{css "css/analytics.css"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}} {{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Notification Listing"}} {{unit "cdmf.unit.ui.title" pageTitle="Notification Listing"}}
{{#zone "content"}} {{#zone "content"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}} {{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.lib.service-invoker-utility"}} {{unit "cdmf.unit.lib.service-invoker-utility"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.lib.select2"}} {{unit "cdmf.unit.lib.select2"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "title"}}{{! to override parent page title }}{{/zone}} {{#zone "title"}}{{! to override parent page title }}{{/zone}}
{{unit "cdmf.unit.ui.title" pageTitle="Login"}} {{unit "cdmf.unit.ui.title" pageTitle="Login"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} {{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} {{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} {{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}} {{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss"}} {{#zone "topCss"}}
{{css "css/daterangepicker.css"}} {{css "css/daterangepicker.css"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss"}} {{#zone "topCss"}}
{{~css "css/dataTables.bootstrap.css"}} {{~css "css/dataTables.bootstrap.css"}}
{{~css "css/dataTables.responsive.css"}} {{~css "css/dataTables.responsive.css"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="panel-heading">Device Details</div> <div class="panel-heading">Device Details</div>
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
<br> <br>

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="wr-operations" style="height: 87px;"></div> <div class="wr-operations" style="height: 87px;"></div>
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/operation-mod.js"}} {{js "js/operation-mod.js"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<table class="table table-responsive table-striped" id="members"> <table class="table table-responsive table-striped" id="members">
<tbody> <tbody>
{{#if device.viewModel.vendor}} {{#if device.viewModel.vendor}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#defineZone "contentTitle"}} {{#defineZone "contentTitle"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="container-fluid"> <div class="container-fluid">
<span id="device-listing-status-msg"></span> <span id="device-listing-status-msg"></span>
<table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view" <table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view"

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "contentTitle"}} {{#zone "contentTitle"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "footer"}} {{#zone "footer"}}
<p> <p>
WSO2 Carbon Device Management Framework v.1.0.0 | &copy; 2015, <a href="http://wso2.com/" target="_blank"><i class="icon fw fw-wso2"></i> Inc</a>. (<a href="http://wso2.com/" target="_blank">http://www.wso2.org</a>) All Rights Reserved. WSO2 Carbon Device Management Framework v.1.0.0 | &copy; 2015, <a href="http://wso2.com/" target="_blank"><i class="icon fw fw-wso2"></i> Inc</a>. (<a href="http://wso2.com/" target="_blank">http://www.wso2.org</a>) All Rights Reserved.

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/handlebars-v2.0.0.js"}} {{js "js/handlebars-v2.0.0.js"}}
{{js "js/utils.js"}} {{js "js/utils.js"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/jquery.qrcode.min.js"}} {{js "js/jquery.qrcode.min.js"}}
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss"}} {{#zone "topCss"}}
{{css "css/graph.css"}} {{css "css/graph.css"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/js.cookie.js"}} {{js "js/js.cookie.js"}}
{{js "js/invoker-lib.js"}} {{js "js/invoker-lib.js"}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/tinymce.min.js" combine=false}} {{js "js/tinymce.min.js" combine=false}}
{{/zone}} {{/zone}}

View File

@ -1,41 +1,61 @@
<span id="permission" data-permission="{{permissions}}"></span> {{!
<div class="row"> Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<div class="col-md-12">
<!-- content --> WSO2 Inc. licenses this file to you under the Apache License,
<div id="config-save-form" class="container col-centered wr-content"> Version 2.0 (the "License"); you may not use this file except
<br> in compliance with the License.
Device Notifications You may obtain a copy of the License at
<br>
<br> http://www.apache.org/licenses/LICENSE-2.0
<div class="wr-advance-operations">
<div class="row no-gutter"> Unless required by applicable law or agreed to in writing,
<div class="wr-hidden-operations-nav col-lg-4"> software distributed under the License is distributed on an
<a id="unReadNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('unread', this)" class="selected"> "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.
}}
<span id="permission" data-permission="{{permissions}}"></span>
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="config-save-form" class="container col-centered wr-content">
<br>
Device Notifications
<br>
<br>
<div class="wr-advance-operations">
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a id="unReadNotifications" href="javascript:void(0)"
onclick="showAdvanceOperation('unread', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack"> <span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-mail fw-stack-2x"></i> <i class="fw fw-mail fw-stack-2x"></i>
</span> </span>
Unread Unread
</a> </a>
<a id="allNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('all', this)"> <a id="allNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('all', this)">
<span class="wr-hidden-operations-icon fw-stack"> <span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-forum fw-stack-2x"></i> <i class="fw fw-forum fw-stack-2x"></i>
</span> </span>
All Notifications All Notifications
</a> </a>
</div> </div>
<div class="wr-hidden-operations-content col-lg-8" id="ast-container"> <div class="wr-hidden-operations-content col-lg-8" id="ast-container">
<div class="panel-body"> <div class="panel-body">
No unread messages No unread messages
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content -->
</div> </div>
</div>
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="notification-listing" data-current-user="{{currentUser.username}}" data-image-resource="{{self.publicURL}}/images/" src="{{self.publicURL}}/templates/notification-listing.hbs" type="text/x-handlebars-template" ></script> <script id="notification-listing" data-current-user="{{currentUser.username}}"
data-image-resource="{{self.publicURL}}/images/" src="{{self.publicURL}}/templates/notification-listing.hbs"
type="text/x-handlebars-template"></script>
{{js "js/notification-listing.js"}} {{js "js/notification-listing.js"}}
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<!-- content --> <!-- content -->

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="container col-centered wr-content policy-platform"> <div class="container col-centered wr-content policy-platform">

View File

@ -1,3 +1,20 @@
{{!
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.
}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
<span class="page-sub-title"> <span class="page-sub-title">

View File

@ -1,94 +1,114 @@
<!-- content/body --> {{!
<div class="row"> Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<div class="col-md-12">
<!-- content --> WSO2 Inc. licenses this file to you under the Apache License,
<div id="role-create-form" class="container col-centered wr-content"> Version 2.0 (the "License"); you may not use this file except
<div class="wr-form"> in compliance with the License.
<p class="page-sub-title">Add Role</p> You may obtain a copy of the License at
<hr/>
<div class="row"> http://www.apache.org/licenses/LICENSE-2.0
<div class="col-lg-8">
<div class="wr-steps"> Unless required by applicable law or agreed to in writing,
<div class="col-md-6 col-xs-6"> software distributed under the License is distributed on an
<div class="itm-wiz itm-wiz-current" data-step="policy-platform"> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<div class="wiz-no">1</div> KIND, either express or implied. See the License for the
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div> specific language governing permissions and limitations
</div> under the License.
<br class="c-both"/> }}
<!-- content/body -->
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="role-create-form" class="container col-centered wr-content">
<div class="wr-form">
<p class="page-sub-title">Add Role</p>
<hr />
<div class="row">
<div class="col-lg-8">
<div class="wr-steps">
<div class="col-md-6 col-xs-6">
<div class="itm-wiz itm-wiz-current" data-step="policy-platform">
<div class="wiz-no">1</div>
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
</div> </div>
<div class="col-md-6 col-xs-6"> <br class="c-both" />
<div class="itm-wiz" data-step="policy-profile"> </div>
<div class="wiz-no">2</div> <div class="col-md-6 col-xs-6">
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div> <div class="itm-wiz" data-step="policy-profile">
</div> <div class="wiz-no">2</div>
<br class="c-both"/> <div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
</div> </div>
</div> <br class="c-both" />
<br/><br/><hr/>
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label">Domain *</label>
<div class="wr-input-control">
<select id="domain" class="form-control select">
<option>PRIMARY</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<label class="wr-input-label">
Role Name *
</label>
<br>
<label class="wr-input-label">
( {{roleNameHelpText}} )
</label>
<div id="roleNameField" class="form-group wr-input-control">
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"/>
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in minimum 3 characters long and do not include any whitespaces. </label>
</div>
<label class="wr-input-label">
User list
</label>
<div class="wr-input-control">
<select id="users" class="form-control select2" multiple="multiple">
</select>
</div> </div>
</div> </div>
<br /><br />
<hr />
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label">Domain *</label>
<div class="wr-input-control">
<select id="domain" class="form-control select">
<option>PRIMARY</option>
{{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<label class="wr-input-label">
Role Name *
</label>
<br>
<label class="wr-input-label">
( {{roleNameHelpText}} )
</label>
<div id="roleNameField" class="form-group wr-input-control">
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control" />
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
minimum 3 characters long and do not
include any whitespaces. </label>
</div>
<label class="wr-input-label">
User list
</label>
<div class="wr-input-control">
<select id="users" class="form-control select2" multiple="multiple">
</select>
</div>
</div> </div>
<br>
<button id="add-role-btn" class="wr-btn">Add Role</button>
</div> </div>
<br>
<button id="add-role-btn" class="wr-btn">Add Role</button>
</div> </div>
<div id="role-created-msg" class="container col-centered wr-content hidden"> </div>
<div class="wr-form"> <div id="role-created-msg" class="container col-centered wr-content hidden">
<p class="page-sub-title">Role was added successfully.</p> <div class="wr-form">
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click <p class="page-sub-title">Role was added successfully.</p>
<b>"View Role List"</b> to complete the process and go back to the role list. <br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
<hr /> <b>"View Role List"</b> to complete the process and go back to the role list.
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'"> <hr />
View Role List <button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
</button> View Role List
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner"> </button>
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Another Role Add Another Role
</a> </a>
</div>
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content/body --> </div>
<!-- /content/body -->
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/bottomJs.js"}} {{js "js/bottomJs.js"}}
{{/zone}} {{/zone}}

View File

@ -1,73 +1,92 @@
<!-- content/body --> {{!
<div class="row"> Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<div class="col-md-12">
<!-- content --> WSO2 Inc. licenses this file to you under the Apache License,
<div id="role-create-form" class="container col-centered wr-content"> Version 2.0 (the "License"); you may not use this file except
<div class="wr-form"> in compliance with the License.
<p class="page-sub-title">Change Role permissions</p> You may obtain a copy of the License at
<p>Please note that * sign represents required fields of data.</p>
<div class="wr-steps hidden" id="role_wizard_header"> http://www.apache.org/licenses/LICENSE-2.0
<hr/>
<div class="col-md-4 col-xs-6"> Unless required by applicable law or agreed to in writing,
<div class="itm-wiz" data-step="policy-platform"> software distributed under the License is distributed on an
<div class="wiz-no">1</div> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div> KIND, either express or implied. See the License for the
</div> specific language governing permissions and limitations
<br class="c-both"/> under the License.
</div> }}
<div class="col-md-4 col-xs-6"> <!-- content/body -->
<div class="itm-wiz itm-wiz-current" data-step="policy-profile"> <div class="row">
<div class="wiz-no">2</div> <div class="col-md-12">
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div> <!-- content -->
</div> <div id="role-create-form" class="container col-centered wr-content">
<br class="c-both"/> <div class="wr-form">
</div> <p class="page-sub-title">Change Role permissions</p>
<br/><br/> <p>Please note that * sign represents required fields of data.</p>
</div> <div class="wr-steps hidden" id="role_wizard_header">
<hr/>
<div class="row">
<div class="col-lg-8">
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div id="permissionList" class="well" data-currentrole="{{roleName}}">
<div id="loading-content" class="col-centered">
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading permissions list . . .
<br>
</div>
</div>
</div>
</div>
<br>
<button id="update-permissions-btn" class="wr-btn">Update Role Permissions</button>
</div>
</div>
<div id="role-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Permissions were assigned to the role successfully.</p>
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
<b>"View Role List"</b> to complete the process and go back to the role list.
<hr /> <hr />
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'"> <div class="col-md-4 col-xs-6">
View Role List <div class="itm-wiz" data-step="policy-platform">
</button> <div class="wiz-no">1</div>
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner"> <div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
</div>
<br class="c-both" />
</div>
<div class="col-md-4 col-xs-6">
<div class="itm-wiz itm-wiz-current" data-step="policy-profile">
<div class="wiz-no">2</div>
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
</div>
<br class="c-both" />
</div>
<br /><br />
</div>
<hr />
<div class="row">
<div class="col-lg-8">
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div id="permissionList" class="well" data-currentrole="{{roleName}}">
<div id="loading-content" class="col-centered">
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading permissions list . . .
<br>
</div>
</div>
</div>
</div>
<br>
<button id="update-permissions-btn" class="wr-btn">Update Role Permissions</button>
</div>
</div>
<div id="role-created-msg" class="container col-centered wr-content hidden">
<div class="wr-form">
<p class="page-sub-title">Permissions were assigned to the role successfully.</p>
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
<b>"View Role List"</b> to complete the process and go back to the role list.
<hr />
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
View Role List
</button>
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
Add Another Role Add Another Role
</a> </a>
</div>
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content/body --> </div>
<!-- /content/body -->
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="list-partial" src="{{@unit.publicUri}}/templates/list-partial.hbs" type="text/x-handlebars-template" ></script> <script id="list-partial" src="{{@unit.publicUri}}/templates/list-partial.hbs"
<script id="tree-template" src="{{@unit.publicUri}}/templates/tree-template.hbs" type="text/x-handlebars-template" ></script> type="text/x-handlebars-template"></script>
<script id="tree-template" src="{{@unit.publicUri}}/templates/tree-template.hbs"
type="text/x-handlebars-template"></script>
{{js "js/bottomJs.js"}} {{js "js/bottomJs.js"}}
{{/zone}} {{/zone}}

View File

@ -1,68 +1,89 @@
<!-- content/body --> {{!
<div class="row"> Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<div class="col-md-12">
<!-- content --> WSO2 Inc. licenses this file to you under the Apache License,
<div id="role-create-form" class="container col-centered wr-content"> Version 2.0 (the "License"); you may not use this file except
<div class="wr-form"> in compliance with the License.
<p class="page-sub-title">Edit Role</p> You may obtain a copy of the License at
<p>Please note that * sign represents required fields of data.</p>
<hr /> http://www.apache.org/licenses/LICENSE-2.0
<div class="row">
<div class="col-lg-8"> Unless required by applicable law or agreed to in writing,
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert"> software distributed under the License is distributed on an
<i class="icon fw fw-error"></i><span></span> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
</div> KIND, either express or implied. See the License for the
<label class="wr-input-label">Domain *</label> specific language governing permissions and limitations
<div class="wr-input-control"> under the License.
<select id="domain" class="form-control select"> }}
<option>PRIMARY</option> <!-- content/body -->
{{#each userStores}} <div class="row">
<option>{{this}}</option> <div class="col-md-12">
{{/each}} <!-- content -->
</select> <div id="role-create-form" class="container col-centered wr-content">
</div> <div class="wr-form">
<label class="wr-input-label"> <p class="page-sub-title">Edit Role</p>
Role Name * <p>Please note that * sign represents required fields of data.</p>
</label> <hr />
<br> <div class="row">
<label class="wr-input-label" id="roleNameValidationText"> <div class="col-lg-8">
( {{roleNameHelpText}} ) <div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
</label> <i class="icon fw fw-error"></i><span></span>
<div id="roleNameField" class="form-group wr-input-control"> </div>
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}" data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control" data-currentrole="{{role.roleName}}" <label class="wr-input-label">Domain *</label>
value="{{role.roleName}}"/> <div class="wr-input-control">
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span> <select id="domain" class="form-control select">
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in minimum 3 characters long and do not include any whitespaces. </label> <option>PRIMARY</option>
</div> {{#each userStores}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<label class="wr-input-label">
Role Name *
</label>
<br>
<label class="wr-input-label" id="roleNameValidationText">
( {{roleNameHelpText}} )
</label>
<div id="roleNameField" class="form-group wr-input-control">
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
data-currentrole="{{role.roleName}}"
value="{{role.roleName}}" />
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
minimum 3 characters long and do not
include any whitespaces. </label>
</div> </div>
</div> </div>
<br>
<button id="add-role-btn" class="wr-btn">Update Role</button>
</div> </div>
<br>
<button id="add-role-btn" class="wr-btn">Update Role</button>
</div> </div>
<div id="role-created-msg" class="container col-centered wr-content hidden"> </div>
<div class="wr-form"> <div id="role-created-msg" class="container col-centered wr-content hidden">
<p class="page-sub-title">Role was updated successfully.</p> <div class="wr-form">
<br>Please click <b>"View Updated Role"</b>, if you wish to view the updated role or click <p class="page-sub-title">Role was updated successfully.</p>
<b>"View Role List"</b> to complete the process and go back to the role list. <br>Please click <b>"View Updated Role"</b>, if you wish to view the updated role or click
<hr /> <b>"View Role List"</b> to complete the process and go back to the role list.
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'"> <hr />
View Role List <button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
</button> View Role List
<a href="{{@app.context}}/roles/edit-role/{{role.roleName}}" </button>
class="cu-btn-inner"> <a href="{{@app.context}}/roles/edit-role/{{role.roleName}}"
class="cu-btn-inner">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>
</span> </span>
View Updated Role View Updated Role
</a> </a>
</div>
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content -->
</div> </div>
<!-- /content/body --> </div>
<!-- /content/body -->
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/bottomJs.js"}} {{js "js/bottomJs.js"}}
{{/zone}} {{/zone}}

View File

@ -1,122 +1,140 @@
<div id="loading-content" class="col-centered"> {{!
{{#if removePermitted}} Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
<input type="hidden" id="can-remove" value="true"/>
{{/if}} WSO2 Inc. licenses this file to you under the Apache License,
{{#if editPermitted}} Version 2.0 (the "License"); you may not use this file except
<input type="hidden" id="can-edit" value="true"/> in compliance with the License.
{{/if}} You may obtain a copy of the License at
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading roles . . . http://www.apache.org/licenses/LICENSE-2.0
<br>
</div> Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
<div id="role-listing-status" class="raw"> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<ul style="list-style-type: none;"> KIND, either express or implied. See the License for the
<li class="message message-info" > specific language governing permissions and limitations
<h4> under the License.
<i class="icon fw fw-info"></i> }}
<a id="role-listing-status-msg"></a> <div id="loading-content" class="col-centered">
</h4> {{#if removePermitted}}
</li> <input type="hidden" id="can-remove" value="true" />
</ul> {{/if}}
</div> {{#if editPermitted}}
<input type="hidden" id="can-edit" value="true" />
<div id="role-table" data-role={{adminRole}}> {{/if}}
<table class="table table-striped table-hover list-table display responsive nowrap data-table row-view" <i class="fw fw-settings fw-spin fw-2x"></i>
id="role-grid"> Loading roles . . .
<thead> <br>
<tr class="sort-row"> </div>
<th class="no-sort"></th>
<th>By Role Name</th> <div id="role-listing-status" class="raw">
<th class="no-sort"></th> <ul style="list-style-type: none;">
</tr> <li class="message message-info">
<tr class="filter-row filter-box"> <h4>
<th colspan="2"> <i class="icon fw fw-info"></i>
<label class="wr-input-label" for="search-by-name"> <a id="role-listing-status-msg"></a>
By Role Name </h4>
</label> </li>
<input id="search-by-name" type="text" class="form-control" placeholder="Search By Role Name"> </ul>
</th> </div>
<th style="vertical-align:bottom;">
<button id="search-btn" class="wr-btn"> <div id="role-table" data-role={{adminRole}}>
Search <table class="table table-striped table-hover list-table display responsive nowrap data-table row-view"
</button> id="role-grid">
</th> <thead>
</tr> <tr class="sort-row">
<tr class="bulk-action-row"> <th class="no-sort"></th>
<th colspan="3"></th> <th>By Role Name</th>
</tr> <th class="no-sort"></th>
</thead> </tr>
<tbody id="ast-container" data-app-context="{{appContext}}"> <tr class="filter-row filter-box">
<br class="c-both"/> <th colspan="2">
</tbody> <label class="wr-input-label" for="search-by-name">
</table> By Role Name
</div> </label>
<br class="c-both"/> <input id="search-by-name" type="text" class="form-control" placeholder="Search By Role Name">
<div id="content-filter-types" style="display: none"> </th>
<div class="sort-title">Sort By</div> <th style="vertical-align:bottom;">
<div class="sort-options"> <button id="search-btn" class="wr-btn">
<th>By Role name</th> Search
</div> </button>
</th>
</tr>
<tr class="bulk-action-row">
<th colspan="3"></th>
</tr>
</thead>
<tbody id="ast-container" data-app-context="{{appContext}}">
<br class="c-both" />
</tbody>
</table>
</div>
<br class="c-both" />
<div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div>
<div class="sort-options">
<th>By Role name</th>
</div> </div>
</div>
<div id="remove-role-modal-content" class="hide"> <div id="remove-role-modal-content" class="hide">
<div class="content"> <div class="content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this role ?</h3> <h3>Do you really want to remove this role ?</h3>
<div class="buttons"> <div class="buttons">
<a href="#" id="remove-role-yes-link" class="btn-operations"> <a href="#" id="remove-role-yes-link" class="btn-operations">
Remove Remove
</a> </a>
<a href="#" id="remove-role-cancel-link" class="btn-operations"> <a href="#" id="remove-role-cancel-link" class="btn-operations">
Cancel Cancel
</a> </a>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="remove-role-success-content" class="hide"> <div id="remove-role-success-content" class="hide">
<div class="content"> <div class="content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Done. Role was successfully removed.</h3> <h3>Done. Role was successfully removed.</h3>
<div class="buttons"> <div class="buttons">
<a href="#" id="remove-role-success-link" class="btn-operations"> <a href="#" id="remove-role-success-link" class="btn-operations">
Ok Ok
</a> </a>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="remove-role-error-content" class="hide"> <div id="remove-role-error-content" class="hide">
<div class="content"> <div class="content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>An unexpected error occurred. Please try again later.</h3> <h3>An unexpected error occurred. Please try again later.</h3>
<div class="buttons"> <div class="buttons">
<a href="#" id="remove-role-error-link" class="btn-operations"> <a href="#" id="remove-role-error-link" class="btn-operations">
Ok Ok
</a> </a>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
{{#zone "common-navigation"}} {{#zone "common-navigation"}}
<!--Later add the navigation menu from here--> <!--Later add the navigation menu from here-->
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="role-listing" data-current-user="{{currentUser.username}}" src="{{@unit.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template" ></script> <script id="role-listing" data-current-user="{{currentUser.username}}"
src="{{@unit.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/role-listing.js"}} {{js "js/role-listing.js"}}
<script type="text/javascript"> <script type="text/javascript">
var clientJsAppContext = "{{{@app.context}}}"; var clientJsAppContext = "{{{@app.context}}}";

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "contentTitle"}} {{#zone "contentTitle"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">

View File

@ -1 +1,18 @@
{{!
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.
}}
{{#zone "productName"}}CDMF BASE APP{{/zone}} {{#zone "productName"}}CDMF BASE APP{{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "userMenu-items"}} {{#zone "userMenu-items"}}
<li> <li>
<a href="{{@app.context}}/logout">Logout</a> <a href="{{@app.context}}/logout">Logout</a>

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "navMenu-icon"}} {{#zone "navMenu-icon"}}
<span class="icon fw-stack"><i class="fw fw-tiles fw-stack-1x"></i></span> <span class="icon fw-stack"><i class="fw fw-tiles fw-stack-1x"></i></span>
{{/zone}} {{/zone}}

View File

@ -1,3 +1,20 @@
{{!
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.
}}
{{#zone "topCss" override=false}} {{#zone "topCss" override=false}}
{{css "css/custom-theme.css"}} {{css "css/custom-theme.css"}}
{{css "css/custom-common.css"}} {{css "css/custom-common.css"}}

Some files were not shown because too many files have changed in this diff Show More