|
|
@ -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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|