|
|
@ -19,9 +19,8 @@
|
|
|
|
package org.wso2.carbon.device.mgt.analytics.dashboard.impl;
|
|
|
|
package org.wso2.carbon.device.mgt.analytics.dashboard.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataServiceException;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOException;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOFactory;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
|
|
|
|
|
|
|
|
|
|
@ -35,17 +34,11 @@ import java.util.Map;
|
|
|
|
public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getTotalDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getTotalDeviceCount() throws SQLException {
|
|
|
|
int totalDeviceCount;
|
|
|
|
int totalDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
|
|
|
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for total device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -53,17 +46,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getActiveDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getActiveDeviceCount() throws SQLException {
|
|
|
|
int activeDeviceCount;
|
|
|
|
int activeDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount();
|
|
|
|
activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for active device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -71,17 +58,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getInactiveDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getInactiveDeviceCount() throws SQLException {
|
|
|
|
int inactiveDeviceCount;
|
|
|
|
int inactiveDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount();
|
|
|
|
inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for inactive device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -89,17 +70,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getRemovedDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getRemovedDeviceCount() throws SQLException {
|
|
|
|
int removedDeviceCount;
|
|
|
|
int removedDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount();
|
|
|
|
removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for removed device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -107,17 +82,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getNonCompliantDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getNonCompliantDeviceCount() throws SQLException {
|
|
|
|
int nonCompliantDeviceCount;
|
|
|
|
int nonCompliantDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getNonCompliantDeviceCount();
|
|
|
|
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
|
|
|
} catch (SQLException e) {
|
|
|
|
getGadgetDataServiceDAO().getNonCompliantDeviceCount();
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for non-compliant device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -125,17 +95,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getUnmonitoredDeviceCount() throws GadgetDataServiceException {
|
|
|
|
public int getUnmonitoredDeviceCount() throws SQLException {
|
|
|
|
int unmonitoredDeviceCount;
|
|
|
|
int unmonitoredDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount();
|
|
|
|
unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for unmonitored device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -144,18 +108,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
|
|
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
throws SQLException, InvalidParameterException {
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getNonCompliantDeviceCountsByFeatures(paginationRequest);
|
|
|
|
getNonCompliantDeviceCountsByFeatures(paginationRequest);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for non-compliant device counts by features.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -163,17 +121,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
public int getDeviceCount(Map<String, Object> filters) throws SQLException {
|
|
|
|
int deviceCount;
|
|
|
|
int deviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
|
|
|
|
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in calling DAO function for getting a filtered device count.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -182,18 +134,12 @@ public 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 {
|
|
|
|
throws SQLException, InvalidParameterException {
|
|
|
|
int featureNonCompliantDeviceCount;
|
|
|
|
int featureNonCompliantDeviceCount;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
|
|
|
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
|
|
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
|
|
|
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting a filtered device count, non compliant by a particular feature.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -201,19 +147,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters)
|
|
|
|
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException {
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
|
|
|
Map<String, Integer> deviceCountsByPlatforms;
|
|
|
|
Map<String, Integer> deviceCountsByPlatforms;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getDeviceCountsByPlatforms(filters);
|
|
|
|
getDeviceCountsByPlatforms(filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered device counts by platforms.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -222,18 +161,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
|
|
|
Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.
|
|
|
|
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
|
|
|
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered device counts by platforms, non compliant by a particular feature.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -241,19 +174,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters)
|
|
|
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException {
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
|
|
|
Map<String, Integer> deviceCountsByOwnershipTypes;
|
|
|
|
Map<String, Integer> deviceCountsByOwnershipTypes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getDeviceCountsByOwnershipTypes(filters);
|
|
|
|
getDeviceCountsByOwnershipTypes(filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered device counts by ownership types.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -262,19 +188,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
|
|
|
Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
featureNonCompliantDeviceCountsByOwnershipTypes =
|
|
|
|
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
|
|
|
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered device counts by ownership types, non compliant by a particular feature.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,18 +202,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
|
|
|
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
|
|
|
PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
|
|
|
PaginationRequest paginationRequest) throws InvalidParameterException, SQLException {
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getDevicesWithDetails(filters, paginationRequest);
|
|
|
|
getDevicesWithDetails(filters, paginationRequest);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered devices with details when pagination is enabled.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -303,18 +216,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
|
|
|
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
|
|
|
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
|
|
|
Map<String, Object> filters, PaginationRequest paginationRequest)
|
|
|
|
|
|
|
|
throws InvalidParameterException, SQLException {
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest);
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered devices with details, non compliant by feature when pagination is enabled.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -322,18 +230,11 @@ public 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) throws SQLException {
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
|
|
|
List<Map<String, Object>> devicesWithDetails;
|
|
|
|
List<Map<String, Object>> devicesWithDetails;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters);
|
|
|
|
devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered devices with details.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -342,18 +243,12 @@ public 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) throws GadgetDataServiceException {
|
|
|
|
Map<String, Object> filters) throws SQLException, InvalidParameterException {
|
|
|
|
List<Map<String, Object>> featureNonCompliantDevicesWithDetails;
|
|
|
|
List<Map<String, Object>> featureNonCompliantDevicesWithDetails;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters);
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
|
|
|
"for getting filtered devices with details, non compliant by feature.", e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|