Adding temporary development code bits for dashboard analytics feature

revert-70aa11f8
dilanua 9 years ago
parent a0d260e6a3
commit c828a5264b

@ -30,58 +30,61 @@ import java.util.Map;
public interface GadgetDataService { public interface GadgetDataService {
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getTotalDeviceCount(); int getTotalDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getActiveDeviceCount(); int getActiveDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getInactiveDeviceCount(); int getInactiveDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getRemovedDeviceCount(); int getRemovedDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getNonCompliantDeviceCount(); int getNonCompliantDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getUnmonitoredDeviceCount(); int getUnmonitoredDeviceCount() throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest); PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getDeviceCount(Map<String, Object> filters); int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters); int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters); Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
Map<String, Object> filters); Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters); Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
Map<String, Object> filters); Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getDevicesWithDetails(Map<String, Object> filters, PaginationRequest paginationRequest); PaginationResult getDevicesWithDetails(Map<String, Object> filters,
PaginationRequest paginationRequest) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
Map<String, Object> filters, PaginationRequest paginationRequest); Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters); List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws GadgetDataServiceException;
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
Map<String, Object> filters); Map<String, Object> filters) throws GadgetDataServiceException;
} }

@ -18,11 +18,11 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao; package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
@SuppressWarnings("unused")
/** /**
* Custom exception class for data access related exceptions. * Custom exception class for GadgetDataServiceDAO layer.
*/ */
public class GadgetDataServiceDAOException extends Exception { public class GadgetDataServiceDAOException extends Exception {
private String errorMessage; private String errorMessage;
private static final long serialVersionUID = 2021891706072918864L; private static final long serialVersionUID = 2021891706072918864L;
@ -43,6 +43,7 @@ public class GadgetDataServiceDAOException extends Exception {
* @param errorMessage Specific error message. * @param errorMessage Specific error message.
* @param cause Cause of this exception. * @param cause Cause of this exception.
*/ */
@SuppressWarnings("unused")
public GadgetDataServiceDAOException(String errorMessage, Throwable cause) { public GadgetDataServiceDAOException(String errorMessage, Throwable cause) {
super(errorMessage, cause); super(errorMessage, cause);
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
@ -53,6 +54,7 @@ public class GadgetDataServiceDAOException extends Exception {
* *
* @param errorMessage Specific error message. * @param errorMessage Specific error message.
*/ */
@SuppressWarnings("unused")
public GadgetDataServiceDAOException(String errorMessage) { public GadgetDataServiceDAOException(String errorMessage) {
super(errorMessage); super(errorMessage);
setErrorMessage(errorMessage); setErrorMessage(errorMessage);
@ -63,10 +65,12 @@ public class GadgetDataServiceDAOException extends Exception {
* *
* @param cause Cause of this exception. * @param cause Cause of this exception.
*/ */
@SuppressWarnings("unused")
public GadgetDataServiceDAOException(Throwable cause) { public GadgetDataServiceDAOException(Throwable cause) {
super(cause); super(cause);
} }
@SuppressWarnings("unused")
public String getErrorMessage() { public String getErrorMessage() {
return errorMessage; return errorMessage;
} }
@ -74,4 +78,5 @@ public class GadgetDataServiceDAOException extends Exception {
public void setErrorMessage(String errorMessage) { public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage; this.errorMessage = errorMessage;
} }
} }

@ -33,6 +33,7 @@ import java.util.List;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class GadgetDataServiceDAOFactory { public class GadgetDataServiceDAOFactory {
private static final Log log = LogFactory.getLog(GadgetDataServiceDAOFactory.class); private static final Log log = LogFactory.getLog(GadgetDataServiceDAOFactory.class);
private static DataSource dataSource; private static DataSource dataSource;
private static String databaseEngine; private static String databaseEngine;
@ -47,7 +48,7 @@ public class GadgetDataServiceDAOFactory {
try { try {
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName(); databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error occurred while retrieving config.datasource connection", e); log.error("Error occurred while retrieving config.datasource connection.", e);
} }
} }
@ -56,7 +57,7 @@ public class GadgetDataServiceDAOFactory {
try { try {
databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName(); databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName();
} catch (SQLException e) { } catch (SQLException e) {
log.error("Error occurred while retrieving config.datasource connection", e); log.error("Error occurred while retrieving config.datasource connection.", e);
} }
} }
@ -65,7 +66,7 @@ public class GadgetDataServiceDAOFactory {
if (conn != null) { if (conn != null) {
throw new IllegalTransactionStateException("A transaction is already active within the context of " + throw new IllegalTransactionStateException("A transaction is already active within the context of " +
"this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " + "this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " +
"transaction is already active is a sign of improper transaction handling"); "transaction is already active is a sign of improper transaction handling.");
} }
conn = dataSource.getConnection(); conn = dataSource.getConnection();
currentConnection.set(conn); currentConnection.set(conn);
@ -76,7 +77,7 @@ public class GadgetDataServiceDAOFactory {
if (conn == null) { if (conn == null) {
throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
"This might have ideally been caused by not properly initiating the transaction via " + "This might have ideally been caused by not properly initiating the transaction via " +
"'beginTransaction'/'openConnection' methods"); "'beginTransaction'/'openConnection' methods.");
} }
return conn; return conn;
} }
@ -86,35 +87,34 @@ public class GadgetDataServiceDAOFactory {
if (conn == null) { if (conn == null) {
throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " +
"This might have ideally been caused by not properly initiating the transaction via " + "This might have ideally been caused by not properly initiating the transaction via " +
"'beginTransaction'/'openConnection' methods"); "'beginTransaction'/'openConnection' methods.");
} }
try { try {
conn.close(); conn.close();
} catch (SQLException e) { } catch (SQLException e) {
log.warn("Error occurred while close the connection"); log.warn("Error occurred while close the connection.");
} }
currentConnection.remove(); currentConnection.remove();
} }
/** /**
* Resolve data source from the data source definition * Resolve data source from the data source definition.
* *
* @param config data source configuration * @param config data source configuration.
* @return data source resolved from the data source definition * @return data source resolved from the data source definition.
*/ */
private static DataSource resolveDataSource(DataSourceConfig config) { private static DataSource resolveDataSource(DataSourceConfig config) {
DataSource dataSource = null; DataSource dataSource = null;
if (config == null) { if (config == null) {
throw new RuntimeException( throw new RuntimeException(
"Device Management Repository data source configuration " + "is null and " + "Device Management Repository data source configuration " + "is null and " +
"thus, is not initialized"); "thus, is not initialized.");
} }
JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition();
if (jndiConfig != null) { if (jndiConfig != null) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Initializing Device Management Repository data source using the JNDI " + log.debug("Initializing Device Management Repository data source using the JNDI Lookup Definition.");
"Lookup Definition");
} }
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties(); List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties();
if (jndiPropertyList != null) { if (jndiPropertyList != null) {

@ -18,8 +18,6 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.dao; package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
@ -35,8 +33,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO { class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
@SuppressWarnings("unused")
private static final Log log = LogFactory.getLog(GadgetDataServiceDAOImpl.class);
@Override @Override
public int getTotalDeviceCount() throws GadgetDataServiceDAOException { public int getTotalDeviceCount() throws GadgetDataServiceDAOException {
@ -72,7 +68,15 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
} }
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest) throws GadgetDataServiceDAOException { public int getUnmonitoredDeviceCount() throws GadgetDataServiceDAOException {
Map<String, Object> filters = new HashMap<>();
filters.put("POLICY_ID", -1);
return this.getDeviceCount(filters);
}
@Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
throws GadgetDataServiceDAOException {
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -112,7 +116,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT"); totalRecordsCount = rs.getInt("NON_COMPLIANT_FEATURE_COUNT");
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -122,13 +127,6 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
return paginationResult; return paginationResult;
} }
@Override
public int getUnmonitoredDeviceCount() throws GadgetDataServiceDAOException {
Map<String, Object> filters = new HashMap<>();
filters.put("POLICY_ID", -1);
return this.getDeviceCount(filters);
}
public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceDAOException { public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceDAOException {
Connection con; Connection con;
PreparedStatement stmt = null; PreparedStatement stmt = null;
@ -166,7 +164,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCount = rs.getInt("DEVICE_COUNT"); filteredDeviceCount = rs.getInt("DEVICE_COUNT");
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", e); throw new GadgetDataServiceDAOException("Error occurred @ GadgetDataServiceDAO layer while trying to " +
"execute relevant SQL queries for getting a filtered device count.", e);
} finally { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -211,7 +210,9 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCount = rs.getInt("DEVICE_COUNT"); filteredDeviceCount = rs.getInt("DEVICE_COUNT");
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -257,7 +258,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT")); filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT"));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -304,7 +306,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT")); filteredDeviceCountsByPlatforms.put(rs.getString("PLATFORM"), rs.getInt("DEVICE_COUNT"));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -350,7 +353,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT")); filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT"));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -398,7 +402,9 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT")); filteredDeviceCountsByOwnershipTypes.put(rs.getString("OWNERSHIP"), rs.getInt("DEVICE_COUNT"));
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -469,7 +475,9 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
totalRecordsCount = rs.getInt("DEVICE_COUNT"); totalRecordsCount = rs.getInt("DEVICE_COUNT");
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -546,7 +554,9 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
totalRecordsCount = rs.getInt("DEVICE_COUNT"); totalRecordsCount = rs.getInt("DEVICE_COUNT");
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -600,7 +610,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDevicesWithDetails.add(filteredDeviceWithDetails); filteredDevicesWithDetails.add(filteredDeviceWithDetails);
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }
@ -654,7 +665,8 @@ class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
filteredDevicesWithDetails.add(filteredDeviceWithDetails); filteredDevicesWithDetails.add(filteredDeviceWithDetails);
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new GadgetDataServiceDAOException("Error occurred while executing a selection query to the database", 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 { } finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs); DeviceManagementDAOUtil.cleanupResources(stmt, rs);
} }

