mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/wso2/carbon-device-mgt into apim
This commit is contained in:
commit
52388ed33d
@ -103,6 +103,10 @@
|
||||
<groupId>org.wso2.carbon.governance</groupId>
|
||||
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -150,6 +154,7 @@
|
||||
org.wso2.carbon.registry.core.*
|
||||
</Import-Package>
|
||||
<Embed-Dependency>
|
||||
javax.ws.rs-api,
|
||||
scribe;scope=compile|runtime;inline=false;
|
||||
</Embed-Dependency>
|
||||
<DynamicImport-Package>*</DynamicImport-Package>
|
||||
|
||||
@ -0,0 +1,209 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<artifactId>certificate-mgt</artifactId>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<version>1.1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.wso2.carbon.certificate.mgt.api</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<name>WSO2 Carbon - Mobile Device Management API</name>
|
||||
<description>WSO2 Carbon - Certificate Management API</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
|
||||
<warName>certificate-mgt</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>deploy</id>
|
||||
<build>
|
||||
<defaultGoal>compile</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
|
||||
overwrite="true">
|
||||
<fileset dir="${basedir}/target">
|
||||
<include name="certificate-mgt.war"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>client</id>
|
||||
<build>
|
||||
<defaultGoal>test</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec.wso2</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>jsr311-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.axis2.wso2</groupId>
|
||||
<artifactId>axis2-client</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.neethi.wso2</groupId>
|
||||
<artifactId>neethi</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-jaxrs</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
package org.wso2.carbon.certificate.mgt.jaxrs.api;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
public interface CertificateMgtService {
|
||||
|
||||
/**
|
||||
* Sign the client's certificate signing request and save it in the database.
|
||||
*
|
||||
* @param binarySecurityToken Base64 encoded Certificate signing request.
|
||||
* @return X509Certificate type sign certificate.
|
||||
*/
|
||||
@POST
|
||||
@Path("csr-sign")
|
||||
@Produces({MediaType.TEXT_PLAIN, MediaType.TEXT_PLAIN})
|
||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.TEXT_PLAIN})
|
||||
Response getSignedCertFromCSR(String binarySecurityToken);
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.api.common;
|
||||
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.ext.ExceptionMapper;
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
public class ErrorHandler implements ExceptionMapper<MDMAPIException> {
|
||||
|
||||
public Response toResponse(MDMAPIException exception) {
|
||||
ErrorMessage errorMessage = new ErrorMessage();
|
||||
errorMessage.setErrorMessage(exception.getErrorMessage());
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.api.common;
|
||||
|
||||
|
||||
public class ErrorMessage {
|
||||
|
||||
private String errorMessage;
|
||||
private String errorCode;
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrorCode(String errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.api.common;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.ext.MessageBodyReader;
|
||||
import javax.ws.rs.ext.MessageBodyWriter;
|
||||
import javax.ws.rs.ext.Provider;
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||
|
||||
@Provider
|
||||
@Produces(APPLICATION_JSON)
|
||||
@Consumes(APPLICATION_JSON)
|
||||
public class GsonMessageBodyHandler implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
|
||||
|
||||
private Gson gson;
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
|
||||
public boolean isReadable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private Gson getGson() {
|
||||
if (gson == null) {
|
||||
final GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gson = gsonBuilder.create();
|
||||
}
|
||||
return gson;
|
||||
}
|
||||
|
||||
public Object readFrom(Class<Object> objectClass, Type type, Annotation[] annotations, MediaType mediaType,
|
||||
MultivaluedMap<String, String> stringStringMultivaluedMap, InputStream entityStream)
|
||||
throws IOException, WebApplicationException {
|
||||
|
||||
InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8");
|
||||
|
||||
try {
|
||||
return getGson().fromJson(reader, type);
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWriteable(Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getSize(Object o, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void writeTo(Object object, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType,
|
||||
MultivaluedMap<String, Object> stringObjectMultivaluedMap, OutputStream entityStream)
|
||||
throws IOException, WebApplicationException {
|
||||
|
||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||
try {
|
||||
Type jsonType = null;
|
||||
if (type.equals(type)) {
|
||||
jsonType = type;
|
||||
}
|
||||
getGson().toJson(object, jsonType, writer);
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.api.common;
|
||||
|
||||
/**
|
||||
* Custom exception class for handling CDM API related exceptions.
|
||||
*/
|
||||
public class MDMAPIException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 7950151650447893900L;
|
||||
private String errorMessage;
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public MDMAPIException(String msg, Exception e) {
|
||||
super(msg, e);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
public MDMAPIException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
public MDMAPIException(String msg) {
|
||||
super(msg);
|
||||
setErrorMessage(msg);
|
||||
}
|
||||
|
||||
public MDMAPIException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MDMAPIException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package org.wso2.carbon.certificate.mgt.jaxrs.api.impl;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException;
|
||||
import org.wso2.carbon.certificate.mgt.core.impl.CertificateGenerator;
|
||||
import org.wso2.carbon.certificate.mgt.jaxrs.api.CertificateMgtService;
|
||||
import org.wso2.carbon.certificate.mgt.jaxrs.exception.Message;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
|
||||
public class CertificateMgtServiceImpl implements CertificateMgtService {
|
||||
private static Log log = LogFactory.getLog(CertificateMgtServiceImpl.class);
|
||||
|
||||
@POST
|
||||
@Path("signcsr")
|
||||
@Produces({MediaType.TEXT_PLAIN, MediaType.TEXT_PLAIN})
|
||||
@Consumes({MediaType.TEXT_PLAIN, MediaType.TEXT_PLAIN})
|
||||
public Response getSignedCertFromCSR(String binarySecurityToken) {
|
||||
Message message = new Message();
|
||||
X509Certificate signedCert;
|
||||
String singedCertificate;
|
||||
Base64 base64 = new Base64();
|
||||
CertificateGenerator certificateGenerator = new CertificateGenerator();
|
||||
try {
|
||||
if (certificateGenerator.getSignedCertificateFromCSR(binarySecurityToken) == null) {
|
||||
message.setErrorMessage("Error occurred while signing the CSR.");
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).
|
||||
entity(message).build();
|
||||
} else {
|
||||
signedCert = certificateGenerator.getSignedCertificateFromCSR(binarySecurityToken);
|
||||
singedCertificate = base64.encodeToString(signedCert.getEncoded());
|
||||
return Response.status(Response.Status.OK).entity(singedCertificate).build();
|
||||
}
|
||||
} catch (KeystoreException e) {
|
||||
String msg = "Error occurred while fetching certificate.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
} catch (CertificateEncodingException e) {
|
||||
String msg = "Error occurred while encoding the certificate.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.api.util;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class ResponsePayload {
|
||||
|
||||
private int statusCode;
|
||||
private String messageFromServer;
|
||||
private Object responseContent;
|
||||
|
||||
@XmlElement
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public void setStatusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public String getMessageFromServer() {
|
||||
return messageFromServer;
|
||||
}
|
||||
|
||||
public void setMessageFromServer(String messageFromServer) {
|
||||
this.messageFromServer = messageFromServer;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public Object getResponseContent() {
|
||||
return responseContent;
|
||||
}
|
||||
|
||||
public void setResponseContent(Object responseContent) {
|
||||
this.responseContent = responseContent;
|
||||
}
|
||||
|
||||
private ResponsePayloadBuilder getBuilder() {
|
||||
return new ResponsePayloadBuilder();
|
||||
}
|
||||
|
||||
public static ResponsePayloadBuilder statusCode(int statusCode) {
|
||||
ResponsePayload message = new ResponsePayload();
|
||||
return message.getBuilder().statusCode(statusCode);
|
||||
}
|
||||
|
||||
public static ResponsePayloadBuilder messageFromServer(String messageFromServer) {
|
||||
ResponsePayload message = new ResponsePayload();
|
||||
return message.getBuilder().messageFromServer(messageFromServer);
|
||||
}
|
||||
|
||||
public static ResponsePayloadBuilder responseContent(String responseContent) {
|
||||
ResponsePayload message = new ResponsePayload();
|
||||
return message.getBuilder().responseContent(responseContent);
|
||||
}
|
||||
|
||||
public class ResponsePayloadBuilder {
|
||||
|
||||
private int statusCode;
|
||||
private String messageFromServer;
|
||||
private Object responseContent;
|
||||
|
||||
public ResponsePayloadBuilder statusCode(int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResponsePayloadBuilder messageFromServer(String messageFromServer) {
|
||||
this.messageFromServer = messageFromServer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResponsePayloadBuilder responseContent(String responseContent) {
|
||||
this.responseContent = responseContent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResponsePayload build() {
|
||||
ResponsePayload payload = new ResponsePayload();
|
||||
payload.setStatusCode(statusCode);
|
||||
payload.setMessageFromServer(messageFromServer);
|
||||
payload.setResponseContent(responseContent);
|
||||
return payload;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.exception;
|
||||
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
public class BadRequestException extends WebApplicationException {
|
||||
|
||||
public BadRequestException(Message message, MediaType mediaType) {
|
||||
super(Response.status(Response.Status.BAD_REQUEST).entity(message).type(mediaType).build());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.certificate.mgt.jaxrs.exception;
|
||||
|
||||
public class Message {
|
||||
|
||||
private String errorMessage;
|
||||
private String discription;
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
public String getDiscription() {
|
||||
return discription;
|
||||
}
|
||||
|
||||
public void setDiscription(String discription) {
|
||||
this.discription = discription;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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 file contains the list of permissions that are associated with URL end points
|
||||
of the web app. Each permission should contain the name, permission path ,API path
|
||||
(URL) , HTTP method and OAUTH2 authorization scope (not-required).
|
||||
When defining dynamic paths for APIs, path variables are denoted by '*' notation.
|
||||
For ex:
|
||||
Actual API endpoint: devicemgt_admin/1.0.0/devices/{device-id}
|
||||
URL to be represented here: /devices/*
|
||||
NOTE: All the endpoints of the web app should be available in this file. Otherwise
|
||||
it will result 403 error at the runtime.
|
||||
-->
|
||||
<PermissionConfiguration>
|
||||
<APIVersion></APIVersion>
|
||||
<!-- Device related APIs -->
|
||||
<Permission>
|
||||
<name>get certificate in the database</name>
|
||||
<path>/device-mgt/emm-admin/certificate/GetSignCSR</path>
|
||||
<url>/certificates/signcsr</url>
|
||||
<method>POST</method>
|
||||
<scope>emm_admin</scope>
|
||||
</Permission>
|
||||
</PermissionConfiguration>
|
||||
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2015, 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 file defines class loading policy of the whole container. But this behaviour can be overridden by individual webapps by putting this file into the META-INF/ directory.
|
||||
-->
|
||||
<Classloading xmlns="http://wso2.org/projects/as/classloading">
|
||||
|
||||
<!-- Parent-first or child-first. Default behaviour is child-first.-->
|
||||
<ParentFirst>false</ParentFirst>
|
||||
|
||||
<!--
|
||||
Default environments that contains provides to all the webapps. This can be overridden by individual webapps by specifing required environments
|
||||
Tomcat environment is the default and every webapps gets it even if they didn't specify it.
|
||||
e.g. If a webapps requires CXF, they will get both Tomcat and CXF.
|
||||
-->
|
||||
<Environments>CXF,Carbon</Environments>
|
||||
</Classloading>
|
||||
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
||||
xmlns="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
|
||||
|
||||
<jaxrs:server id="services" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="swaggerResource"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<ref bean="jsonProvider"/>
|
||||
<ref bean="errorHandler"/>
|
||||
<ref bean="swaggerWriter"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
<jaxrs:server id="certificateService" address="/certificates">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="certificateServiceBean"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<ref bean="jsonProvider"/>
|
||||
<ref bean="errorHandler"/>
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
|
||||
<bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers"/>
|
||||
<bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource"/>
|
||||
|
||||
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
|
||||
<property name="resourcePackage" value="org.wso2.carbon.certificate.mgt.jaxrs"/>
|
||||
<property name="version" value="1.0.0"/>
|
||||
<property name="host" value="localhost:9443"/>
|
||||
<property name="basePath" value="/"/>
|
||||
<property name="title" value="Device Management Admin Service API Definitions"/>
|
||||
<property name="contact" value="dev@wso2.org"/>
|
||||
<property name="license" value="Apache 2.0"/>
|
||||
<property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
|
||||
<property name="scan" value="true"/>
|
||||
</bean>
|
||||
|
||||
<bean id="certificateServiceBean" class="org.wso2.carbon.certificate.mgt.jaxrs.api.impl.CertificateMgtServiceImpl"/>
|
||||
<bean id="jsonProvider" class="org.wso2.carbon.certificate.mgt.jaxrs.api.common.GsonMessageBodyHandler"/>
|
||||
<bean id="errorHandler" class="org.wso2.carbon.certificate.mgt.jaxrs.api.common.ErrorHandler"/>
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
|
||||
<display-name>Certificate-Webapp</display-name>
|
||||
<servlet>
|
||||
<description>JAX-WS/JAX-RS Certificate Management Endpoint</description>
|
||||
<display-name>JAX-WS/JAX-RS Servlet</display-name>
|
||||
<servlet-name>CXFServlet</servlet-name>
|
||||
<servlet-class>
|
||||
org.apache.cxf.transport.servlet.CXFServlet
|
||||
</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CXFServlet</servlet-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
<session-config>
|
||||
<session-timeout>60</session-timeout>
|
||||
</session-config>
|
||||
|
||||
<context-param>
|
||||
<param-name>isAdminService</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>doAuthentication</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
|
||||
<!--publish to apim-->
|
||||
<context-param>
|
||||
<param-name>managed-api-enabled</param-name>
|
||||
<param-value>true</param-value>
|
||||
</context-param>
|
||||
<context-param>
|
||||
<param-name>managed-api-owner</param-name>
|
||||
<param-value>admin</param-value>
|
||||
</context-param>
|
||||
|
||||
</web-app>
|
||||
@ -157,8 +157,6 @@
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||
@ -167,7 +165,6 @@
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
|
||||
<modules>
|
||||
<module>org.wso2.carbon.certificate.mgt.core</module>
|
||||
<module>org.wso2.carbon.certificate.mgt.api</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
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.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.util.List;
|
||||
@ -35,222 +35,227 @@ public interface GadgetDataService {
|
||||
|
||||
/**
|
||||
* This method is used to get a count of devices based on a defined filter set.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return An object of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @param extendedFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total device count in the system
|
||||
* wrapped by the defined return format.
|
||||
* @return An object of type DeviceCountByGroup.
|
||||
* @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
|
||||
* value of extendedFilterSet is set with some
|
||||
* value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get a count of devices non-compliant upon on a particular feature
|
||||
* and a defined filter set.
|
||||
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return An object of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
|
||||
* This can also occur if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @param featureCode Code name of the non-compliant feature.
|
||||
* @param basicFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total non-compliant device count in the system
|
||||
* for the given feature-code, wrapped by the defined return format.
|
||||
* @return An object of type DeviceCountByGroup.
|
||||
* @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
|
||||
throws InvalidFeatureCodeValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get total count of devices currently enrolled under a particular tenant.
|
||||
* @return An object of type DeviceCountByGroupEntry.
|
||||
* @return An object of type DeviceCountByGroup.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException;
|
||||
DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts classified by connectivity statuses.
|
||||
* @return A list of objects of type DeviceCountByGroupEntry.
|
||||
* @return A list of objects of type DeviceCountByGroup.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts classified by potential vulnerabilities.
|
||||
* @return A list of objects of type DeviceCountByGroupEntry.
|
||||
* @return A list of objects of type DeviceCountByGroup.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get non-compliant device counts classified by individual features.
|
||||
* @param startIndex Starting index of the data set to be retrieved.
|
||||
* @param resultCount Total count of the result set retrieved.
|
||||
* @return An object of type PaginationResult.
|
||||
* @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values
|
||||
* lesser than their minimums.
|
||||
* @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
|
||||
* @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts classified by platforms.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return An object of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if startIndex or resultCount is set to values
|
||||
* lesser than their minimums.
|
||||
* @param extendedFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total device counts per each platform in
|
||||
* the system, wrapped by the defined return format.
|
||||
* @return An object of type DeviceCountByGroup.
|
||||
* @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
|
||||
* value of extendedFilterSet is set with some
|
||||
* value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts non-compliant upon a particular feature classified by platforms.
|
||||
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @param featureCode Code name of the non-compliant feature.
|
||||
* @param basicFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total non-compliant device counts per each platform
|
||||
* in the system, wrapped by the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroup.
|
||||
* @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts classified by ownership types.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
|
||||
* This can also occur if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @param extendedFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total device counts per each ownership
|
||||
* type in the system, wrapped by the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroup.
|
||||
* @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
|
||||
* value of extendedFilterSet is set with some
|
||||
* value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get device counts non-compliant upon a particular feature classified by ownership types.
|
||||
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroupEntry.
|
||||
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* This method is used to get device counts non-compliant upon a particular feature
|
||||
* classified by ownership types.
|
||||
* @param featureCode Code name of the non-compliant feature.
|
||||
* @param basicFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total non-compliant device counts per each
|
||||
* ownership type in the system, wrapped by the defined return format.
|
||||
* @return A list of objects of type DeviceCountByGroup.
|
||||
* @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get a paginated list of devices with details, based on a defined filter set.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @param extendedFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined
|
||||
* filtering options, this method would return a paginated device list in the
|
||||
* system specified by result count, starting from specified start index, and
|
||||
* wrapped by the defined return format.
|
||||
* @param startIndex Starting index of the data set to be retrieved.
|
||||
* @param resultCount Total count of the result set retrieved.
|
||||
* @return An object of type PaginationResult.
|
||||
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
|
||||
* This can also occur if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
|
||||
* value of extendedFilterSet is set with some
|
||||
* value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
* @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
|
||||
* @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException;
|
||||
|
||||
/**
|
||||
* This method is used to get a paginated list of non-compliant devices with details, upon a particular feature.
|
||||
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* This method is used to get a paginated list of non-compliant devices with details,
|
||||
* upon a particular feature.
|
||||
* @param featureCode Code name of the non-compliant feature.
|
||||
* @param basicFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return a paginated device list in the system,
|
||||
* non-compliant by specified feature-code, result count, starting from specified
|
||||
* start index, and wrapped by the defined return format.
|
||||
* @param startIndex Starting index of the data set to be retrieved.
|
||||
* @param resultCount Total count of the result set retrieved.
|
||||
* @return An object of type PaginationResult.
|
||||
* @throws InvalidParameterValueException This can occur if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* This can also occur if startIndex or resultCount is set to values
|
||||
* lesser than their minimums.
|
||||
* @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
* @throws InvalidStartIndexValueException This can occur if startIndex value is lesser than its minimum (0).
|
||||
* @throws InvalidResultCountValueException This can occur if resultCount value is lesser than its minimum (5).
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
|
||||
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException;
|
||||
|
||||
/**
|
||||
* This method is used to get a list of devices with details, based on a defined filter set.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return A list of objects of type DetailedDeviceEntry.
|
||||
* @throws InvalidParameterValueException This can occur if nonCompliantFeatureCode is set to null or empty.
|
||||
* This can occur if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* This can also occur if startIndex or resultCount is set to values
|
||||
* lesser than their minimums.
|
||||
* @param extendedFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total device list in the system
|
||||
* wrapped by the defined return format.
|
||||
* @return A list of objects of type DeviceWithDetails.
|
||||
* @throws InvalidPotentialVulnerabilityValueException This can occur if potentialVulnerability
|
||||
* value of extendedFilterSet is set with some
|
||||
* value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException;
|
||||
|
||||
/**
|
||||
* This method is used to get a list of non-compliant devices with details, upon a particular feature.
|
||||
* @param nonCompliantFeatureCode Code name of the non-compliant feature.
|
||||
* @param filterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering options,
|
||||
* this method would return total device count in the system
|
||||
* wrapped with in the defined return format.
|
||||
* @return A list of objects of type DetailedDeviceEntry.
|
||||
* @throws InvalidParameterValueException This can occur if and only if potentialVulnerability value of filterSet
|
||||
* is set with some value other than "NON_COMPLIANT" or "UNMONITORED".
|
||||
* @param featureCode Code name of the non-compliant feature.
|
||||
* @param basicFilterSet An abstract representation of possible filtering options.
|
||||
* if this value is simply "null" or no values are set for the defined filtering
|
||||
* options, this method would return total set of non-compliant devices in the
|
||||
* system upon given feature-code, wrapped by the defined return format.
|
||||
* @return A list of objects of type DeviceWithDetails.
|
||||
* @throws InvalidFeatureCodeValueException This can occur if featureCode is set to null or empty.
|
||||
* @throws DataAccessLayerException This can occur due to errors connecting to database,
|
||||
* executing SQL query and retrieving data.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException;
|
||||
List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException;
|
||||
|
||||
}
|
||||
|
||||
@ -18,10 +18,9 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class FilterSet {
|
||||
public class BasicFilterSet {
|
||||
|
||||
private String connectivityStatus;
|
||||
private String potentialVulnerability;
|
||||
private String platform;
|
||||
private String ownership;
|
||||
|
||||
@ -33,14 +32,6 @@ public class FilterSet {
|
||||
this.connectivityStatus = connectivityStatus;
|
||||
}
|
||||
|
||||
public String getPotentialVulnerability() {
|
||||
return potentialVulnerability;
|
||||
}
|
||||
|
||||
public void setPotentialVulnerability(String potentialVulnerability) {
|
||||
this.potentialVulnerability = potentialVulnerability;
|
||||
}
|
||||
|
||||
public String getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class DeviceCountByGroupEntry {
|
||||
public class DeviceCountByGroup {
|
||||
|
||||
private String group;
|
||||
private String displayNameForGroup;
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.bean;
|
||||
|
||||
public class DetailedDeviceEntry {
|
||||
public class DeviceWithDetails {
|
||||
|
||||
private int deviceId;
|
||||
private String deviceIdentification;
|
||||
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.bean;
|
||||
|
||||
public class ExtendedFilterSet extends BasicFilterSet {
|
||||
|
||||
/*
|
||||
* Following property is an abstract filter, introduced @ service layer,
|
||||
* wrapping few (actual) low level database properties.
|
||||
*/
|
||||
private String potentialVulnerability;
|
||||
|
||||
public String getPotentialVulnerability() {
|
||||
return potentialVulnerability;
|
||||
}
|
||||
|
||||
public void setPotentialVulnerability(String potentialVulnerability) {
|
||||
this.potentialVulnerability = potentialVulnerability;
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,10 +19,12 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidFeatureCodeValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidPotentialVulnerabilityValueException;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
import java.sql.Connection;
|
||||
@ -37,40 +39,40 @@ import java.util.Map;
|
||||
public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceDAO {
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException {
|
||||
public DeviceCountByGroup getTotalDeviceCount() throws SQLException {
|
||||
int totalDeviceCount;
|
||||
try {
|
||||
totalDeviceCount = this.getFilteredDeviceCount(null);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
|
||||
deviceCountByGroupEntry.setGroup("total");
|
||||
deviceCountByGroupEntry.setDisplayNameForGroup("Total");
|
||||
deviceCountByGroupEntry.setDeviceCount(totalDeviceCount);
|
||||
DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
|
||||
deviceCountByGroup.setGroup("total");
|
||||
deviceCountByGroup.setDisplayNameForGroup("Total");
|
||||
deviceCountByGroup.setDeviceCount(totalDeviceCount);
|
||||
|
||||
return deviceCountByGroupEntry;
|
||||
return deviceCountByGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException {
|
||||
|
||||
int filteredDeviceCount = this.getFilteredDeviceCount(filterSet);
|
||||
int filteredDeviceCount = this.getFilteredDeviceCount(extendedFilterSet);
|
||||
|
||||
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
|
||||
deviceCountByGroupEntry.setGroup("filtered");
|
||||
deviceCountByGroupEntry.setDisplayNameForGroup("Filtered");
|
||||
deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount);
|
||||
DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
|
||||
deviceCountByGroup.setGroup("filtered");
|
||||
deviceCountByGroup.setDisplayNameForGroup("Filtered");
|
||||
deviceCountByGroup.setDeviceCount(filteredDeviceCount);
|
||||
|
||||
return deviceCountByGroupEntry;
|
||||
return deviceCountByGroup;
|
||||
}
|
||||
|
||||
private int getFilteredDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
private int getFilteredDeviceCount(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
@ -115,14 +117,14 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
@ -143,7 +145,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -165,21 +167,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
|
||||
DeviceCountByGroupEntry deviceCountByGroupEntry = new DeviceCountByGroupEntry();
|
||||
deviceCountByGroupEntry.setGroup("feature-non-compliant-and-filtered");
|
||||
deviceCountByGroupEntry.setDisplayNameForGroup("Feature-non-compliant-and-filtered");
|
||||
deviceCountByGroupEntry.setDeviceCount(filteredDeviceCount);
|
||||
DeviceCountByGroup deviceCountByGroup = new DeviceCountByGroup();
|
||||
deviceCountByGroup.setGroup("feature-non-compliant-and-filtered");
|
||||
deviceCountByGroup.setDisplayNameForGroup("Feature-non-compliant-and-filtered");
|
||||
deviceCountByGroup.setDeviceCount(filteredDeviceCount);
|
||||
|
||||
return deviceCountByGroupEntry;
|
||||
return deviceCountByGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws SQLException {
|
||||
public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws SQLException {
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses = new ArrayList<>();
|
||||
List<DeviceCountByGroup> deviceCountsByConnectivityStatuses = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql = "SELECT CONNECTIVITY_STATUS, COUNT(DEVICE_ID) AS DEVICE_COUNT FROM " +
|
||||
@ -191,9 +193,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry deviceCountByConnectivityStatus;
|
||||
DeviceCountByGroup deviceCountByConnectivityStatus;
|
||||
while (rs.next()) {
|
||||
deviceCountByConnectivityStatus = new DeviceCountByGroupEntry();
|
||||
deviceCountByConnectivityStatus = new DeviceCountByGroup();
|
||||
deviceCountByConnectivityStatus.setGroup(rs.getString("CONNECTIVITY_STATUS"));
|
||||
deviceCountByConnectivityStatus.setDisplayNameForGroup(rs.getString("CONNECTIVITY_STATUS"));
|
||||
deviceCountByConnectivityStatus.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -206,20 +208,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws SQLException {
|
||||
public List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws SQLException {
|
||||
// getting non-compliant device count
|
||||
DeviceCountByGroupEntry nonCompliantDeviceCount = new DeviceCountByGroupEntry();
|
||||
DeviceCountByGroup nonCompliantDeviceCount = new DeviceCountByGroup();
|
||||
nonCompliantDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
|
||||
nonCompliantDeviceCount.setDisplayNameForGroup("Non-compliant");
|
||||
nonCompliantDeviceCount.setDeviceCount(getNonCompliantDeviceCount());
|
||||
|
||||
// getting unmonitored device count
|
||||
DeviceCountByGroupEntry unmonitoredDeviceCount = new DeviceCountByGroupEntry();
|
||||
DeviceCountByGroup unmonitoredDeviceCount = new DeviceCountByGroup();
|
||||
unmonitoredDeviceCount.setGroup(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
|
||||
unmonitoredDeviceCount.setDisplayNameForGroup("Unmonitored");
|
||||
unmonitoredDeviceCount.setDeviceCount(getUnmonitoredDeviceCount());
|
||||
|
||||
List<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities = new ArrayList<>();
|
||||
List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities = new ArrayList<>();
|
||||
deviceCountsByPotentialVulnerabilities.add(nonCompliantDeviceCount);
|
||||
deviceCountsByPotentialVulnerabilities.add(unmonitoredDeviceCount);
|
||||
|
||||
@ -227,36 +229,38 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
private int getNonCompliantDeviceCount() throws SQLException {
|
||||
FilterSet filterSet = new FilterSet();
|
||||
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT);
|
||||
ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
|
||||
extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
|
||||
PotentialVulnerability.NON_COMPLIANT);
|
||||
try {
|
||||
return this.getFilteredDeviceCount(filterSet);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
return this.getFilteredDeviceCount(extendedFilterSet);
|
||||
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
private int getUnmonitoredDeviceCount() throws SQLException {
|
||||
FilterSet filterSet = new FilterSet();
|
||||
filterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED);
|
||||
ExtendedFilterSet extendedFilterSet = new ExtendedFilterSet();
|
||||
extendedFilterSet.setPotentialVulnerability(GadgetDataServiceDAOConstants.
|
||||
PotentialVulnerability.UNMONITORED);
|
||||
try {
|
||||
return this.getFilteredDeviceCount(filterSet);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
return this.getFilteredDeviceCount(extendedFilterSet);
|
||||
} catch (InvalidPotentialVulnerabilityValueException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql, advancedSqlFiltering = "";
|
||||
@ -286,9 +290,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredDeviceCountByPlatform;
|
||||
DeviceCountByGroup filteredDeviceCountByPlatform;
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountByPlatform = new DeviceCountByGroupEntry();
|
||||
filteredDeviceCountByPlatform = new DeviceCountByGroup();
|
||||
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
|
||||
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
|
||||
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -301,21 +305,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry>
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceCountByGroup>
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredDeviceCountsByPlatforms = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredDeviceCountsByPlatforms = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql, advancedSqlFiltering = "";
|
||||
@ -332,7 +336,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -347,9 +351,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredDeviceCountByPlatform;
|
||||
DeviceCountByGroup filteredDeviceCountByPlatform;
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountByPlatform = new DeviceCountByGroupEntry();
|
||||
filteredDeviceCountByPlatform = new DeviceCountByGroup();
|
||||
filteredDeviceCountByPlatform.setGroup(rs.getString("PLATFORM"));
|
||||
filteredDeviceCountByPlatform.setDisplayNameForGroup(rs.getString("PLATFORM").toUpperCase());
|
||||
filteredDeviceCountByPlatform.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -362,16 +366,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql, advancedSqlFiltering = "";
|
||||
@ -402,9 +406,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredDeviceCountByOwnershipType;
|
||||
DeviceCountByGroup filteredDeviceCountByOwnershipType;
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry();
|
||||
filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
|
||||
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
|
||||
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
|
||||
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -417,21 +421,21 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry>
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceCountByGroup>
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredDeviceCountsByOwnershipTypes = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql, advancedSqlFiltering = "";
|
||||
@ -448,7 +452,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -463,9 +467,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredDeviceCountByOwnershipType;
|
||||
DeviceCountByGroup filteredDeviceCountByOwnershipType;
|
||||
while (rs.next()) {
|
||||
filteredDeviceCountByOwnershipType = new DeviceCountByGroupEntry();
|
||||
filteredDeviceCountByOwnershipType = new DeviceCountByGroup();
|
||||
filteredDeviceCountByOwnershipType.setGroup(rs.getString("OWNERSHIP"));
|
||||
filteredDeviceCountByOwnershipType.setDisplayNameForGroup(rs.getString("OWNERSHIP"));
|
||||
filteredDeviceCountByOwnershipType.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -478,16 +482,16 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException {
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql;
|
||||
@ -517,9 +521,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -534,20 +538,20 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException {
|
||||
public List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
try {
|
||||
con = this.getConnection();
|
||||
String sql;
|
||||
@ -564,7 +568,7 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -579,9 +583,9 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -595,46 +599,56 @@ public abstract class AbstractGadgetDataServiceDAO implements GadgetDataServiceD
|
||||
return filteredDevicesWithDetails;
|
||||
}
|
||||
|
||||
protected Map<String, Object> extractDatabaseFiltersFromBean(FilterSet filterSet)
|
||||
throws InvalidParameterValueException {
|
||||
if (filterSet == null) {
|
||||
protected Map<String, Object> extractDatabaseFiltersFromBean(BasicFilterSet basicFilterSet) {
|
||||
if (basicFilterSet == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, Object> filters = new LinkedHashMap<>();
|
||||
|
||||
String connectivityStatus = filterSet.getConnectivityStatus();
|
||||
if (connectivityStatus != null) {
|
||||
String connectivityStatus = basicFilterSet.getConnectivityStatus();
|
||||
if (connectivityStatus != null && !connectivityStatus.isEmpty()) {
|
||||
filters.put("CONNECTIVITY_STATUS", connectivityStatus);
|
||||
}
|
||||
|
||||
String potentialVulnerability = filterSet.getPotentialVulnerability();
|
||||
if (potentialVulnerability != null) {
|
||||
String platform = basicFilterSet.getPlatform();
|
||||
if (platform != null && !platform.isEmpty()) {
|
||||
filters.put("PLATFORM", platform);
|
||||
}
|
||||
|
||||
String ownership = basicFilterSet.getOwnership();
|
||||
if (ownership != null && !ownership.isEmpty()) {
|
||||
filters.put("OWNERSHIP", ownership);
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected Map<String, Object> extractDatabaseFiltersFromBean(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException {
|
||||
if (extendedFilterSet == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean((BasicFilterSet) extendedFilterSet);
|
||||
|
||||
String potentialVulnerability = extendedFilterSet.getPotentialVulnerability();
|
||||
if (potentialVulnerability != null && !potentialVulnerability.isEmpty()) {
|
||||
if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.equals(potentialVulnerability) ||
|
||||
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) {
|
||||
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED.equals(potentialVulnerability)) {
|
||||
if (GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT.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 either " +
|
||||
throw new InvalidPotentialVulnerabilityValueException("Invalid use of value for potential " +
|
||||
"vulnerability. Value of potential vulnerability could only be either " +
|
||||
GadgetDataServiceDAOConstants.PotentialVulnerability.NON_COMPLIANT + " or " +
|
||||
GadgetDataServiceDAOConstants.PotentialVulnerability.UNMONITORED + ".");
|
||||
}
|
||||
}
|
||||
|
||||
String platform = filterSet.getPlatform();
|
||||
if (platform != null) {
|
||||
filters.put("PLATFORM", platform);
|
||||
}
|
||||
|
||||
String ownership = filterSet.getOwnership();
|
||||
if (ownership != null) {
|
||||
filters.put("OWNERSHIP", ownership);
|
||||
}
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
||||
@ -18,10 +18,11 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
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 java.sql.SQLException;
|
||||
@ -29,44 +30,45 @@ import java.util.List;
|
||||
|
||||
public interface GadgetDataServiceDAO {
|
||||
|
||||
DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException;
|
||||
|
||||
DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode, FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
|
||||
throws InvalidFeatureCodeValueException, SQLException;
|
||||
|
||||
DeviceCountByGroupEntry getTotalDeviceCount() throws SQLException;
|
||||
DeviceCountByGroup getTotalDeviceCount() throws SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws SQLException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws SQLException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws SQLException;
|
||||
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount) throws
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException;
|
||||
|
||||
List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
|
||||
|
||||
PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
|
||||
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
|
||||
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException;
|
||||
|
||||
List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, SQLException;
|
||||
|
||||
List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, SQLException;
|
||||
List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException, SQLException;
|
||||
|
||||
}
|
||||
|
||||
@ -19,12 +19,13 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -40,15 +41,15 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -71,9 +72,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
|
||||
DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
|
||||
while (rs.next()) {
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
|
||||
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -103,26 +104,27 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex,
|
||||
int resultCount) throws InvalidPotentialVulnerabilityValueException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -159,9 +161,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -193,31 +195,32 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -236,7 +239,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -256,9 +259,9 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -273,7 +276,7 @@ public class GenericGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDA
|
||||
|
||||
stmt = con.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
@ -19,12 +19,13 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -40,15 +41,15 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -71,9 +72,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
|
||||
DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
|
||||
while (rs.next()) {
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
|
||||
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -103,26 +104,29 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException,
|
||||
InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException,
|
||||
SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -159,9 +163,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -193,31 +197,32 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidFeatureCodeValueException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -236,7 +241,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -256,9 +261,9 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -273,7 +278,7 @@ public class MSSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
stmt = con.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
@ -19,12 +19,13 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -40,15 +41,15 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -73,9 +74,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
|
||||
DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
|
||||
while (rs.next()) {
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
|
||||
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -105,26 +106,27 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -163,9 +165,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -197,31 +199,31 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
|
||||
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -240,7 +242,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -260,9 +262,9 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -277,7 +279,7 @@ public class OracleGadgetDataServiceDAOImpl extends AbstractGadgetDataServiceDAO
|
||||
|
||||
stmt = con.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
@ -19,12 +19,13 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.dao.impl;
|
||||
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceWithDetails;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroup;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.ExtendedFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.AbstractGadgetDataServiceDAO;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.dao.GadgetDataServiceDAOConstants;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||
|
||||
@ -40,15 +41,15 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
throws InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DeviceCountByGroupEntry> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
List<DeviceCountByGroup> filteredNonCompliantDeviceCountsByFeatures = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -72,9 +73,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DeviceCountByGroupEntry filteredNonCompliantDeviceCountByFeature;
|
||||
DeviceCountByGroup filteredNonCompliantDeviceCountByFeature;
|
||||
while (rs.next()) {
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroupEntry();
|
||||
filteredNonCompliantDeviceCountByFeature = new DeviceCountByGroup();
|
||||
filteredNonCompliantDeviceCountByFeature.setGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDisplayNameForGroup(rs.getString("FEATURE_CODE"));
|
||||
filteredNonCompliantDeviceCountByFeature.setDeviceCount(rs.getInt("DEVICE_COUNT"));
|
||||
@ -104,26 +105,27 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(extendedFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -161,9 +163,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -195,31 +197,31 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, SQLException {
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
|
||||
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException, SQLException {
|
||||
|
||||
if (nonCompliantFeatureCode == null || nonCompliantFeatureCode.isEmpty()) {
|
||||
throw new InvalidParameterValueException("Non-compliant feature code should not be either null or empty.");
|
||||
if (featureCode == null || featureCode.isEmpty()) {
|
||||
throw new InvalidFeatureCodeValueException("Feature code should not be either null or empty.");
|
||||
}
|
||||
|
||||
if (startIndex < GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX) {
|
||||
throw new InvalidParameterValueException("Start index should be equal to " +
|
||||
throw new InvalidStartIndexValueException("Start index should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_START_INDEX + " or greater than that.");
|
||||
}
|
||||
|
||||
if (resultCount < GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT) {
|
||||
throw new InvalidParameterValueException("Result count should be equal to " +
|
||||
throw new InvalidResultCountValueException("Result count should be equal to " +
|
||||
GadgetDataServiceDAOConstants.Pagination.MIN_RESULT_COUNT + " or greater than that.");
|
||||
}
|
||||
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(filterSet);
|
||||
Map<String, Object> filters = this.extractDatabaseFiltersFromBean(basicFilterSet);
|
||||
|
||||
Connection con;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
List<DetailedDeviceEntry> filteredDevicesWithDetails = new ArrayList<>();
|
||||
List<DeviceWithDetails> filteredDevicesWithDetails = new ArrayList<>();
|
||||
int totalRecordsCount = 0;
|
||||
try {
|
||||
con = this.getConnection();
|
||||
@ -238,7 +240,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
stmt = con.prepareStatement(sql);
|
||||
// [2] appending filter column values, if exist
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
if (filters != null && filters.values().size() > 0) {
|
||||
int i = 3;
|
||||
for (Object value : filters.values()) {
|
||||
@ -258,9 +260,9 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
// fetching query results
|
||||
DetailedDeviceEntry filteredDeviceWithDetails;
|
||||
DeviceWithDetails filteredDeviceWithDetails;
|
||||
while (rs.next()) {
|
||||
filteredDeviceWithDetails = new DetailedDeviceEntry();
|
||||
filteredDeviceWithDetails = new DeviceWithDetails();
|
||||
filteredDeviceWithDetails.setDeviceId(rs.getInt("DEVICE_ID"));
|
||||
filteredDeviceWithDetails.setDeviceIdentification(rs.getString("DEVICE_IDENTIFICATION"));
|
||||
filteredDeviceWithDetails.setPlatform(rs.getString("PLATFORM"));
|
||||
@ -275,7 +277,7 @@ public class PostgreSQLGadgetDataServiceDAOImpl extends AbstractGadgetDataServic
|
||||
|
||||
stmt = con.prepareStatement(sql);
|
||||
stmt.setInt(1, tenantId);
|
||||
stmt.setString(2, nonCompliantFeatureCode);
|
||||
stmt.setString(2, featureCode);
|
||||
|
||||
// executing query
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for catching invalid parameter values,
|
||||
* relevant to Gadget Data Service DAO layer.
|
||||
*/
|
||||
public class InvalidFeatureCodeValueException extends Exception {
|
||||
|
||||
private String errorMessage;
|
||||
private static final long serialVersionUID = 2021891706072918864L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and nested exception.
|
||||
* @param errorMessage specific error message.
|
||||
* @param nestedException Nested exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidFeatureCodeValueException(String errorMessage, Exception nestedException) {
|
||||
super(errorMessage, nestedException);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param errorMessage Specific error message.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidFeatureCodeValueException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message.
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
public InvalidFeatureCodeValueException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidFeatureCodeValueException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for catching invalid parameter values,
|
||||
* relevant to Gadget Data Service DAO layer.
|
||||
*/
|
||||
public class InvalidPotentialVulnerabilityValueException extends Exception {
|
||||
|
||||
private String errorMessage;
|
||||
private static final long serialVersionUID = 2021891706072918864L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and nested exception.
|
||||
* @param errorMessage specific error message.
|
||||
* @param nestedException Nested exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidPotentialVulnerabilityValueException(String errorMessage, Exception nestedException) {
|
||||
super(errorMessage, nestedException);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param errorMessage Specific error message.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidPotentialVulnerabilityValueException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message.
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
public InvalidPotentialVulnerabilityValueException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidPotentialVulnerabilityValueException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for catching invalid parameter values,
|
||||
* relevant to Gadget Data Service DAO layer.
|
||||
*/
|
||||
public class InvalidResultCountValueException extends Exception {
|
||||
|
||||
private String errorMessage;
|
||||
private static final long serialVersionUID = 2021891706072918864L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and nested exception.
|
||||
* @param errorMessage specific error message.
|
||||
* @param nestedException Nested exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidResultCountValueException(String errorMessage, Exception nestedException) {
|
||||
super(errorMessage, nestedException);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param errorMessage Specific error message.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidResultCountValueException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message.
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
public InvalidResultCountValueException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specific error message and cause.
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidResultCountValueException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.errorMessage = errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
package org.wso2.carbon.device.mgt.analytics.dashboard.exception;
|
||||
|
||||
/**
|
||||
* Custom exception class for catching invalid parameter issues,
|
||||
* Custom exception class for catching invalid parameter values,
|
||||
* relevant to Gadget Data Service DAO layer.
|
||||
*/
|
||||
public class InvalidParameterValueException extends Exception {
|
||||
public class InvalidStartIndexValueException extends Exception {
|
||||
|
||||
private String errorMessage;
|
||||
private static final long serialVersionUID = 2021891706072918864L;
|
||||
@ -33,7 +33,7 @@ public class InvalidParameterValueException extends Exception {
|
||||
* @param nestedException Nested exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidParameterValueException(String errorMessage, Exception nestedException) {
|
||||
public InvalidStartIndexValueException(String errorMessage, Exception nestedException) {
|
||||
super(errorMessage, nestedException);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class InvalidParameterValueException extends Exception {
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidParameterValueException(String errorMessage, Throwable cause) {
|
||||
public InvalidStartIndexValueException(String errorMessage, Throwable cause) {
|
||||
super(errorMessage, cause);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
@ -53,7 +53,7 @@ public class InvalidParameterValueException extends Exception {
|
||||
* Constructs a new exception with the specific error message.
|
||||
* @param errorMessage Specific error message.
|
||||
*/
|
||||
public InvalidParameterValueException(String errorMessage) {
|
||||
public InvalidStartIndexValueException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
setErrorMessage(errorMessage);
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class InvalidParameterValueException extends Exception {
|
||||
* @param cause Cause of this exception.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public InvalidParameterValueException(Throwable cause) {
|
||||
public InvalidStartIndexValueException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@ -77,3 +77,4 @@ public class InvalidParameterValueException extends Exception {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -19,12 +19,12 @@
|
||||
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.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.dao.GadgetDataServiceDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DetailedDeviceEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.DeviceCountByGroupEntry;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.FilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.DataAccessLayerException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.InvalidParameterValueException;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.bean.BasicFilterSet;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.exception.*;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -36,12 +36,13 @@ import java.util.List;
|
||||
public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getDeviceCount(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
DeviceCountByGroupEntry filteredDeviceCount;
|
||||
public DeviceCountByGroup getDeviceCount(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
|
||||
DeviceCountByGroup filteredDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getDeviceCount(filterSet);
|
||||
filteredDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCount(extendedFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -52,13 +53,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getFeatureNonCompliantDeviceCount(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
DeviceCountByGroupEntry featureNonCompliantDeviceCount;
|
||||
public DeviceCountByGroup getFeatureNonCompliantDeviceCount(String featureCode, BasicFilterSet basicFilterSet)
|
||||
throws InvalidFeatureCodeValueException, DataAccessLayerException {
|
||||
DeviceCountByGroup featureNonCompliantDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCount = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(nonCompliantFeatureCode, filterSet);
|
||||
getGadgetDataServiceDAO().getFeatureNonCompliantDeviceCount(featureCode, basicFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -69,8 +70,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceCountByGroupEntry getTotalDeviceCount() throws DataAccessLayerException {
|
||||
DeviceCountByGroupEntry totalDeviceCount;
|
||||
public DeviceCountByGroup getTotalDeviceCount() throws DataAccessLayerException {
|
||||
DeviceCountByGroup totalDeviceCount;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
totalDeviceCount = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().getTotalDeviceCount();
|
||||
@ -84,8 +85,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> deviceCountsByConnectivityStatuses;
|
||||
public List<DeviceCountByGroup> getDeviceCountsByConnectivityStatuses() throws DataAccessLayerException {
|
||||
List<DeviceCountByGroup> deviceCountsByConnectivityStatuses;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByConnectivityStatuses = GadgetDataServiceDAOFactory.
|
||||
@ -100,8 +101,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> deviceCountsByPotentialVulnerabilities;
|
||||
public List<DeviceCountByGroup> getDeviceCountsByPotentialVulnerabilities() throws DataAccessLayerException {
|
||||
List<DeviceCountByGroup> deviceCountsByPotentialVulnerabilities;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByPotentialVulnerabilities = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
@ -117,7 +118,8 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
|
||||
@Override
|
||||
public PaginationResult getNonCompliantDeviceCountsByFeatures(int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
throws InvalidStartIndexValueException, InvalidResultCountValueException,
|
||||
DataAccessLayerException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
@ -133,13 +135,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByPlatforms(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> deviceCountsByPlatforms;
|
||||
public List<DeviceCountByGroup> getDeviceCountsByPlatforms(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroup> deviceCountsByPlatforms;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByPlatforms(filterSet);
|
||||
getDeviceCountsByPlatforms(extendedFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -150,13 +152,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getFeatureNonCompliantDeviceCountsByPlatforms(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByPlatforms;
|
||||
public List<DeviceCountByGroup> getFeatureNonCompliantDeviceCountsByPlatforms(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException {
|
||||
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByPlatforms;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCountsByPlatforms = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(nonCompliantFeatureCode, filterSet);
|
||||
getFeatureNonCompliantDeviceCountsByPlatforms(featureCode, basicFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -167,13 +170,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry> getDeviceCountsByOwnershipTypes(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> deviceCountsByOwnershipTypes;
|
||||
public List<DeviceCountByGroup> getDeviceCountsByOwnershipTypes(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException,
|
||||
DataAccessLayerException {
|
||||
List<DeviceCountByGroup> deviceCountsByOwnershipTypes;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
deviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDeviceCountsByOwnershipTypes(filterSet);
|
||||
getDeviceCountsByOwnershipTypes(extendedFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -184,14 +188,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceCountByGroupEntry>
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroupEntry> featureNonCompliantDeviceCountsByOwnershipTypes;
|
||||
public List<DeviceCountByGroup>
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(String featureCode, BasicFilterSet basicFilterSet)
|
||||
throws InvalidFeatureCodeValueException, DataAccessLayerException {
|
||||
List<DeviceCountByGroup> featureNonCompliantDeviceCountsByOwnershipTypes;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDeviceCountsByOwnershipTypes = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(nonCompliantFeatureCode, filterSet);
|
||||
getFeatureNonCompliantDeviceCountsByOwnershipTypes(featureCode, basicFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -202,13 +206,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getDevicesWithDetails(FilterSet filterSet,
|
||||
int startIndex, int resultCount) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
public PaginationResult getDevicesWithDetails(ExtendedFilterSet extendedFilterSet, int startIndex, int resultCount)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException,
|
||||
InvalidStartIndexValueException, InvalidResultCountValueException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getDevicesWithDetails(filterSet, startIndex, resultCount);
|
||||
getDevicesWithDetails(extendedFilterSet, startIndex, resultCount);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -219,14 +224,15 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet, int startIndex, int resultCount)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
public PaginationResult getFeatureNonCompliantDevicesWithDetails(String featureCode, BasicFilterSet basicFilterSet,
|
||||
int startIndex, int resultCount) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException, InvalidStartIndexValueException,
|
||||
InvalidResultCountValueException {
|
||||
PaginationResult paginationResult;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
paginationResult = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet, startIndex, resultCount);
|
||||
getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet, startIndex, resultCount);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -237,13 +243,13 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getDevicesWithDetails(FilterSet filterSet)
|
||||
throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DetailedDeviceEntry> devicesWithDetails;
|
||||
public List<DeviceWithDetails> getDevicesWithDetails(ExtendedFilterSet extendedFilterSet)
|
||||
throws InvalidPotentialVulnerabilityValueException, DataAccessLayerException {
|
||||
List<DeviceWithDetails> devicesWithDetails;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
devicesWithDetails = GadgetDataServiceDAOFactory.
|
||||
getGadgetDataServiceDAO().getDevicesWithDetails(filterSet);
|
||||
getGadgetDataServiceDAO().getDevicesWithDetails(extendedFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
@ -254,13 +260,14 @@ public class GadgetDataServiceImpl implements GadgetDataService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailedDeviceEntry> getFeatureNonCompliantDevicesWithDetails(String nonCompliantFeatureCode,
|
||||
FilterSet filterSet) throws InvalidParameterValueException, DataAccessLayerException {
|
||||
List<DetailedDeviceEntry> featureNonCompliantDevicesWithDetails;
|
||||
public List<DeviceWithDetails> getFeatureNonCompliantDevicesWithDetails(String featureCode,
|
||||
BasicFilterSet basicFilterSet) throws InvalidFeatureCodeValueException,
|
||||
DataAccessLayerException {
|
||||
List<DeviceWithDetails> featureNonCompliantDevicesWithDetails;
|
||||
try {
|
||||
GadgetDataServiceDAOFactory.openConnection();
|
||||
featureNonCompliantDevicesWithDetails = GadgetDataServiceDAOFactory.getGadgetDataServiceDAO().
|
||||
getFeatureNonCompliantDevicesWithDetails(nonCompliantFeatureCode, filterSet);
|
||||
getFeatureNonCompliantDevicesWithDetails(featureCode, basicFilterSet);
|
||||
} catch (SQLException e) {
|
||||
throw new DataAccessLayerException("Error in either opening a database connection or " +
|
||||
"accessing the database to fetch corresponding results.", e);
|
||||
|
||||
@ -238,6 +238,11 @@
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -52,7 +52,6 @@ public interface Certificate {
|
||||
* @return Status of the data persist operation.
|
||||
*/
|
||||
@POST
|
||||
@Path("saveCertificate")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
package org.wso2.carbon.device.mgt.jaxrs.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);
|
||||
}
|
||||
@ -24,7 +24,9 @@ import org.wso2.carbon.device.mgt.common.device.details.DeviceWrapper;
|
||||
import org.wso2.carbon.device.mgt.common.search.SearchContext;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
@ -50,8 +52,25 @@ public interface DeviceSearch {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "OK", response = DeviceWrapper.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 500, message = "Error occurred while searching the device information")
|
||||
})
|
||||
})
|
||||
@Permission(scope = "device-search", permissions = {"/permission/admin/device-mgt/admin/devices/list"})
|
||||
Response getFilteredDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions",
|
||||
required = true) SearchContext searchContext);
|
||||
Response getDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions",
|
||||
required = true) SearchContext searchContext);
|
||||
|
||||
@GET
|
||||
@Path("after/{time}")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "Get devices information since a specified time.",
|
||||
notes = "Get devices information of devices updated since a specified time.",
|
||||
response = DeviceWrapper.class,
|
||||
responseContainer = "List")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "OK", response = DeviceWrapper.class, responseContainer = "List"),
|
||||
@ApiResponse(code = 500, message = "Error occurred while fetching the device information")
|
||||
})
|
||||
@Permission(scope = "device-search", permissions = {"/permission/admin/device-mgt/admin/devices/update-since-list"})
|
||||
Response getUpdatedDevices(@ApiParam(name = "time", value = "Time since the updated devices should be " +
|
||||
"fetched.", required = true)@PathParam("time") String time);
|
||||
}
|
||||
|
||||
@ -180,14 +180,13 @@ public interface Operation {
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||
httpMethod = "POST",
|
||||
httpMethod = "GET",
|
||||
value = "Retrieving the operation details.",
|
||||
notes = "This will return the operation details including the responses from the devices")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "Activity details provided successfully.."),
|
||||
@ApiResponse(code = 500, message = "Error occurred while fetching the activity for the supplied id.")})
|
||||
@Permission(scope = "operation-view", permissions = {"/permission/admin/device-mgt/admin/devices/view"})
|
||||
Response getActivity(
|
||||
@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
|
||||
Response getActivity(@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
|
||||
required = true) @PathParam("id") String id)
|
||||
throws MDMAPIException;
|
||||
|
||||
|
||||
@ -280,4 +280,9 @@ public interface Policy {
|
||||
required = true) @PathParam("type") String type,
|
||||
@ApiParam(name = "id", value = "Define the device ID as the value for {id}.",
|
||||
required = true) @PathParam("id") String id);
|
||||
|
||||
//TODO: This API is still not in use, but will be needed when grouping is implemented.
|
||||
@GET
|
||||
@Path("/device-group/{user}")
|
||||
public Response getDeviceGroupsRelatedToPolicies(@PathParam("user") String userName);
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.DeviceMgtAPIUtils;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.beans.EnrollmentCertificate;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.exception.BadRequestException;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.exception.Message;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
@ -65,7 +66,6 @@ public class CertificateImpl implements Certificate {
|
||||
* @return Status of the data persist operation.
|
||||
*/
|
||||
@POST
|
||||
@Path("saveCertificate")
|
||||
public Response saveCertificate(@HeaderParam("Accept") String acceptHeader,
|
||||
EnrollmentCertificate[] enrollmentCertificates) {
|
||||
MediaType responseMediaType = DeviceMgtAPIUtils.getResponseMediaType(acceptHeader);
|
||||
@ -111,14 +111,11 @@ public class CertificateImpl implements Certificate {
|
||||
}
|
||||
|
||||
CertificateManagementService certificateService = DeviceMgtAPIUtils.getCertificateManagementService();
|
||||
CertificateResponse certificateResponse;
|
||||
List<CertificateResponse> certificateResponse;
|
||||
try {
|
||||
certificateResponse = certificateService.getCertificateBySerial(serialNumber);
|
||||
if(certificateResponse != null) {
|
||||
certificateResponse.setCertificate(null); //avoid sending byte array in response.
|
||||
}
|
||||
certificateResponse = certificateService.searchCertificates(serialNumber);
|
||||
return Response.status(Response.Status.OK).entity(certificateResponse).type(responseMediaType).build();
|
||||
} catch (KeystoreException e) {
|
||||
} catch (CertificateManagementDAOException e) {
|
||||
String msg = "Error occurred while converting PEM file to X509Certificate";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).type(responseMediaType).build();
|
||||
@ -164,6 +161,28 @@ public class CertificateImpl implements Certificate {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all certificates
|
||||
*
|
||||
* @return certificate details in an array.
|
||||
* @throws MDMAPIException
|
||||
*/
|
||||
@GET
|
||||
public Response getAllCertificates(@HeaderParam("Accept") String acceptHeader)
|
||||
throws MDMAPIException {
|
||||
MediaType responseMediaType = DeviceMgtAPIUtils.getResponseMediaType(acceptHeader);
|
||||
|
||||
CertificateManagementService certificateService = DeviceMgtAPIUtils.getCertificateManagementService();
|
||||
try {
|
||||
List<CertificateResponse> certificates = certificateService.getCertificates();
|
||||
return Response.status(Response.Status.OK).entity(certificates).type(responseMediaType).build();
|
||||
} catch (CertificateManagementDAOException e) {
|
||||
String msg = "Error occurred while fetching all certificates.";
|
||||
log.error(msg, e);
|
||||
throw new MDMAPIException(msg, e);
|
||||
}
|
||||
}
|
||||
|
||||
@DELETE
|
||||
@Path("{serialNumber}")
|
||||
public Response removeCertificate(@HeaderParam("Accept") String acceptHeader,
|
||||
|
||||
@ -0,0 +1,687 @@
|
||||
/*
|
||||
* 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.api;
|
||||
|
||||
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.api.util.DeviceMgtAPIUtils;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardGadgetDataWrapper;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.beans.DashboardPaginationGadgetDataWrapper;
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.jaxrs.api.impl;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceWrapper;
|
||||
@ -29,16 +30,22 @@ import org.wso2.carbon.device.mgt.jaxrs.api.DeviceSearch;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.DeviceMgtAPIUtils;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
@Path("/search")
|
||||
@Api(value = "DeviceSearch", description = "Device searching related operations can be found here.")
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
public class DeviceSearchImpl implements DeviceSearch {
|
||||
|
||||
private static Log log = LogFactory.getLog(DeviceSearchImpl.class);
|
||||
|
||||
@GET
|
||||
public Response getFilteredDeviceInfo(SearchContext searchContext) {
|
||||
public Response getDeviceInfo(SearchContext searchContext) {
|
||||
|
||||
SearchManagerService searchManagerService;
|
||||
List<DeviceWrapper> devices;
|
||||
try {
|
||||
@ -52,5 +59,25 @@ public class DeviceSearchImpl implements DeviceSearch {
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(devices).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("after/{time}")
|
||||
public Response getUpdatedDevices(@PathParam("time") String time){
|
||||
|
||||
SearchManagerService searchManagerService;
|
||||
List<DeviceWrapper> devices;
|
||||
try {
|
||||
searchManagerService = DeviceMgtAPIUtils.getSearchManagerService();
|
||||
devices = searchManagerService.getUpdated(Long.parseLong(time));
|
||||
|
||||
} catch (SearchMgtException e) {
|
||||
String msg = "Error occurred while retrieving the updated device information after the given time.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(devices).build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.jaxrs.api.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.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.context.DeviceOperationContext;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.MDMIOSOperationUtil;
|
||||
@ -135,12 +136,12 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
if (deviceIdentifiers.size() > 0) {
|
||||
type = deviceIdentifiers.get(0).getType();
|
||||
}
|
||||
int operationId = dmService.addOperation(type, operationContext.getOperation(), operationContext.getDevices());
|
||||
if (operationId > 0) {
|
||||
Activity activity = dmService.addOperation(type, operationContext.getOperation(), operationContext.getDevices());
|
||||
if (activity != null) {
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("Operation has added successfully.");
|
||||
}
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
return Response.status(Response.Status.CREATED).entity(activity).build();
|
||||
} catch (OperationManagementException e) {
|
||||
String msg = "Error occurred while saving the operation";
|
||||
log.error(msg, e);
|
||||
@ -176,6 +177,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
ResponsePayload responseMsg = new ResponsePayload();
|
||||
ApplicationManager appManagerConnector;
|
||||
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null;
|
||||
Activity activity = null;
|
||||
try {
|
||||
appManagerConnector = DeviceMgtAPIUtils.getAppManagementService();
|
||||
MobileApp mobileApp = applicationWrapper.getApplication();
|
||||
@ -188,11 +190,11 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp);
|
||||
}
|
||||
}
|
||||
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
activity = appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
}
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("Authentication installation request has been sent to the device.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
return Response.status(Response.Status.CREATED).entity(activity).build();
|
||||
} catch (ApplicationManagementException | MDMAPIException e) {
|
||||
String msg = "Error occurred while saving the operation";
|
||||
log.error(msg, e);
|
||||
@ -208,6 +210,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
ResponsePayload responseMsg = new ResponsePayload();
|
||||
ApplicationManager appManagerConnector;
|
||||
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null;
|
||||
Activity activity = null;
|
||||
try {
|
||||
appManagerConnector = DeviceMgtAPIUtils.getAppManagementService();
|
||||
MobileApp mobileApp = applicationWrapper.getApplication();
|
||||
@ -220,11 +223,11 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
operation = MDMIOSOperationUtil.createAppUninstallOperation(mobileApp);
|
||||
}
|
||||
}
|
||||
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
activity = appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
}
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("Authentication removal request has been sent to the device.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
return Response.status(Response.Status.CREATED).entity(activity).build();
|
||||
} catch (ApplicationManagementException | MDMAPIException e) {
|
||||
String msg = "Error occurred while saving the operation";
|
||||
log.error(msg, e);
|
||||
@ -235,7 +238,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
@Override
|
||||
@GET
|
||||
@Path("activity/{id}")
|
||||
public Response getActivity(@PathParam("id") String id)
|
||||
public Response getActivity( @PathParam("id") String id)
|
||||
throws MDMAPIException {
|
||||
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation;
|
||||
DeviceManagementProviderService dmService;
|
||||
|
||||
@ -25,7 +25,10 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException;
|
||||
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationService;
|
||||
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
|
||||
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||
import org.wso2.carbon.device.mgt.core.service.GroupManagementProviderService;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.DeviceMgtAPIUtils;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper;
|
||||
@ -33,6 +36,7 @@ import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtUtil;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper;
|
||||
import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorPoint;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyMonitoringTaskException;
|
||||
@ -447,9 +451,9 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@GET
|
||||
@Path("{type}/{id}/active-policy")
|
||||
@Path("{type}/{id}/active-policy")
|
||||
public Response getDeviceActivePolicy(@PathParam("type") String type, @PathParam("id") String id) {
|
||||
try {
|
||||
DeviceIdentifier deviceIdentifier = DeviceMgtAPIUtils.instantiateDeviceIdentifier(type, id);
|
||||
@ -463,4 +467,35 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/device-group/{user}")
|
||||
public Response getDeviceGroupsRelatedToPolicies(@PathParam("user") String userName) {
|
||||
try {
|
||||
List<DeviceGroupWrapper> groupWrappers = new ArrayList<>();
|
||||
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
|
||||
List<DeviceGroup> deviceGroups = service.getGroups(userName);
|
||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
for (DeviceGroup dg : deviceGroups) {
|
||||
DeviceGroupWrapper gw = new DeviceGroupWrapper();
|
||||
gw.setId(dg.getId());
|
||||
gw.setOwner(dg.getOwner());
|
||||
gw.setName(dg.getName());
|
||||
gw.setTenantId(tenantId);
|
||||
groupWrappers.add(gw);
|
||||
}
|
||||
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("Sending all retrieved device groups.");
|
||||
responsePayload.setResponseContent(groupWrappers);
|
||||
return Response.status(HttpStatus.SC_OK).entity(groupWrappers).build();
|
||||
|
||||
} catch (GroupManagementException e) {
|
||||
String error = "Error occurred while getting the groups related to users for policy.";
|
||||
log.error(error, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService;
|
||||
import org.wso2.carbon.context.CarbonContext;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.device.mgt.analytics.dashboard.GadgetDataService;
|
||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
@ -319,4 +320,13 @@ public class DeviceMgtAPIUtils {
|
||||
}
|
||||
return searchManagerService;
|
||||
}
|
||||
|
||||
public static GadgetDataService getGadgetDataService() {
|
||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||
GadgetDataService gadgetDataService = (GadgetDataService) ctx.getOSGiService(GadgetDataService.class, null);
|
||||
if (gadgetDataService == null) {
|
||||
throw new IllegalStateException("Gadget Data Service has not been initialized.");
|
||||
}
|
||||
return gadgetDataService;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -886,10 +886,16 @@
|
||||
<Permission>
|
||||
<name>Device Search</name>
|
||||
<path>/device-mgt/admin/search</path>
|
||||
<url>/information/*</url>
|
||||
<method>GET</method>
|
||||
<url>/search</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
|
||||
<Permission>
|
||||
<name>Device Updated</name>
|
||||
<path>/device-mgt/admin/search/after</path>
|
||||
<url>/search/after/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!--End of the device search and information -->
|
||||
|
||||
|
||||
@ -937,19 +943,25 @@
|
||||
<!-- Certificate related APIs -->
|
||||
<Permission>
|
||||
<name>Save certificate in the database</name>
|
||||
<path>/device-mgt/android/certificate/save</path>
|
||||
<url>/certificates/saveCertificate</url>
|
||||
<path>/device-mgt/admin/certificate/save</path>
|
||||
<url>/certificates</url>
|
||||
<method>POST</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get certificate in the database</name>
|
||||
<path>/device-mgt/android/certificate/view</path>
|
||||
<path>/device-mgt/admin/certificate/Get</path>
|
||||
<url>/certificates/*</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>Remove certificate in the database</name>
|
||||
<path>/device-mgt/android/certificate/remove</path>
|
||||
<name>get certificate in the database</name>
|
||||
<path>/device-mgt/admin/certificate/GetAll</path>
|
||||
<url>/certificates</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get certificate in the database</name>
|
||||
<path>/device-mgt/admin/certificate/Get</path>
|
||||
<url>/certificates/*</url>
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
@ -1152,5 +1164,61 @@
|
||||
<method>DELETE</method>
|
||||
</Permission>
|
||||
<!-- End of Group related APIs -->
|
||||
<!-- Dashboard related APIs -->
|
||||
<Permission>
|
||||
<name>get device count overview</name>
|
||||
<path>/device-mgt/admin/dashboard/device-count-overview</path>
|
||||
<url>/dashboard/device-count-overview</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get device counts by potential vulnerabilities</name>
|
||||
<path>/device-mgt/admin/dashboard/device-counts-by-potential-vulnerabilities</path>
|
||||
<url>/dashboard/device-counts-by-potential-vulnerabilities</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get non-compliant device counts by features</name>
|
||||
<path>/device-mgt/admin/dashboard/non-compliant-device-counts-by-features</path>
|
||||
<url>/dashboard/non-compliant-device-counts-by-features</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get device counts by groups</name>
|
||||
<path>/device-mgt/admin/dashboard/device-counts-by-groups</path>
|
||||
<url>/dashboard/device-counts-by-groups</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get feature-non-compliant device counts by groups</name>
|
||||
<path>/device-mgt/admin/dashboard/feature-non-compliant-device-counts-by-groups</path>
|
||||
<url>/dashboard/feature-non-compliant-device-counts-by-groups</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get filtered device count over total</name>
|
||||
<path>/device-mgt/admin/dashboard/filtered-device-count-over-total</path>
|
||||
<url>/dashboard/filtered-device-count-over-total</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get feature-non-compliant device count over total</name>
|
||||
<path>/device-mgt/admin/dashboard/feature-non-compliant-device-count-over-total</path>
|
||||
<url>/dashboard/feature-non-compliant-device-count-over-total</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get devices with details</name>
|
||||
<path>/device-mgt/admin/dashboard/devices-with-details</path>
|
||||
<url>/dashboard/devices-with-details</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<Permission>
|
||||
<name>get feature-non-compliant devices with details</name>
|
||||
<path>/device-mgt/admin/dashboard/feature-non-compliant-devices-with-details</path>
|
||||
<url>/dashboard/feature-non-compliant-devices-with-details</url>
|
||||
<method>GET</method>
|
||||
</Permission>
|
||||
<!-- End of Dashboard related APIs -->
|
||||
|
||||
</PermissionConfiguration>
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
<ref bean="notificationServiceBean"/>
|
||||
<ref bean="informationServiceBean"/>
|
||||
<ref bean="searchingServiceBean"/>
|
||||
<ref bean="dashboardServiceBean"/>
|
||||
<ref bean="swaggerResource"/>
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
@ -78,6 +79,7 @@
|
||||
<bean id="searchingServiceBean" class="org.wso2.carbon.device.mgt.jaxrs.api.impl.DeviceSearchImpl"/>
|
||||
<bean id="policyServiceBean" class="org.wso2.carbon.device.mgt.jaxrs.api.impl.PolicyImpl"/>
|
||||
<bean id="profileServiceBean" class="org.wso2.carbon.device.mgt.jaxrs.api.impl.ProfileImpl"/>
|
||||
<bean id="dashboardServiceBean" class="org.wso2.carbon.device.mgt.jaxrs.api.DashboardImpl"/>
|
||||
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
|
||||
<bean id="errorHandler" class="org.wso2.carbon.device.mgt.jaxrs.api.common.ErrorHandler"/>
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
package org.wso2.carbon.device.mgt.common.app.mgt;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
|
||||
import java.util.List;
|
||||
@ -66,12 +67,12 @@ public interface ApplicationManager {
|
||||
throws ApplicationManagementException;
|
||||
|
||||
|
||||
void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
|
||||
Activity installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
|
||||
throws ApplicationManagementException;
|
||||
|
||||
void installApplicationForUsers(Operation operation, List<String> userNameList)
|
||||
Activity installApplicationForUsers(Operation operation, List<String> userNameList)
|
||||
throws ApplicationManagementException;
|
||||
|
||||
void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
||||
Activity installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
||||
throws ApplicationManagementException;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public interface OperationManager {
|
||||
* @throws OperationManagementException If some unusual behaviour is observed while adding the
|
||||
* operation
|
||||
*/
|
||||
int addOperation(Operation operation, List<DeviceIdentifier> devices) throws OperationManagementException;
|
||||
Activity addOperation(Operation operation, List<DeviceIdentifier> devices) throws OperationManagementException;
|
||||
|
||||
/**
|
||||
* Method to retrieve the list of all operations to a device.
|
||||
|
||||
@ -30,6 +30,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
||||
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
|
||||
@ -91,7 +92,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIds)
|
||||
public Activity installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIds)
|
||||
throws ApplicationManagementException {
|
||||
try {
|
||||
//TODO: Fix this properly later adding device type to be passed in when the task manage executes "addOperations()"
|
||||
@ -99,10 +100,11 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
if (deviceIds.size() > 0) {
|
||||
type = deviceIds.get(0).getType();
|
||||
}
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation,
|
||||
deviceIds);
|
||||
Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
|
||||
addOperation(type, operation, deviceIds);
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().notifyOperationToDevices
|
||||
(operation, deviceIds);
|
||||
return activity;
|
||||
} catch (OperationManagementException e) {
|
||||
throw new ApplicationManagementException("Error in add operation at app installation", e);
|
||||
} catch (DeviceManagementException e) {
|
||||
@ -111,7 +113,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installApplicationForUsers(Operation operation, List<String> userNameList)
|
||||
public Activity installApplicationForUsers(Operation operation, List<String> userNameList)
|
||||
throws ApplicationManagementException {
|
||||
|
||||
String userName = null;
|
||||
@ -138,9 +140,10 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
if (deviceIdentifierList.size() > 0) {
|
||||
type = deviceIdentifierList.get(0).getType();
|
||||
}
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
|
||||
.addOperation(type, operation, deviceIdentifierList);
|
||||
|
||||
return activity;
|
||||
} catch (DeviceManagementException e) {
|
||||
throw new ApplicationManagementException("Error in get devices for user: " + userName +
|
||||
" in app installation", e);
|
||||
@ -152,7 +155,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
||||
public Activity installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
||||
throws ApplicationManagementException {
|
||||
|
||||
String userRole = null;
|
||||
@ -178,9 +181,9 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
if (deviceIdentifierList.size() > 0) {
|
||||
type = deviceIdentifierList.get(0).getType();
|
||||
}
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation,
|
||||
Activity activity = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(type, operation,
|
||||
deviceIdentifierList);
|
||||
|
||||
return activity;
|
||||
} catch (DeviceManagementException e) {
|
||||
throw new ApplicationManagementException("Error in get devices for user role " + userRole +
|
||||
" in app installation", e);
|
||||
|
||||
@ -24,6 +24,7 @@ import org.wso2.carbon.context.CarbonContext;
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException;
|
||||
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
||||
@ -47,6 +48,7 @@ import org.wso2.carbon.device.mgt.core.task.impl.DeviceTaskManagerImpl;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -83,8 +85,8 @@ public class OperationManagerImpl implements OperationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addOperation(Operation operation,
|
||||
List<DeviceIdentifier> deviceIds) throws OperationManagementException {
|
||||
public Activity addOperation(Operation operation,
|
||||
List<DeviceIdentifier> deviceIds) throws OperationManagementException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("operation:[" + operation.toString() + "]");
|
||||
for (DeviceIdentifier deviceIdentifier : deviceIds) {
|
||||
@ -96,7 +98,7 @@ public class OperationManagerImpl implements OperationManager {
|
||||
List<DeviceIdentifier> authorizedDeviceList = this.getAuthorizedDevices(operation, deviceIds);
|
||||
if (authorizedDeviceList.size() <= 0) {
|
||||
log.info("User : " + getUser() + " is not authorized to perform operations on given device-list.");
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
List<EnrolmentInfo> enrolments = this.getEnrollmentsByStatus(deviceIds);
|
||||
@ -128,7 +130,12 @@ public class OperationManagerImpl implements OperationManager {
|
||||
}
|
||||
}
|
||||
OperationManagementDAOFactory.commitTransaction();
|
||||
return operationId;
|
||||
Activity activity = new Activity();
|
||||
activity.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + operationId);
|
||||
activity.setCode(operationDto.getCode());
|
||||
activity.setCreatedTimeStamp(new Date().toString());
|
||||
activity.setType(Activity.Type.valueOf(operationDto.getType().toString()));
|
||||
return activity;
|
||||
} catch (OperationManagementDAOException e) {
|
||||
OperationManagementDAOFactory.rollbackTransaction();
|
||||
throw new OperationManagementException("Error occurred while adding operation", e);
|
||||
|
||||
@ -22,6 +22,7 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
||||
@ -43,9 +44,9 @@ public class PushNotificationBasedOperationManager implements OperationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addOperation(Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException {
|
||||
int operationId = this.operationManager.addOperation(operation, devices);
|
||||
public Activity addOperation(Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException {
|
||||
Activity activity = this.operationManager.addOperation(operation, devices);
|
||||
for (DeviceIdentifier deviceId : devices) {
|
||||
try {
|
||||
this.notificationProvider.execute(new NotificationContext(deviceId));
|
||||
@ -53,7 +54,7 @@ public class PushNotificationBasedOperationManager implements OperationManager {
|
||||
throw new OperationManagementException("Error occurred while sending push notification to device", e);
|
||||
}
|
||||
}
|
||||
return operationId;
|
||||
return activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
|
||||
@ -216,8 +217,8 @@ public interface DeviceManagementProviderService {
|
||||
void notifyOperationToDevices(Operation operation,
|
||||
List<DeviceIdentifier> deviceIds) throws DeviceManagementException;
|
||||
|
||||
int addOperation(String type, Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException;
|
||||
Activity addOperation(String type, Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException;
|
||||
|
||||
List<? extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException;
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ import org.wso2.carbon.device.mgt.common.TransactionManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
|
||||
@ -816,8 +817,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addOperation(String type, Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException {
|
||||
public Activity addOperation(String type, Operation operation,
|
||||
List<DeviceIdentifier> devices) throws OperationManagementException {
|
||||
return DeviceManagementDataHolder.getInstance().getOperationManager().addOperation(operation, devices);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,8 @@
|
||||
"apiContext" : "api",
|
||||
"httpsURL" : "https://localhost:8243",
|
||||
"httpURL" : "%http.ip%",
|
||||
"wssURL" : "%https.ip%",
|
||||
"wsURL" : "%http.ip%",
|
||||
"enrollmentDir": "/emm-web-agent/enrollment",
|
||||
"iOSConfigRoot" : "%https.ip%/ios-enrollment/",
|
||||
"iOSAPIRoot" : "%https.ip%/ios/",
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Dashboard"}}
|
||||
{{unit "cdmf.unit.ui.content.title" pageHeader="Dashboard"}}
|
||||
|
||||
|
||||
@ -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 "topCss"}}
|
||||
{{css "css/analytics.css"}}
|
||||
{{/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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Device Types"}}
|
||||
{{unit "cdmf.unit.ui.content.title" pageHeader="Device List"}}
|
||||
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Device"}}
|
||||
{{! unit "cdmf.unit.ui.content.title" pageHeader="Device Download"}}
|
||||
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Device Details"}}
|
||||
{{unit "cdmf.unit.lib.service-invoker-utility"}}
|
||||
{{unit "cdmf.unit.lib.handlebars"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Device Management"}}
|
||||
|
||||
{{unit "cdmf.unit.data-tables-extended"}}
|
||||
|
||||
@ -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 "title"}}Error | {{@app.conf.appName}}{{/zone}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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 "topCss"}}
|
||||
{{css "css/analytics.css"}}
|
||||
{{/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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
|
||||
{{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}}
|
||||
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Notification Listing"}}
|
||||
|
||||
{{#zone "content"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
{{unit "cdmf.unit.data-tables-extended"}}
|
||||
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
|
||||
|
||||
{{unit "cdmf.unit.lib.service-invoker-utility"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
|
||||
|
||||
{{unit "cdmf.unit.lib.select2"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
|
||||
|
||||
{{unit "cdmf.unit.data-tables-extended"}}
|
||||
|
||||
@ -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 "title"}}{{! to override parent page title }}{{/zone}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Login"}}
|
||||
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="User Management"}}
|
||||
|
||||
{{unit "cdmf.unit.data-tables-extended"}}
|
||||
|
||||
@ -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 "topCss"}}
|
||||
{{css "css/daterangepicker.css"}}
|
||||
{{/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 "topCss"}}
|
||||
{{~css "css/dataTables.bootstrap.css"}}
|
||||
{{~css "css/dataTables.responsive.css"}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
<div class="panel-heading">Device Details</div>
|
||||
<div id="loading-content" class="col-centered">
|
||||
<br>
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
<div class="wr-operations" style="height: 87px;"></div>
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
|
||||
@ -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"}}
|
||||
{{js "js/operation-mod.js"}}
|
||||
{{/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.
|
||||
}}
|
||||
<table class="table table-responsive table-striped" id="members">
|
||||
<tbody>
|
||||
{{#if device.viewModel.vendor}}
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
{{#defineZone "contentTitle"}}
|
||||
<div class="row wr-device-board">
|
||||
<div class="col-lg-12 wr-secondary-bar">
|
||||
|
||||
@ -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.
|
||||
}}
|
||||
<div class="container-fluid">
|
||||
<span id="device-listing-status-msg"></span>
|
||||
<table class="table table-striped table-hover list-table no-operations display responsive nowrap data-table grid-view"
|
||||
|
||||
@ -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 "contentTitle"}}
|
||||
<div class="row wr-device-board">
|
||||
<div class="col-lg-12 wr-secondary-bar">
|
||||
|
||||
@ -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 "footer"}}
|
||||
<p>
|
||||
WSO2 Carbon Device Management Framework v.1.0.0 | © 2015, <a href="http://wso2.com/" target="_blank"><i class="icon fw fw-wso2"></i> Inc</a>. (<a href="http://wso2.com/" target="_blank">http://www.wso2.org</a>) All Rights Reserved.
|
||||
|
||||
@ -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"}}
|
||||
{{js "js/handlebars-v2.0.0.js"}}
|
||||
{{js "js/utils.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 "bottomJs"}}
|
||||
{{js "js/jquery.qrcode.min.js"}}
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -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 "topCss"}}
|
||||
{{css "css/graph.css"}}
|
||||
{{/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"}}
|
||||
{{js "js/js.cookie.js"}}
|
||||
{{js "js/invoker-lib.js"}}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user