mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding temporary development code bits for dashboard analytics feature
This commit is contained in:
parent
84ebba0bd7
commit
9786908b35
@ -63,7 +63,8 @@
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.internal
|
||||
</Private-Package>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard,
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.osgi.framework,
|
||||
|
||||
@ -18,9 +18,11 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -30,61 +32,62 @@ import java.util.Map;
|
||||
public interface GadgetDataService {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getTotalDeviceCount() throws GadgetDataServiceException;
|
||||
int getTotalDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getActiveDeviceCount() throws GadgetDataServiceException;
|
||||
int getActiveDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getInactiveDeviceCount() throws GadgetDataServiceException;
|
||||
int getInactiveDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getRemovedDeviceCount() throws GadgetDataServiceException;
|
||||
int getRemovedDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getNonCompliantDeviceCount() throws GadgetDataServiceException;
|
||||
int getNonCompliantDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getUnmonitoredDeviceCount() throws GadgetDataServiceException;
|
||||
int getUnmonitoredDeviceCount() throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
||||
throws GadgetDataServiceException;
|
||||
throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
int getDeviceCount(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
||||
PaginationRequest paginationRequest) throws GadgetDataServiceException;
|
||||
PaginationRequest paginationRequest) throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException;
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest)
|
||||
throws SQLException, InvalidParameterException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException;
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException;
|
||||
|
||||
}
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Custom exception class for GadgetDataService layer.
|
||||
*/
|
||||
public class GadgetDataServiceException 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.
|
||||
*/
|
||||
public GadgetDataServiceException(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 GadgetDataServiceException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message.
|
||||
*
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public GadgetDataServiceException(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 GadgetDataServiceException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,9 +18,11 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -31,70 +33,71 @@ public interface GadgetDataServiceDAO {
|
||||
*
|
||||
* @return Total filtered device count.
|
||||
*/
|
||||
int getTotalDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getTotalDeviceCount() throws SQLException;
|
||||
|
||||
/**
|
||||
* Method to get active device count from a particular tenant.
|
||||
*
|
||||
* @return active device count.
|
||||
*/
|
||||
int getActiveDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getActiveDeviceCount() throws SQLException;
|
||||
|
||||
/**
|
||||
* Method to get inactive device count from a particular tenant.
|
||||
*
|
||||
* @return inactive device count.
|
||||
*/
|
||||
int getInactiveDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getInactiveDeviceCount() throws SQLException;
|
||||
|
||||
/**
|
||||
* Method to get removed device count from a particular tenant.
|
||||
*
|
||||
* @return removed device count.
|
||||
*/
|
||||
int getRemovedDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getRemovedDeviceCount() throws SQLException;
|
||||
|
||||
/**
|
||||
* Method to get non-compliant device count from a particular tenant.
|
||||
*
|
||||
* @return Non-compliant device count.
|
||||
*/
|
||||
int getNonCompliantDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getNonCompliantDeviceCount() throws SQLException;
|
||||
|
||||
/**
|
||||
* Method to get unmonitored device count from a particular tenant.
|
||||
*
|
||||
* @return Unmonitored device count.
|
||||
*/
|
||||
int getUnmonitoredDeviceCount() throws GadgetDataServiceDAOException;
|
||||
int getUnmonitoredDeviceCount() throws SQLException;
|
||||
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest) throws GadgetDataServiceDAOException;
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
||||
throws InvalidParameterException, SQLException;
|
||||
|
||||
int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
int getDeviceCount(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
||||
|
||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
||||
|
||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters)
|
||||
throws GadgetDataServiceDAOException;
|
||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
||||
|
||||
PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
||||
PaginationRequest paginationRequest) throws GadgetDataServiceDAOException;
|
||||
PaginationRequest paginationRequest) throws InvalidParameterException, SQLException;
|
||||
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceDAOException;
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest)
|
||||
throws InvalidParameterException, SQLException;
|
||||
|
||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException;
|
||||
|
||||
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException;
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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.dao;
|
||||
|
||||
/**
|
||||
* Custom exception class for GadgetDataServiceDAO layer.
|
||||
*/
|
||||
public class GadgetDataServiceDAOException 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.
|
||||
*/
|
||||
public GadgetDataServiceDAOException(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 GadgetDataServiceDAOException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message.
|
||||
*
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public GadgetDataServiceDAOException(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 GadgetDataServiceDAOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@ -20,8 +20,8 @@ package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
@ -38,40 +38,40 @@ import java.util.Map;
|
||||
public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
|
||||
@Override
|
||||
public int getTotalDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getTotalDeviceCount() throws SQLException {
|
||||
return this.getDeviceCount(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getActiveDeviceCount() throws SQLException {
|
||||
Map<String, Object> filters = new HashMap<>();
|
||||
filters.put("CONNECTIVITY_STATUS", "ACTIVE");
|
||||
return this.getDeviceCount(filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInactiveDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getInactiveDeviceCount() throws SQLException {
|
||||
Map<String, Object> filters = new HashMap<>();
|
||||
filters.put("CONNECTIVITY_STATUS", "INACTIVE");
|
||||
return this.getDeviceCount(filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemovedDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getRemovedDeviceCount() throws SQLException {
|
||||
Map<String, Object> filters = new HashMap<>();
|
||||
filters.put("CONNECTIVITY_STATUS", "REMOVED");
|
||||
return this.getDeviceCount(filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNonCompliantDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getNonCompliantDeviceCount() throws SQLException {
|
||||
Map<String, Object> filters = new HashMap<>();
|
||||
filters.put("IS_COMPLIANT", 0);
|
||||
return this.getDeviceCount(filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnmonitoredDeviceCount() throws GadgetDataServiceDAOException {
|
||||
public int getUnmonitoredDeviceCount() throws SQLException {
|
||||
Map<String, Object> filters = new HashMap<>();
|
||||
filters.put("POLICY_ID", -1);
|
||||
return this.getDeviceCount(filters);
|
||||
@ -79,7 +79,22 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
||||
throws GadgetDataServiceDAOException {
|
||||
throws InvalidParameterException, SQLException {
|
||||
|
||||
if (paginationRequest == null) {
|
||||
throw new InvalidParameterException("PaginationRequest object should not be null.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getStartIndex() < 0) {
|
||||
throw new InvalidParameterException("startIndex of PaginationRequest object " +
|
||||
"should be equal to 0 or greater than that.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getRowCount() < 5) {
|
||||
throw new InvalidParameterException("rowCount of PaginationRequest object " +
|
||||
"should be equal to 5 or greater than that.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -118,9 +133,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting non compliant device counts by features.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -130,7 +142,7 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
return paginationResult;
|
||||
}
|
||||
|
||||
public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public int getDeviceCount(Map<String, Object> filters) throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -166,16 +178,19 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered device count.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return filteredDeviceCount;
|
||||
}
|
||||
|
||||
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
|
||||
throws InvalidParameterException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -212,17 +227,13 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered device count, " +
|
||||
"non compliant by a particular feature.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return filteredDeviceCount;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -260,16 +271,19 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of device counts by platforms.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return filteredDeviceCountsByPlatforms;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -308,16 +322,13 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a set of feature non-compliant device counts by platforms.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
return filteredDeviceCountsByPlatforms;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -355,9 +366,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of device counts by ownership types.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -365,7 +373,12 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
}
|
||||
|
||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -404,10 +417,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT"));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of feature " +
|
||||
"non-compliant device counts by ownership types.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -415,7 +424,22 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
}
|
||||
|
||||
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
||||
PaginationRequest paginationRequest) throws GadgetDataServiceDAOException {
|
||||
PaginationRequest paginationRequest) throws InvalidParameterException, SQLException {
|
||||
|
||||
if (paginationRequest == null) {
|
||||
throw new InvalidParameterException("PaginationRequest object should not be null.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getStartIndex() < 0) {
|
||||
throw new InvalidParameterException("startIndex of PaginationRequest object " +
|
||||
"should be equal to 0 or greater than that.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getRowCount() < 5) {
|
||||
throw new InvalidParameterException("rowCount of PaginationRequest object " +
|
||||
"should be equal to 5 or greater than that.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -477,10 +501,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of devices " +
|
||||
"with details when pagination is enabled.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -491,7 +511,27 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
}
|
||||
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceDAOException {
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest)
|
||||
throws InvalidParameterException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
||||
}
|
||||
|
||||
if (paginationRequest == null) {
|
||||
throw new InvalidParameterException("PaginationRequest object should not be null.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getStartIndex() < 0) {
|
||||
throw new InvalidParameterException("startIndex of PaginationRequest object " +
|
||||
"should be equal to 0 or greater than that.");
|
||||
}
|
||||
|
||||
if (paginationRequest.getRowCount() < 5) {
|
||||
throw new InvalidParameterException("rowCount of PaginationRequest object " +
|
||||
"should be equal to 5 or greater than that.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -556,10 +596,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of feature non-compliant devices " +
|
||||
"with details when pagination is enabled.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -569,7 +605,7 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
return paginationResult;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -612,9 +648,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
filteredDeviceWithDetails.put("connectivity-details", rs.getString("CONNECTIVITY_STATUS"));
|
||||
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting a filtered set of devices with details.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -622,7 +655,12 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceDAOException {
|
||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
||||
}
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -667,9 +705,6 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||
filteredDeviceWithDetails.put("connectivity-details", rs.getString("CONNECTIVITY_STATUS"));
|
||||
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
|
||||
"execute relevant SQL queries for getting filtered set of feature non-compliant devices with details.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
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.GadgetDataServiceException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
@ -35,17 +34,11 @@ import java.util.Map;
|
||||
public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public int getTotalDeviceCount() throws GadgetDataServiceException {
|
||||
public int getTotalDeviceCount() throws SQLException {
|
||||
int totalDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for total device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -53,17 +46,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveDeviceCount() throws GadgetDataServiceException {
|
||||
public int getActiveDeviceCount() throws SQLException {
|
||||
int activeDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for active device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -71,17 +58,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInactiveDeviceCount() throws GadgetDataServiceException {
|
||||
public int getInactiveDeviceCount() throws SQLException {
|
||||
int inactiveDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for inactive device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -89,17 +70,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRemovedDeviceCount() throws GadgetDataServiceException {
|
||||
public int getRemovedDeviceCount() throws SQLException {
|
||||
int removedDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for removed device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -107,17 +82,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNonCompliantDeviceCount() throws GadgetDataServiceException {
|
||||
public int getNonCompliantDeviceCount() throws SQLException {
|
||||
int nonCompliantDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getNonCompliantDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for non-compliant device count.", e);
|
||||
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getNonCompliantDeviceCount();
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -125,17 +95,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnmonitoredDeviceCount() throws GadgetDataServiceException {
|
||||
public int getUnmonitoredDeviceCount() throws SQLException {
|
||||
int unmonitoredDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for unmonitored device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -144,18 +108,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
||||
throws GadgetDataServiceException {
|
||||
throws SQLException, InvalidParameterException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getNonCompliantDeviceCountsByFeatures(paginationRequest);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for non-compliant device counts by features.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -163,17 +121,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException {
|
||||
public int getDeviceCount(Map<String, Object> filters) throws SQLException {
|
||||
int deviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in calling DAO function for getting a filtered device count.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -182,18 +134,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
|
||||
throws GadgetDataServiceException {
|
||||
throws SQLException, InvalidParameterException {
|
||||
int featureNonCompliantDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting a filtered device count, non compliant by a particular feature.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -201,19 +147,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters)
|
||||
throws GadgetDataServiceException {
|
||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException {
|
||||
Map<String, Integer> deviceCountsByPlatforms;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByPlatforms(filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered device counts by platforms.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -222,18 +161,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException {
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
||||
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered device counts by platforms, non compliant by a particular feature.", e);
|
||||
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -241,19 +174,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters)
|
||||
throws GadgetDataServiceException {
|
||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException {
|
||||
Map<String, Integer> deviceCountsByOwnershipTypes;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByOwnershipTypes(filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered device counts by ownership types.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -262,19 +188,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException {
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
||||
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCountsByOwnershipTypes =
|
||||
GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection.", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered device counts by ownership types, non compliant by a particular feature.", e);
|
||||
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -283,18 +202,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
||||
PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
||||
PaginationRequest paginationRequest) throws InvalidParameterException, SQLException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDevicesWithDetails(filters, paginationRequest);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered devices with details when pagination is enabled.", e);
|
||||
getDevicesWithDetails(filters, paginationRequest);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -303,18 +216,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
||||
Map<String, Object> filters, PaginationRequest paginationRequest)
|
||||
throws InvalidParameterException, SQLException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered devices with details, non compliant by feature when pagination is enabled.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -322,18 +230,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters)
|
||||
throws GadgetDataServiceException {
|
||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException {
|
||||
List<Map<String, Object>> devicesWithDetails;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered devices with details.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -342,18 +243,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
Map<String, Object> filters) throws GadgetDataServiceException {
|
||||
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
||||
List<Map<String, Object>> featureNonCompliantDevicesWithDetails;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters);
|
||||
} catch (SQLException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
||||
"in opening database connection", e);
|
||||
} catch (GadgetDataServiceDAOException e) {
|
||||
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
||||
"for getting filtered devices with details, non compliant by feature.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user