Fixed conflicts and merged

revert-70aa11f8
mharindu 8 years ago
commit 0f904e21d8

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.annotations</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Annotations</name>
<description>WSO2 Carbon - API Management Custom Annotation Module</description>

@ -21,12 +21,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension.api</artifactId>
<packaging>war</packaging>
<name>WSO2 Carbon - API Application Management API</name>

@ -22,12 +22,12 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<artifactId>org.wso2.carbon.apimgt.application.extension</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Application Management</name>

@ -22,13 +22,13 @@
<parent>
<artifactId>apimgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - API Management Webapp Publisher</name>
<description>WSO2 Carbon - API Management Webapp Publisher</description>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apimgt-extensions</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Component</name>
<url>http://wso2.org</url>

@ -17,14 +17,12 @@
~ 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">
<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>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -76,8 +74,7 @@
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true">
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target">
<include name="api-scep-mgt-v1.0.war"/>
</fileset>

@ -32,7 +32,7 @@
<!-- Device related APIs -->
<Permission>
<name>get certificate in the database</name>
<path>/device-mgt/emm-admin/certificate/GetSignCSR</path>
<path>/device-mgt/admin/certificate/GetSignCSR</path>
<url>/certificates/scep/signcsr</url>
<method>POST</method>
<scope>emm_admin</scope>

@ -17,14 +17,12 @@
~ 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">
<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>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -72,8 +70,7 @@
</goals>
<configuration>
<tasks>
<copy todir="${basedir}/../../../repository/deployment/server/webapps"
overwrite="true">
<copy todir="${basedir}/../../../repository/deployment/server/webapps" overwrite="true">
<fileset dir="${basedir}/target">
<include name="api-certificate-mgt-v1.0.war"/>
</fileset>

@ -32,22 +32,16 @@
<!-- CertificateManagementAdminService related APIs -->
<Permission>
<name>Save certificate</name>
<path>/device-mgt/admin/certificate/Save</path>
<name>View all certificates</name>
<path>/device-mgt/admin/certificate/GetAll</path>
<url>/admin/certificates</url>
<method>POST</method>
</Permission>
<Permission>
<name>Get certificate</name>
<path>/device-mgt/admin/certificate/Get</path>
<url>/admin/certificates/*</url>
<method>GET</method>
</Permission>
<Permission>
<name>Get all certificates</name>
<path>/device-mgt/admin/certificate/GetAll</path>
<name>Add certificate</name>
<path>/device-mgt/admin/certificate/Add</path>
<url>/admin/certificates</url>
<method>GET</method>
<method>POST</method>
</Permission>
<Permission>
<name>Remove certificate</name>
@ -55,5 +49,11 @@
<url>/admin/certificates/*</url>
<method>DELETE</method>
</Permission>
<Permission>
<name>View certificate</name>
<path>/device-mgt/admin/certificate/View</path>
<url>/admin/certificates/*</url>
<method>GET</method>
</Permission>
<!-- End of CertificateManagementAdminService related APIs -->
</PermissionConfiguration>

@ -21,13 +21,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.core</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Certificate Management Core</name>
<description>WSO2 Carbon - Certificate Management Core</description>

@ -67,10 +67,9 @@ public class GenericCertificateDAOImpl implements CertificateDAO {
serialNumber = String.valueOf(certificate.getCertificate().getSerialNumber());
}
byte[] bytes = Serializer.serialize(certificate.getCertificate());
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
stmt.setString(1, serialNumber);
stmt.setObject(2, byteArrayInputStream);
stmt.setBytes(2, bytes);
stmt.setInt(3, certificate.getTenantId());
stmt.setString(4, username);
stmt.addBatch();
@ -102,7 +101,7 @@ public class GenericCertificateDAOImpl implements CertificateDAO {
stmt.setInt(2, tenantId);
resultSet = stmt.executeQuery();
while (resultSet.next()) {
if (resultSet.next()) {
certificateResponse = new CertificateResponse();
byte [] certificateBytes = resultSet.getBytes("CERTIFICATE");
certificateResponse.setCertificate(certificateBytes);
@ -110,7 +109,6 @@ public class GenericCertificateDAOImpl implements CertificateDAO {
certificateResponse.setTenantId(resultSet.getInt("TENANT_ID"));
certificateResponse.setUsername(resultSet.getString("USERNAME"));
CertificateGenerator.extractCertificateDetails(certificateBytes, certificateResponse);
break;
}
} catch (SQLException e) {
String errorMsg =

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Component</name>
<url>http://wso2.org</url>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>carbon-devicemgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -28,7 +28,7 @@ public class BasePaginatedResult {
private String previous;
/**
* Number of Devices returned.
* Number of Resources returned.
*/
@ApiModelProperty(value = "Number of resources returned.")
@JsonProperty("count")

@ -0,0 +1,55 @@
/*
* 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 io.swagger.annotations.ApiModel;
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
@ApiModel(value = "DeviceCompliance", description = "Device's policy compliance status")
public class DeviceCompliance {
private String deviceID;
private ComplianceData complianceData;
private Long code;
public ComplianceData getComplianceData() {
return complianceData;
}
public void setComplianceData(ComplianceData complianceData) {
this.complianceData = complianceData;
}
public Long getCode() {
return code;
}
public void setCode(Long code) {
this.code = code;
}
public String getDeviceID() {
return deviceID;
}
public void setDeviceID(String deviceID) {
this.deviceID = deviceID;
}
}

@ -0,0 +1,101 @@
/*
* 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 com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.Device;
import java.util.ArrayList;
import java.util.List;
public class DeviceTypeList {
private int count;
private String next;
private String previous;
private List<String> deviceTypes = new ArrayList<>();
/**
* Number of Devices Types returned.
*/
@ApiModelProperty(value = "Number of resources returned.")
@JsonProperty("count")
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
/**
* Link to the next subset of resources qualified. \nEmpty if no more resources are to be returned.
*/
@ApiModelProperty(value = "Link to the next subset of resources qualified. \n " +
"Empty if no more resources are to be returned.")
@JsonProperty("next")
public String getNext() {
return next;
}
public void setNext(String next) {
this.next = next;
}
/**
* Link to the previous subset of resources qualified. \nEmpty if current subset is the first subset returned.
*/
@ApiModelProperty(value = "Link to the previous subset of resources qualified. \n" +
"Empty if current subset is the first subset returned.")
@JsonProperty("previous")
public String getPrevious() {
return previous;
}
public void setPrevious(String previous) {
this.previous = previous;
}
@ApiModelProperty(value = "List of device types returned")
@JsonProperty("devicesTypes")
public List<String> getList() {
return deviceTypes;
}
public void setList(List<String> deviceTypes) {
this.deviceTypes = deviceTypes;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
sb.append(" count: ").append(getCount()).append(",\n");
sb.append(" next: ").append(getNext()).append(",\n");
sb.append(" previous: ").append(getPrevious()).append(",\n");
sb.append(" deviceTypes: [").append(deviceTypes).append("\n");
sb.append("]}\n");
return sb.toString();
}
}

