mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Properly layering beans and custom exceptions in dashboard analytics feature
This commit is contained in:
parent
a7c7452e2e
commit
975a3b915f
@ -64,8 +64,8 @@
|
||||
</Private-Package>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard,
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception,
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.exception,
|
||||
org.wso2.carbon.device.mgt.analytics.dashboard.bean
|
||||
</Export-Package>
|
||||
<Import-Package>
|
||||
org.osgi.framework,
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class DetailedDeviceEntry {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class DeviceCountByGroupEntry {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class FilterSet {
|
||||
|
||||
@ -19,11 +19,10 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
@ -38,7 +37,7 @@ import java.util.Map;
|
||||
public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO {
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException {
|
||||
public DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException {
|
||||
int totalDeviceCount;
|
||||
try {
|
||||
totalDeviceCount = this.getFilteredDeviceCount(null);
|
||||
@ -56,7 +55,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
int filteredDeviceCount = this.getFilteredDeviceCount(filterSet);
|
||||
|
||||
@ -69,7 +68,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
private int getFilteredDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
|
||||
@ -80,8 +79,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
int filteredDeviceCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " + GadgetDataServiceDAOConstants.DatabaseView.
|
||||
DEVICES_VIEW_1 + " WHERE TENANT_ID = ?";
|
||||
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
|
||||
GadgetDataServiceDAOConstants.DatabaseView.DEVICES_VIEW_1 + " WHERE TENANT_ID = ?";
|
||||
// appending filters to support advanced filtering options
|
||||
// [1] appending filter columns
|
||||
if (filters != null && filters.size() > 0) {
|
||||
@ -109,9 +108,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
while (rs.next()) {
|
||||
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -120,7 +116,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -135,8 +131,8 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
int filteredDeviceCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " + GadgetDataServiceDAOConstants.DatabaseView.
|
||||
DEVICES_VIEW_2 + " WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
|
||||
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
|
||||
GadgetDataServiceDAOConstants.DatabaseView.DEVICES_VIEW_2 + " WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
|
||||
// appending filters to support advanced filtering options
|
||||
// [1] appending filter columns
|
||||
if (filters != null && filters.size() > 0) {
|
||||
@ -165,9 +161,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
while (rs.next()) {
|
||||
filteredDeviceCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -181,7 +174,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
@ -206,9 +199,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
deviceCountByConnectivityStatus.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
deviceCountsByConnectivityStatuses.add(deviceCountByConnectivityStatus);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -216,7 +206,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws SQLException {
|
||||
// getting non-compliant device count
|
||||
DeviceCountByGroupEntry nonCompliantDeviceCount = new DeviceCountByGroupEntry();
|
||||
nonCompliantDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
|
||||
@ -236,7 +226,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
return deviceCountsByPotentialVulnerabilities;
|
||||
}
|
||||
|
||||
private int getNonCompliantDeviceCount() throws DataAccessLayerException {
|
||||
private int getNonCompliantDeviceCount() throws SQLException {
|
||||
FilterSet filterSet = new FilterSet();
|
||||
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
|
||||
try {
|
||||
@ -246,7 +236,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
}
|
||||
|
||||
private int getUnmonitoredDeviceCount() throws DataAccessLayerException {
|
||||
private int getUnmonitoredDeviceCount() throws SQLException {
|
||||
FilterSet filterSet = new FilterSet();
|
||||
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
|
||||
try {
|
||||
@ -258,7 +248,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
|
||||
@ -304,9 +294,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
filteredDeviceCountsByPlatforms.add(filteredDeviceCountByPlatform);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -316,7 +303,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry>
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -368,9 +355,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
filteredDeviceCountsByPlatforms.add(filteredDeviceCountByPlatform);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -379,7 +363,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
|
||||
@ -426,9 +410,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
filteredDeviceCountsByOwnershipTypes.add(filteredDeviceCountByOwnershipType);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -438,7 +419,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry>
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -490,9 +471,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
filteredDeviceCountsByOwnershipTypes.add(filteredDeviceCountByOwnershipType);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -501,7 +479,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
|
||||
@ -549,9 +527,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
|
||||
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -560,7 +535,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -614,9 +589,6 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
filteredDeviceWithDetails.setConnectivityStatus(rs.getString("CONNECTIVITY_STATUS"));
|
||||
filteredDevicesWithDetails.add(filteredDeviceWithDetails);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -18,55 +18,55 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public interface GadgetDataServiceDAO {
|
||||
|
||||
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException;
|
||||
DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws SQLException;
|
||||
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
|
||||
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
|
||||
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -41,7 +40,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -94,9 +93,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -108,7 +104,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -187,9 +183,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -202,7 +195,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -288,9 +281,6 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -41,7 +40,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -94,9 +93,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -108,7 +104,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -187,9 +183,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -202,7 +195,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -288,9 +281,6 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -41,7 +40,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -96,9 +95,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -110,7 +106,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -191,9 +187,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -205,8 +198,8 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -292,9 +285,6 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -41,7 +40,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -95,9 +94,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -109,7 +105,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
@ -189,9 +185,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
@ -204,7 +197,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
@ -290,9 +283,6 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
while (rs.next()) {
|
||||
totalRecordsCount = rs.getInt("DEVICE_COUNT");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either getting database connection, " +
|
||||
"running SQL query or fetching results.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception;
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for communicating data access layer issues
|
||||
@ -16,7 +16,7 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception;
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for catching invalid parameter issues,
|
||||
@ -20,11 +20,11 @@ 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.dao.GadgetDataServiceDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -43,7 +43,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -59,7 +60,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -73,7 +75,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -88,7 +91,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getDeviceCountsByConnectivityStatuses();
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -103,7 +107,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByPotentialVulnerabilities();
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -119,7 +124,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getNonCompliantDeviceCountsByFeatures(startIndex, resultCount);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -135,7 +141,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByPlatforms(filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -151,7 +158,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -167,7 +175,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByOwnershipTypes(filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -184,7 +193,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -200,7 +210,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDevicesWithDetails(filterSet, startIndex, resultCount);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -217,7 +228,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet, startIndex, resultCount);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -233,7 +245,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
devicesWithDetails = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getDevicesWithDetails(filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
@ -249,7 +262,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in opening database connection.", e);
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
} finally {
|
||||
GadgetDataServiceDAOFactory.closeConnection();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user