Adding class & method comments, constants to dashboard analytics feature

revert-70aa11f8
dilanua 9 years ago
parent 083e0f6eaa
commit b9a9fb3169

@ -28,60 +28,219 @@ import org.wso2.carbon.device.mgt.common.PaginationResult;
import java.util.List; import java.util.List;
/** /**
* To be updated... * This interface exposes useful service layer functions to retrieve data
* required by high level dashboard APIs.
*/ */
public interface GadgetDataService { public interface GadgetDataService {
/**
* This method is used to get a count of devices based on a defined filter set.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return An object of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet) DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get a count of devices non-compliant upon on a particular feature
* and a defined filter set.
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return An object of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get total count of devices currently enrolled under a particular tenant.
* @return An object of type DeviceCountByGroupEntry.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException; DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException;
/**
* This method is used to get device counts classified by connectivity statuses.
* @return A list of objects of type DeviceCountByGroupEntry.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException; List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
/**
* This method is used to get device counts classified by potential vulnerabilities.
* @return A list of objects of type DeviceCountByGroupEntry.
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException; List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
/**
* This method is used to get non-compliant device counts classified by individual features.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get device counts classified by platforms.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return An object of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet) List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get device counts non-compliant upon a particular feature classified by platforms.
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return A list of objects of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode, List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get device counts classified by ownership types.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return A list of objects of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet) List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get device counts non-compliant upon a particular feature classified by ownership types.
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return A list of objects of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode, List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get a paginated list of devices with details, based on a defined filter set.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get a paginated list of non-compliant devices with details, upon a particular feature.
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @param startIndex Starting index of the data set to be retrieved.
* @param resultCount Total count of the result set retrieved.
* @return An object of type PaginationResult.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet, int startIndex, int resultCount) FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get a list of devices with details, based on a defined filter set.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return A list of objects of type DetailedDeviceEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet) List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;
/**
* This method is used to get a list of non-compliant devices with details, upon a particular feature.
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return A list of objects of type DetailedDeviceEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
@SuppressWarnings("unused") @SuppressWarnings("unused")
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode, List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException; FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;

@ -29,18 +29,6 @@ import java.util.List;
public interface GadgetDataServiceDAO { public interface GadgetDataServiceDAO {
/**
* This method is used to get device count based on a defined filter set.
* @param filterSet An abstract representation of possible filtering options.
* if this value is simply "null" or no values are set for the defined filtering options,
* this method would return total device count in the system
* wrapped with in the defined return format.
* @return An object of type DeviceCountByGroupEntry.
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
* @throws DataAccessLayerException This can occur due to errors connecting to database,
* executing SQL query and retrieving data.
*/
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet) DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
throws InvalidParameterValueException, DataAccessLayerException; throws InvalidParameterValueException, DataAccessLayerException;

@ -31,6 +31,18 @@ public final class GadgetDataServiceDAOConstants {
} }
public static class Pagination {
// Minimum acceptable values for start index and result count
public static final int MIN_START_INDEX = 0;
public static final int MIN_RESULT_COUNT = 5;
private Pagination() {
throw new AssertionError();
}
}
public static class PotentialVulnerability { public static class PotentialVulnerability {
// These constants do not hold actual database values // These constants do not hold actual database values

@ -43,12 +43,14 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Connection con; Connection con;
@ -108,12 +110,14 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
@ -204,12 +208,14 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
} }
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);

@ -43,12 +43,14 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Connection con; Connection con;
@ -108,12 +110,14 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
@ -204,12 +208,14 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
} }
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);

@ -43,12 +43,14 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Connection con; Connection con;
@ -110,12 +112,14 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
@ -208,12 +212,14 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
} }
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);

@ -43,12 +43,14 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Connection con; Connection con;
@ -109,12 +111,14 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount) public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
throws InvalidParameterValueException, DataAccessLayerException { throws InvalidParameterValueException, DataAccessLayerException {
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
@ -206,12 +210,14 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty."); throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
} }
if (startIndex < 0) { if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that."); throw new InvalidParameterValueException("Start index should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
} }
if (resultCount < 5) { if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that."); throw new InvalidParameterValueException("Result count should be equal to " +
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
} }
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet); Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);

@ -31,7 +31,7 @@ import java.sql.SQLException;
import java.util.List; import java.util.List;
/** /**
* To be updated... * Implementation class of GadgetDataService.
*/ */
public class GadgetDataServiceImpl implements GadgetDataService { public class GadgetDataServiceImpl implements GadgetDataService {

Loading…
Cancel
Save