@ -39,6 +39,7 @@ import org.wso2.carbon.ndatasource.core.DataSourceService;
* unbind="unsetDataSourceService" * unbind="unsetDataSourceService"
*/ */
public class GadgetDataServiceComponent { public class GadgetDataServiceComponent {
private static final Log log = LogFactory.getLog(GadgetDataServiceComponent.class); private static final Log log = LogFactory.getLog(GadgetDataServiceComponent.class);
protected void activate(ComponentContext componentContext) { protected void activate(ComponentContext componentContext) {
@ -56,10 +57,10 @@ public class GadgetDataServiceComponent {
componentContext.getBundleContext(). componentContext.getBundleContext().
registerService(GadgetDataService.class.getName(), new GadgetDataServiceImpl(), null); registerService(GadgetDataService.class.getName(), new GadgetDataServiceImpl(), null);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Device Management Dashboard Analytics Bundle has been started successfully"); log.debug("Device Management Dashboard Analytics Bundle has been started successfully.");
} }
} catch (Throwable e) { } catch (Throwable e) {
log.error("Error occurred while initializing the bundle", e); log.error("Error occurred while initializing the bundle.", e);
} }
} }
@ -71,10 +72,17 @@ public class GadgetDataServiceComponent {
} }
public void setDataSourceService(DataSourceService dataSourceService) { public void setDataSourceService(DataSourceService dataSourceService) {
if (log.isDebugEnabled()) {
log.debug("Binding org.wso2.carbon.ndatasource.core.DataSourceService...");
}
//do nothing
} }
public void unsetDataSourceService(DataSourceService dataSourceService) { public void unsetDataSourceService(DataSourceService dataSourceService) {
if (log.isDebugEnabled()) {
log.debug("Unbinding org.wso2.carbon.ndatasource.core.DataSourceService...");
} }
//do nothing
}
} }