@ -40,7 +40,7 @@ public class Profile {
private int tenantId;
@ApiModelProperty(name = "deviceType", value = "Contains the device type details the policy was created "
+ "for", required = true)
private DeviceType deviceType;
private String deviceType;
@ApiModelProperty(name = "createdDate", value = "The date the policy was created", required = true)
private Timestamp createdDate;
@ApiModelProperty(name = "updatedDate", value = "The date the changes made to the policy was published to"
@ -50,11 +50,11 @@ public class Profile {
+ "in the policy", required = true)
private List<ProfileFeature> profileFeaturesList; // Features included in the policies.
public DeviceType getDeviceType() {
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(DeviceType deviceType) {
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
@XmlElement

@ -37,7 +37,7 @@ public class ProfileFeature implements Serializable {
private int profileId;
@ApiModelProperty(name = "deviceTypeId", value = "The ID used to define the type of the device platform",
required = true)
private int deviceTypeId;
private String deviceType;
@ApiModelProperty(name = "content", value = "The list of parameters that define the policy",
required = true)
private Object content;
@ -69,12 +69,12 @@ public class ProfileFeature implements Serializable {
this.profileId = profileId;
}
public int getDeviceTypeId() {
return deviceTypeId;
public String getDeviceTypeId() {
return deviceType;
}
public void setDeviceTypeId(int deviceTypeId) {
this.deviceTypeId = deviceTypeId;
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}

@ -29,6 +29,7 @@ import org.wso2.carbon.device.mgt.common.search.SearchContext;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@ -92,6 +93,11 @@ public interface DeviceManagementService {
})
@Permission(scope = "device:list", roles = {"admin"})
Response getDevices(
@ApiParam(
name = "name",
value = "The device name, such as shamu, bullhead or angler.",
required = false)
String name,
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
@ -639,4 +645,45 @@ public interface DeviceManagementService {
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
@GET
@Path("{type}/{id}/compliance-data")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get the effective policy calculated for a device.",
notes = "When a device registers with WSO2 EMM a policy is enforced on the device. Initially the "
+ "EMM filters the policies based on the Platform (device type), filters based on the "
+ "device ownership type , filters based on the user role or name and finally the policy"
+ " is enforced on the device.",
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK",
response = ComplianceData.class),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Error occurred while getting the compliance data.",
response = ErrorResponse.class)
}
)
Response getComplianceDataOfDevice(
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
required = true)
@PathParam("type")
String type,
@ApiParam(
name = "id",
value = "Device Identifier",
required = true)
@PathParam("id") String id);
}

@ -119,7 +119,7 @@ public interface NotificationManagementService {
int limit);
@PUT
@Path("{id}/mark-checked")
@Path("/{id}/mark-checked")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",

@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.*;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@API(name = "User Management", version = "1.0.0", context = "/api-device-mgt-v1.0/users", tags = {"devicemgt_admin"})
@ -451,4 +452,42 @@ public interface UserManagementService {
value = "Credential.",
required = true) OldPasswordResetWrapper credentials);
@POST
@Path("/send-invitation")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Send invitation mail.",
notes = "A user is able to send invitation mail via this REST API.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
message = "OK. \n Invitation mails have been sent."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
response = ErrorResponse.class),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource to be deleted does not exist.",
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format.",
response = ErrorResponse.class),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n " +
"Server error occurred while updating credentials of the user.",
response = ErrorResponse.class)
})
@Permission(scope = "user:invite", roles = {"admin"})
Response inviteExistingUsersToEnrollDevice(
@ApiParam(
name = "users",
value = "List of users",
required = true) List<String> usernames);
}

@ -0,0 +1,90 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.jaxrs.service.api.admin;
import io.swagger.annotations.*;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@API(name = "Device Type Management", version = "1.0.0", context = "/admin/device-types", tags = {"devicemgt_admin"})
@Path("/admin/device-types")
@Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " +
"type management")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface DeviceTypeManagementService {
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get the list of device types registered.",
notes = "Retrieves the list of device types of which the devices intended to be managed.",
tags = "Device Type Management")
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the list of supported device types.",
response = DeviceTypeList.class,
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " +
"the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Server error occurred while fetching the " +
"list of supported device types.",
response = ErrorResponse.class)
}
)
@Permission(scope = "device-types:read", roles = {"admin"})
Response getDeviceTypes(
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
}

