|
|
|
@ -18,9 +18,8 @@
|
|
|
|
|
|
|
|
|
|
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.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.common.PaginationRequest;
|
|
|
|
@ -35,18 +34,18 @@ import java.util.Map;
|
|
|
|
|
*/
|
|
|
|
|
class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private static final Log log = LogFactory.getLog(GadgetDataServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getTotalDeviceCount() {
|
|
|
|
|
public int getTotalDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int totalDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
totalDeviceCount = -1;
|
|
|
|
|
return totalDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for total device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -54,14 +53,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getActiveDeviceCount() {
|
|
|
|
|
public int getActiveDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int activeDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
activeDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getActiveDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
activeDeviceCount = -1;
|
|
|
|
|
return activeDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for active device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -69,14 +71,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getInactiveDeviceCount() {
|
|
|
|
|
public int getInactiveDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int inactiveDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
inactiveDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getInactiveDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
inactiveDeviceCount = -1;
|
|
|
|
|
return inactiveDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for inactive device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -84,14 +89,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getRemovedDeviceCount() {
|
|
|
|
|
public int getRemovedDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int removedDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
removedDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getRemovedDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
removedDeviceCount = -1;
|
|
|
|
|
return removedDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for removed device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -99,14 +107,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getNonCompliantDeviceCount() {
|
|
|
|
|
public int getNonCompliantDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int nonCompliantDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
nonCompliantDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getNonCompliantDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
nonCompliantDeviceCount = -1;
|
|
|
|
|
return nonCompliantDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for non-compliant device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -114,14 +125,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getUnmonitoredDeviceCount() {
|
|
|
|
|
public int getUnmonitoredDeviceCount() throws GadgetDataServiceException {
|
|
|
|
|
int unmonitoredDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
unmonitoredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getUnmonitoredDeviceCount();
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
unmonitoredDeviceCount = -1;
|
|
|
|
|
return unmonitoredDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for unmonitored device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -129,14 +143,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest) {
|
|
|
|
|
PaginationResult paginationResult = null;
|
|
|
|
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(PaginationRequest paginationRequest)
|
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getNonCompliantDeviceCountsByFeatures(paginationRequest);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for non-compliant device counts by features.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -144,14 +163,17 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getDeviceCount(Map<String, Object> filters) {
|
|
|
|
|
public int getDeviceCount(Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
|
int deviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
deviceCount = -1;
|
|
|
|
|
return deviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in calling DAO function for getting a filtered device count.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -159,15 +181,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters) {
|
|
|
|
|
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
|
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
int featureNonCompliantDeviceCount;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
|
|
|
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
featureNonCompliantDeviceCount = -1;
|
|
|
|
|
return featureNonCompliantDeviceCount;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting a filtered device count, non compliant by a particular feature.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -175,14 +201,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) {
|
|
|
|
|
Map<String, Integer> deviceCountsByPlatforms = null;
|
|
|
|
|
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters)
|
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
Map<String, Integer> deviceCountsByPlatforms;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getDeviceCountsByPlatforms(filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting filtered device counts by platforms.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -191,14 +222,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
|
|
|
|
Map<String, Object> filters) {
|
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms = null;
|
|
|
|
|
Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.
|
|
|
|
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} 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 {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -206,14 +241,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) {
|
|
|
|
|
Map<String, Integer> deviceCountsByOwnershipTypes = null;
|
|
|
|
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters)
|
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
Map<String, Integer> deviceCountsByOwnershipTypes;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getDeviceCountsByOwnershipTypes(filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection.", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting filtered device counts by ownership types.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -222,15 +262,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
|
|
|
|
Map<String, Object> filters) {
|
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes = null;
|
|
|
|
|
Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
|
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
featureNonCompliantDeviceCountsByOwnershipTypes =
|
|
|
|
|
GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} 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 {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -238,14 +282,19 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PaginationResult getDevicesWithDetails(Map<String, Object> filters, PaginationRequest paginationRequest) {
|
|
|
|
|
PaginationResult paginationResult = null;
|
|
|
|
|
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
|
|
|
|
PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getDevicesWithDetails(filters, paginationRequest);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} 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 {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -254,14 +303,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
|
|
|
|
Map<String, Object> filters, PaginationRequest paginationRequest) {
|
|
|
|
|
PaginationResult paginationResult = null;
|
|
|
|
|
Map<String, Object> filters, PaginationRequest paginationRequest) throws GadgetDataServiceException {
|
|
|
|
|
PaginationResult paginationResult;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, paginationRequest);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting filtered devices with details, non compliant by feature when pagination is enabled.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -269,13 +322,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) {
|
|
|
|
|
List<Map<String, Object>> devicesWithDetails = null;
|
|
|
|
|
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters)
|
|
|
|
|
throws GadgetDataServiceException {
|
|
|
|
|
List<Map<String, Object>> devicesWithDetails;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
devicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDevicesWithDetails(filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting filtered devices with details.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
@ -284,14 +342,18 @@ class GadgetDataServiceImpl implements GadgetDataService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
|
|
|
|
Map<String, Object> filters) {
|
|
|
|
|
List<Map<String, Object>> featureNonCompliantDevicesWithDetails = null;
|
|
|
|
|
Map<String, Object> filters) throws GadgetDataServiceException {
|
|
|
|
|
List<Map<String, Object>> featureNonCompliantDevicesWithDetails;
|
|
|
|
|
try {
|
|
|
|
|
GadgetDataServiceDAOFactory.openConnection();
|
|
|
|
|
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
|
|
|
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters);
|
|
|
|
|
} catch (GadgetDataServiceDAOException | SQLException e) {
|
|
|
|
|
return null;
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer " +
|
|
|
|
|
"in opening database connection", e);
|
|
|
|
|
} catch (GadgetDataServiceDAOException e) {
|
|
|
|
|
throw new GadgetDataServiceException("Error occurred @ GadgetDataService layer in calling DAO function " +
|
|
|
|
|
"for getting filtered devices with details, non compliant by feature.", e);
|
|
|
|
|
} finally {
|
|
|
|
|
GadgetDataServiceDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
|