@ -18,9 +18,8 @@
package org.wso2.carbon.device.mgt.analytics.dashboard.internal; package org.wso2.carbon.device.mgt.analytics.dashboard.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService; import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataServiceException;
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOException; 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.GadgetDataServiceDAOFactory;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
@ -35,18 +34,18 @@ import java.util.Map;
*/ */
class GadgetDataServiceImpl implements GadgetDataService { class GadgetDataServiceImpl implements GadgetDataService {
@SuppressWarnings("unused")
private static final Log log = LogFactory.getLog(GadgetDataServiceImpl.class);
@Override @Override
public int getTotalDeviceCount() { public int getTotalDeviceCount() throws GadgetDataServiceException {
int totalDeviceCount; int totalDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount(); totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
totalDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return totalDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -54,14 +53,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getActiveDeviceCount() { public int getActiveDeviceCount() throws GadgetDataServiceException {
int activeDeviceCount; int activeDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount(); activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
activeDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return activeDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -69,14 +71,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getInactiveDeviceCount() { public int getInactiveDeviceCount() throws GadgetDataServiceException {
int inactiveDeviceCount; int inactiveDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount(); inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
inactiveDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return inactiveDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -84,14 +89,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getRemovedDeviceCount() { public int getRemovedDeviceCount() throws GadgetDataServiceException {
int removedDeviceCount; int removedDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount(); removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
removedDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return removedDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -99,14 +107,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getNonCompliantDeviceCount() { public int getNonCompliantDeviceCount() throws GadgetDataServiceException {
int nonCompliantDeviceCount; int nonCompliantDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getNonCompliantDeviceCount(); nonCompliantDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getNonCompliantDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
nonCompliantDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return nonCompliantDeviceCount; "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);
} finally { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -114,14 +125,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getUnmonitoredDeviceCount() { public int getUnmonitoredDeviceCount() throws GadgetDataServiceException {
int unmonitoredDeviceCount; int unmonitoredDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount(); unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount();
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
unmonitoredDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return unmonitoredDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -129,14 +143,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest) { public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
PaginationResult paginationResult = null; throws GadgetDataServiceException {
PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getNonCompliantDeviceCountsByFeatures(paginationRequest); getNonCompliantDeviceCountsByFeatures(paginationRequest);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -144,14 +163,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getDeviceCount(Map<String, Object> filters) { public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException {
int deviceCount; int deviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters); deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
deviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return deviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -159,15 +181,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters) { public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
throws GadgetDataServiceException {
int featureNonCompliantDeviceCount; int featureNonCompliantDeviceCount;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory. featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters); getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
featureNonCompliantDeviceCount = -1; throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
return featureNonCompliantDeviceCount; "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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -175,14 +201,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) { public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters)
Map<String, Integer> deviceCountsByPlatforms = null; throws GadgetDataServiceException {
Map<String, Integer> deviceCountsByPlatforms;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByPlatforms(filters); getDeviceCountsByPlatforms(filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -191,14 +222,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
Map<String, Object> filters) { Map<String, Object> filters) throws GadgetDataServiceException {
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms = null; Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory. featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters); getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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);
} finally { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -206,14 +241,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) { public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters)
Map<String, Integer> deviceCountsByOwnershipTypes = null; throws GadgetDataServiceException {
Map<String, Integer> deviceCountsByOwnershipTypes;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDeviceCountsByOwnershipTypes(filters); getDeviceCountsByOwnershipTypes(filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -222,15 +262,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
Map<String, Object> filters) { Map<String, Object> filters) throws GadgetDataServiceException {
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes = null; Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDeviceCountsByOwnershipTypes = featureNonCompliantDeviceCountsByOwnershipTypes =
GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters); getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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);
} finally { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -238,14 +282,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public PaginationResult getDevicesWithDetails(Map<String, Object> filters, PaginationRequest paginationRequest) { public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
PaginationResult paginationResult = null; PaginationRequest paginationRequest) throws GadgetDataServiceException {
PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getDevicesWithDetails(filters, paginationRequest); getDevicesWithDetails(filters, paginationRequest);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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);
} finally { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -254,14 +303,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
Map<String, Object> filters, PaginationRequest paginationRequest) { Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException {
PaginationResult paginationResult = null; PaginationResult paginationResult;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest); getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -269,13 +322,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
} }
@Override @Override
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) { public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters)
List<Map<String, Object>> devicesWithDetails = null; throws GadgetDataServiceException {
List<Map<String, Object>> devicesWithDetails;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters); devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }
@ -284,14 +342,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
@Override @Override
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
Map<String, Object> filters) { Map<String, Object> filters) throws GadgetDataServiceException {
List<Map<String, Object>> featureNonCompliantDevicesWithDetails = null; List<Map<String, Object>> featureNonCompliantDevicesWithDetails;
try { try {
GadgetDataServiceDAOFactory.openConnection(); GadgetDataServiceDAOFactory.openConnection();
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO(). featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters); getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters);
} catch (GadgetDataServiceDAOException | SQLException e) { } catch (SQLException e) {
return null; 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 { } finally {
GadgetDataServiceDAOFactory.closeConnection(); GadgetDataServiceDAOFactory.closeConnection();
} }

Loading…
Cancel
Save