mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding temporary development code bits for dashboard analytics feature
This commit is contained in:
parent
d568c6e8bd
commit
7b43d28298
@ -64,7 +64,8 @@
|
|||||||
</Private-Package>
|
</Private-Package>
|
||||||
<Export-Package>
|
<Export-Package>
|
||||||
org.wso2.carbon.device.mgt.analytics.dashboard,
|
org.wso2.carbon.device.mgt.analytics.dashboard,
|
||||||
org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception
|
org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception,
|
||||||
|
org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean
|
||||||
</Export-Package>
|
</Export-Package>
|
||||||
<Import-Package>
|
<Import-Package>
|
||||||
org.osgi.framework,
|
org.osgi.framework,
|
||||||
|
|||||||
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.analytics.dashboard;
|
package org.wso2.carbon.device.mgt.analytics.dashboard;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -50,43 +51,46 @@ public interface GadgetDataService {
|
|||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException;
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
int getDeviceCount(Map<String, Object> filters) throws SQLException;
|
int getDeviceCount(FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException;
|
Map<String, Integer> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException;
|
Map<String, Integer> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||||
int startIndex, int resultCount) throws InvalidParameterException, SQLException;
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters, int startIndex, int resultCount)
|
FilterSet filterSet, int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException;
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException;
|
List<Map<String, Object>> getDevicesWithDetails(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterException;
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean.FilterSet;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -70,33 +71,35 @@ public interface GadgetDataServiceDAO {
|
|||||||
int getUnmonitoredDeviceCount() throws SQLException;
|
int getUnmonitoredDeviceCount() throws SQLException;
|
||||||
|
|
||||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException;
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
int getDeviceCount(Map<String, Object> filters) throws SQLException;
|
int getDeviceCount(FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException;
|
Map<String, Integer> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException;
|
Map<String, Integer> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||||
int startIndex, int resultCount) throws InvalidParameterException, SQLException;
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters, int startIndex, int resultCount)
|
FilterSet filterSet, int startIndex, int resultCount) throws InvalidParameterValueException, SQLException;
|
||||||
throws InvalidParameterException, SQLException;
|
|
||||||
|
|
||||||
List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException;
|
List<Map<String, Object>> getDevicesWithDetails(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException;
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* you may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||||
|
|
||||||
|
public enum ConnectivityStatus {
|
||||||
|
active, inactive, removed
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* you may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||||
|
|
||||||
|
public class FilterSet {
|
||||||
|
private String connectivityStatus;
|
||||||
|
private String potentialVulnerability;
|
||||||
|
private String platform;
|
||||||
|
private String ownership;
|
||||||
|
|
||||||
|
public String getConnectivityStatus() {
|
||||||
|
return connectivityStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConnectivityStatus(String connectivityStatus) {
|
||||||
|
this.connectivityStatus = connectivityStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPotentialVulnerability() {
|
||||||
|
return potentialVulnerability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPotentialVulnerability(String potentialVulnerability) {
|
||||||
|
this.potentialVulnerability = potentialVulnerability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnership() {
|
||||||
|
return ownership;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnership(String ownership) {
|
||||||
|
this.ownership = ownership;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* you may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||||
|
|
||||||
|
public enum Ownership {
|
||||||
|
byod, cope
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* you may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||||
|
|
||||||
|
public enum Platform {
|
||||||
|
android, ios, windows
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* you may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.bean;
|
||||||
|
|
||||||
|
public enum PotentialVulnerability {
|
||||||
|
non_compliant, unmonitored
|
||||||
|
}
|
||||||
@ -22,7 +22,7 @@ package org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception;
|
|||||||
* Custom exception class for catching invalid parameter issues,
|
* Custom exception class for catching invalid parameter issues,
|
||||||
* relevant to Gadget Data Service DAO layer.
|
* relevant to Gadget Data Service DAO layer.
|
||||||
*/
|
*/
|
||||||
public class InvalidParameterException extends Exception {
|
public class InvalidParameterValueException extends Exception {
|
||||||
|
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
private static final long serialVersionUID = 2021891706072918864L;
|
private static final long serialVersionUID = 2021891706072918864L;
|
||||||
@ -34,7 +34,7 @@ public class InvalidParameterException extends Exception {
|
|||||||
* @param nestedException Nested exception.
|
* @param nestedException Nested exception.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public InvalidParameterException(String errorMessage, Exception nestedException) {
|
public InvalidParameterValueException(String errorMessage, Exception nestedException) {
|
||||||
super(errorMessage, nestedException);
|
super(errorMessage, nestedException);
|
||||||
setErrorMessage(errorMessage);
|
setErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ public class InvalidParameterException extends Exception {
|
|||||||
* @param cause Cause of this exception.
|
* @param cause Cause of this exception.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public InvalidParameterException(String errorMessage, Throwable cause) {
|
public InvalidParameterValueException(String errorMessage, Throwable cause) {
|
||||||
super(errorMessage, cause);
|
super(errorMessage, cause);
|
||||||
setErrorMessage(errorMessage);
|
setErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ public class InvalidParameterException extends Exception {
|
|||||||
*
|
*
|
||||||
* @param errorMessage Specific error message.
|
* @param errorMessage Specific error message.
|
||||||
*/
|
*/
|
||||||
public InvalidParameterException(String errorMessage) {
|
public InvalidParameterValueException(String errorMessage) {
|
||||||
super(errorMessage);
|
super(errorMessage);
|
||||||
setErrorMessage(errorMessage);
|
setErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ public class InvalidParameterException extends Exception {
|
|||||||
* @param cause Cause of this exception.
|
* @param cause Cause of this exception.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public InvalidParameterException(Throwable cause) {
|
public InvalidParameterValueException(Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +21,8 @@ package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
|||||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAO;
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAO;
|
||||||
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.analytics.dashboard.dao.bean.*;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||||
|
|
||||||
@ -29,65 +30,84 @@ import java.sql.Connection;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalDeviceCount() throws SQLException {
|
public int getTotalDeviceCount() throws SQLException {
|
||||||
|
try {
|
||||||
return this.getDeviceCount(null);
|
return this.getDeviceCount(null);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getActiveDeviceCount() throws SQLException {
|
public int getActiveDeviceCount() throws SQLException {
|
||||||
Map<String, Object> filters = new HashMap<>();
|
FilterSet filterSet = new FilterSet();
|
||||||
filters.put("CONNECTIVITY_STATUS", "ACTIVE");
|
filterSet.setConnectivityStatus(ConnectivityStatus.active.toString());
|
||||||
return this.getDeviceCount(filters);
|
try {
|
||||||
|
return this.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInactiveDeviceCount() throws SQLException {
|
public int getInactiveDeviceCount() throws SQLException {
|
||||||
Map<String, Object> filters = new HashMap<>();
|
FilterSet filterSet = new FilterSet();
|
||||||
filters.put("CONNECTIVITY_STATUS", "INACTIVE");
|
filterSet.setConnectivityStatus(ConnectivityStatus.inactive.toString());
|
||||||
return this.getDeviceCount(filters);
|
try {
|
||||||
|
return this.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRemovedDeviceCount() throws SQLException {
|
public int getRemovedDeviceCount() throws SQLException {
|
||||||
Map<String, Object> filters = new HashMap<>();
|
FilterSet filterSet = new FilterSet();
|
||||||
filters.put("CONNECTIVITY_STATUS", "REMOVED");
|
filterSet.setConnectivityStatus(ConnectivityStatus.removed.toString());
|
||||||
return this.getDeviceCount(filters);
|
try {
|
||||||
|
return this.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNonCompliantDeviceCount() throws SQLException {
|
public int getNonCompliantDeviceCount() throws SQLException {
|
||||||
Map<String, Object> filters = new HashMap<>();
|
FilterSet filterSet = new FilterSet();
|
||||||
filters.put("IS_COMPLIANT", 0);
|
filterSet.setPotentialVulnerability(PotentialVulnerability.non_compliant.toString());
|
||||||
return this.getDeviceCount(filters);
|
try {
|
||||||
|
return this.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getUnmonitoredDeviceCount() throws SQLException {
|
public int getUnmonitoredDeviceCount() throws SQLException {
|
||||||
Map<String, Object> filters = new HashMap<>();
|
FilterSet filterSet = new FilterSet();
|
||||||
filters.put("POLICY_ID", -1);
|
filterSet.setPotentialVulnerability(PotentialVulnerability.unmonitored.toString());
|
||||||
return this.getDeviceCount(filters);
|
try {
|
||||||
|
return this.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidParameterValueException e) {
|
||||||
|
throw new AssertionError(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (startIndex < 0) {
|
if (startIndex < 0) {
|
||||||
throw new InvalidParameterException("Start index (startIndex) should be " +
|
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that.");
|
||||||
"equal to 0 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultCount < 5) {
|
if (resultCount < 5) {
|
||||||
throw new InvalidParameterException("Result count (resultCount) should be " +
|
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that.");
|
||||||
"equal to 5 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
@ -137,7 +157,10 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return paginationResult;
|
return paginationResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDeviceCount(Map<String, Object> filters) throws SQLException {
|
public int getDeviceCount(FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -179,13 +202,15 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return filteredDeviceCount;
|
return filteredDeviceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
|
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, FilterSet filterSet)
|
||||||
throws InvalidParameterException, SQLException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||||
throw new InvalidParameterException("nonCompliantFeatureCode should not be either null or empty.");
|
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -193,7 +218,8 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
int filteredDeviceCount = 0;
|
int filteredDeviceCount = 0;
|
||||||
try {
|
try {
|
||||||
con = this.getConnection();
|
con = this.getConnection();
|
||||||
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM DEVICES_VIEW_2 WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
|
String sql = "SELECT COUNT(DEVICE_ID) AS DEVICE_COUNT FROM DEVICES_VIEW_2 " +
|
||||||
|
"WHERE TENANT_ID = ? AND FEATURE_CODE = ?";
|
||||||
// appending filters to support advanced filtering options
|
// appending filters to support advanced filtering options
|
||||||
// [1] appending filter columns
|
// [1] appending filter columns
|
||||||
if (filters != null && filters.size() > 0) {
|
if (filters != null && filters.size() > 0) {
|
||||||
@ -228,7 +254,11 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return filteredDeviceCount;
|
return filteredDeviceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException {
|
public Map<String, Integer> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -273,13 +303,14 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||||
throw new InvalidParameterException("Non-compliant feature code (nonCompliantFeatureCode) " +
|
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||||
"should not be either null or empty.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -324,7 +355,11 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return filteredDeviceCountsByPlatforms;
|
return filteredDeviceCountsByPlatforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException {
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -369,13 +404,14 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
public Map<String, Integer> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||||
throw new InvalidParameterException("Non-compliant feature code (nonCompliantFeatureCode) " +
|
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||||
"should not be either null or empty.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -420,19 +456,19 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return filteredDeviceCountsByOwnershipTypes;
|
return filteredDeviceCountsByOwnershipTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||||
int startIndex, int resultCount) throws InvalidParameterException, SQLException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (startIndex < 0) {
|
if (startIndex < 0) {
|
||||||
throw new InvalidParameterException("Start index (startIndex) should be " +
|
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that.");
|
||||||
"equal to 0 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultCount < 5) {
|
if (resultCount < 5) {
|
||||||
throw new InvalidParameterException("Result count (resultCount) should be " +
|
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that.");
|
||||||
"equal to 5 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -504,24 +540,23 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters, int startIndex, int resultCount)
|
FilterSet filterSet, int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||||
throw new InvalidParameterException("Non-compliant feature code (nonCompliantFeatureCode) " +
|
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||||
"should not be either null or empty.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startIndex < 0) {
|
if (startIndex < 0) {
|
||||||
throw new InvalidParameterException("Start index (startIndex) should be " +
|
throw new InvalidParameterValueException("Start index should be equal to 0 or greater than that.");
|
||||||
"equal to 0 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resultCount < 5) {
|
if (resultCount < 5) {
|
||||||
throw new InvalidParameterException("Result count (resultCount) should be " +
|
throw new InvalidParameterValueException("Result count should be equal to 5 or greater than that.");
|
||||||
"equal to 5 or greater than that.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -595,7 +630,11 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return paginationResult;
|
return paginationResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException {
|
public List<Map<String, Object>> getDevicesWithDetails(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -645,13 +684,14 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
public List<Map<String, Object>> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters) throws InvalidParameterException, SQLException {
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
|
|
||||||
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
if (nonCompliantFeatureCode == null || "".equals(nonCompliantFeatureCode)) {
|
||||||
throw new InvalidParameterException("Non-compliant feature code (nonCompliantFeatureCode) " +
|
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||||
"should not be either null or empty.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||||
|
|
||||||
Connection con;
|
Connection con;
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
@ -702,6 +742,67 @@ public class GadgetDataServiceDAOImpl implements GadgetDataServiceDAO {
|
|||||||
return filteredDevicesWithDetails;
|
return filteredDevicesWithDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> extractDatabaseFiltersFromBean(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException {
|
||||||
|
if (filterSet == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> filters = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
String connectivityStatus = filterSet.getConnectivityStatus();
|
||||||
|
if (connectivityStatus != null) {
|
||||||
|
if (ConnectivityStatus.active.toString().equals(connectivityStatus) ||
|
||||||
|
ConnectivityStatus.inactive.toString().equals(connectivityStatus) ||
|
||||||
|
ConnectivityStatus.removed.toString().equals(connectivityStatus)) {
|
||||||
|
filters.put("CONNECTIVITY_STATUS", connectivityStatus.toUpperCase());
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterValueException("Invalid use of value for platform. " +
|
||||||
|
"Value of platform could only be either android, ios or windows.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String potentialVulnerability = filterSet.getPotentialVulnerability();
|
||||||
|
if (potentialVulnerability != null) {
|
||||||
|
if (PotentialVulnerability.non_compliant.toString().equals(potentialVulnerability) ||
|
||||||
|
PotentialVulnerability.unmonitored.toString().equals(potentialVulnerability)) {
|
||||||
|
if (PotentialVulnerability.non_compliant.toString().equals(potentialVulnerability)) {
|
||||||
|
filters.put("IS_COMPLIANT", 0);
|
||||||
|
} else {
|
||||||
|
filters.put("POLICY_ID", -1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterValueException("Invalid use of value for potential vulnerability. " +
|
||||||
|
"Value of potential vulnerability could only be non_compliant or unmonitored.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String platform = filterSet.getPlatform();
|
||||||
|
if (platform != null) {
|
||||||
|
if (Platform.android.toString().equals(platform) ||
|
||||||
|
Platform.ios.toString().equals(platform) ||
|
||||||
|
Platform.windows.toString().equals(platform)) {
|
||||||
|
filters.put("PLATFORM", platform);
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterValueException("Invalid use of value for platform. " +
|
||||||
|
"Value of platform could only be either android, ios or windows.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String ownership = filterSet.getOwnership();
|
||||||
|
if (ownership != null) {
|
||||||
|
if (Ownership.byod.toString().equals(ownership) ||
|
||||||
|
Ownership.cope.toString().equals(ownership)) {
|
||||||
|
filters.put("OWNERSHIP", ownership.toUpperCase());
|
||||||
|
} else {
|
||||||
|
throw new InvalidParameterValueException("Invalid use of value for ownership. " +
|
||||||
|
"Value of ownership could only be either BYOD or COPE.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
private Connection getConnection() throws SQLException {
|
private Connection getConnection() throws SQLException {
|
||||||
return GadgetDataServiceDAOFactory.getConnection();
|
return GadgetDataServiceDAOFactory.getConnection();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,8 @@ 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.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.analytics.dashboard.dao.bean.FilterSet;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.exception.InvalidParameterValueException;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@ -108,7 +108,7 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||||
throws SQLException, InvalidParameterException {
|
throws SQLException, InvalidParameterValueException {
|
||||||
PaginationResult paginationResult;
|
PaginationResult paginationResult;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
@ -121,11 +121,11 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDeviceCount(Map<String, Object> filters) throws SQLException {
|
public int getDeviceCount(FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
int deviceCount;
|
int deviceCount;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filters);
|
deviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -133,13 +133,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, Map<String, Object> filters)
|
public int getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, FilterSet filterSet)
|
||||||
throws SQLException, InvalidParameterException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
int featureNonCompliantDeviceCount;
|
int featureNonCompliantDeviceCount;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
||||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filters);
|
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -147,12 +147,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Integer> getDeviceCountsByPlatforms(Map<String, Object> filters) throws SQLException {
|
public Map<String, Integer> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
Map<String, Integer> deviceCountsByPlatforms;
|
Map<String, Integer> deviceCountsByPlatforms;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getDeviceCountsByPlatforms(filters);
|
getDeviceCountsByPlatforms(filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -161,12 +162,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 SQLException, InvalidParameterException {
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
Map<String, Integer> featureNonCompliantDeviceCountsByPlatforms;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filters);
|
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -174,12 +175,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Integer> getDeviceCountsByOwnershipTypes(Map<String, Object> filters) throws SQLException {
|
public Map<String, Integer> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
Map<String, Integer> deviceCountsByOwnershipTypes;
|
Map<String, Integer> deviceCountsByOwnershipTypes;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getDeviceCountsByOwnershipTypes(filters);
|
getDeviceCountsByOwnershipTypes(filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -188,12 +190,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 SQLException, InvalidParameterException {
|
FilterSet filterSet) throws SQLException, InvalidParameterValueException {
|
||||||
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
Map<String, Integer> featureNonCompliantDeviceCountsByOwnershipTypes;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filters);
|
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -201,13 +203,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginationResult getDevicesWithDetails(Map<String, Object> filters,
|
public PaginationResult getDevicesWithDetails(FilterSet filterSet,
|
||||||
int startIndex, int resultCount) throws InvalidParameterException, SQLException {
|
int startIndex, int resultCount) throws InvalidParameterValueException, SQLException {
|
||||||
PaginationResult paginationResult;
|
PaginationResult paginationResult;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getDevicesWithDetails(filters, startIndex, resultCount);
|
getDevicesWithDetails(filterSet, startIndex, resultCount);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -216,13 +218,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||||
Map<String, Object> filters, int startIndex, int resultCount)
|
FilterSet filterSet, int startIndex, int resultCount)
|
||||||
throws InvalidParameterException, SQLException {
|
throws InvalidParameterValueException, SQLException {
|
||||||
PaginationResult paginationResult;
|
PaginationResult paginationResult;
|
||||||
try {
|
try {
|
||||||
GadgetDataServiceDAOFactory.openConnection();
|
GadgetDataServiceDAOFactory.openConnection();
|
||||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filters, startIndex, resultCount);
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet, startIndex, resultCount);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -230,11 +232,12 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getDevicesWithDetails(Map<String, Object> filters) throws SQLException {
|
public List<Map<String, Object>> getDevicesWithDetails(FilterSet filterSet)
|
||||||
|
throws InvalidParameterValueException, SQLException {
|
||||||
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(filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
@ -243,12 +246,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 SQLException, InvalidParameterException {
|
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||||
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, filterSet);
|
||||||
} finally {
|
} finally {
|
||||||
GadgetDataServiceDAOFactory.closeConnection();
|
GadgetDataServiceDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,14 +72,14 @@ public class GadgetDataServiceComponent {
|
|||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDataSourceService(DataSourceService dataSourceService) {
|
protected void setDataSourceService(DataSourceService dataSourceService) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Binding org.wso2.carbon.ndatasource.core.DataSourceService...");
|
log.debug("Binding org.wso2.carbon.ndatasource.core.DataSourceService...");
|
||||||
}
|
}
|
||||||
//do nothing
|
//do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unsetDataSourceService(DataSourceService dataSourceService) {
|
protected void unsetDataSourceService(DataSourceService dataSourceService) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("Unbinding org.wso2.carbon.ndatasource.core.DataSourceService...");
|
log.debug("Unbinding org.wso2.carbon.ndatasource.core.DataSourceService...");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user