@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
@ -30,6 +31,7 @@ import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderServ
import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService;
import org.wso2.carbon.device.mgt.core.search.mgt.SearchMgtException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceCompliance;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.beans.OperationList;
@ -38,6 +40,8 @@ import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.common.monitor.ComplianceData;
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.ws.rs.*;
@ -58,6 +62,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@GET
@Override
public Response getDevices(
@QueryParam("name") String name,
@QueryParam("type") String type,
@QueryParam("user") String user,
@QueryParam("roleName") String roleName,
@ -68,29 +73,32 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
try {
RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
// RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
PaginationRequest request = new PaginationRequest(offset, limit);
PaginationResult result;
DeviceList devices = new DeviceList();
if (type != null) {
if(name != null && !name.isEmpty()){
request.setDeviceName(name);
}
if (type != null && !type.isEmpty()) {
request.setDeviceType(type);
}
if (user != null) {
if (user != null && !user.isEmpty()) {
request.setOwner(user);
}
if (ownership != null) {
if (ownership != null && !ownership.isEmpty()) {
RequestValidationUtil.validateOwnershipType(ownership);
request.setOwnership(ownership);
}
if (status != null) {
if (status != null && !status.isEmpty()) {
RequestValidationUtil.validateStatus(status);
request.setStatus(status);
}
if (ifModifiedSince != null) {
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
Date sinceDate;
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
try {
@ -106,7 +114,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
"after the timestamp provided in 'If-Modified-Since' header").build();
}
} else if (since != null) {
} else if (since != null && !since.isEmpty()) {
Date sinceDate;
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
try {
@ -141,6 +149,32 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
}
}
@GET
@Path("/user-devices")
public Response getDeviceByUser(@QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
PaginationRequest request = new PaginationRequest(offset, limit);
PaginationResult result;
DeviceList devices = new DeviceList();
String currentUser = CarbonContext.getThreadLocalCarbonContext().getUsername();
request.setOwner(currentUser);
try {
result = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(request);
devices.setList((List<Device>) result.getData());
devices.setCount(result.getRecordsTotal());
return Response.status(Response.Status.OK).entity(devices).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while fetching all enrolled devices";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
}
@GET
@Path("/{type}/{id}")
@Override
@ -301,4 +335,48 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
}
}
@GET
@Path("{type}/{id}/compliance-data")
public Response getComplianceDataOfDevice(@PathParam("type") String type,
@PathParam("id") String id) {
RequestValidationUtil.validateDeviceIdentifier(type, id);
PolicyManagerService policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
Policy policy;
ComplianceData complianceData = null;
DeviceCompliance deviceCompliance = new DeviceCompliance();
try {
policy = policyManagementService.getAppliedPolicyToDevice(new DeviceIdentifier(id, type));
} catch (PolicyManagementException e) {
String msg = "Error occurred while retrieving the current policy associated with the '" + type +
"' device, which carries the id '" + id + "'";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
if (policy == null) {
deviceCompliance.setDeviceID(id);
deviceCompliance.setComplianceData(null);
//deviceCompliance.setCode(0001l); //code 0001 means no compliance data related to the device
return Response.status(Response.Status.OK).entity(deviceCompliance).build();
} else {
try {
policyManagementService = DeviceMgtAPIUtils.getPolicyManagementService();
complianceData = policyManagementService.getDeviceCompliance(
new DeviceIdentifier(id, type));
deviceCompliance.setDeviceID(id);
deviceCompliance.setComplianceData(complianceData);
//deviceCompliance.setCode(0002l); //code 0002 means there are compliance data related to the device
return Response.status(Response.Status.OK).entity(deviceCompliance).build();
} catch (PolicyComplianceException e) {
String error = "Error occurred while getting the compliance data.";
log.error(error, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(error).build()).build();
}
}
}
}

@ -76,7 +76,7 @@ public class NotificationManagementServiceImpl implements NotificationManagement
}
@PUT
@Path("{id}/mark-checked")
@Path("/{id}/mark-checked")
public Response updateNotificationStatus(
@PathParam("id") int id) {
String msg;

@ -21,6 +21,9 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo;
import org.wso2.carbon.device.mgt.jaxrs.beans.*;
import org.wso2.carbon.device.mgt.jaxrs.service.api.UserManagementService;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
@ -338,6 +341,43 @@ public class UserManagementServiceImpl implements UserManagementService {
return CredentialManagementResponseBuilder.buildChangePasswordResponse(username, credentials);
}
/**
* Method used to send an invitation email to a existing user to enroll a device.
*
* @param usernames Username list of the users to be invited
*/
@POST
@Path("send-invitation")
@Produces({MediaType.APPLICATION_JSON})
public Response inviteExistingUsersToEnrollDevice(List<String> usernames) {
if (log.isDebugEnabled()) {
log.debug("Sending enrollment invitation mail to existing user.");
}
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
try {
for (String username : usernames) {
String recipient = getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS);
Properties props = new Properties();
props.setProperty("first-name", getClaimValue(username, Constants.USER_CLAIM_FIRST_NAME));
props.setProperty("username", username);
EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props);
dms.sendEnrolmentInvitation(metaInfo);
}
} catch (DeviceManagementException e) {
String msg = "Error occurred while inviting user to enrol their device";
log.error(msg, e);
} catch (UserStoreException e) {
String msg = "Error occurred while getting claim values to invite user";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
return Response.status(Response.Status.OK).entity("Invitation mails have been sent.").build();
}
private Map<String, String> buildDefaultUserClaims(String firstName, String lastName, String emailAddress) {
Map<String, String> defaultUserClaims = new HashMap<>();
defaultUserClaims.put(Constants.USER_CLAIM_FIRST_NAME, firstName);

@ -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.device.mgt.jaxrs.service.impl.admin;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceTypeManagementService;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import java.util.List;
@Path("/admin/device-types")
public class DeviceTypeManagementServiceImpl implements DeviceTypeManagementService {
private static Log log = LogFactory.getLog(DeviceTypeManagementServiceImpl.class);
@GET
@Override
public Response getDeviceTypes(@HeaderParam("If-Modified-Since") String ifModifiedSince) {
List<String> deviceTypes;
try {
deviceTypes = DeviceMgtAPIUtils.getDeviceManagementService().getAvailableDeviceTypes();
DeviceTypeList deviceTypeList = new DeviceTypeList();
deviceTypeList.setCount(deviceTypes.size());
deviceTypeList.setList(deviceTypes);
return Response.status(Response.Status.OK).entity(deviceTypeList).build();
} catch (DeviceManagementException e) {
String msg = "Error occurred while fetching the list of device types.";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
}
}

@ -52,7 +52,7 @@ public class DeviceMgtUtil {
new org.wso2.carbon.policy.mgt.common.ProfileFeature();
profileFeature.setProfileId(mdmProfileFeature.getProfileId());
profileFeature.setContent(mdmProfileFeature.getPayLoad());
profileFeature.setDeviceTypeId(mdmProfileFeature.getDeviceTypeId());
profileFeature.setDeviceType(mdmProfileFeature.getDeviceTypeId());
profileFeature.setFeatureCode(mdmProfileFeature.getFeatureCode());
profileFeature.setId(mdmProfileFeature.getId());
return profileFeature;

@ -38,6 +38,7 @@
<!--<ref bean="groupManagementService"/>-->
<ref bean="groupManagementAdminService"/>
<ref bean="applicationManagementAdminService"/>
<ref bean="deviceTypeManagementAdminService"/>
<ref bean="dashboardServiceBean"/>
<ref bean="swaggerResource"/>
</jaxrs:serviceBeans>
@ -77,6 +78,7 @@
<bean id="groupManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.GroupManagementAdminServiceImpl"/>
<bean id="userManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.UserManagementAdminServiceImpl"/>
<bean id="dashboardServiceBean" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.DashboardImpl"/>
<bean id="deviceTypeManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceTypeManagementServiceImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.mgt.jaxrs.common.GsonMessageBodyHandler"/>
<!--<bean id="errorHandler" class="org.wso2.carbon.device.mgt.jaxrs.common.ErrorHandler"/>-->

@ -21,7 +21,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -51,17 +51,17 @@ public interface DeviceTypeDAO {
List<DeviceType> getDeviceTypes(int tenantId) throws DeviceManagementDAOException;
/**
* @param tenandId of the device type provider.
* @param tenantId of the device type provider.
* @return return only the device types that are associated with the provider tenant.
* @throws DeviceManagementDAOException
*/
List<DeviceType> getDeviceTypesByProvider(int tenandId) throws DeviceManagementDAOException;
List<String> getDeviceTypesByProvider(int tenantId) throws DeviceManagementDAOException;
/**
* @return sharedWithAllDeviceTypes This returns public shared device types.
* @throws DeviceManagementDAOException
*/
List<DeviceType> getSharedDeviceTypes() throws DeviceManagementDAOException;
List<String> getSharedDeviceTypes() throws DeviceManagementDAOException;
/**
* @param id retrieve the device type with its id.

@ -89,24 +89,21 @@ public class DeviceTypeDAOImpl implements DeviceTypeDAO {
}
@Override
public List<DeviceType> getDeviceTypesByProvider(int tenantId) throws DeviceManagementDAOException {
public List<String> getDeviceTypesByProvider(int tenantId) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
List<DeviceType> deviceTypes = new ArrayList<>();
List<String> deviceTypes = new ArrayList<>();
try {
conn = this.getConnection();
String sql =
"SELECT ID AS DEVICE_TYPE_ID, NAME AS DEVICE_TYPE FROM DM_DEVICE_TYPE where PROVIDER_TENANT_ID =?";
"SELECT NAME AS DEVICE_TYPE FROM DM_DEVICE_TYPE where PROVIDER_TENANT_ID =?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
rs = stmt.executeQuery();
while (rs.next()) {
DeviceType deviceType = new DeviceType();
deviceType.setId(rs.getInt("DEVICE_TYPE_ID"));
deviceType.setName(rs.getString("DEVICE_TYPE"));
deviceTypes.add(deviceType);
deviceTypes.add(rs.getString("DEVICE_TYPE"));
}
return deviceTypes;
} catch (SQLException e) {
@ -117,25 +114,22 @@ public class DeviceTypeDAOImpl implements DeviceTypeDAO {
}
@Override
public List<DeviceType> getSharedDeviceTypes() throws DeviceManagementDAOException {
public List<String> getSharedDeviceTypes() throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
List<DeviceType> deviceTypes = new ArrayList<>();
List<String> deviceTypes = new ArrayList<>();
try {
conn = this.getConnection();
String sql =
"SELECT ID AS DEVICE_TYPE_ID, NAME AS DEVICE_TYPE FROM DM_DEVICE_TYPE where " +
"SELECT NAME AS DEVICE_TYPE FROM DM_DEVICE_TYPE where " +
"SHARED_WITH_ALL_TENANTS = ?";
stmt = conn.prepareStatement(sql);
stmt.setBoolean(1, true);
rs = stmt.executeQuery();
while (rs.next()) {
DeviceType deviceType = new DeviceType();
deviceType.setId(rs.getInt("DEVICE_TYPE_ID"));
deviceType.setName(rs.getString("DEVICE_TYPE"));
deviceTypes.add(deviceType);
deviceTypes.add(rs.getString("DEVICE_TYPE"));
}
return deviceTypes;
} catch (SQLException e) {

@ -207,7 +207,7 @@ public interface DeviceManagementProviderService {
Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException;
List<DeviceType> getAvailableDeviceTypes() throws DeviceManagementException;
List<String> getAvailableDeviceTypes() throws DeviceManagementException;
boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException;

@ -857,10 +857,10 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
}
@Override
public List<DeviceType> getAvailableDeviceTypes() throws DeviceManagementException {
List<DeviceType> deviceTypesProvidedByTenant;
List<DeviceType> publicSharedDeviceTypesInDB;
List<DeviceType> deviceTypesResponse = new ArrayList<>();
public List<String> getAvailableDeviceTypes() throws DeviceManagementException {
List<String> deviceTypesProvidedByTenant;
List<String> publicSharedDeviceTypesInDB;
List<String> deviceTypesResponse = new ArrayList<>();
try {
DeviceManagementDAOFactory.openConnection();
int tenantId = this.getTenantId();
@ -872,21 +872,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
if (registeredTypes != null) {
if (deviceTypesProvidedByTenant != null) {
for (DeviceType deviceType : deviceTypesProvidedByTenant) {
DeviceTypeIdentifier providerKey = new DeviceTypeIdentifier(deviceType.getName(), tenantId);
for (String deviceType : deviceTypesProvidedByTenant) {
DeviceTypeIdentifier providerKey = new DeviceTypeIdentifier(deviceType, tenantId);
if (registeredTypes.get(providerKey) != null) {
deviceTypesResponse.add(deviceType);
deviceTypeSetForTenant.add(deviceType.getName());
deviceTypeSetForTenant.add(deviceType);
}
}
}
// Get the device from the public space, however if there is another device with same name then give
// priority to that
if (publicSharedDeviceTypesInDB != null) {
for (DeviceType deviceType : publicSharedDeviceTypesInDB) {
DeviceTypeIdentifier providerKey = new DeviceTypeIdentifier(deviceType.getName());
if (registeredTypes.get(providerKey) != null && !deviceTypeSetForTenant.contains(
deviceType.getName())) {
for (String deviceType : publicSharedDeviceTypesInDB) {
DeviceTypeIdentifier providerKey = new DeviceTypeIdentifier(deviceType);
if (registeredTypes.get(providerKey) != null && !deviceTypeSetForTenant.contains(deviceType)) {
deviceTypesResponse.add(deviceType);
}
}

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>email-sender</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -21,14 +21,14 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web-proxy</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Proxy endpoint of Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web Proxy</description>
<packaging>war</packaging>

@ -21,14 +21,14 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.mdm</groupId>
<artifactId>dynamic-client-web</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Dynamic Client Registration Web Service</name>
<description>WSO2 Carbon - Dynamic Client Registration Web</description>
<packaging>war</packaging>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.registration</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client registration service</name>
<description>WSO2 Carbon - Dynamic Client Registration Service</description>

@ -21,13 +21,13 @@
<parent>
<artifactId>dynamic-client-registration</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.dynamic.client.web.app.registration</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Dynamic client web app registration</name>
<description>WSO2 Carbon - Dynamic Client Web-app Registration Service</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>dynamic-client-registration</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Dynamic client registration</name>
<url>http://wso2.org</url>

@ -22,13 +22,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.oauth.extensions</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - OAuth Extensions</name>
<url>http://wso2.org</url>

@ -21,7 +21,7 @@
<parent>
<artifactId>identity-extensions</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>identity-extensions</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
<description>WSO2 Carbon - Policy Decision Point</description>

@ -36,7 +36,7 @@ public class PolicyFilterImpl implements PolicyFilter {
@Override
public List<Policy> extractPoliciesRelatedToRoles(List<Policy> policyList, List<String> roles) {
List<Policy> policies = new ArrayList<Policy>();
List<Policy> policies = new ArrayList<>();
for (Policy policy : policyList) {
List<String> roleList = policy.getRoles();
@ -60,10 +60,10 @@ public class PolicyFilterImpl implements PolicyFilter {
*/
@Override
public List<Policy> extractPoliciesRelatedToDeviceType(List<Policy> policyList, String deviceType) {
List<Policy> policies = new ArrayList<Policy>();
List<Policy> policies = new ArrayList<>();
for (Policy policy : policyList) {
if (policy.getProfile().getDeviceType().getName().equalsIgnoreCase(deviceType)) {
if (policy.getProfile().getDeviceType().equalsIgnoreCase(deviceType)) {
policies.add(policy);
}
}

@ -3,7 +3,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -11,7 +11,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Common</name>
<description>WSO2 Carbon - Policy Management Common</description>

@ -33,17 +33,17 @@ public class Profile implements Serializable {
private int profileId;
private String profileName;
private int tenantId;
private DeviceType deviceType;
private String deviceType;
private Timestamp createdDate;
private Timestamp updatedDate;
// private List<Feature> featuresList; // Features included in the policies.
private List<ProfileFeature> profileFeaturesList; // Features included in the policies.
public DeviceType getDeviceType() {
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(DeviceType deviceType) {
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
@XmlElement

@ -38,7 +38,7 @@ public class ProfileFeature implements Serializable {
private int profileId;
@ApiModelProperty(name = "deviceTypeId", value = "The ID used to define the type of the device platform",
required = true)
private int deviceTypeId;
private String deviceType;
@ApiModelProperty(name = "content", value = "The list of parameters that define the policy",
required = true)
private Object content;
@ -67,12 +67,12 @@ public class ProfileFeature implements Serializable {
this.profileId = profileId;
}
public int getDeviceTypeId() {
return deviceTypeId;
public String getDeviceType() {
return deviceType;
}
public void setDeviceTypeId(int deviceTypeId) {
this.deviceTypeId = deviceTypeId;
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public Object getContent() {

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Management Core</name>
<description>WSO2 Carbon - Policy Management Core</description>

@ -31,7 +31,7 @@ public interface PolicyDAO {
Policy addPolicy(Policy policy) throws PolicyManagerDAOException;
Policy addPolicy(String deviceType, Policy policy) throws PolicyManagerDAOException;
// Policy addPolicyToDeviceType(String deviceType, Policy policy) throws PolicyManagerDAOException;
/**
* This method is used to add/update the roles associated with the policy.

@ -85,6 +85,6 @@ public interface ProfileDAO {
* @return retruns list of profiles.
* @throws ProfileManagerDAOException
*/
List<Profile> getProfilesOfDeviceType(DeviceType deviceType) throws ProfileManagerDAOException;
List<Profile> getProfilesOfDeviceType(String deviceType) throws ProfileManagerDAOException;
}

@ -66,14 +66,14 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "INSERT INTO DM_PROFILE_FEATURES (PROFILE_ID, FEATURE_CODE, DEVICE_TYPE_ID, CONTENT, " +
String query = "INSERT INTO DM_PROFILE_FEATURES (PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT, " +
"TENANT_ID) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, new String[] {"id"});
for (ProfileFeature feature : features) {
stmt.setInt(1, profileId);
stmt.setString(2, feature.getFeatureCode());
stmt.setInt(3, feature.getDeviceTypeId());
stmt.setString(3, feature.getDeviceType());
// if (conn.getMetaData().getDriverName().contains("H2")) {
// stmt.setBytes(4, PolicyManagerUtil.getBytes(feature.getContent()));
// } else {
@ -145,10 +145,7 @@ public class FeatureDAOImpl implements FeatureDAO {
stmt = conn.prepareStatement(query);
stmt.setInt(1, profile.getProfileId());
stmt.setInt(2, tenantId);
if (stmt.executeUpdate() > 0) {
return true;
}
return false;
return stmt.executeUpdate() > 0;
} catch (SQLException e) {
throw new FeatureManagerDAOException("Error occurred while deleting the feature related to a profile.", e);
} finally {
@ -211,7 +208,7 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "SELECT ID, PROFILE_ID, FEATURE_CODE, DEVICE_TYPE_ID, CONTENT FROM DM_PROFILE_FEATURES " +
String query = "SELECT ID, PROFILE_ID, FEATURE_CODE, DEVICE_TYPE, CONTENT FROM DM_PROFILE_FEATURES " +
"WHERE TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, tenantId);
@ -221,7 +218,7 @@ public class FeatureDAOImpl implements FeatureDAO {
ProfileFeature profileFeature = new ProfileFeature();
profileFeature.setFeatureCode(resultSet.getString("FEATURE_CODE"));
profileFeature.setDeviceTypeId(resultSet.getInt("DEVICE_TYPE_ID"));
profileFeature.setDeviceType(resultSet.getString("DEVICE_TYPE"));
profileFeature.setId(resultSet.getInt("ID"));
profileFeature.setProfileId(resultSet.getInt("PROFILE_ID"));
@ -272,9 +269,9 @@ public class FeatureDAOImpl implements FeatureDAO {
List<Feature> featureList = new ArrayList<Feature>();
try {
conn = this.getConnection();
String query = "SELECT f.ID ID, f.NAME NAME, f.CODE CODE, f.DEVICE_TYPE_ID DEVICE_TYPE_ID," +
String query = "SELECT f.ID ID, f.NAME NAME, f.CODE CODE, f.DEVICE_TYPE DEVICE_TYPE," +
" f.EVALUATION_RULE EVALUATION_RULE FROM DM_FEATURES f INNER JOIN DM_DEVICE_TYPE d " +
"ON d.ID=f.DEVICE_TYPE_ID WHERE d.NAME = ?";
"ON d.ID=f.DEVICE_TYPE WHERE d.NAME = ?";
stmt = conn.prepareStatement(query);
stmt.setString(1, deviceType);
resultSet = stmt.executeQuery();
@ -306,7 +303,7 @@ public class FeatureDAOImpl implements FeatureDAO {
try {
conn = this.getConnection();
String query = "SELECT ID, FEATURE_CODE, DEVICE_TYPE_ID, CONTENT FROM DM_PROFILE_FEATURES " +
String query = "SELECT ID, FEATURE_CODE, DEVICE_TYPE, CONTENT FROM DM_PROFILE_FEATURES " +
"WHERE PROFILE_ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, profileId);
@ -317,7 +314,7 @@ public class FeatureDAOImpl implements FeatureDAO {
ProfileFeature profileFeature = new ProfileFeature();
profileFeature.setId(resultSet.getInt("ID"));
profileFeature.setFeatureCode(resultSet.getString("FEATURE_CODE"));
profileFeature.setDeviceTypeId(resultSet.getInt("DEVICE_TYPE_ID"));
profileFeature.setDeviceType(resultSet.getString("DEVICE_TYPE"));
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;

@ -48,25 +48,25 @@ public class PolicyDAOImpl implements PolicyDAO {
return persistPolicy(policy);
}
@Override
public Policy addPolicy(String deviceType, Policy policy) throws PolicyManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String query = "INSERT INTO DM_DEVICE_TYPE_POLICY (DEVICE_TYPE_ID, POLICY_ID) VALUES (?, ?)";
stmt = conn.prepareStatement(query);
stmt.setInt(1, getDeviceTypeId(deviceType));
stmt.setInt(2, policy.getId());
stmt.executeQuery();
} catch (SQLException e) {
throw new PolicyManagerDAOException("Error occurred while adding the device type policy to database.", e);
} finally {
PolicyManagementDAOUtil.cleanupResources(stmt, null);
}
return policy;
}
// @Override
// public Policy addPolicyToDeviceType(String deviceType, Policy policy) throws PolicyManagerDAOException {
// Connection conn;
// PreparedStatement stmt = null;
// try {
// conn = this.getConnection();
// String query = "INSERT INTO DM_DEVICE_TYPE_POLICY (DEVICE_TYPE_ID, POLICY_ID) VALUES (?, ?)";
// stmt = conn.prepareStatement(query);
// stmt.setInt(1, getDeviceTypeId(deviceType));
// stmt.setInt(2, policy.getId());
// stmt.executeQuery();
// } catch (SQLException e) {
// throw new PolicyManagerDAOException("Error occurred while adding the device type policy to database.", e);
// } finally {
// PolicyManagementDAOUtil.cleanupResources(stmt, null);
// }
// return policy;
//
// }
@Override
public Policy addPolicyToRole(List<String> rolesToAdd, Policy policy) throws PolicyManagerDAOException {
@ -831,10 +831,10 @@ public class PolicyDAOImpl implements PolicyDAO {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "INSERT INTO DM_POLICY_CHANGE_MGT (POLICY_ID, DEVICE_TYPE_ID, TENANT_ID) VALUES (?, ?, ?)";
String query = "INSERT INTO DM_POLICY_CHANGE_MGT (POLICY_ID, DEVICE_TYPE, TENANT_ID) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(query);
stmt.setInt(1, policy.getId());
stmt.setInt(2, policy.getProfile().getDeviceType().getId());
stmt.setString(2, policy.getProfile().getDeviceType());
stmt.setInt(3, tenantId);
stmt.executeUpdate();
@ -855,11 +855,11 @@ public class PolicyDAOImpl implements PolicyDAO {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
try {
conn = this.getConnection();
String query = "INSERT INTO DM_POLICY_CHANGE_MGT (POLICY_ID, DEVICE_TYPE_ID, TENANT_ID) VALUES (?, ?, ?)";
String query = "INSERT INTO DM_POLICY_CHANGE_MGT (POLICY_ID, DEVICE_TYPE, TENANT_ID) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(query);
for (Policy policy : policies) {
stmt.setInt(1, policy.getId());
stmt.setInt(2, policy.getProfile().getDeviceType().getId());
stmt.setString(2, policy.getProfile().getDeviceType());
stmt.setInt(3, tenantId);
stmt.addBatch();
}

@ -50,12 +50,12 @@ public class ProfileDAOImpl implements ProfileDAO {
try {
conn = this.getConnection();
String query = "INSERT INTO DM_PROFILE " +
"(PROFILE_NAME,TENANT_ID, DEVICE_TYPE_ID, CREATED_TIME, UPDATED_TIME) VALUES (?, ?, ?, ?, ?)";
"(PROFILE_NAME, TENANT_ID, DEVICE_TYPE, CREATED_TIME, UPDATED_TIME) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(query, new String[] {"id"});
stmt.setString(1, profile.getProfileName());
stmt.setInt(2, tenantId);
stmt.setLong(3, profile.getDeviceType().getId());
stmt.setString(3, profile.getDeviceType());
stmt.setTimestamp(4, profile.getCreatedDate());
stmt.setTimestamp(5, profile.getUpdatedDate());
@ -95,11 +95,11 @@ public class ProfileDAOImpl implements ProfileDAO {
try {
conn = this.getConnection();
String query = "UPDATE DM_PROFILE SET PROFILE_NAME = ? , DEVICE_TYPE_ID = ? , UPDATED_TIME = ? " +
String query = "UPDATE DM_PROFILE SET PROFILE_NAME = ? , DEVICE_TYPE = ? , UPDATED_TIME = ? " +
"WHERE ID = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(query);
stmt.setString(1, profile.getProfileName());
stmt.setLong(2, profile.getDeviceType().getId());
stmt.setString(2, profile.getDeviceType());
stmt.setTimestamp(3, profile.getUpdatedDate());
stmt.setInt(4, profile.getProfileId());
stmt.setInt(5, tenantId);
@ -183,8 +183,6 @@ public class ProfileDAOImpl implements ProfileDAO {
PreparedStatement stmt = null;
ResultSet resultSet = null;
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
try {
conn = this.getConnection();
String query = "SELECT * FROM DM_PROFILE WHERE ID = ?";
@ -194,11 +192,10 @@ public class ProfileDAOImpl implements ProfileDAO {
while (resultSet.next()) {
deviceType.setId(resultSet.getInt("DEVICE_TYPE_ID"));
profile.setProfileId(profileId);
profile.setProfileName(resultSet.getString("PROFILE_NAME"));
profile.setTenantId(resultSet.getInt("TENANT_ID"));
profile.setDeviceType(deviceType);
profile.setDeviceType(resultSet.getString("DEVICE_TYPE"));
profile.setCreatedDate(resultSet.getTimestamp("CREATED_TIME"));
profile.setUpdatedDate(resultSet.getTimestamp("UPDATED_TIME"));
}
@ -236,11 +233,7 @@ public class ProfileDAOImpl implements ProfileDAO {
profile.setTenantId(resultSet.getInt("TENANT_ID"));
profile.setCreatedDate(resultSet.getTimestamp("CREATED_TIME"));
profile.setUpdatedDate(resultSet.getTimestamp("UPDATED_TIME"));
DeviceType deviceType = new DeviceType();
deviceType.setId(resultSet.getInt("DEVICE_TYPE_ID"));
profile.setDeviceType(deviceType);
profile.setDeviceType(resultSet.getString("DEVICE_TYPE"));
profileList.add(profile);
}
@ -256,16 +249,16 @@ public class ProfileDAOImpl implements ProfileDAO {
}
@Override
public List<Profile> getProfilesOfDeviceType(DeviceType deviceType) throws ProfileManagerDAOException {
public List<Profile> getProfilesOfDeviceType(String deviceType) throws ProfileManagerDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet resultSet = null;
List<Profile> profileList = new ArrayList<>();
try {
conn = this.getConnection();
String query = "SELECT * FROM DM_PROFILE WHERE DEVICE_TYPE_ID = ?";
String query = "SELECT * FROM DM_PROFILE WHERE DEVICE_TYPE = ?";
stmt = conn.prepareStatement(query);
stmt.setInt(1, deviceType.getId());
stmt.setString(1, deviceType);
resultSet = stmt.executeQuery();
while (resultSet.next()) {
@ -273,7 +266,7 @@ public class ProfileDAOImpl implements ProfileDAO {
profile.setProfileId(resultSet.getInt("ID"));
profile.setProfileName(resultSet.getString("PROFILE_NAME"));
profile.setTenantId(resultSet.getInt("TENANT_ID"));
profile.setDeviceType(deviceType);
profile.setDeviceType(resultSet.getString("DEVICE_TYPE"));
profile.setCreatedDate(resultSet.getTimestamp("CREATED_TIME"));
profile.setUpdatedDate(resultSet.getTimestamp("UPDATED_TIME"));

@ -54,7 +54,7 @@ public class DelegationTask implements Task {
try {
PolicyManager policyManager = new PolicyManagerImpl();
List<DeviceType> deviceTypes = policyManager.applyChangesMadeToPolicies();
List<String> deviceTypes = policyManager.applyChangesMadeToPolicies();
PolicyCacheManagerImpl.getInstance().rePopulateCache();
@ -65,9 +65,9 @@ public class DelegationTask implements Task {
DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance()
.getDeviceManagementService();
List<Device> devices = new ArrayList<>();
for (DeviceType deviceType : deviceTypes) {
for (String deviceType : deviceTypes) {
try {
devices.addAll(service.getAllDevices(deviceType.getName()));
devices.addAll(service.getAllDevices(deviceType));
} catch (DeviceManagementException e) {
throw new PolicyManagementException("Error occurred while taking the devices", e);
}

@ -179,7 +179,7 @@ public class PolicyFilterImpl implements PolicyFilter {
List<Policy> temp = new ArrayList<Policy>();
for (Policy policy : policies) {
if (deviceType.equalsIgnoreCase(policy.getProfile().getDeviceType().getName())) {
if (deviceType.equalsIgnoreCase(policy.getProfile().getDeviceType())) {
temp.add(policy);
}
}

@ -68,7 +68,7 @@ public interface PolicyManager {
void addAppliedPolicyFeaturesToDevice(DeviceIdentifier deviceIdentifier, Policy policy)
throws PolicyManagementException;
List<DeviceType> applyChangesMadeToPolicies() throws PolicyManagementException;
List<String> applyChangesMadeToPolicies() throws PolicyManagementException;
void addAppliedPolicyToDevice(DeviceIdentifier deviceIdentifier, Policy policy) throws PolicyManagementException;

@ -681,7 +681,7 @@ public class PolicyManagerImpl implements PolicyManager {
List<Policy> allPolicies = PolicyCacheManagerImpl.getInstance().getAllPolicies();
for (Policy policy : allPolicies) {
if (policy.getProfile().getDeviceType().getName().equalsIgnoreCase(deviceTypeName)) {
if (policy.getProfile().getDeviceType().equalsIgnoreCase(deviceTypeName)) {
policies.add(policy);
}
}
@ -843,9 +843,9 @@ public class PolicyManagerImpl implements PolicyManager {
}
@Override
public List<DeviceType> applyChangesMadeToPolicies() throws PolicyManagementException {
public List<String> applyChangesMadeToPolicies() throws PolicyManagementException {
List<DeviceType> changedDeviceTypes = new ArrayList<>();
List<String> changedDeviceTypes = new ArrayList<>();
try {
//HashMap<Integer, Integer> map = policyDAO.getUpdatedPolicyIdandDeviceTypeId();
List<Policy> updatedPolicies = new ArrayList<>();

@ -144,8 +144,6 @@ public class ProfileManagerImpl implements ProfileManager {
public Profile getProfile(int profileId) throws ProfileManagementException {
Profile profile;
List<ProfileFeature> featureList;
DeviceType deviceType = null;
try {
PolicyManagementDAOFactory.openConnection();
profile = profileDAO.getProfile(profileId);
@ -161,41 +159,12 @@ public class ProfileManagerImpl implements ProfileManager {
} finally {
PolicyManagementDAOFactory.closeConnection();
}
try {
DeviceManagementDAOFactory.openConnection();
deviceType = deviceTypeDAO.getDeviceType(profile.getDeviceType().getId());
} catch (DeviceManagementDAOException e) {
throw new ProfileManagementException("Error occurred while getting features related profile id (" +
profileId + ")", e);
} catch (SQLException e) {
throw new ProfileManagementException("SQL exception occurred while getting features related profile id (" +
profileId + ")", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
profile.setDeviceType(deviceType);
return profile;
}
@Override
public List<Profile> getAllProfiles() throws ProfileManagementException {
List<Profile> profileList;
List<DeviceType> deviceTypes;
try {
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
DeviceManagementDAOFactory.openConnection();
deviceTypes = deviceTypeDAO.getDeviceTypes(tenantId);
} catch (SQLException e) {
throw new ProfileManagementException("Error occurred while opening a connection to the data source", e);
} catch (DeviceManagementDAOException e) {
throw new ProfileManagementException("Error occurred while retrieving device type information", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
try {
PolicyManagementDAOFactory.openConnection();
profileList = profileDAO.getAllProfiles();
@ -210,12 +179,6 @@ public class ProfileManagerImpl implements ProfileManager {
}
}
profile.setProfileFeaturesList(list);
for (DeviceType deviceType : deviceTypes) {
if (profile.getDeviceType().getId() == deviceType.getId()) {
profile.setDeviceType(deviceType);
}
}
}
} catch (ProfileManagerDAOException e) {
throw new ProfileManagementException("Error occurred while getting profiles", e);
@ -225,29 +188,14 @@ public class ProfileManagerImpl implements ProfileManager {
throw new ProfileManagementException("Error occurred while opening a connection to the data source", e);
} finally {
PolicyManagementDAOFactory.closeConnection();
// DeviceManagementDAOFactory.closeConnection();
}
return profileList;
}
@Override
public List<Profile> getProfilesOfDeviceType(String deviceTypeName) throws ProfileManagementException {
public List<Profile> getProfilesOfDeviceType(String deviceType) throws ProfileManagementException {
List<Profile> profileList;
List<ProfileFeature> featureList;
DeviceType deviceType;
try {
DeviceManagementDAOFactory.openConnection();
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
deviceType = deviceTypeDAO.getDeviceType(deviceTypeName, tenantId);
} catch (DeviceManagementDAOException e) {
throw new ProfileManagementException("Error occurred while retrieving device type information", e);
} catch (SQLException e) {
throw new ProfileManagementException("Error occurred while opening a connection to the data source", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
try {
PolicyManagementDAOFactory.openConnection();

@ -59,13 +59,25 @@ public class MonitoringTestCase extends BasePolicyManagementDAOTest {
}
@Test
public void testMonitorDao() throws PolicyManagementException, DeviceManagementException {
public void testMonitorDao() {
DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl();
PolicyManagerService policyManagerService = new PolicyManagerServiceImpl();
List<Policy> policies = policyManagerService.getPolicies(ANDROID);
List<Device> devices = service.getAllDevices(ANDROID);
List<Policy> policies = null;
List<Device> devices = null;
try {
policies = policyManagerService.getPolicies(ANDROID);
devices = service.getAllDevices(ANDROID);
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving the list of policies defined against the device type '" +
ANDROID + "'", e);
Assert.fail();
} catch (DeviceManagementException e) {
log.error("Error occurred while retrieving the list of devices pertaining to the type '" +
ANDROID + "'", e);
Assert.fail();
}
for (Policy policy : policies) {
log.debug("Policy Name : " + policy.getPolicyName());

@ -17,6 +17,7 @@
*/
package org.wso2.carbon.policy.mgt.core;
import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.annotations.BeforeClass;
@ -63,10 +64,11 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
deviceTypeDAO.addDeviceType(DeviceTypeCreator.getDeviceType(), -1234, true);
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
throw new DeviceManagementDAOException("Error occurred while adding dummy device type", e);
log.error("Error occurred while adding dummy device type", e);
Assert.fail();
} catch (TransactionManagementException e) {
throw new DeviceManagementDAOException("Error occurred while initiating a transaction to add dummy " +
"device type", e);
log.error("Error occurred while initiating a transaction to add dummy device type", e);
Assert.fail();
} finally {
DeviceManagementDAOFactory.closeConnection();
}
@ -94,10 +96,12 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
enrollmentDAO.addEnrollment(id, device.getEnrolmentInfo(), -1234);
}
} catch (TransactionManagementException e) {
throw new PolicyManagementException("Error occurred while adding device enrolment", e);
log.error("Error occurred while adding device enrolment", e);
Assert.fail();
} catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction();
throw new PolicyManagementException("Error occurred while adding device information", e);
log.error("Error occurred while adding device information", e);
Assert.fail();
} finally {
DeviceManagementDAOFactory.closeConnection();
}
@ -107,7 +111,9 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
PolicyManagementDataHolder.getInstance().setDeviceManagementService(service);
log.debug("Printing device taken by calling the service layer with device type.");
if (log.isDebugEnabled()) {
log.debug("Printing device taken by calling the service layer with device type.");
}
List<Device> devices3 = service.getAllDevices("android");
log.debug("Device list size ...! " + devices3.size());
@ -141,14 +147,19 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
}
@Test(dependsOnMethods = ("addProfileFeatures"))
public void addPolicy() throws PolicyManagementException, ProfileManagementException {
public void addPolicy() {
// ProfileManager profileManager = new ProfileManagerImpl();
Profile profile = ProfileCreator.getProfile5(FeatureCreator.getFeatureList5());
try {
Profile profile = ProfileCreator.getProfile5(FeatureCreator.getFeatureList5());
// profileManager.addProfile(profile);
PolicyAdministratorPoint pap = new PolicyAdministratorPointImpl();
policy = PolicyCreator.createPolicy(profile);
policy = pap.addPolicy(policy);
pap.activatePolicy(policy.getId());
PolicyAdministratorPoint pap = new PolicyAdministratorPointImpl();
policy = PolicyCreator.createPolicy(profile);
policy = pap.addPolicy(policy);
pap.activatePolicy(policy.getId());
} catch (PolicyManagementException e) {
log.error("Error occurred while adding the policy", e);
Assert.fail();
}
}
@Test(dependsOnMethods = ("addPolicy"))
@ -205,9 +216,15 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
}
@Test(dependsOnMethods = ("addNewPolicy"))
public void getPolicies() throws PolicyManagementException {
public void getPolicies() {
PolicyAdministratorPoint policyAdministratorPoint = new PolicyAdministratorPointImpl();
List<Policy> policyList = policyAdministratorPoint.getPolicies();
List<Policy> policyList = null;
try {
policyList = policyAdministratorPoint.getPolicies();
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving all the policies registered in the system", e);
Assert.fail();
}
log.debug("----------All policies---------");
@ -228,10 +245,16 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
}
@Test(dependsOnMethods = ("getPolicies"))
public void getDeviceTypeRelatedPolicy() throws PolicyManagementException {
public void getDeviceTypeRelatedPolicy() {
PolicyAdministratorPoint policyAdministratorPoint = new PolicyAdministratorPointImpl();
List<Policy> policyList = policyAdministratorPoint.getPoliciesOfDeviceType("android");
List<Policy> policyList = null;
try {
policyList = policyAdministratorPoint.getPoliciesOfDeviceType("android");
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving the list of policies configured upon the platform 'android'", e);
Assert.fail();
}
log.debug("----------Device type related policy---------");
@ -253,10 +276,17 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
@Test(dependsOnMethods = ("getDeviceTypeRelatedPolicy"))
public void getUserRelatedPolicy() throws PolicyManagementException {
public void getUserRelatedPolicy() {
String targetUser = "Dilshan";
PolicyAdministratorPoint policyAdministratorPoint = new PolicyAdministratorPointImpl();
List<Policy> policyList = policyAdministratorPoint.getPoliciesOfUser("Dilshan");
List<Policy> policyList = null;
try {
policyList = policyAdministratorPoint.getPoliciesOfUser(targetUser);
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving the list of policies assigned to the user '" +
targetUser + "'", e);
Assert.fail();
}
log.debug("----------User related policy---------");
@ -277,10 +307,17 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest {
}
@Test(dependsOnMethods = ("getDeviceTypeRelatedPolicy"))
public void getRoleRelatedPolicy() throws PolicyManagementException {
public void getRoleRelatedPolicy() {
String targetRole = "Test_ROLE_01";
PolicyAdministratorPoint policyAdministratorPoint = new PolicyAdministratorPointImpl();
List<Policy> policyList = policyAdministratorPoint.getPoliciesOfRole("Test_ROLE_01");
List<Policy> policyList = null;
try {
policyList = policyAdministratorPoint.getPoliciesOfRole(targetRole);
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving the list of policies defined against the role '" +
targetRole + "'", e);
Assert.fail();
}
log.debug("----------Roles related policy---------");

@ -19,6 +19,7 @@
package org.wso2.carbon.policy.mgt.core;
import junit.framework.Assert;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.annotations.BeforeClass;
@ -54,18 +55,37 @@ public class PolicyEvaluationTestCase extends BasePolicyManagementDAOTest {
}
@Test
public void activatePolicies() throws PolicyManagementException, TaskException {
public void activatePolicies() {
PolicyManagerService policyManagerService = new PolicyManagerServiceImpl();
PolicyAdministratorPoint administratorPoint = policyManagerService.getPAP();
PolicyAdministratorPoint administratorPoint = null;
try {
administratorPoint = policyManagerService.getPAP();
} catch (PolicyManagementException e) {
log.error("Error occurred while loading the policy administration point", e);
Assert.fail();
}
List<Policy> policies = policyManagerService.getPolicies(ANDROID);
List<Policy> policies = null;
try {
policies = policyManagerService.getPolicies(ANDROID);
} catch (PolicyManagementException e) {
log.error("Error occurred while retrieving the list of policies defined against the device type '" +
ANDROID + "'", e);
Assert.fail();
}
for (Policy policy : policies) {
log.debug("Policy status : " + policy.getPolicyName() + " - " + policy.isActive() + " - " + policy
.isUpdated() + " Policy id : " + policy.getId());
if (!policy.isActive()) {
administratorPoint.activatePolicy(policy.getId());
try {
administratorPoint.activatePolicy(policy.getId());
} catch (PolicyManagementException e) {
log.error("Error occurred while activating the policy, which carries the id '" +
policy.getId() + "'", e);
Assert.fail();
}
}
}
// This cannot be called due to task service cannot be started from the

@ -29,60 +29,40 @@ public class ProfileCreator {
public static Profile getProfile(List<Feature> features) {
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
deviceType.setId(1);
deviceType.setName("android");
profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features));
profile.setProfileName("Test Profile");
profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
profile.setDeviceType(deviceType);
profile.setDeviceType("android");
return profile;
}
public static Profile getProfile2(List<Feature> features) {
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
deviceType.setId(1);
deviceType.setName("android");
profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features));
profile.setProfileName("Test Profile 2");
profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
profile.setDeviceType(deviceType);
profile.setDeviceType("android");
return profile;
}
public static Profile getProfile3(List<Feature> features) {
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
deviceType.setId(1);
deviceType.setName("android");
profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features));
profile.setProfileName("Test Profile 3");
profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
profile.setDeviceType(deviceType);
profile.setDeviceType("android");
return profile;
}
public static Profile getProfile4(List<Feature> features) {
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
deviceType.setId(1);
deviceType.setName("android");
profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features));
profile.setProfileName("Test Profile 4");
profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
profile.setDeviceType(deviceType);
profile.setDeviceType("android");
return profile;
}
@ -90,15 +70,10 @@ public class ProfileCreator {
public static Profile getProfile5(List<Feature> features) {
Profile profile = new Profile();
DeviceType deviceType = new DeviceType();
deviceType.setId(1);
deviceType.setName("android");
profile.setProfileFeaturesList(ProfileFeatureCreator.getProfileFeature(features));
profile.setProfileName("Test Profile 5");
profile.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
profile.setDeviceType(deviceType);
profile.setDeviceType("android");
return profile;
}

@ -38,7 +38,9 @@ public class ProfileFeatureCreator {
} else {
profileFeature.setContent(getJSON2());
}
profileFeature.setDeviceTypeId(1);
//TODO why assigning a random number below?
//profileFeature.setDeviceTypeId(1);
profileFeature.setDeviceType("android");
profileFeature.setFeatureCode(feature.getCode());
// profileFeature.setContent("mm");

@ -141,13 +141,13 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
ID INT NOT NULL AUTO_INCREMENT ,
PROFILE_NAME VARCHAR(45) NOT NULL ,
TENANT_ID INT NOT NULL ,
DEVICE_TYPE_ID INT NOT NULL ,
DEVICE_TYPE VARCHAR(20) NOT NULL ,
CREATED_TIME DATETIME NOT NULL ,
UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID )
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME )
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ID INT(11) NOT NULL ,
DEVICE_TYPE_ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(20) NOT NULL ,
POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DEVICE_TYPE_POLICY
@ -211,8 +211,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID )
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
@ -225,7 +225,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ID INT(11) NOT NULL AUTO_INCREMENT,
PROFILE_ID INT(11) NOT NULL,
FEATURE_CODE VARCHAR(100) NOT NULL,
DEVICE_TYPE_ID INT NOT NULL,
DEVICE_TYPE VARCHAR(20) NOT NULL,
TENANT_ID INT(11) NOT NULL ,
CONTENT BLOB NULL DEFAULT NULL,
PRIMARY KEY (ID),
@ -346,7 +346,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID INT NOT NULL AUTO_INCREMENT,
POLICY_ID INT NOT NULL,
DEVICE_TYPE_ID INT NOT NULL,
DEVICE_TYPE VARCHAR(20) NOT NULL,
TENANT_ID INT(11) NOT NULL,
PRIMARY KEY (ID)
);

@ -3,14 +3,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.simple.policy.decision.point</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Simple Policy Decision Point</name>
<description>WSO2 Carbon - Simple Policy Decision Point</description>

@ -23,13 +23,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>policy-mgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Policy Management Component</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.webapp.authenticator.framework</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Web Application Authenticator Framework Bundle</name>
<description>WSO2 Carbon - Web Application Authenticator Framework Bundle</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>webapp-authenticator-framework</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Webapp Authenticator Framework</name>
<url>http://wso2.org</url>

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.application.extension.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Application Extension Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a api application registration, which takes care of subscription

@ -21,14 +21,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.apimgt.webapp.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - API Management Webapp Publisher Feature</name>
<url>http://wso2.org</url>
<description>This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>apimgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - API Management Extensions Feature</name>
<url>http://wso2.org</url>

@ -17,14 +17,12 @@
~ 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">
<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>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -17,14 +17,12 @@
~ 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">
<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>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.certificate.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Certificate Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for back-end Certificate Management functionality

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>certificate-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Certificate Management Feature</name>
<url>http://wso2.org</url>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.gcm.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - GCM Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - MQTT Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - MQTT Based Push Notification Provider Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-extensions-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - XMPP Based Push Notification Provider Feature</name>
<url>http://wso2.org</url>
<description>WSO2 Carbon - XMPP Based Push Notification Provider Feature</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>carbon-devicemgt</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

@ -3,13 +3,13 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.dashboard.feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Device Management Dashboard Analytics Feature</name>
<description>WSO2 Carbon - Device Management Dashboard Analytics Feature</description>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.analytics.data.publisher.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains bundles related to device analytics data publisher</description>

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -4,14 +4,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.extensions.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Extensions Feature</name>
<url>http://wso2.org</url>
<description>This feature contains common extensions used by key device management functionalities

@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.2-SNAPSHOT</version>
<name>WSO2 Carbon - Device Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Device Management functionality

@ -141,13 +141,13 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE (
ID INT NOT NULL AUTO_INCREMENT ,
PROFILE_NAME VARCHAR(45) NOT NULL ,
TENANT_ID INT NOT NULL ,
DEVICE_TYPE_ID INT NOT NULL ,
DEVICE_TYPE VARCHAR(20) NOT NULL ,
CREATED_TIME DATETIME NOT NULL ,
UPDATED_TIME DATETIME NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT DM_PROFILE_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID )
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
@ -202,7 +202,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ID INT(11) NOT NULL ,
DEVICE_TYPE_ID INT(11) NOT NULL ,
DEVICE_TYPE VARCHAR(20) NOT NULL ,
POLICY_ID INT(11) NOT NULL ,
PRIMARY KEY (ID) ,
CONSTRAINT FK_DEVICE_TYPE_POLICY
@ -211,8 +211,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY (
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT FK_DEVICE_TYPE_POLICY_DEVICE_TYPE
FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID )
FOREIGN KEY (DEVICE_TYPE )
REFERENCES DM_DEVICE_TYPE (NAME)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
@ -225,7 +225,7 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES (
ID INT(11) NOT NULL AUTO_INCREMENT,
PROFILE_ID INT(11) NOT NULL,
FEATURE_CODE VARCHAR(100) NOT NULL,
DEVICE_TYPE_ID INT NOT NULL,
DEVICE_TYPE VARCHAR(20) NOT NULL,
TENANT_ID INT(11) NOT NULL ,
CONTENT BLOB NULL DEFAULT NULL,
PRIMARY KEY (ID),
@ -346,7 +346,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
ID INT NOT NULL AUTO_INCREMENT,
POLICY_ID INT NOT NULL,
DEVICE_TYPE_ID INT NOT NULL,
DEVICE_TYPE VARCHAR(20) NOT NULL,
TENANT_ID INT(11) NOT NULL,
PRIMARY KEY (ID)
);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save