commit
7e8f38cf16
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* 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.jaxrs.beans;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DashboardGadgetDataWrapper {
|
||||||
|
|
||||||
|
private String context;
|
||||||
|
private String groupingAttribute;
|
||||||
|
private List<?> data;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public String getContext() {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContext(String context) {
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public String getGroupingAttribute() {
|
||||||
|
return groupingAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupingAttribute(String groupingAttribute) {
|
||||||
|
this.groupingAttribute = groupingAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public List<?> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(List<?> data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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.jaxrs.beans;
|
||||||
|
|
||||||
|
public class DashboardPaginationGadgetDataWrapper extends DashboardGadgetDataWrapper {
|
||||||
|
|
||||||
|
private int totalRecordCount;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public int getTotalRecordCount() {
|
||||||
|
return totalRecordCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalRecordCount(int totalRecordCount) {
|
||||||
|
this.totalRecordCount = totalRecordCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
package org.wso2.carbon.device.mgt.jaxrs.service.api;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
@Path("/dashboard")
|
||||||
|
@Api(value = "Dashboard", description = "Dashboard related operations are described here.")
|
||||||
|
@SuppressWarnings("NonJaxWsWebServices")
|
||||||
|
public interface Dashboard {
|
||||||
|
|
||||||
|
String CONNECTIVITY_STATUS = "connectivity-status";
|
||||||
|
String POTENTIAL_VULNERABILITY = "potential-vulnerability";
|
||||||
|
String NON_COMPLIANT_FEATURE_CODE = "non-compliant-feature-code";
|
||||||
|
String PLATFORM = "platform";
|
||||||
|
String OWNERSHIP = "ownership";
|
||||||
|
// Constants related to pagination
|
||||||
|
String PAGINATION_ENABLED = "pagination-enabled";
|
||||||
|
String START_INDEX = "start";
|
||||||
|
String RESULT_COUNT = "length";
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-count-overview")
|
||||||
|
Response getOverviewDeviceCounts();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-counts-by-potential-vulnerabilities")
|
||||||
|
Response getDeviceCountsByPotentialVulnerabilities();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("non-compliant-device-counts-by-features")
|
||||||
|
Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-counts-by-groups")
|
||||||
|
Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-device-counts-by-groups")
|
||||||
|
Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership);
|
||||||
|
@GET
|
||||||
|
@Path("filtered-device-count-over-total")
|
||||||
|
Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-device-count-over-total")
|
||||||
|
Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("devices-with-details")
|
||||||
|
Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership,
|
||||||
|
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
|
||||||
|
@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-devices-with-details")
|
||||||
|
Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership,
|
||||||
|
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
|
||||||
|
@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount);
|
||||||
|
}
|
@ -0,0 +1,688 @@
|
|||||||
|
/*
|
||||||
|
* 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.jaxrs.service.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
|
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.bean.BasicFilterSet;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||||
|
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.service.api.Dashboard;
|
||||||
|
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class consists of dashboard related REST APIs
|
||||||
|
* to be consumed by individual client gadgets such as
|
||||||
|
* [1] Overview of Devices,
|
||||||
|
* [2] Potential Vulnerabilities,
|
||||||
|
* [3] Non-compliant Devices by Features,
|
||||||
|
* [4] Device Groupings and etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Consumes({"application/json"})
|
||||||
|
@Produces({"application/json"})
|
||||||
|
|
||||||
|
@SuppressWarnings("NonJaxWsWebServices")
|
||||||
|
public class DashboardImpl implements Dashboard {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(DashboardImpl.class);
|
||||||
|
|
||||||
|
private static final String FLAG_TRUE = "true";
|
||||||
|
private static final String FLAG_FALSE = "false";
|
||||||
|
// Constants related to common error-response messages
|
||||||
|
private static final String INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY = "Received an invalid value for " +
|
||||||
|
"query parameter : " + POTENTIAL_VULNERABILITY + ", Should be either NON_COMPLIANT or UNMONITORED.";
|
||||||
|
private static final String INVALID_QUERY_PARAM_VALUE_START_INDEX = "Received an invalid value for " +
|
||||||
|
"query parameter : " + START_INDEX + ", Should not be lesser than 0.";
|
||||||
|
private static final String INVALID_QUERY_PARAM_VALUE_RESULT_COUNT = "Received an invalid value for " +
|
||||||
|
"query parameter : " + RESULT_COUNT + ", Should not be lesser than 5.";
|
||||||
|
private static final String INVALID_QUERY_PARAM_VALUE_PAGINATION_ENABLED = "Received an invalid value for " +
|
||||||
|
"query parameter : " + PAGINATION_ENABLED + ", Should be either true or false.";
|
||||||
|
private static final String REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE = "Missing required query " +
|
||||||
|
"parameter : " + NON_COMPLIANT_FEATURE_CODE;
|
||||||
|
private static final String REQUIRED_QUERY_PARAM_VALUE_PAGINATION_ENABLED = "Missing required query " +
|
||||||
|
"parameter : " + PAGINATION_ENABLED;
|
||||||
|
private static final String ERROR_IN_RETRIEVING_REQUESTED_DATA = "Error in retrieving requested data.";
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-count-overview")
|
||||||
|
public Response getOverviewDeviceCounts() {
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper1 = new DashboardGadgetDataWrapper();
|
||||||
|
|
||||||
|
// getting total device count
|
||||||
|
DeviceCountByGroup totalDeviceCount;
|
||||||
|
try {
|
||||||
|
totalDeviceCount = gadgetDataService.getTotalDeviceCount();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve total device count.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DeviceCountByGroup> totalDeviceCountInListEntry = new ArrayList<>();
|
||||||
|
totalDeviceCountInListEntry.add(totalDeviceCount);
|
||||||
|
|
||||||
|
dashboardGadgetDataWrapper1.setContext("Total-device-count");
|
||||||
|
dashboardGadgetDataWrapper1.setGroupingAttribute(null);
|
||||||
|
dashboardGadgetDataWrapper1.setData(totalDeviceCountInListEntry);
|
||||||
|
|
||||||
|
// getting device counts by connectivity statuses
|
||||||
|
List<DeviceCountByGroup> deviceCountsByConnectivityStatuses;
|
||||||
|
try {
|
||||||
|
deviceCountsByConnectivityStatuses = gadgetDataService.getDeviceCountsByConnectivityStatuses();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve device counts by connectivity statuses.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper2 = new DashboardGadgetDataWrapper();
|
||||||
|
|
||||||
|
dashboardGadgetDataWrapper2.setContext("Device-counts-by-connectivity-statuses");
|
||||||
|
dashboardGadgetDataWrapper2.setGroupingAttribute(CONNECTIVITY_STATUS);
|
||||||
|
dashboardGadgetDataWrapper2.setData(deviceCountsByConnectivityStatuses);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper1);
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper2);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-counts-by-potential-vulnerabilities")
|
||||||
|
public Response getDeviceCountsByPotentialVulnerabilities() {
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities;
|
||||||
|
try {
|
||||||
|
deviceCountsByPotentialVulnerabilities = gadgetDataService.getDeviceCountsByPotentialVulnerabilities();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve device counts by potential vulnerabilities.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper.setContext("Device-counts-by-potential-vulnerabilities");
|
||||||
|
dashboardGadgetDataWrapper.setGroupingAttribute(POTENTIAL_VULNERABILITY);
|
||||||
|
dashboardGadgetDataWrapper.setData(deviceCountsByPotentialVulnerabilities);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("non-compliant-device-counts-by-features")
|
||||||
|
public Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount) {
|
||||||
|
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
DashboardPaginationGadgetDataWrapper
|
||||||
|
dashboardPaginationGadgetDataWrapper = new DashboardPaginationGadgetDataWrapper();
|
||||||
|
|
||||||
|
PaginationResult paginationResult;
|
||||||
|
try {
|
||||||
|
paginationResult = gadgetDataService.
|
||||||
|
getNonCompliantDeviceCountsByFeatures(startIndex, resultCount);
|
||||||
|
} catch (InvalidStartIndexValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a non-compliant set " +
|
||||||
|
"of device counts by features.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).entity(INVALID_QUERY_PARAM_VALUE_START_INDEX).build();
|
||||||
|
} catch (InvalidResultCountValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a non-compliant set " +
|
||||||
|
"of device counts by features.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).entity(INVALID_QUERY_PARAM_VALUE_RESULT_COUNT).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a non-compliant set of device counts by features.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
dashboardPaginationGadgetDataWrapper.setContext("Non-compliant-device-counts-by-features");
|
||||||
|
dashboardPaginationGadgetDataWrapper.setGroupingAttribute(NON_COMPLIANT_FEATURE_CODE);
|
||||||
|
dashboardPaginationGadgetDataWrapper.setData(paginationResult.getData());
|
||||||
|
dashboardPaginationGadgetDataWrapper.setTotalRecordCount(paginationResult.getRecordsTotal());
|
||||||
|
|
||||||
|
List<DashboardPaginationGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardPaginationGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("device-counts-by-groups")
|
||||||
|
public Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
ExtendedFilterSet filterSet = new ExtendedFilterSet();
|
||||||
|
filterSet.setConnectivityStatus(connectivityStatus);
|
||||||
|
filterSet.setPotentialVulnerability(potentialVulnerability);
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
// creating device-Counts-by-platforms Data Wrapper
|
||||||
|
List<DeviceCountByGroup> deviceCountsByPlatforms;
|
||||||
|
try {
|
||||||
|
deviceCountsByPlatforms = gadgetDataService.getDeviceCountsByPlatforms(filterSet);
|
||||||
|
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of device counts by platforms.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of device counts by platforms.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper1 = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper1.setContext("Device-counts-by-platforms");
|
||||||
|
dashboardGadgetDataWrapper1.setGroupingAttribute(PLATFORM);
|
||||||
|
dashboardGadgetDataWrapper1.setData(deviceCountsByPlatforms);
|
||||||
|
|
||||||
|
// creating device-Counts-by-ownership-types Data Wrapper
|
||||||
|
List<DeviceCountByGroup> deviceCountsByOwnerships;
|
||||||
|
try {
|
||||||
|
deviceCountsByOwnerships = gadgetDataService.getDeviceCountsByOwnershipTypes(filterSet);
|
||||||
|
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of device counts by ownerships.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of device counts by ownerships.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper2 = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper2.setContext("Device-counts-by-ownerships");
|
||||||
|
dashboardGadgetDataWrapper2.setGroupingAttribute(OWNERSHIP);
|
||||||
|
dashboardGadgetDataWrapper2.setData(deviceCountsByOwnerships);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper1);
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper2);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-device-counts-by-groups")
|
||||||
|
public Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership) {
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
BasicFilterSet filterSet = new BasicFilterSet();
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
// creating feature-non-compliant-device-Counts-by-platforms Data Wrapper
|
||||||
|
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByPlatforms;
|
||||||
|
try {
|
||||||
|
featureNonCompliantDeviceCountsByPlatforms = gadgetDataService.
|
||||||
|
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
|
||||||
|
} catch (InvalidFeatureCodeValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of feature " +
|
||||||
|
"non-compliant device counts by platforms.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of feature non-compliant " +
|
||||||
|
"device counts by platforms.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper1 = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper1.setContext("Feature-non-compliant-device-counts-by-platforms");
|
||||||
|
dashboardGadgetDataWrapper1.setGroupingAttribute(PLATFORM);
|
||||||
|
dashboardGadgetDataWrapper1.setData(featureNonCompliantDeviceCountsByPlatforms);
|
||||||
|
|
||||||
|
// creating feature-non-compliant-device-Counts-by-ownership-types Data Wrapper
|
||||||
|
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByOwnerships;
|
||||||
|
try {
|
||||||
|
featureNonCompliantDeviceCountsByOwnerships = gadgetDataService.
|
||||||
|
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
|
||||||
|
} catch (InvalidFeatureCodeValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of feature " +
|
||||||
|
"non-compliant device counts by ownerships.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of feature non-compliant " +
|
||||||
|
"device counts by ownerships.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper2 = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper2.setContext("Feature-non-compliant-device-counts-by-ownerships");
|
||||||
|
dashboardGadgetDataWrapper2.setGroupingAttribute(OWNERSHIP);
|
||||||
|
dashboardGadgetDataWrapper2.setData(featureNonCompliantDeviceCountsByOwnerships);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper1);
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper2);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("filtered-device-count-over-total")
|
||||||
|
public Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
ExtendedFilterSet filterSet = new ExtendedFilterSet();
|
||||||
|
filterSet.setConnectivityStatus(connectivityStatus);
|
||||||
|
filterSet.setPotentialVulnerability(potentialVulnerability);
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
// creating filteredDeviceCount Data Wrapper
|
||||||
|
DeviceCountByGroup filteredDeviceCount;
|
||||||
|
try {
|
||||||
|
filteredDeviceCount = gadgetDataService.getDeviceCount(filterSet);
|
||||||
|
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered device count over the total.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered device count over the total.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// creating TotalDeviceCount Data Wrapper
|
||||||
|
DeviceCountByGroup totalDeviceCount;
|
||||||
|
try {
|
||||||
|
totalDeviceCount = gadgetDataService.getTotalDeviceCount();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve the total device count over filtered.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Object> filteredDeviceCountOverTotalDataWrapper = new ArrayList<>();
|
||||||
|
filteredDeviceCountOverTotalDataWrapper.add(filteredDeviceCount);
|
||||||
|
filteredDeviceCountOverTotalDataWrapper.add(totalDeviceCount);
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper.setContext("Filtered-device-count-over-total");
|
||||||
|
dashboardGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardGadgetDataWrapper.setData(filteredDeviceCountOverTotalDataWrapper);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-device-count-over-total")
|
||||||
|
public Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
BasicFilterSet filterSet = new BasicFilterSet();
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
// creating featureNonCompliantDeviceCount Data Wrapper
|
||||||
|
DeviceCountByGroup featureNonCompliantDeviceCount;
|
||||||
|
try {
|
||||||
|
featureNonCompliantDeviceCount = gadgetDataService.
|
||||||
|
getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet);
|
||||||
|
} catch (InvalidFeatureCodeValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a feature non-compliant device count over the total.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a feature non-compliant device count over the total.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
// creating TotalDeviceCount Data Wrapper
|
||||||
|
DeviceCountByGroup totalDeviceCount;
|
||||||
|
try {
|
||||||
|
totalDeviceCount = gadgetDataService.getTotalDeviceCount();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve the total device count over filtered feature non-compliant.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Object> featureNonCompliantDeviceCountOverTotalDataWrapper = new ArrayList<>();
|
||||||
|
featureNonCompliantDeviceCountOverTotalDataWrapper.add(featureNonCompliantDeviceCount);
|
||||||
|
featureNonCompliantDeviceCountOverTotalDataWrapper.add(totalDeviceCount);
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper.setContext("Feature-non-compliant-device-count-over-total");
|
||||||
|
dashboardGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardGadgetDataWrapper.setData(featureNonCompliantDeviceCountOverTotalDataWrapper);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("devices-with-details")
|
||||||
|
public Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
|
||||||
|
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership,
|
||||||
|
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
|
||||||
|
@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount) {
|
||||||
|
|
||||||
|
if (paginationEnabled == null) {
|
||||||
|
|
||||||
|
log.error("Bad request on retrieving a filtered set of devices with details @ " +
|
||||||
|
"Dashboard API layer. " + REQUIRED_QUERY_PARAM_VALUE_PAGINATION_ENABLED);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_PAGINATION_ENABLED).build();
|
||||||
|
|
||||||
|
} else if (FLAG_TRUE.equals(paginationEnabled)) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
ExtendedFilterSet filterSet = new ExtendedFilterSet();
|
||||||
|
filterSet.setConnectivityStatus(connectivityStatus);
|
||||||
|
filterSet.setPotentialVulnerability(potentialVulnerability);
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
PaginationResult paginationResult;
|
||||||
|
try {
|
||||||
|
paginationResult = gadgetDataService.
|
||||||
|
getDevicesWithDetails(filterSet, startIndex, resultCount);
|
||||||
|
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY).build();
|
||||||
|
} catch (InvalidStartIndexValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_START_INDEX).build();
|
||||||
|
} catch (InvalidResultCountValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_RESULT_COUNT).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardPaginationGadgetDataWrapper
|
||||||
|
dashboardPaginationGadgetDataWrapper = new DashboardPaginationGadgetDataWrapper();
|
||||||
|
dashboardPaginationGadgetDataWrapper.setContext("Filtered-and-paginated-devices-with-details");
|
||||||
|
dashboardPaginationGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardPaginationGadgetDataWrapper.setData(paginationResult.getData());
|
||||||
|
dashboardPaginationGadgetDataWrapper.setTotalRecordCount(paginationResult.getRecordsTotal());
|
||||||
|
|
||||||
|
List<DashboardPaginationGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardPaginationGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
|
||||||
|
} else if (FLAG_FALSE.equals(paginationEnabled)) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
ExtendedFilterSet filterSet = new ExtendedFilterSet();
|
||||||
|
filterSet.setConnectivityStatus(connectivityStatus);
|
||||||
|
filterSet.setPotentialVulnerability(potentialVulnerability);
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
List<DeviceWithDetails> devicesWithDetails;
|
||||||
|
try {
|
||||||
|
devicesWithDetails = gadgetDataService.getDevicesWithDetails(filterSet);
|
||||||
|
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_POTENTIAL_VULNERABILITY).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper.setContext("Filtered-devices-with-details");
|
||||||
|
dashboardGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardGadgetDataWrapper.setData(devicesWithDetails);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error("Bad request on retrieving a filtered set of devices with details @ " +
|
||||||
|
"Dashboard API layer. " + INVALID_QUERY_PARAM_VALUE_PAGINATION_ENABLED);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_PAGINATION_ENABLED).build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("feature-non-compliant-devices-with-details")
|
||||||
|
public Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
|
||||||
|
@QueryParam(PLATFORM) String platform,
|
||||||
|
@QueryParam(OWNERSHIP) String ownership,
|
||||||
|
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
|
||||||
|
@QueryParam(START_INDEX) int startIndex,
|
||||||
|
@QueryParam(RESULT_COUNT) int resultCount) {
|
||||||
|
if (paginationEnabled == null) {
|
||||||
|
|
||||||
|
log.error("Bad request on retrieving a filtered set of feature non-compliant devices with " +
|
||||||
|
"details @ Dashboard API layer. " + REQUIRED_QUERY_PARAM_VALUE_PAGINATION_ENABLED);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_PAGINATION_ENABLED).build();
|
||||||
|
|
||||||
|
} else if (FLAG_TRUE.equals(paginationEnabled)) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
BasicFilterSet filterSet = new BasicFilterSet();
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
PaginationResult paginationResult;
|
||||||
|
try {
|
||||||
|
paginationResult = gadgetDataService.
|
||||||
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode,
|
||||||
|
filterSet, startIndex, resultCount);
|
||||||
|
} catch (InvalidFeatureCodeValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of " +
|
||||||
|
"feature non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE).build();
|
||||||
|
} catch (InvalidStartIndexValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of " +
|
||||||
|
"feature non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_START_INDEX).build();
|
||||||
|
} catch (InvalidResultCountValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of " +
|
||||||
|
"feature non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_RESULT_COUNT).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of feature " +
|
||||||
|
"non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardPaginationGadgetDataWrapper
|
||||||
|
dashboardPaginationGadgetDataWrapper = new DashboardPaginationGadgetDataWrapper();
|
||||||
|
dashboardPaginationGadgetDataWrapper.
|
||||||
|
setContext("Filtered-and-paginated-feature-non-compliant-devices-with-details");
|
||||||
|
dashboardPaginationGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardPaginationGadgetDataWrapper.setData(paginationResult.getData());
|
||||||
|
dashboardPaginationGadgetDataWrapper.setTotalRecordCount(paginationResult.getRecordsTotal());
|
||||||
|
|
||||||
|
List<DashboardPaginationGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardPaginationGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
|
||||||
|
} else if (FLAG_FALSE.equals(paginationEnabled)) {
|
||||||
|
|
||||||
|
// getting gadget data service
|
||||||
|
GadgetDataService gadgetDataService = DeviceMgtAPIUtils.getGadgetDataService();
|
||||||
|
|
||||||
|
// constructing filter set
|
||||||
|
BasicFilterSet filterSet = new BasicFilterSet();
|
||||||
|
filterSet.setPlatform(platform);
|
||||||
|
filterSet.setOwnership(ownership);
|
||||||
|
|
||||||
|
List<DeviceWithDetails> featureNonCompliantDevicesWithDetails;
|
||||||
|
try {
|
||||||
|
featureNonCompliantDevicesWithDetails = gadgetDataService.
|
||||||
|
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet);
|
||||||
|
} catch (InvalidFeatureCodeValueException e) {
|
||||||
|
log.error("Bad request and error occurred @ Gadget Data Service layer due to " +
|
||||||
|
"invalid (query) parameter value. This was while trying to execute relevant data service " +
|
||||||
|
"function @ Dashboard API layer to retrieve a filtered set of " +
|
||||||
|
"feature non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(REQUIRED_QUERY_PARAM_VALUE_NON_COMPLIANT_FEATURE_CODE).build();
|
||||||
|
} catch (DataAccessLayerException e) {
|
||||||
|
log.error("An internal error occurred while trying to execute relevant data service function " +
|
||||||
|
"@ Dashboard API layer to retrieve a filtered set of feature " +
|
||||||
|
"non-compliant devices with details.", e);
|
||||||
|
return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).
|
||||||
|
entity(ERROR_IN_RETRIEVING_REQUESTED_DATA).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
DashboardGadgetDataWrapper dashboardGadgetDataWrapper = new DashboardGadgetDataWrapper();
|
||||||
|
dashboardGadgetDataWrapper.setContext("Filtered-feature-non-compliant-devices-with-details");
|
||||||
|
dashboardGadgetDataWrapper.setGroupingAttribute(null);
|
||||||
|
dashboardGadgetDataWrapper.setData(featureNonCompliantDevicesWithDetails);
|
||||||
|
|
||||||
|
List<DashboardGadgetDataWrapper> responsePayload = new ArrayList<>();
|
||||||
|
responsePayload.add(dashboardGadgetDataWrapper);
|
||||||
|
|
||||||
|
return Response.status(HttpStatus.SC_OK).entity(responsePayload).build();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
log.error("Bad request on retrieving a filtered set of feature non-compliant devices with " +
|
||||||
|
"details @ Dashboard API layer. " + INVALID_QUERY_PARAM_VALUE_PAGINATION_ENABLED);
|
||||||
|
return Response.status(HttpStatus.SC_BAD_REQUEST).
|
||||||
|
entity(INVALID_QUERY_PARAM_VALUE_PAGINATION_ENABLED).build();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.common.operation.mgt;
|
||||||
|
|
||||||
|
public class Activity {
|
||||||
|
|
||||||
|
public enum Type {
|
||||||
|
CONFIG, MESSAGE, INFO, COMMAND, PROFILE, POLICY
|
||||||
|
}
|
||||||
|
|
||||||
|
private String activityId;
|
||||||
|
private String code;
|
||||||
|
private Type type;
|
||||||
|
private String createdTimeStamp;
|
||||||
|
|
||||||
|
public String getActivityId() {
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityId(String activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Type type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedTimeStamp() {
|
||||||
|
return createdTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedTimeStamp(String createdTimeStamp) {
|
||||||
|
this.createdTimeStamp = createdTimeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* 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.common.operation.mgt;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ActivityStatus {
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED
|
||||||
|
}
|
||||||
|
private DeviceIdentifier deviceIdentifier;
|
||||||
|
private Status status;
|
||||||
|
private List<OperationResponse> responses;
|
||||||
|
private String updatedTimestamp;
|
||||||
|
|
||||||
|
public DeviceIdentifier getDeviceIdentifier() {
|
||||||
|
return deviceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceIdentifier(DeviceIdentifier deviceIdentifier) {
|
||||||
|
this.deviceIdentifier = deviceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Status getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<OperationResponse> getResponses() {
|
||||||
|
return responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponses(List<OperationResponse> responses) {
|
||||||
|
this.responses = responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUpdatedTimestamp() {
|
||||||
|
return updatedTimestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedTimestamp(String updatedTimestamp) {
|
||||||
|
this.updatedTimestamp = updatedTimestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,20 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/operation-mod.js"}}
|
{{js "js/operation-mod.js"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,3 +1,20 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/tinymce.min.js" combine=false}}
|
{{js "js/tinymce.min.js" combine=false}}
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,41 +1,61 @@
|
|||||||
<span id="permission" data-permission="{{permissions}}"></span>
|
{{!
|
||||||
<div class="row">
|
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
<div class="col-md-12">
|
|
||||||
<!-- content -->
|
WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
<div id="config-save-form" class="container col-centered wr-content">
|
Version 2.0 (the "License"); you may not use this file except
|
||||||
<br>
|
in compliance with the License.
|
||||||
Device Notifications
|
You may obtain a copy of the License at
|
||||||
<br>
|
|
||||||
<br>
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
<div class="wr-advance-operations">
|
|
||||||
<div class="row no-gutter">
|
Unless required by applicable law or agreed to in writing,
|
||||||
<div class="wr-hidden-operations-nav col-lg-4">
|
software distributed under the License is distributed on an
|
||||||
<a id="unReadNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('unread', this)" class="selected">
|
"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.
|
||||||
|
}}
|
||||||
|
<span id="permission" data-permission="{{permissions}}"></span>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<!-- content -->
|
||||||
|
<div id="config-save-form" class="container col-centered wr-content">
|
||||||
|
<br>
|
||||||
|
Device Notifications
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<div class="wr-advance-operations">
|
||||||
|
<div class="row no-gutter">
|
||||||
|
<div class="wr-hidden-operations-nav col-lg-4">
|
||||||
|
<a id="unReadNotifications" href="javascript:void(0)"
|
||||||
|
onclick="showAdvanceOperation('unread', this)" class="selected">
|
||||||
<span class="wr-hidden-operations-icon fw-stack">
|
<span class="wr-hidden-operations-icon fw-stack">
|
||||||
<i class="fw fw-mail fw-stack-2x"></i>
|
<i class="fw fw-mail fw-stack-2x"></i>
|
||||||
</span>
|
</span>
|
||||||
Unread
|
Unread
|
||||||
</a>
|
</a>
|
||||||
<a id="allNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('all', this)">
|
<a id="allNotifications" href="javascript:void(0)" onclick="showAdvanceOperation('all', this)">
|
||||||
<span class="wr-hidden-operations-icon fw-stack">
|
<span class="wr-hidden-operations-icon fw-stack">
|
||||||
<i class="fw fw-forum fw-stack-2x"></i>
|
<i class="fw fw-forum fw-stack-2x"></i>
|
||||||
</span>
|
</span>
|
||||||
All Notifications
|
All Notifications
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wr-hidden-operations-content col-lg-8" id="ast-container">
|
<div class="wr-hidden-operations-content col-lg-8" id="ast-container">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
No unread messages
|
No unread messages
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /content -->
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- /content -->
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
<script id="notification-listing" data-current-user="{{currentUser.username}}" data-image-resource="{{self.publicURL}}/images/" src="{{self.publicURL}}/templates/notification-listing.hbs" type="text/x-handlebars-template" ></script>
|
<script id="notification-listing" data-current-user="{{currentUser.username}}"
|
||||||
|
data-image-resource="{{self.publicURL}}/images/" src="{{self.publicURL}}/templates/notification-listing.hbs"
|
||||||
|
type="text/x-handlebars-template"></script>
|
||||||
{{js "js/notification-listing.js"}}
|
{{js "js/notification-listing.js"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,73 +1,92 @@
|
|||||||
<!-- content/body -->
|
{{!
|
||||||
<div class="row">
|
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
<div class="col-md-12">
|
|
||||||
<!-- content -->
|
WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
<div id="role-create-form" class="container col-centered wr-content">
|
Version 2.0 (the "License"); you may not use this file except
|
||||||
<div class="wr-form">
|
in compliance with the License.
|
||||||
<p class="page-sub-title">Change Role permissions</p>
|
You may obtain a copy of the License at
|
||||||
<p>Please note that * sign represents required fields of data.</p>
|
|
||||||
<div class="wr-steps hidden" id="role_wizard_header">
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
<hr/>
|
|
||||||
<div class="col-md-4 col-xs-6">
|
Unless required by applicable law or agreed to in writing,
|
||||||
<div class="itm-wiz" data-step="policy-platform">
|
software distributed under the License is distributed on an
|
||||||
<div class="wiz-no">1</div>
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
|
KIND, either express or implied. See the License for the
|
||||||
</div>
|
specific language governing permissions and limitations
|
||||||
<br class="c-both"/>
|
under the License.
|
||||||
|
}}
|
||||||
|
<!-- content/body -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<!-- content -->
|
||||||
|
<div id="role-create-form" class="container col-centered wr-content">
|
||||||
|
<div class="wr-form">
|
||||||
|
<p class="page-sub-title">Change Role permissions</p>
|
||||||
|
<p>Please note that * sign represents required fields of data.</p>
|
||||||
|
<div class="wr-steps hidden" id="role_wizard_header">
|
||||||
|
<hr />
|
||||||
|
<div class="col-md-4 col-xs-6">
|
||||||
|
<div class="itm-wiz" data-step="policy-platform">
|
||||||
|
<div class="wiz-no">1</div>
|
||||||
|
<div class="wiz-lbl hidden-xs"><span>Add a role</span></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-xs-6">
|
<br class="c-both" />
|
||||||
<div class="itm-wiz itm-wiz-current" data-step="policy-profile">
|
</div>
|
||||||
<div class="wiz-no">2</div>
|
<div class="col-md-4 col-xs-6">
|
||||||
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
|
<div class="itm-wiz itm-wiz-current" data-step="policy-profile">
|
||||||
</div>
|
<div class="wiz-no">2</div>
|
||||||
<br class="c-both"/>
|
<div class="wiz-lbl hidden-xs"><span>Assign permissions</span></div>
|
||||||
</div>
|
</div>
|
||||||
<br/><br/>
|
<br class="c-both" />
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<br /><br />
|
||||||
<div class="row">
|
</div>
|
||||||
<div class="col-lg-8">
|
<hr />
|
||||||
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
|
<div class="row">
|
||||||
<i class="icon fw fw-error"></i><span></span>
|
<div class="col-lg-8">
|
||||||
</div>
|
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
|
||||||
<div id="permissionList" class="well" data-currentrole="{{roleName}}">
|
<i class="icon fw fw-error"></i><span></span>
|
||||||
<div id="loading-content" class="col-centered">
|
</div>
|
||||||
<i class="fw fw-settings fw-spin fw-2x"></i>
|
<div id="permissionList" class="well" data-currentrole="{{roleName}}">
|
||||||
Loading permissions list . . .
|
<div id="loading-content" class="col-centered">
|
||||||
<br>
|
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||||
</div>
|
Loading permissions list . . .
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
|
||||||
<button id="update-permissions-btn" class="wr-btn">Update Role Permissions</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<button id="update-permissions-btn" class="wr-btn">Update Role Permissions</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="role-created-msg" class="container col-centered wr-content hidden">
|
</div>
|
||||||
<div class="wr-form">
|
<div id="role-created-msg" class="container col-centered wr-content hidden">
|
||||||
<p class="page-sub-title">Permissions were assigned to the role successfully.</p>
|
<div class="wr-form">
|
||||||
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
|
<p class="page-sub-title">Permissions were assigned to the role successfully.</p>
|
||||||
<b>"View Role List"</b> to complete the process and go back to the role list.
|
<br>Please click <b>"Add Another Role"</b>, if you wish to add another role or click
|
||||||
<hr />
|
<b>"View Role List"</b> to complete the process and go back to the role list.
|
||||||
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
|
<hr />
|
||||||
View Role List
|
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
|
||||||
</button>
|
View Role List
|
||||||
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner">
|
</button>
|
||||||
|
<a href="{{@app.context}}/roles/add-role" class="cu-btn-inner">
|
||||||
<span class="fw-stack">
|
<span class="fw-stack">
|
||||||
<i class="fw fw-ring fw-stack-2x"></i>
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
<i class="fw fw-add fw-stack-1x"></i>
|
<i class="fw fw-add fw-stack-1x"></i>
|
||||||
</span>
|
</span>
|
||||||
Add Another Role
|
Add Another Role
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /content -->
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- /content -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /content/body -->
|
</div>
|
||||||
|
<!-- /content/body -->
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
<script id="list-partial" src="{{@unit.publicUri}}/templates/list-partial.hbs" type="text/x-handlebars-template" ></script>
|
<script id="list-partial" src="{{@unit.publicUri}}/templates/list-partial.hbs"
|
||||||
<script id="tree-template" src="{{@unit.publicUri}}/templates/tree-template.hbs" type="text/x-handlebars-template" ></script>
|
type="text/x-handlebars-template"></script>
|
||||||
|
<script id="tree-template" src="{{@unit.publicUri}}/templates/tree-template.hbs"
|
||||||
|
type="text/x-handlebars-template"></script>
|
||||||
{{js "js/bottomJs.js"}}
|
{{js "js/bottomJs.js"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
|
||||||
|
@ -1,68 +1,89 @@
|
|||||||
<!-- content/body -->
|
{{!
|
||||||
<div class="row">
|
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
<div class="col-md-12">
|
|
||||||
<!-- content -->
|
WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
<div id="role-create-form" class="container col-centered wr-content">
|
Version 2.0 (the "License"); you may not use this file except
|
||||||
<div class="wr-form">
|
in compliance with the License.
|
||||||
<p class="page-sub-title">Edit Role</p>
|
You may obtain a copy of the License at
|
||||||
<p>Please note that * sign represents required fields of data.</p>
|
|
||||||
<hr />
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-8">
|
Unless required by applicable law or agreed to in writing,
|
||||||
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
|
software distributed under the License is distributed on an
|
||||||
<i class="icon fw fw-error"></i><span></span>
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
</div>
|
KIND, either express or implied. See the License for the
|
||||||
<label class="wr-input-label">Domain *</label>
|
specific language governing permissions and limitations
|
||||||
<div class="wr-input-control">
|
under the License.
|
||||||
<select id="domain" class="form-control select">
|
}}
|
||||||
<option>PRIMARY</option>
|
<!-- content/body -->
|
||||||
{{#each userStores}}
|
<div class="row">
|
||||||
<option>{{this}}</option>
|
<div class="col-md-12">
|
||||||
{{/each}}
|
<!-- content -->
|
||||||
</select>
|
<div id="role-create-form" class="container col-centered wr-content">
|
||||||
</div>
|
<div class="wr-form">
|
||||||
<label class="wr-input-label">
|
<p class="page-sub-title">Edit Role</p>
|
||||||
Role Name *
|
<p>Please note that * sign represents required fields of data.</p>
|
||||||
</label>
|
<hr />
|
||||||
<br>
|
<div class="row">
|
||||||
<label class="wr-input-label" id="roleNameValidationText">
|
<div class="col-lg-8">
|
||||||
( {{roleNameHelpText}} )
|
<div id="role-create-error-msg" class="alert alert-danger hidden" role="alert">
|
||||||
</label>
|
<i class="icon fw fw-error"></i><span></span>
|
||||||
<div id="roleNameField" class="form-group wr-input-control">
|
</div>
|
||||||
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}" data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control" data-currentrole="{{role.roleName}}"
|
<label class="wr-input-label">Domain *</label>
|
||||||
value="{{role.roleName}}"/>
|
<div class="wr-input-control">
|
||||||
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
|
<select id="domain" class="form-control select">
|
||||||
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in minimum 3 characters long and do not include any whitespaces. </label>
|
<option>PRIMARY</option>
|
||||||
</div>
|
{{#each userStores}}
|
||||||
|
<option>{{this}}</option>
|
||||||
|
{{/each}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<label class="wr-input-label">
|
||||||
|
Role Name *
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<label class="wr-input-label" id="roleNameValidationText">
|
||||||
|
( {{roleNameHelpText}} )
|
||||||
|
</label>
|
||||||
|
<div id="roleNameField" class="form-group wr-input-control">
|
||||||
|
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
|
||||||
|
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
|
||||||
|
data-currentrole="{{role.roleName}}"
|
||||||
|
value="{{role.roleName}}" />
|
||||||
|
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
|
||||||
|
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
|
||||||
|
minimum 3 characters long and do not
|
||||||
|
include any whitespaces. </label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
|
||||||
<button id="add-role-btn" class="wr-btn">Update Role</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<button id="add-role-btn" class="wr-btn">Update Role</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="role-created-msg" class="container col-centered wr-content hidden">
|
</div>
|
||||||
<div class="wr-form">
|
<div id="role-created-msg" class="container col-centered wr-content hidden">
|
||||||
<p class="page-sub-title">Role was updated successfully.</p>
|
<div class="wr-form">
|
||||||
<br>Please click <b>"View Updated Role"</b>, if you wish to view the updated role or click
|
<p class="page-sub-title">Role was updated successfully.</p>
|
||||||
<b>"View Role List"</b> to complete the process and go back to the role list.
|
<br>Please click <b>"View Updated Role"</b>, if you wish to view the updated role or click
|
||||||
<hr />
|
<b>"View Role List"</b> to complete the process and go back to the role list.
|
||||||
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
|
<hr />
|
||||||
View Role List
|
<button class="wr-btn" onclick="window.location.href='{{@app.context}}/roles'">
|
||||||
</button>
|
View Role List
|
||||||
<a href="{{@app.context}}/roles/edit-role/{{role.roleName}}"
|
</button>
|
||||||
class="cu-btn-inner">
|
<a href="{{@app.context}}/roles/edit-role/{{role.roleName}}"
|
||||||
|
class="cu-btn-inner">
|
||||||
<span class="fw-stack">
|
<span class="fw-stack">
|
||||||
<i class="fw fw-ring fw-stack-2x"></i>
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
<i class="fw fw-add fw-stack-1x"></i>
|
<i class="fw fw-add fw-stack-1x"></i>
|
||||||
</span>
|
</span>
|
||||||
View Updated Role
|
View Updated Role
|
||||||
</a>
|
</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /content -->
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- /content -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /content/body -->
|
</div>
|
||||||
|
<!-- /content/body -->
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
{{js "js/bottomJs.js"}}
|
{{js "js/bottomJs.js"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
@ -1 +1,18 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "productName"}}CDMF BASE APP{{/zone}}
|
{{#zone "productName"}}CDMF BASE APP{{/zone}}
|
@ -1 +1,18 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "title"}}{{@unit.params.pageTitle}} | {{@app.conf.appName}}{{/zone}}
|
{{#zone "title"}}{{@unit.params.pageTitle}} | {{@app.conf.appName}}{{/zone}}
|
@ -1 +1,18 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{! This template won't be rendered. So nothing is here }}
|
{{! This template won't be rendered. So nothing is here }}
|
@ -1,3 +1,20 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "favicon"}}
|
{{#zone "favicon"}}
|
||||||
<link rel="shortcut icon" href="{{@unit.publicUri}}/img/favicon.png" />
|
<link rel="shortcut icon" href="{{@unit.publicUri}}/img/favicon.png" />
|
||||||
{{/zone}}
|
{{/zone}}
|
@ -1,3 +1,20 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "bottomJs"}}
|
{{#zone "bottomJs"}}
|
||||||
<!-- Jquery Resize JS -->
|
<!-- Jquery Resize JS -->
|
||||||
{{~js "jquery-resize_0.5.3/jquery.resize.js"}}
|
{{~js "jquery-resize_0.5.3/jquery.resize.js"}}
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
{{!
|
||||||
|
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.
|
||||||
|
}}
|
||||||
{{#zone "navbarCollapsableLeftItems"}}
|
{{#zone "navbarCollapsableLeftItems"}}
|
||||||
{{defineZone "navbarActions"}}
|
{{defineZone "navbarActions"}}
|
||||||
{{/zone}}
|
{{/zone}}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue