Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Megala 2016-10-01 22:02:35 +05:30
commit bacd7ccfd2
113 changed files with 1482 additions and 1127 deletions

View File

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

View File

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

View File

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

View File

@ -33,7 +33,6 @@ import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;

View File

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

View File

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

View File

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.2.2-SNAPSHOT</version> <version>1.2.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -22,7 +22,7 @@
<parent> <parent>
<artifactId>certificate-mgt</artifactId> <artifactId>certificate-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.2.2-SNAPSHOT</version> <version>1.2.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext; import org.wso2.carbon.device.mgt.common.push.notification.NotificationContext;
import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy; import org.wso2.carbon.device.mgt.common.push.notification.NotificationStrategy;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
@ -77,17 +78,22 @@ public class MQTTNotificationStrategy implements NotificationStrategy {
@Override @Override
public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException { public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException {
Map<String, String> dynamicProperties = new HashMap<>(); Map<String, String> dynamicProperties = new HashMap<>();
Properties properties = ctx.getOperation().getProperties(); Operation operation = ctx.getOperation();
Properties properties = operation.getProperties();
if (properties != null && properties.get(MQTT_ADAPTER_TOPIC) != null) { if (properties != null && properties.get(MQTT_ADAPTER_TOPIC) != null) {
dynamicProperties.put("topic", (String) properties.get(MQTT_ADAPTER_TOPIC)); dynamicProperties.put("topic", (String) properties.get(MQTT_ADAPTER_TOPIC));
} else { } else {
String topic = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true) + "/" String topic = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(true) + "/"
+ ctx.getDeviceId().getType() + "/" + ctx.getDeviceId().getId() + "/" + ctx.getOperation().getType(); + ctx.getDeviceId().getType() + "/" + ctx.getDeviceId().getId() + "/" + operation.getType()
+ "/" + operation.getCode();
dynamicProperties.put("topic", topic); dynamicProperties.put("topic", topic);
if (operation.getPayLoad() == null) {
operation.setPayLoad("");
}
} }
MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties, MQTTDataHolder.getInstance().getOutputEventAdapterService().publish(mqttAdapterName, dynamicProperties,
ctx.getOperation().getPayLoad()); operation.getPayLoad());
} }
@Override @Override

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,17 +18,29 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.api; package org.wso2.carbon.device.mgt.jaxrs.service.api;
import io.swagger.annotations.*; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission; 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.DeviceTypeList;
import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse;
import javax.ws.rs.*; import javax.validation.constraints.Size;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@API(name = "Device Type Management", version = "1.0.0", context = "/api/device-mgt/v1.0/admin/device-types", tags = {"devicemgt_admin"}) @API(name = "Device Type Management", version = "1.0.0", context = "/api/device-mgt/v1.0/admin/device-types",
tags = {"devicemgt_admin"})
@Path("/device-types") @Path("/device-types")
@Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " + @Api(value = "Device Type Management", description = "This API corresponds to all tasks related to device " +
@ -60,14 +72,17 @@ public interface DeviceTypeManagementService {
"Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
@ResponseHeader( @ResponseHeader(
name = "Last-Modified", name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" + description =
"Used by caches, or in conditional requests."), "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
} }
), ),
@ApiResponse( @ApiResponse(
code = 304, code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of " + message =
"the requested resource."), "Not Modified. \n Empty body because the client has already the latest version of" +
" " +
"the requested resource."),
@ApiResponse( @ApiResponse(
code = 406, code = 406,
message = "Not Acceptable.\n The requested media type is not supported"), message = "Not Acceptable.\n The requested media type is not supported"),
@ -85,6 +100,66 @@ public interface DeviceTypeManagementService {
value = "Validates if the requested variant has not been modified since the time specified", value = "Validates if the requested variant has not been modified since the time specified",
required = false) required = false)
@HeaderParam("If-Modified-Since") @HeaderParam("If-Modified-Since")
String ifModifiedSince); String ifModifiedSince);
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get the list of features for a give device type.",
notes = "Retrieves the list of features of a given device type.",
tags = "Device Type Management")
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the list of supported features.",
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(name = "View Device Types", permission = "/device-mgt/devices/owning-device/view")
Response getFeatures(
@ApiParam(
name = "type",
value = "The device type, such as ios, android or windows.",
required = true)
@PathParam("type")
@Size(max = 45)
String type,
@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);
} }

View File

@ -18,85 +18,96 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.api; package org.wso2.carbon.device.mgt.jaxrs.service.api;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import javax.ws.rs.*; import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
//@Path("/groups") @API(name = "Group Management", version = "1.0.0", context = "/api/device-mgt/v1.0/groups", tags = {"devicemgt_admin"})
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON) @Path("/groups")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface GroupManagementService { public interface GroupManagementService {
// @GET @GET
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"}) @Permission(name = "View Group", permission = "/permission/admin/device-mgt/user/groups/list")
// Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset, Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit); @QueryParam("limit") int limit);
//
// @POST
// @Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/add"})
// Response createGroup(DeviceGroup group);
//
// @Path("/{groupName}")
// @GET
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/view"})
// Response getGroup(@PathParam("groupName") String groupName);
//
// @Path("/{groupName}")
// @PUT
// @Permission(scope = "group-modify", permissions = {"/permission/admin/device-mgt/user/groups/update"})
// Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup);
//
// @Path("/{groupName}")
// @DELETE
// @Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/remove"})
// Response deleteGroup(@PathParam("groupName") String groupName);
//
// @Path("/{groupName}/share-with-user")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
// Response shareGroupWithUser(@PathParam("groupName") String groupName, String targetUser);
//
// @Path("/{groupName}/share-with-role")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
// Response shareGroupWithRole(@PathParam("groupName") String groupName, String targetRole);
//
// @Path("/{groupName}/remove-share-with-user")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
// Response removeShareWithUser(@PathParam("groupName") String groupName, String targetUser);
//
// @Path("/{groupName}/remove-share-with-role")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
// Response removeShareWithRole(@PathParam("groupName") String groupName, String targetUser);
//
// @GET
// @Path("/{groupName}/users")
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
// Response getUsersOfGroup(@PathParam("groupName") String groupName);
//
// @GET
// @Path("/{groupName}/devices")
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/groups/roles"})
// Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit);
//
// @POST
// @Path("/{groupName}/devices")
// @Produces("application/json")
// @Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/devices/add"})
// Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier);
//
// @DELETE
// @Path("/{groupName}/devices")
// @Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/devices/remove"})
// Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
// @QueryParam("id") String id);
@POST
@Permission(name = "Add Group", permission = "/permission/admin/device-mgt/user/groups/add")
Response createGroup(DeviceGroup group);
@Path("/{groupName}")
@GET
@Permission(name = "View Group", permission = "/permission/admin/device-mgt/user/groups/view")
Response getGroup(@PathParam("groupName") String groupName);
@Path("/{groupName}")
@PUT
@Permission(name = "Update Group", permission = "/permission/admin/device-mgt/user/groups/update")
Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup);
@Path("/{groupName}")
@DELETE
@Permission(name = "Remove Groups", permission = "/permission/admin/device-mgt/user/groups/remove")
Response deleteGroup(@PathParam("groupName") String groupName);
@Path("/{groupName}/share-with-user")
@POST
@Permission(name = "Share Group to a User", permission = "/permission/admin/device-mgt/user/groups/share")
Response shareGroupWithUser(@PathParam("groupName") String groupName, String targetUser);
@Path("/{groupName}/share-with-role")
@POST
@Permission(name = "Share Group to a Role", permission = "/permission/admin/device-mgt/user/groups/share")
Response shareGroupWithRole(@PathParam("groupName") String groupName, String targetRole);
@Path("/{groupName}/remove-share-with-user")
@POST
@Permission(name = "Unshare a Group", permission = "/permission/admin/device-mgt/user/groups/unshare")
Response removeShareWithUser(@PathParam("groupName") String groupName, String targetUser);
@Path("/{groupName}/remove-share-with-role")
@POST
@Permission(name = "Unshare a Group", permission = "/permission/admin/device-mgt/user/groups/unshare")
Response removeShareWithRole(@PathParam("groupName") String groupName, String targetUser);
@GET
@Path("/{groupName}/users")
@Permission(name = "Get Users of Group", permission = "/permission/admin/device-mgt/user/groups/list")
Response getUsersOfGroup(@PathParam("groupName") String groupName);
@GET
@Path("/{groupName}/devices")
@Permission(name = "Get Devices of Group", permission = "/permission/admin/device-mgt/groups/roles")
Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
@QueryParam("limit") int limit);
@POST
@Path("/{groupName}/devices")
@Produces("application/json")
@Permission(name = "Add Device to a Group", permission = "/permission/admin/device-mgt/user/groups/devices/add")
Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier);
@DELETE
@Path("/{groupName}/devices")
@Permission(name = "Remove Devices from Group",
permission = "/permission/admin/device-mgt/user/groups/devices/remove")
Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
@QueryParam("id") String id);
} }

View File

@ -18,82 +18,92 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; package org.wso2.carbon.device.mgt.jaxrs.service.api.admin;
import io.swagger.annotations.*; import io.swagger.annotations.Api;
import org.wso2.carbon.apimgt.annotations.api.Scope; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ResponseHeader;
import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper; import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper;
import javax.ws.rs.*; import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.Date;
//@Path("/admin/groups") @API(name = "Group Management Admin", version = "1.0.0", context = "/api/device-mgt/v1.0/admin/groups", tags = {"devicemgt_admin"})
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON) @Path("/admin/groups")
//@Api(value = "Group Management Administrative Service", description = "This an API intended to be used by " + @Produces(MediaType.APPLICATION_JSON)
// "'internal' components to log in as an admin user and do a selected number of operations. " + @Consumes(MediaType.APPLICATION_JSON)
// "Further, this is strictly restricted to admin users only ") @Api(value = "Group Management Administrative Service", description = "This an API intended to be used by " +
"'internal' components to log in as an admin user and do a selected number of operations. " +
"Further, this is strictly restricted to admin users only ")
public interface GroupManagementAdminService { public interface GroupManagementAdminService {
// @GET @GET
// @ApiOperation( @ApiOperation(
// produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
// httpMethod = "GET", httpMethod = "GET",
// value = "Get groups by the name.", value = "Get groups by the name.",
// notes = "Get devices the name of device and tenant.", notes = "Get devices the name of device and tenant.",
// response = DeviceGroupWrapper.class, response = DeviceGroupWrapper.class,
// responseContainer = "List", responseContainer = "List",
// tags = "Group Management Administrative Service") tags = "Group Management Administrative Service")
// @ApiResponses(value = { @ApiResponses(value = {
// @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of groups.", @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of groups.",
// response = DeviceGroupWrapper.class, response = DeviceGroupWrapper.class,
// responseContainer = "List", responseContainer = "List",
// responseHeaders = { responseHeaders = {
// @ResponseHeader( @ResponseHeader(
// name = "Content-Type", name = "Content-Type",
// description = "The content type of the body"), description = "The content type of the body"),
// @ResponseHeader( @ResponseHeader(
// name = "ETag", name = "ETag",
// description = "Entity Tag of the response resource.\n" + description = "Entity Tag of the response resource.\n" +
// "Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
// @ResponseHeader( @ResponseHeader(
// name = "Last-Modified", name = "Last-Modified",
// description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource has been modified the last time.\n" +
// "Used by caches, or in conditional requests."), "Used by caches, or in conditional requests."),
// }), }),
// @ApiResponse( @ApiResponse(
// code = 304, code = 304,
// message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), message = "Not Modified. \n Empty body because the client has already the latest version of the " +
// @ApiResponse( "requested resource."),
// code = 406, @ApiResponse(
// message = "Not Acceptable.\n The requested media type is not supported"), code = 406,
// @ApiResponse( message = "Not Acceptable.\n The requested media type is not supported"),
// code = 500, @ApiResponse(
// message = "Internal Server ErrorResponse. \n Server error occurred while fetching the group list.") code = 500,
// }) message = "Internal Server ErrorResponse. \n Server error occurred while fetching the group list.")
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"}) })
// Response getGroupsOfUser( @Permission(name = "View All Groups", permission = "/permission/admin/device-mgt/user/groups/list")
// @ApiParam( Response getGroupsOfUser(
// name = "username", @ApiParam(
// value = "Username of the user.", name = "username",
// required = true) value = "Username of the user.",
// @QueryParam("username") String username, required = true)
// @ApiParam( @QueryParam("username") String username,
// name = "If-Modified-Since", @ApiParam(
// value = "Timestamp of the last modified date", name = "If-Modified-Since",
// required = false) value = "Timestamp of the last modified date",
// @HeaderParam("If-Modified-Since") String timestamp, required = false)
// @ApiParam( @HeaderParam("If-Modified-Since") String timestamp,
// name = "offset", @ApiParam(
// value = "Starting point within the complete list of items qualified.", name = "offset",
// required = false) value = "Starting point within the complete list of items qualified.",
// @QueryParam("offset") int offset, required = false)
// @ApiParam( @QueryParam("offset") int offset,
// name = "limit", @ApiParam(
// value = "Maximum size of resource array to return.", name = "limit",
// required = false) value = "Maximum size of resource array to return.",
// @QueryParam("limit") int limit); required = false)
// @QueryParam("limit") int limit);
} }

View File

@ -21,14 +21,20 @@ package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList; 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.beans.ErrorResponse;
import org.wso2.carbon.device.mgt.jaxrs.service.api.DeviceTypeManagementService; import org.wso2.carbon.device.mgt.jaxrs.service.api.DeviceTypeManagementService;
import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import javax.validation.constraints.Size;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam; import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@ -56,4 +62,28 @@ public class DeviceTypeManagementServiceImpl implements DeviceTypeManagementServ
} }
} }
@GET
@Override
@Path("/{type}/features")
public Response getFeatures(@PathParam("type") @Size(max = 45) String type, @HeaderParam("If-Modified-Since") String ifModifiedSince) {
List<Feature> features;
DeviceManagementProviderService dms;
try {
dms = DeviceMgtAPIUtils.getDeviceManagementService();
FeatureManager fm = dms.getFeatureManager(type);
if (fm == null) {
return Response.status(Response.Status.NOT_FOUND).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("No feature manager is " +
"registered with the given type '" + type + "'").build()).build();
}
features = fm.getFeatures();
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the list of features of '" + type + "' device type";
log.error(msg, e);
return Response.serverError().entity(
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
return Response.status(Response.Status.OK).entity(features).build();
}
} }

View File

@ -18,10 +18,6 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.impl; package org.wso2.carbon.device.mgt.jaxrs.service.impl;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import org.wso2.carbon.device.mgt.jaxrs.service.api.GroupManagementService;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
@ -33,105 +29,108 @@ import org.wso2.carbon.device.mgt.jaxrs.service.api.GroupManagementService;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper; import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper;
import javax.ws.rs.*; import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
//@Path("/groups") @Path("/groups")
//@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public class GroupManagementServiceImpl implements GroupManagementService { public class GroupManagementServiceImpl implements GroupManagementService {
// private static final Log log = LogFactory.getLog(GroupManagementServiceImpl.class); private static final Log log = LogFactory.getLog(GroupManagementServiceImpl.class);
//
// @Override
// public Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit) {
// try {
// List<DeviceGroupWrapper> groupWrappers = new ArrayList<>();
// GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
// List<DeviceGroup> deviceGroups = service.getGroups(user);
// int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
// for (DeviceGroup dg : deviceGroups) {
// DeviceGroupWrapper gw = new DeviceGroupWrapper();
// gw.setId(dg.getId());
// gw.setOwner(dg.getOwner());
// gw.setName(dg.getName());
// gw.setTenantId(tenantId);
// groupWrappers.add(gw);
// }
// return Response.status(Response.Status.OK).entity(groupWrappers).build();
// } catch (GroupManagementException e) {
// String error = "ErrorResponse occurred while getting the groups related to users for policy.";
// log.error(error, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
// }
// }
//
// @Override
// public Response createGroup(DeviceGroup group) {
// return null;
// }
//
// @Override
// public Response getGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup) {
// return null;
// }
//
// @Override
// public Response deleteGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response shareGroupWithUser(String groupName, String targetUser) {
// return null;
// }
//
// @Override
// public Response shareGroupWithRole(String groupName, String targetRole) {
// return null;
// }
//
// @Override
// public Response removeShareWithUser(@PathParam("groupName") String groupName,
// @QueryParam("username") String targetUser) {
// return null;
// }
//
// @Override
// public Response removeShareWithRole(@PathParam("groupName") String groupName,
// @QueryParam("roleName") String targetUser) {
// return null;
// }
//
// @Override
// public Response getUsersOfGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit) {
// return null;
// }
//
// @Override
// public Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier) {
// return null;
// }
//
// @Override
// public Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
// @QueryParam("id") String id) {
// return null;
// }
@Override
public Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
try {
List<DeviceGroupWrapper> groupWrappers = new ArrayList<>();
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
List<DeviceGroup> deviceGroups = service.getGroups(user);
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
for (DeviceGroup dg : deviceGroups) {
DeviceGroupWrapper gw = new DeviceGroupWrapper();
gw.setId(dg.getId());
gw.setOwner(dg.getOwner());
gw.setName(dg.getName());
gw.setTenantId(tenantId);
groupWrappers.add(gw);
}
return Response.status(Response.Status.OK).entity(groupWrappers).build();
} catch (GroupManagementException e) {
String error = "ErrorResponse occurred while getting the groups related to users for policy.";
log.error(error, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
}
}
@Override
public Response createGroup(DeviceGroup group) {
return null;
}
@Override
public Response getGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup) {
return null;
}
@Override
public Response deleteGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response shareGroupWithUser(String groupName, String targetUser) {
return null;
}
@Override
public Response shareGroupWithRole(String groupName, String targetRole) {
return null;
}
@Override
public Response removeShareWithUser(@PathParam("groupName") String groupName,
@QueryParam("username") String targetUser) {
return null;
}
@Override
public Response removeShareWithRole(@PathParam("groupName") String groupName,
@QueryParam("roleName") String targetUser) {
return null;
}
@Override
public Response getUsersOfGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
return null;
}
@Override
public Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier) {
return null;
}
@Override
public Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
@QueryParam("id") String id) {
return null;
}
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.wso2.carbon.device.mgt.jaxrs.service.impl.admin; package org.wso2.carbon.device.mgt.jaxrs.service.impl.admin;
import io.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.PaginationResult; import org.wso2.carbon.device.mgt.common.PaginationResult;
@ -26,37 +25,42 @@ import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.GroupManagementAdminService; import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.GroupManagementAdminService;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import javax.ws.rs.*; import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.Date;
//@Path("/admin/groups") @Path("/admin/groups")
//@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public class GroupManagementAdminServiceImpl implements GroupManagementAdminService { public class GroupManagementAdminServiceImpl implements GroupManagementAdminService {
//
// private static final Log log = LogFactory.getLog(GroupManagementAdminServiceImpl.class); private static final Log log = LogFactory.getLog(GroupManagementAdminServiceImpl.class);
//
// @Override @GET
// public Response getGroupsOfUser( @Override
// @QueryParam("username") String username, public Response getGroupsOfUser(
// @HeaderParam("If-Modified-Since") String timestamp, @QueryParam("username") String username,
// @QueryParam("offset") int offset, @HeaderParam("If-Modified-Since") String timestamp,
// @QueryParam("limit") int limit) { @QueryParam("offset") int offset,
// try { @QueryParam("limit") int limit) {
// PaginationResult result = try {
// DeviceMgtAPIUtils.getGroupManagementProviderService().getGroups(username, offset, limit); PaginationResult result =
// if (result != null && result.getRecordsTotal() > 0) { DeviceMgtAPIUtils.getGroupManagementProviderService().getGroups(username, offset, limit);
// return Response.status(Response.Status.OK).entity(result).build(); if (result != null && result.getRecordsTotal() > 0) {
// } else { return Response.status(Response.Status.OK).entity(result).build();
// return Response.status(Response.Status.NOT_FOUND).build(); } else {
// } return Response.status(Response.Status.NOT_FOUND).build();
// } catch (GroupManagementException e) { }
// String msg = "ErrorResponse occurred while retrieving the groups of user '" + username + "'"; } catch (GroupManagementException e) {
// log.error(msg, e); String msg = "ErrorResponse occurred while retrieving the groups of user '" + username + "'";
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); log.error(msg, e);
// } return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
// } }
}
} }

View File

@ -73,7 +73,7 @@
<bean id="policyManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.PolicyManagementServiceImpl"/> <bean id="policyManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.PolicyManagementServiceImpl"/>
<bean id="roleManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.RoleManagementServiceImpl"/> <bean id="roleManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.RoleManagementServiceImpl"/>
<bean id="userManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.UserManagementServiceImpl"/> <bean id="userManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.UserManagementServiceImpl"/>
<!--<bean id="groupManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.GroupManagementServiceImpl"/>--> <bean id="groupManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.GroupManagementServiceImpl"/>
<bean id="deviceManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceManagementAdminServiceImpl"/> <bean id="deviceManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceManagementAdminServiceImpl"/>
<bean id="applicationManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.ApplicationManagementAdminServiceImpl"/> <bean id="applicationManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.ApplicationManagementAdminServiceImpl"/>
<bean id="groupManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.GroupManagementAdminServiceImpl"/> <bean id="groupManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.GroupManagementAdminServiceImpl"/>

View File

@ -21,7 +21,7 @@
<parent> <parent>
<artifactId>device-mgt</artifactId> <artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<version>1.2.2-SNAPSHOT</version> <version>1.2.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -48,10 +48,10 @@
org.wso2.carbon.device.mgt.common.* org.wso2.carbon.device.mgt.common.*
</Export-Package> </Export-Package>
<Import-Package> <Import-Package>
javax.xml.bind.annotation, javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}",
com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", com.fasterxml.jackson.annotation;version="${jackson-annotations.version}",
org.wso2.carbon.apimgt.api.model.*;version="${carbon.api.mgt.version.range}", org.wso2.carbon.apimgt.api.model.*;version="${carbon.api.mgt.version.range}",
io.swagger.annotations.*;resolution:=optional io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional
</Import-Package> </Import-Package>
</instructions> </instructions>
</configuration> </configuration>

View File

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

View File

@ -334,6 +334,16 @@ public interface DeviceDAO {
EnrolmentInfo getEnrolment(DeviceIdentifier deviceId, String currentUser, EnrolmentInfo getEnrolment(DeviceIdentifier deviceId, String currentUser,
int tenantId) throws DeviceManagementDAOException; int tenantId) throws DeviceManagementDAOException;
/**
* This method is used to retrieve current active enrollment of a given device and tenant id.
*
* @param deviceId device id.
* @param tenantId tenant id.
* @return returns EnrolmentInfo object.
* @throws DeviceManagementDAOException
*/
EnrolmentInfo getActiveEnrolment(DeviceIdentifier deviceId, int tenantId) throws DeviceManagementDAOException;
/** /**
* This method is used to retrieve devices of a given enrollment status. * This method is used to retrieve devices of a given enrollment status.
* *

View File

@ -34,7 +34,7 @@ public interface EnrollmentDAO {
int removeEnrollment(int deviceId, String currentOwner, int tenantId) throws DeviceManagementDAOException; int removeEnrollment(int deviceId, String currentOwner, int tenantId) throws DeviceManagementDAOException;
boolean setStatus(int deviceId, String currentOwner, Status status, boolean setStatus(int enrolmentId, String currentOwner, Status status,
int tenantId) throws DeviceManagementDAOException; int tenantId) throws DeviceManagementDAOException;
Status getStatus(int deviceId, String currentOwner, int tenantId) throws DeviceManagementDAOException; Status getStatus(int deviceId, String currentOwner, int tenantId) throws DeviceManagementDAOException;

View File

@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.utils.xml.StringUtils;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -323,8 +324,10 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
rs = stmt.executeQuery(); rs = stmt.executeQuery();
devices = new ArrayList<>(); devices = new ArrayList<>();
while (rs.next()) { while (rs.next()) {
Device device = DeviceManagementDAOUtil.loadDevice(rs); Device device = DeviceManagementDAOUtil.loadActiveDevice(rs, false);
devices.add(device); if (device != null) {
devices.add(device);
}
} }
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while listing devices for type '" + type + "'", e); throw new DeviceManagementDAOException("Error occurred while listing devices for type '" + type + "'", e);
@ -780,7 +783,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
stmt.setInt(5, tenantId); stmt.setInt(5, tenantId);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
enrolmentInfo = DeviceManagementDAOUtil.loadEnrolment(rs); enrolmentInfo = DeviceManagementDAOUtil.loadMatchingEnrolment(rs);
} }
return enrolmentInfo; return enrolmentInfo;
} catch (SQLException e) { } catch (SQLException e) {
@ -791,6 +794,38 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
} }
} }
@Override
public EnrolmentInfo getActiveEnrolment(DeviceIdentifier deviceId, int tenantId) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
EnrolmentInfo enrolmentInfo = null;
try {
conn = this.getConnection();
String sql = "SELECT ID AS ENROLMENT_ID, DEVICE_ID, OWNER, OWNERSHIP, STATUS, DATE_OF_ENROLMENT, " +
"DATE_OF_LAST_UPDATE, TENANT_ID FROM DM_ENROLMENT WHERE DEVICE_ID = (SELECT d.ID " +
"FROM DM_DEVICE d, DM_DEVICE_TYPE t WHERE d.DEVICE_TYPE_ID = t.ID " +
"AND d.DEVICE_IDENTIFICATION = ? AND t.NAME = ? AND d.TENANT_ID = ?) " +
"AND TENANT_ID = ? AND STATUS in ('ACTIVE','UNREACHABLE','INACTIVE')";
stmt = conn.prepareStatement(sql);
stmt.setString(1, deviceId.getId());
stmt.setString(2, deviceId.getType());
stmt.setInt(3, tenantId);
stmt.setInt(4, tenantId);
rs = stmt.executeQuery();
if (rs.next()) {
enrolmentInfo = DeviceManagementDAOUtil.loadEnrolment(rs);
}
return enrolmentInfo;
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving the enrolment " +
"information of device '" + deviceId.getId() + "' of type : "
+ deviceId.getType(), e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
public int getEnrolmentByStatus(DeviceIdentifier deviceId, Status status, public int getEnrolmentByStatus(DeviceIdentifier deviceId, Status status,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {
Connection conn; Connection conn;

View File

@ -145,16 +145,16 @@ public class EnrollmentDAOImpl implements EnrollmentDAO {
} }
@Override @Override
public boolean setStatus(int deviceId, String currentOwner, EnrolmentInfo.Status status, public boolean setStatus(int enrolmentID, String currentOwner, EnrolmentInfo.Status status,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
conn = this.getConnection(); conn = this.getConnection();
String sql = "UPDATE DM_ENROLMENT SET STATUS = ? WHERE DEVICE_ID = ? AND OWNER = ? AND TENANT_ID = ?"; String sql = "UPDATE DM_ENROLMENT SET STATUS = ? WHERE ID = ? AND OWNER = ? AND TENANT_ID = ?";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setString(1, status.toString()); stmt.setString(1, status.toString());
stmt.setInt(2, deviceId); stmt.setInt(2, enrolmentID);
stmt.setString(3, currentOwner); stmt.setString(3, currentOwner);
stmt.setInt(4, tenantId); stmt.setInt(4, tenantId);
stmt.executeUpdate(); stmt.executeUpdate();

View File

@ -147,6 +147,40 @@ public final class DeviceManagementDAOUtil {
return enrolmentInfo; return enrolmentInfo;
} }
public static EnrolmentInfo loadMatchingEnrolment(ResultSet rs) throws SQLException {
Map<EnrolmentInfo.Status, EnrolmentInfo> enrolmentInfos = new HashMap<>();
EnrolmentInfo enrolmentInfo = loadEnrolment(rs);
if (EnrolmentInfo.Status.ACTIVE.equals(enrolmentInfo.getStatus())) {
return enrolmentInfo;
}
enrolmentInfos.put(enrolmentInfo.getStatus(), enrolmentInfo);
while (rs.next()) {
enrolmentInfo = loadEnrolment(rs);
if (EnrolmentInfo.Status.ACTIVE.equals(enrolmentInfo.getStatus())) {
return enrolmentInfo;
}
enrolmentInfos.put(enrolmentInfo.getStatus(), enrolmentInfo);
}
if (enrolmentInfos.containsKey(EnrolmentInfo.Status.UNREACHABLE)) {
return enrolmentInfos.get(EnrolmentInfo.Status.UNREACHABLE);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.INACTIVE)) {
return enrolmentInfos.get(EnrolmentInfo.Status.INACTIVE);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.CREATED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.CREATED);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.REMOVED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.REMOVED);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.UNCLAIMED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.UNCLAIMED);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.SUSPENDED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.SUSPENDED);
} else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.BLOCKED)) {
return enrolmentInfos.get(EnrolmentInfo.Status.BLOCKED);
}
return enrolmentInfo;
}
public static Device loadDevice(ResultSet rs) throws SQLException { public static Device loadDevice(ResultSet rs) throws SQLException {
Device device = new Device(); Device device = new Device();
device.setId(rs.getInt("DEVICE_ID")); device.setId(rs.getInt("DEVICE_ID"));
@ -158,6 +192,43 @@ public final class DeviceManagementDAOUtil {
return device; return device;
} }
//This method will retrieve most appropriate device information when there are multiple device enrollments for
//a single device. Here we'll consider only active status.
public static Device loadActiveDevice(ResultSet rs, boolean deviceInfoIncluded) throws SQLException {
Map<EnrolmentInfo.Status, Device> deviceMap = new HashMap<>();
Device device = loadDevice(rs);
if (deviceInfoIncluded) {
device.setDeviceInfo(loadDeviceInfo(rs));
}
if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) {
return device;
}
deviceMap.put(device.getEnrolmentInfo().getStatus(), device);
while (rs.next()) {
device = loadDevice(rs);
if (deviceInfoIncluded) {
device.setDeviceInfo(loadDeviceInfo(rs));
}
if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) {
return device;
}
if (device.getEnrolmentInfo() != null) {
deviceMap.put(device.getEnrolmentInfo().getStatus(), device);
}
}
if (deviceMap.containsKey(EnrolmentInfo.Status.UNREACHABLE)) {
return deviceMap.get(EnrolmentInfo.Status.UNREACHABLE);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.INACTIVE)) {
return deviceMap.get(EnrolmentInfo.Status.INACTIVE);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.CREATED)) {
return deviceMap.get(EnrolmentInfo.Status.CREATED);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.UNCLAIMED)) {
return deviceMap.get(EnrolmentInfo.Status.UNCLAIMED);
}
return null;
}
//This method will retrieve most appropriate device information when there are multiple device enrollments for //This method will retrieve most appropriate device information when there are multiple device enrollments for
//a single device. We'll give the highest priority to active devices. //a single device. We'll give the highest priority to active devices.
public static Device loadMatchingDevice(ResultSet rs, boolean deviceInfoIncluded) throws SQLException { public static Device loadMatchingDevice(ResultSet rs, boolean deviceInfoIncluded) throws SQLException {
@ -182,10 +253,10 @@ public final class DeviceManagementDAOUtil {
deviceMap.put(device.getEnrolmentInfo().getStatus(), device); deviceMap.put(device.getEnrolmentInfo().getStatus(), device);
} }
} }
if (deviceMap.containsKey(EnrolmentInfo.Status.INACTIVE)) { if (deviceMap.containsKey(EnrolmentInfo.Status.UNREACHABLE)) {
return deviceMap.get(EnrolmentInfo.Status.INACTIVE);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.UNREACHABLE)) {
return deviceMap.get(EnrolmentInfo.Status.UNREACHABLE); return deviceMap.get(EnrolmentInfo.Status.UNREACHABLE);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.INACTIVE)) {
return deviceMap.get(EnrolmentInfo.Status.INACTIVE);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED)) { } else if (deviceMap.containsKey(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED)) {
return deviceMap.get(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED); return deviceMap.get(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED);
} else if (deviceMap.containsKey(EnrolmentInfo.Status.CREATED)) { } else if (deviceMap.containsKey(EnrolmentInfo.Status.CREATED)) {

View File

@ -34,6 +34,7 @@ import org.wso2.carbon.device.mgt.core.config.task.TaskConfiguration;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO; import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.EnrollmentDAO;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
@ -68,6 +69,7 @@ public class OperationManagerImpl implements OperationManager {
private OperationMappingDAO operationMappingDAO; private OperationMappingDAO operationMappingDAO;
private OperationDAO operationDAO; private OperationDAO operationDAO;
private DeviceDAO deviceDAO; private DeviceDAO deviceDAO;
private EnrollmentDAO enrollmentDAO;
private NotificationStrategy notificationStrategy; private NotificationStrategy notificationStrategy;
public OperationManagerImpl() { public OperationManagerImpl() {
@ -78,6 +80,7 @@ public class OperationManagerImpl implements OperationManager {
operationMappingDAO = OperationManagementDAOFactory.getOperationMappingDAO(); operationMappingDAO = OperationManagementDAOFactory.getOperationMappingDAO();
operationDAO = OperationManagementDAOFactory.getOperationDAO(); operationDAO = OperationManagementDAOFactory.getOperationDAO();
deviceDAO = DeviceManagementDAOFactory.getDeviceDAO(); deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
enrollmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO();
} }
public OperationManagerImpl(NotificationStrategy notificationStrategy) { public OperationManagerImpl(NotificationStrategy notificationStrategy) {
@ -138,8 +141,10 @@ public class OperationManagerImpl implements OperationManager {
} }
} else if (isNotRepeated) { } else if (isNotRepeated) {
operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode, operationDAO.updateEnrollmentOperationsStatus(enrolmentId, operationCode,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.PENDING, org.wso2.carbon.device.mgt.core.dto.operation.mgt.
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.REPEATED); Operation.Status.PENDING,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.
Operation.Status.REPEATED);
operationMappingDAO.addOperationMapping(operationId, enrolmentId); operationMappingDAO.addOperationMapping(operationId, enrolmentId);
} else { } else {
operationMappingDAO.addOperationMapping(operationId, enrolmentId); operationMappingDAO.addOperationMapping(operationId, enrolmentId);
@ -165,7 +170,8 @@ public class OperationManagerImpl implements OperationManager {
if (!isScheduledOperation) { if (!isScheduledOperation) {
//Get the device-type from 1st valid DeviceIdentifier. We know the 1st element is definitely there. //Get the device-type from 1st valid DeviceIdentifier. We know the 1st element is definitely there.
String deviceType = validDeviceIds.get(0).getType(); String deviceType = validDeviceIds.get(0).getType();
activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult, deviceType)); activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult,
deviceType));
} }
return activity; return activity;
} else { } else {
@ -268,15 +274,15 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentId < 0) { if (enrolmentInfo == null) {
return null; return null;
} }
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
List<? extends org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> operationList = List<? extends org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> operationList =
operationDAO.getOperationsForDevice(enrolmentId); operationDAO.getOperationsForDevice(enrolmentInfo.getId());
operations = new ArrayList<>(); operations = new ArrayList<>();
for (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation : operationList) { for (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation : operationList) {
@ -308,13 +314,13 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentId < 0) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device " + throw new OperationManagementException("Device not found for given device " +
"Identifier:" + deviceId.getId() + " and given type" + "Identifier:" + deviceId.getId() + " and given type" +
deviceId.getType()); deviceId.getType());
} }
int enrolmentId = enrolmentInfo.getId();
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
List<? extends org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> operationList = List<? extends org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> operationList =
@ -358,7 +364,7 @@ public class OperationManagerImpl implements OperationManager {
} }
// //
EnrolmentInfo enrolmentInfo = this.getEnrolmentInfo(deviceId); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for the given device Identifier:" + throw new OperationManagementException("Device not found for the given device Identifier:" +
deviceId.getId() + " and given type:" + deviceId.getId() + " and given type:" +
@ -373,7 +379,7 @@ public class OperationManagerImpl implements OperationManager {
case INACTIVE: case INACTIVE:
case UNREACHABLE: case UNREACHABLE:
this.resetAttemptCount(enrolmentId); this.resetAttemptCount(enrolmentId);
this.setEnrolmentStatus(deviceId, EnrolmentInfo.Status.ACTIVE); this.setEnrolmentStatus(enrolmentId, EnrolmentInfo.Status.ACTIVE);
break; break;
} }
@ -419,8 +425,8 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentId < 0) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device " + throw new OperationManagementException("Device not found for given device " +
"Identifier:" + deviceId.getId() + " and given type" + "Identifier:" + deviceId.getId() + " and given type" +
deviceId.getType()); deviceId.getType());
@ -429,7 +435,7 @@ public class OperationManagerImpl implements OperationManager {
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getNextOperation( org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getNextOperation(
enrolmentId); enrolmentInfo.getId());
if (dtoOperation != null) { if (dtoOperation != null) {
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType() if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType()
)) { )) {
@ -474,17 +480,22 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentInfo == null) {
throw new OperationManagementException(
"Device not found for device id:" + deviceId.getId() + " " + "type:" +
deviceId.getType());
}
try { try {
int enrolmentId = enrolmentInfo.getId();
OperationManagementDAOFactory.beginTransaction(); OperationManagementDAOFactory.beginTransaction();
boolean isUpdated = false; boolean isUpdated = false;
if (operation.getStatus() != null) { if (operation.getStatus() != null) {
isUpdated = operationDAO.updateOperationStatus(enrolmentId, operationId, isUpdated = operationDAO.updateOperationStatus(enrolmentId, operationId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status org.wso2.carbon.device.mgt.core.dto.operation.mgt.
. Operation.Status.valueOf(operation.getStatus().
valueOf(operation.getStatus() toString()));
.toString()));
} }
if (isUpdated && operation.getOperationResponse() != null) { if (isUpdated && operation.getOperationResponse() != null) {
operationDAO.addOperationResponse(enrolmentId, operationId, operation.getOperationResponse()); operationDAO.addOperationResponse(enrolmentId, operationId, operation.getOperationResponse());
@ -538,8 +549,8 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentId < 0) { if (enrolmentInfo == null) {
throw new OperationManagementException("Device not found for given device identifier: " + throw new OperationManagementException("Device not found for given device identifier: " +
deviceId.getId() + " type: " + deviceId.getType()); deviceId.getId() + " type: " + deviceId.getType());
} }
@ -547,17 +558,14 @@ public class OperationManagerImpl implements OperationManager {
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.
getOperationByDeviceAndId( getOperationByDeviceAndId(enrolmentInfo.getId(),
enrolmentId, operationId);
operationId);
if (dtoOperation.getType(). if (dtoOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation( getOperation(dtoOperation.getId());
dtoOperation
.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (dtoOperation.getType(). } else if (dtoOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
@ -601,24 +609,28 @@ public class OperationManagerImpl implements OperationManager {
deviceId.getId() + "'"); deviceId.getId() + "'");
} }
int enrolmentId = this.getEnrolmentByStatus(deviceId, EnrolmentInfo.Status.ACTIVE); EnrolmentInfo enrolmentInfo = this.getActiveEnrolmentInfo(deviceId);
if (enrolmentId < 0) { if (enrolmentInfo == null) {
throw new OperationManagementException( throw new OperationManagementException(
"Device not found for device id:" + deviceId.getId() + " " + "type:" + "Device not found for device id:" + deviceId.getId() + " " + "type:" +
deviceId.getType()); deviceId.getType());
} }
try { try {
int enrolmentId = enrolmentInfo.getId();
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status dtoOpStatus = org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status dtoOpStatus =
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf(status.toString()); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf(status.toString());
dtoOperationList.addAll(commandOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOpStatus)); dtoOperationList.addAll(commandOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOpStatus));
dtoOperationList.addAll(configOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(configOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.PENDING)); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING));
dtoOperationList.addAll(profileOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(profileOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.PENDING)); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING));
dtoOperationList.addAll(policyOperationDAO.getOperationsByDeviceAndStatus(enrolmentId, dtoOperationList.addAll(policyOperationDAO.getOperationsByDeviceAndStatus(enrolmentId,
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.PENDING)); org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.
Status.PENDING));
Operation operation; Operation operation;
@ -646,9 +658,8 @@ public class OperationManagerImpl implements OperationManager {
Operation operation; Operation operation;
try { try {
OperationManagementDAOFactory.openConnection(); OperationManagementDAOFactory.openConnection();
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO. org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.getOperation(
getOperation( operationId);
operationId);
if (dtoOperation == null) { if (dtoOperation == null) {
throw new OperationManagementException("Operation not found for given Id:" + operationId); throw new OperationManagementException("Operation not found for given Id:" + operationId);
} }
@ -658,9 +669,7 @@ public class OperationManagerImpl implements OperationManager {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
commandOperation = commandOperation =
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. (org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
getOperation( getOperation(dtoOperation.getId());
dtoOperation
.getId());
dtoOperation.setEnabled(commandOperation.isEnabled()); dtoOperation.setEnabled(commandOperation.isEnabled());
} else if (dtoOperation.getType(). } else if (dtoOperation.getType().
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
@ -919,19 +928,37 @@ public class OperationManagerImpl implements OperationManager {
return enrolmentInfo; return enrolmentInfo;
} }
private boolean setEnrolmentStatus(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws OperationManagementException { private EnrolmentInfo getActiveEnrolmentInfo(DeviceIdentifier deviceId) throws OperationManagementException {
EnrolmentInfo enrolmentInfo;
try {
DeviceManagementDAOFactory.openConnection();
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
enrolmentInfo = deviceDAO.getActiveEnrolment(deviceId, tenantId);
} catch (DeviceManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving enrollment data of '" +
deviceId.getType() + "' device carrying the identifier '" +
deviceId.getId() + "'", e);
} catch (SQLException e) {
throw new OperationManagementException(
"Error occurred while opening a connection to the data source", e);
} finally {
DeviceManagementDAOFactory.closeConnection();
}
return enrolmentInfo;
}
private boolean setEnrolmentStatus(int enrolmentId, EnrolmentInfo.Status status) throws OperationManagementException {
boolean updateStatus; boolean updateStatus;
try { try {
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
String user = this.getUser(); String user = this.getUser();
updateStatus = deviceDAO.setEnrolmentStatus(deviceId, user, status, tenantId); updateStatus = enrollmentDAO.setStatus(enrolmentId, user, status, tenantId);
DeviceManagementDAOFactory.commitTransaction(); DeviceManagementDAOFactory.commitTransaction();
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
DeviceManagementDAOFactory.rollbackTransaction(); DeviceManagementDAOFactory.rollbackTransaction();
throw new OperationManagementException("Error occurred while updating enrollment status of '" + throw new OperationManagementException("Error occurred while updating enrollment status of device of " +
deviceId.getType() + "' device carrying the identifier '" + "enrolment-id '" + enrolmentId + "'", e);
deviceId.getId() + "'", e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
throw new OperationManagementException("Error occurred while initiating a transaction", e); throw new OperationManagementException("Error occurred while initiating a transaction", e);
} finally { } finally {

View File

@ -46,7 +46,7 @@ public class PushNotificationBasedOperationManager implements OperationManager {
Activity activity = this.operationManager.addOperation(operation, devices); Activity activity = this.operationManager.addOperation(operation, devices);
for (DeviceIdentifier deviceId : devices) { for (DeviceIdentifier deviceId : devices) {
try { try {
this.notificationProvider.execute(new NotificationContext(deviceId)); this.notificationProvider.execute(new NotificationContext(deviceId, operation));
} catch (PushNotificationExecutionFailedException e) { } catch (PushNotificationExecutionFailedException e) {
throw new OperationManagementException("Error occurred while sending push notification to device", e); throw new OperationManagementException("Error occurred while sending push notification to device", e);
} }

View File

@ -240,8 +240,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
try { try {
int tenantId = this.getTenantId(); int tenantId = this.getTenantId();
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();
DeviceType type = deviceTypeDAO.getDeviceType(device.getType(), tenantId);
Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId); Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId);
device.setId(currentDevice.getId()); device.setId(currentDevice.getId());
device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId());
@ -1019,10 +1017,14 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
public boolean setStatus(DeviceIdentifier deviceId, String currentOwner, public boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
EnrolmentInfo.Status status) throws DeviceManagementException { EnrolmentInfo.Status status) throws DeviceManagementException {
try { try {
boolean success = false;
DeviceManagementDAOFactory.beginTransaction(); DeviceManagementDAOFactory.beginTransaction();
int tenantId = this.getTenantId(); int tenantId = this.getTenantId();
Device device = deviceDAO.getDevice(deviceId, tenantId); Device device = deviceDAO.getDevice(deviceId, tenantId);
boolean success = enrollmentDAO.setStatus(device.getId(), currentOwner, status, tenantId); EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
if (enrolmentInfo != null) {
success = enrollmentDAO.setStatus(enrolmentInfo.getId(), currentOwner, status, tenantId);
}
DeviceManagementDAOFactory.commitTransaction(); DeviceManagementDAOFactory.commitTransaction();
return success; return success;
} catch (DeviceManagementDAOException e) { } catch (DeviceManagementDAOException e) {
@ -1032,6 +1034,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
throw new DeviceManagementException("Error occurred while initiating transaction", e); throw new DeviceManagementException("Error occurred while initiating transaction", e);
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
} }

View File

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

View File

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

View File

@ -104,10 +104,12 @@ deviceModule = function () {
if (device["properties"] && device["properties"].length > 0) { if (device["properties"] && device["properties"].length > 0) {
var propertiesList = device["properties"]; var propertiesList = device["properties"];
var properties = {}; var properties = {};
for (var i = 0; i < propertiesList.length; i++) { if (propertiesList) {
if (propertiesList[i]["value"]) { for (var i = 0; i < propertiesList.length; i++) {
properties[propertiesList[i]["name"]] = if (propertiesList[i]["value"]) {
propertiesList[i]["value"]; properties[propertiesList[i]["name"]] =
propertiesList[i]["value"];
}
} }
} }

View File

@ -38,42 +38,42 @@ var operationModule = function () {
} }
privateMethods.getOperationsFromFeatures = function (deviceType, operationType) { privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/features/" + deviceType; var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/device-types/" + deviceType + "/features";
var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) { var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
var features = responsePayload; var features = JSON.parse(responsePayload.responseText);
var featureList = []; var featureList = [];
var feature; var feature;
for (var i = 0; i < features.length; i++) { for (var i = 0; i < features.length; i++) {
feature = {}; feature = {};
var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"]; var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
if (analyticStreams) { if (analyticStreams) {
for (var stream in analyticStreams) { for (var stream in analyticStreams) {
if (analyticStreams[stream].name == features[i].name) { if (analyticStreams[stream].name == features[i].name) {
feature.ui_unit = analyticStreams[stream].ui_unit; feature.ui_unit = analyticStreams[stream].ui_unit;
break; break;
} }
} }
} }
feature["operation"] = features[i].code; feature["operation"] = features[i].code;
feature["name"] = features[i].name; feature["name"] = features[i].name;
feature["description"] = features[i].description; feature["description"] = features[i].description;
feature["deviceType"] = deviceType; feature["deviceType"] = deviceType;
feature["params"] = []; feature["params"] = [];
var metaData = features[i].metadataEntries; var metaData = features[i].metadataEntries;
if (metaData) { if (metaData) {
for (var j = 0; j < metaData.length; j++) { for (var j = 0; j < metaData.length; j++) {
feature["params"].push(metaData[j].value); feature["params"].push(metaData[j].value);
} }
featureList.push(feature); featureList.push(feature);
} }
} }
return featureList; return featureList;
}, function (responsePayload) { }, function (responsePayload) {
var response = {}; var response = {};
response["status"] = "error"; response["status"] = "error";
return response; return response;
} }
); );
return featuresList; return featuresList;
}; };

View File

@ -72,7 +72,7 @@ var invokers = function () {
var xmlHttpRequest = new XMLHttpRequest(); var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open(httpMethod, endpoint); xmlHttpRequest.open(httpMethod, endpoint);
for(var i in headers){ for (var i in headers) {
xmlHttpRequest.setRequestHeader(headers[i].name, headers[i].value); xmlHttpRequest.setRequestHeader(headers[i].name, headers[i].value);
} }
xmlHttpRequest.setRequestHeader(constants["CONTENT_TYPE_IDENTIFIER"], constants["APPLICATION_JSON"]); xmlHttpRequest.setRequestHeader(constants["CONTENT_TYPE_IDENTIFIER"], constants["APPLICATION_JSON"]);
@ -117,9 +117,10 @@ var invokers = function () {
* @param endpoint Backend REST API url. * @param endpoint Backend REST API url.
* @param responseCallback a function to be called with response retrieved. * @param responseCallback a function to be called with response retrieved.
*/ */
privateMethods["initiateXMLHTTPRequest"] = function (httpMethod, requestPayload, endpoint, responseCallback, headers) { privateMethods["initiateXMLHTTPRequest"] =
return privateMethods.execute(httpMethod, requestPayload, endpoint, responseCallback, 0, headers); function (httpMethod, requestPayload, endpoint, responseCallback, headers) {
}; return privateMethods.execute(httpMethod, requestPayload, endpoint, responseCallback, 0, headers);
};
/** /**
* This method invokes return initiateXMLHttpRequest for get calls. * This method invokes return initiateXMLHttpRequest for get calls.
@ -128,7 +129,8 @@ var invokers = function () {
*/ */
publicXMLHTTPInvokers["get"] = function (endpoint, responseCallback, headers) { publicXMLHTTPInvokers["get"] = function (endpoint, responseCallback, headers) {
var requestPayload = null; var requestPayload = null;
return privateMethods.initiateXMLHTTPRequest(constants["HTTP_GET"], requestPayload, endpoint, responseCallback, headers); return privateMethods.initiateXMLHTTPRequest(constants["HTTP_GET"], requestPayload, endpoint, responseCallback,
headers);
}; };
/** /**
@ -138,7 +140,8 @@ var invokers = function () {
* @param responseCallback a function to be called with response retrieved. * @param responseCallback a function to be called with response retrieved.
*/ */
publicXMLHTTPInvokers["post"] = function (endpoint, requestPayload, responseCallback, headers) { publicXMLHTTPInvokers["post"] = function (endpoint, requestPayload, responseCallback, headers) {
return privateMethods.initiateXMLHTTPRequest(constants["HTTP_POST"], requestPayload, endpoint, responseCallback, headers); return privateMethods.initiateXMLHTTPRequest(constants["HTTP_POST"], requestPayload, endpoint, responseCallback,
headers);
}; };
/** /**
@ -148,7 +151,8 @@ var invokers = function () {
* @param responseCallback a function to be called with response retrieved. * @param responseCallback a function to be called with response retrieved.
*/ */
publicXMLHTTPInvokers["put"] = function (endpoint, requestPayload, responseCallback, headers) { publicXMLHTTPInvokers["put"] = function (endpoint, requestPayload, responseCallback, headers) {
return privateMethods.initiateXMLHTTPRequest(constants["HTTP_PUT"], requestPayload, endpoint, responseCallback, headers); return privateMethods.initiateXMLHTTPRequest(constants["HTTP_PUT"], requestPayload, endpoint, responseCallback,
headers);
}; };
/** /**
@ -158,7 +162,8 @@ var invokers = function () {
*/ */
publicXMLHTTPInvokers["delete"] = function (endpoint, responseCallback, headers) { publicXMLHTTPInvokers["delete"] = function (endpoint, responseCallback, headers) {
var requestPayload = null; var requestPayload = null;
return privateMethods.initiateXMLHTTPRequest(constants["HTTP_DELETE"], requestPayload, endpoint, responseCallback, headers); return privateMethods.initiateXMLHTTPRequest(constants["HTTP_DELETE"], requestPayload, endpoint,
responseCallback, headers);
}; };
/** /**
@ -245,100 +250,105 @@ var invokers = function () {
* @param errorCallback a function to be called if en error is reserved. * @param errorCallback a function to be called if en error is reserved.
* @param headers a list of name value pairs for additional http headers. * @param headers a list of name value pairs for additional http headers.
*/ */
privateMethods["initiateHTTPClientRequest"] = function (method, url, successCallback, errorCallback, payload, headers) { privateMethods["initiateHTTPClientRequest"] =
//noinspection JSUnresolvedVariable function (method, url, successCallback, errorCallback, payload, headers) {
var HttpClient = Packages.org.apache.commons.httpclient.HttpClient; //noinspection JSUnresolvedVariable
var httpMethodObject; var HttpClient = Packages.org.apache.commons.httpclient.HttpClient;
switch (method) { var httpMethodObject;
case constants["HTTP_GET"]: switch (method) {
//noinspection JSUnresolvedVariable case constants["HTTP_GET"]:
var GetMethod = Packages.org.apache.commons.httpclient.methods.GetMethod; //noinspection JSUnresolvedVariable
httpMethodObject = new GetMethod(url); var GetMethod = Packages.org.apache.commons.httpclient.methods.GetMethod;
break; httpMethodObject = new GetMethod(url);
case constants["HTTP_POST"]: break;
//noinspection JSUnresolvedVariable case constants["HTTP_POST"]:
var PostMethod = Packages.org.apache.commons.httpclient.methods.PostMethod; //noinspection JSUnresolvedVariable
httpMethodObject = new PostMethod(url); var PostMethod = Packages.org.apache.commons.httpclient.methods.PostMethod;
break; httpMethodObject = new PostMethod(url);
case constants["HTTP_PUT"]: break;
//noinspection JSUnresolvedVariable case constants["HTTP_PUT"]:
var PutMethod = Packages.org.apache.commons.httpclient.methods.PutMethod; //noinspection JSUnresolvedVariable
httpMethodObject = new PutMethod(url); var PutMethod = Packages.org.apache.commons.httpclient.methods.PutMethod;
break; httpMethodObject = new PutMethod(url);
case constants["HTTP_DELETE"]: break;
//noinspection JSUnresolvedVariable case constants["HTTP_DELETE"]:
var DeleteMethod = Packages.org.apache.commons.httpclient.methods.DeleteMethod; //noinspection JSUnresolvedVariable
httpMethodObject = new DeleteMethod(url); var DeleteMethod = Packages.org.apache.commons.httpclient.methods.DeleteMethod;
break; httpMethodObject = new DeleteMethod(url);
default: break;
//noinspection JSUnresolvedFunction default:
throw new IllegalArgumentException("Invalid HTTP request method: " + method); //noinspection JSUnresolvedFunction
} throw new IllegalArgumentException("Invalid HTTP request method: " + method);
}
//noinspection JSUnresolvedVariable //noinspection JSUnresolvedVariable
var Header = Packages.org.apache.commons.httpclient.Header; var Header = Packages.org.apache.commons.httpclient.Header;
for(var i in headers){ for (var i in headers) {
var header = new Header(); var header = new Header();
header.setName(headers[i].name); header.setName(headers[i].name);
header.setValue(headers[i].value); header.setValue(headers[i].value);
httpMethodObject.addRequestHeader(header);
}
var header = new Header();
header.setName(constants["CONTENT_TYPE_IDENTIFIER"]);
header.setValue(constants["APPLICATION_JSON"]);
//noinspection JSUnresolvedFunction
httpMethodObject.addRequestHeader(header);
header = new Header();
header.setName(constants["ACCEPT_IDENTIFIER"]);
header.setValue(constants["APPLICATION_JSON"]);
//noinspection JSUnresolvedFunction
httpMethodObject.addRequestHeader(header);
if (devicemgtProps["isOAuthEnabled"]) {
var accessToken = privateMethods.getAccessToken();
if (accessToken) {
header = new Header();
header.setName(constants["AUTHORIZATION_HEADER"]);
header.setValue(constants["BEARER_PREFIX"] + accessToken);
//noinspection JSUnresolvedFunction
httpMethodObject.addRequestHeader(header); httpMethodObject.addRequestHeader(header);
} else {
response.sendRedirect(devicemgtProps["appContext"] + "login");
} }
}
//noinspection JSUnresolvedFunction var header = new Header();
if (payload != null) { header.setName(constants["CONTENT_TYPE_IDENTIFIER"]);
var StringRequestEntity = Packages.org.apache.commons.httpclient.methods.StringRequestEntity; header.setValue(constants["APPLICATION_JSON"]);
var stringRequestEntity = new StringRequestEntity(stringify(payload));
//noinspection JSUnresolvedFunction //noinspection JSUnresolvedFunction
httpMethodObject.setRequestEntity(stringRequestEntity); httpMethodObject.addRequestHeader(header);
} header = new Header();
var client = new HttpClient(); header.setName(constants["ACCEPT_IDENTIFIER"]);
try { header.setValue(constants["APPLICATION_JSON"]);
//noinspection JSUnresolvedFunction //noinspection JSUnresolvedFunction
client.executeMethod(httpMethodObject); httpMethodObject.addRequestHeader(header);
//noinspection JSUnresolvedFunction
var status = httpMethodObject.getStatusCode(); if (devicemgtProps["isOAuthEnabled"]) {
if (status == 200) { var accessToken = privateMethods.getAccessToken();
var responseContentDispositionHeader = httpMethodObject.getResponseHeader(constants["CONTENT_DISPOSITION_IDENTIFIER"]); if (accessToken) {
if (responseContentDispositionHeader) { header = new Header();
return successCallback(httpMethodObject.getResponseBodyAsStream(), httpMethodObject.getResponseHeaders()); header.setName(constants["AUTHORIZATION_HEADER"]);
header.setValue(constants["BEARER_PREFIX"] + accessToken);
//noinspection JSUnresolvedFunction
httpMethodObject.addRequestHeader(header);
} else { } else {
return successCallback(httpMethodObject.getResponseBody()); response.sendRedirect(devicemgtProps["appContext"] + "login");
} }
} else {
return errorCallback(httpMethodObject.getResponseBody());
} }
} catch (e) {
return errorCallback(response);
} finally {
//noinspection JSUnresolvedFunction //noinspection JSUnresolvedFunction
if (method != constants["HTTP_GET"]) { if (payload != null) {
method.releaseConnection(); var StringRequestEntity = Packages.org.apache.commons.httpclient.methods.StringRequestEntity;
var stringRequestEntity = new StringRequestEntity(stringify(payload));
//noinspection JSUnresolvedFunction
httpMethodObject.setRequestEntity(stringRequestEntity);
} }
} var client = new HttpClient();
}; try {
//noinspection JSUnresolvedFunction
client.executeMethod(httpMethodObject);
//noinspection JSUnresolvedFunction
var status = httpMethodObject.getStatusCode();
if (status == 200) {
var responseContentDispositionHeader = httpMethodObject.getResponseHeader(
constants["CONTENT_DISPOSITION_IDENTIFIER"]);
if (responseContentDispositionHeader) {
return successCallback(httpMethodObject.getResponseBodyAsStream(),
httpMethodObject.getResponseHeaders());
} else {
return successCallback(httpMethodObject.getResponseBodyAsString(),
httpMethodObject.getResponseHeaders());
}
} else {
return errorCallback(httpMethodObject.getResponseBodyAsString(),
httpMethodObject.getResponseHeaders());
}
} catch (e) {
return errorCallback(response);
} finally {
//noinspection JSUnresolvedFunction
if (method != constants["HTTP_GET"]) {
method.releaseConnection();
}
}
};
/** /**
* This method invokes return initiateHTTPClientRequest for get calls. * This method invokes return initiateHTTPClientRequest for get calls.
@ -349,8 +359,8 @@ var invokers = function () {
*/ */
publicHTTPClientInvokers["get"] = function (url, successCallback, errorCallback, headers) { publicHTTPClientInvokers["get"] = function (url, successCallback, errorCallback, headers) {
var requestPayload = null; var requestPayload = null;
return privateMethods. return privateMethods.initiateHTTPClientRequest(constants["HTTP_GET"], url, successCallback, errorCallback,
initiateHTTPClientRequest(constants["HTTP_GET"], url, successCallback, errorCallback, requestPayload, headers); requestPayload, headers);
}; };
/** /**
@ -362,8 +372,8 @@ var invokers = function () {
* @param headers a list of name value pairs for additional http headers. * @param headers a list of name value pairs for additional http headers.
*/ */
publicHTTPClientInvokers["post"] = function (url, payload, successCallback, errorCallback, headers) { publicHTTPClientInvokers["post"] = function (url, payload, successCallback, errorCallback, headers) {
return privateMethods. return privateMethods.initiateHTTPClientRequest(constants["HTTP_POST"], url, successCallback, errorCallback,
initiateHTTPClientRequest(constants["HTTP_POST"], url, successCallback, errorCallback, payload, headers); payload, headers);
}; };
/** /**
@ -375,8 +385,8 @@ var invokers = function () {
* @param headers a list of name value pairs for additional http headers. * @param headers a list of name value pairs for additional http headers.
*/ */
publicHTTPClientInvokers["put"] = function (url, payload, successCallback, errorCallback, headers) { publicHTTPClientInvokers["put"] = function (url, payload, successCallback, errorCallback, headers) {
return privateMethods. return privateMethods.initiateHTTPClientRequest(constants["HTTP_PUT"], url, successCallback, errorCallback,
initiateHTTPClientRequest(constants["HTTP_PUT"], url, successCallback, errorCallback, payload, headers); payload, headers);
}; };
/** /**
@ -388,8 +398,8 @@ var invokers = function () {
*/ */
publicHTTPClientInvokers["delete"] = function (url, successCallback, errorCallback, headers) { publicHTTPClientInvokers["delete"] = function (url, successCallback, errorCallback, headers) {
var requestPayload = null; var requestPayload = null;
return privateMethods. return privateMethods.initiateHTTPClientRequest(constants["HTTP_DELETE"], url, successCallback, errorCallback,
initiateHTTPClientRequest(constants["HTTP_DELETE"], url, successCallback, errorCallback, requestPayload, headers); requestPayload, headers);
}; };
var publicMethods = {}; var publicMethods = {};

View File

@ -24,6 +24,7 @@ utility = function () {
var log = new Log("/app/modules/utility.js"); var log = new Log("/app/modules/utility.js");
var JavaClass = Packages.java.lang.Class; var JavaClass = Packages.java.lang.Class;
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext; var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;
var server = require("carbon")["server"];
var getOsgiService = function (className) { var getOsgiService = function (className) {
return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className)); return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className));
@ -38,8 +39,8 @@ utility = function () {
PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext.startTenantFlow();
context = PrivilegedCarbonContext.getThreadLocalCarbonContext(); context = PrivilegedCarbonContext.getThreadLocalCarbonContext();
context.setTenantDomain(carbon.server.tenantDomain({ context.setTenantDomain(carbon.server.tenantDomain({
tenantId: userInfo.tenantId tenantId: userInfo.tenantId
})); }));
context.setTenantId(userInfo.tenantId); context.setTenantId(userInfo.tenantId);
context.setUsername(userInfo.username || null); context.setUsername(userInfo.username || null);
}; };
@ -71,7 +72,10 @@ utility = function () {
if (deviceTypeConfigFile.isExists()) { if (deviceTypeConfigFile.isExists()) {
try { try {
deviceTypeConfigFile.open("r"); deviceTypeConfigFile.open("r");
deviceTypeConfig = parse(deviceTypeConfigFile.readAll()); var config = deviceTypeConfigFile.readAll();
config = config.replace("%https.ip%", server.address("https"));
config = config.replace("%http.ip%", server.address("http"));
deviceTypeConfig = parse(config);
} catch (err) { } catch (err) {
log.error("Error while reading device config file for `" + deviceType + "`: " + err); log.error("Error while reading device config file for `" + deviceType + "`: " + err);
} finally { } finally {

View File

@ -138,11 +138,11 @@
</thead> </thead>
<tbody id="ast-container"> <tbody id="ast-container">
<br class="c-both"/> <br class="c-both" />
</tbody> </tbody>
</table> </table>
</div> </div>
<br class="c-both"/> <br class="c-both" />
<div id="content-filter-types" style="display: none"> <div id="content-filter-types" style="display: none">
<div class="sort-title">Sort By</div> <div class="sort-title">Sort By</div>
<div class="sort-options"> <div class="sort-options">
@ -163,7 +163,7 @@
registered registered
{{/if}} {{/if}}
at the moment.</h2> at the moment.</h2>
<br/> <br />
<p class="text-center"> <p class="text-center">
{{#if groupName}} {{#if groupName}}
@ -233,7 +233,9 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Do you really want to remove this device from your Devices List? Do you really want to remove this device from your Devices List?
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
@ -256,7 +258,9 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Device was successfully removed. Device was successfully removed.
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
@ -273,7 +277,9 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Please enter new name for the device? Please enter new name for the device?
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<input id="edit-device-name" style="color:#3f3f3f;padding:5px" type="text" <input id="edit-device-name" style="color:#3f3f3f;padding:5px" type="text"
@ -298,7 +304,9 @@
<h3 class="pull-left modal-title"> <h3 class="pull-left modal-title">
Device was successfully updated. Device was successfully updated.
</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i>
</button>
</div> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
@ -306,78 +314,82 @@
<div class="modal-footer"> <div class="modal-footer">
<div class="buttons"> <div class="buttons">
<div id="edit-device-200-content" class="hide"> <div id="edit-device-200-content" class="hide">
<div class="content"> <div class="content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Device was successfully updated.</h3> <h3>Device was successfully updated.</h3>
</div> </div>
</div> </div>
</div>
</div>
<div id="device-400-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Exception at backend. Try Later.</h3>
<br/>
<div class="buttons">
<a href="#" id="device-400-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div id="device-403-content" class="hide"> <div id="device-400-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Operation not permitted.</h3> <h3>Exception at backend. Try Later.</h3>
<br/> <br />
<div class="buttons"> <div class="buttons">
<a href="#" id="device-403-link" class="btn-operations"> <a href="#" id="device-400-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a> </a>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div id="group-404-content" class="hide"> <div id="device-403-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>You don't have any groups to add this device. Please add group first.</h3> <h3>Operation not permitted.</h3>
<br/> <br />
<div class="buttons"> <div class="buttons">
<a href="{{@app.context}}/group/add" class="btn-operations"> <a href="#" id="device-403-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Add New Group&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a> </a>
&nbsp;&nbsp; </div>
<a href="#" id="cancel-link" class="btn-operations"> </div>
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp; </div>
</a>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div id="device-409-content" class="hide"> <div id="group-404-content" class="hide">
<div class="modal-content"> <div class="modal-content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
<h3>Device does not exist.</h3> <h3>You don't have any groups to add this device. Please add group
<br/> first.</h3>
<div class="buttons"> <br />
<a href="#" id="remove-device-409-link" class="btn-operations"> <div class="buttons">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp; <a href="{{@app.context}}/group/add" class="btn-operations">
</a> &nbsp;&nbsp;&nbsp;&nbsp;Add New Group&nbsp;&nbsp;&nbsp;&nbsp;
</a>
&nbsp;&nbsp;
<a href="#" id="cancel-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Cancel&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-409-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Device does not exist.</h3>
<br />
<div class="buttons">
<a href="#" id="remove-device-409-link" class="btn-operations">
&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;
</a>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -389,7 +401,7 @@
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="device-listing" data-current-user="{{currentUser.username}}" data-device-types="{{deviceTypes}}" <script id="device-listing" data-current-user="{{@user.username}}" data-device-types="{{deviceTypes}}"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
{{js "js/listing.js"}} {{js "js/listing.js"}}
{{/zone}} {{/zone}}

View File

@ -87,21 +87,21 @@ $(document).ready(function () {
/* for device list sorting drop down */ /* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({ $(".ctrl-filter-type-switcher").popover({
html : true, html: true,
content : function () { content: function () {
return $("#content-filter-types").html(); return $("#content-filter-types").html();
} }
}); });
$(".ast-container").on("click", ".claim-btn", function(e){ $(".ast-container").on("click", ".claim-btn", function (e) {
e.stopPropagation(); e.stopPropagation();
var deviceId = $(this).data("deviceid"); var deviceId = $(this).data("deviceid");
var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser; var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser;
var deviceIdentifier = {id: deviceId, type: "TemperatureController"}; var deviceIdentifier = {id: deviceId, type: "TemperatureController"};
invokerUtil.put(serviceURL, deviceIdentifier, function(message){ invokerUtil.put(serviceURL, deviceIdentifier, function (message) {
console.log(message); console.log(message);
}, function(message){ }, function (message) {
console.log(message.content); console.log(message.content);
}); });
}); });
}); });
@ -166,15 +166,15 @@ function toTitleCase(str) {
}); });
} }
function loadDevices(searchType, searchParam){ function loadDevices(searchType, searchParam) {
var serviceURL; var serviceURL;
if (groupName && groupOwner && $.hasPermission("LIST_OWN_DEVICES")) { if (groupName && groupOwner && $.hasPermission("LIST_OWN_DEVICES")) {
serviceURL = "/devicemgt_admin/groups/owner/" + groupOwner + "/name/" + groupName + "/devices"; serviceURL = "/api/device-mgt/v1.0/groups/owner/" + groupOwner + "/name/" + groupName + "/devices";
} else if ($.hasPermission("LIST_DEVICES")) { } else if ($.hasPermission("LIST_DEVICES")) {
serviceURL = "/devicemgt_admin/devices"; serviceURL = "/api/device-mgt/v1.0/devices";
} else if ($.hasPermission("LIST_OWN_DEVICES")) { } else if ($.hasPermission("LIST_OWN_DEVICES")) {
//Get authenticated users devices //Get authenticated users devices
serviceURL = "/devicemgt_admin/users/devices?username=" + currentUser; serviceURL = "/api/device-mgt/v1.0/users/devices?username=" + currentUser;
} else { } else {
$("#loading-content").remove(); $("#loading-content").remove();
$('#device-table').addClass('hidden'); $('#device-table').addClass('hidden');
@ -197,10 +197,10 @@ function loadDevices(searchType, searchParam){
return {}; return {};
} }
function getDeviceTypeLabel(type){ function getDeviceTypeLabel(type) {
var deviceTypes = deviceListing.data("deviceTypes"); var deviceTypes = deviceListing.data("deviceTypes");
for (var i = 0; i < deviceTypes.length; i++){ for (var i = 0; i < deviceTypes.length; i++) {
if (deviceTypes[i].type == type){ if (deviceTypes[i].type == type) {
return deviceTypes[i].label; return deviceTypes[i].label;
} }
} }
@ -227,29 +227,21 @@ function loadDevices(searchType, searchParam){
return type; return type;
} }
$('#device-grid').datatables_extended ({ var columns = [
serverSide: true, {
processing: false, targets: 0,
searching: true, data: 'name',
ordering: false, class: 'remove-padding icon-only content-fill',
filter: false, render: function (data, type, row, meta) {
pageLength : 16, return '<div class="thumbnail icon"><img class="square-element text fw " src="' + getDeviceTypeThumb(
ajax: { url : '/devicemgt/api/devices', data : {url : serviceURL}, row.deviceType) + '"/></div>';
dataSrc: function ( json ) { }
$('#device-grid').removeClass('hidden');
$("#loading-content").remove();
var $list = $("#device-table :input[type='search']");
$list.each(function(){
$(this).addClass("hidden");
});
return json.data;
}
}, },
columnDefs: [ {
{ targets: 0, data: 'name', className: 'remove-padding icon-only content-fill' , render: function ( data, type, row, meta ) { targets: 1,
return '<div class="thumbnail icon"><img class="square-element text fw " src="' + getDeviceTypeThumb(row.type) + '"/></div>'; data: 'name',
}}, class: 'fade-edge',
{ targets: 1, data: 'name', className: 'fade-edge' , render: function ( name, type, row, meta ) { render: function (name, type, row, meta) {
var model = getPropertyValue(row.properties, 'DEVICE_MODEL'); var model = getPropertyValue(row.properties, 'DEVICE_MODEL');
var vendor = getPropertyValue(row.properties, 'VENDOR'); var vendor = getPropertyValue(row.properties, 'VENDOR');
var html = '<h4>' + name + '</h4>'; var html = '<h4>' + name + '</h4>';
@ -257,11 +249,17 @@ function loadDevices(searchType, searchParam){
html += '<div>(' + vendor + '-' + model + ')</div>'; html += '<div>(' + vendor + '-' + model + ')</div>';
} }
return html; return html;
}}, }
{ targets: 2, data: 'enrolmentInfo.owner', className: 'fade-edge remove-padding-top'}, },
{ {targets: 2,
targets: 3, data: 'enrolmentInfo.status', className: 'fade-edge remove-padding-top', data: 'user',
render: function ( status, type, row, meta ) { class: 'fade-edge remove-padding-top',
},
{
targets: 3,
data: 'status',
class: 'fade-edge remove-padding-top',
render: function (status, type, row, meta) {
var html; var html;
switch (status) { switch (status) {
case 'ACTIVE' : case 'ACTIVE' :
@ -278,106 +276,171 @@ function loadDevices(searchType, searchParam){
break; break;
} }
return html; return html;
}}, }
{ },
targets: 4, data: 'type', className: 'fade-edge remove-padding-top', {
render: function ( status, type, row, meta ) { targets: 4,
return getDeviceTypeLabel(row.type); data: 'deviceType',
class: 'fade-edge remove-padding-top',
render: function (status, type, row, meta) {
return getDeviceTypeLabel(row.deviceType);
}
},
{
targets: 5,
data: 'ownership',
class: 'fade-edge remove-padding-top',
render: function (status, type, row, meta) {
if (getDeviceTypeCategory(row.deviceType) == 'mobile') {
return row.enrolmentInfo.ownership;
} else {
return null;
} }
}, }
{ },
targets: 5, data: 'enrolmentInfo.ownership', className: 'fade-edge remove-padding-top', {
render: function (status, type, row, meta) { targets: 6,
if (getDeviceTypeCategory(row.type) == 'mobile') { data: 'status',
return row.enrolmentInfo.ownership; class: 'text-right content-fill text-left-on-grid-view no-wrap',
} else { render: function (status, type, row, meta) {
return null; var deviceType = row.deviceType;
}
}
},
{ targets: 6, data: 'enrolmentInfo.status' , className: 'text-right content-fill text-left-on-grid-view no-wrap' ,
render: function ( status, type, row, meta ) {
var deviceType = row.type;
var deviceIdentifier = row.deviceIdentifier; var deviceIdentifier = row.deviceIdentifier;
var html = '<span></span>'; var html = '<span></span>';
if (status != 'REMOVED') { if (status != 'REMOVED') {
html = '<a href="device/' + deviceType + '?id=' + deviceIdentifier + '" data-click-event="remove-form"' + html =
' class="btn padding-reduce-on-grid-view"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + '<a href="device/' + deviceType + '?id=' + deviceIdentifier + '" data-click-event="remove-form"'
+
' class="btn padding-reduce-on-grid-view"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>'
+
'<i class="fw fw-view fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">View</span></a>'; '<i class="fw fw-view fw-stack-1x"></i></span><span class="hidden-xs hidden-on-grid-view">View</span></a>';
html += '<a href="device/' + deviceType + '/analytics?deviceId=' + deviceIdentifier + '&deviceName=' + row.name + '" ' + html += '<a href="device/' + deviceType + '/analytics?deviceId=' + deviceIdentifier + '&deviceName='
'data-click-event="remove-form" class="btn padding-reduce-on-grid-view"><span class="fw-stack">' + + row.name + '" ' +
'<i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' + 'data-click-event="remove-form" class="btn padding-reduce-on-grid-view"><span class="fw-stack">'
+
'<i class="fw fw-ring fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>'
+
'<span class="hidden-xs hidden-on-grid-view">Analytics</span>'; '<span class="hidden-xs hidden-on-grid-view">Analytics</span>';
if (!groupName || !groupOwner) { if (!groupName || !groupOwner) {
html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view group-device-link" ' + html +=
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + '" data-devicename="' + '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view group-device-link" '
row.name + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + +
'<i class="fw fw-grouping fw-stack-1x"></i></span>' + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>'; + '" data-devicename="' +
row.name + '"><span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-grouping fw-stack-1x"></i></span>' +
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
} }
html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" ' + html +=
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + '" data-devicename="' + row.name + '">' + '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + +
'<i class="fw fw-edit fw-stack-1x"></i></span>' + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
'<span class="hidden-xs hidden-on-grid-view">Edit</span></a>'; + '" data-devicename="' + row.name + '">' +
html += '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" ' + '<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType + '" data-devicename="' + row.name + '">' + '<i class="fw fw-edit fw-stack-1x"></i></span>' +
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' + '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
'<i class="fw fw-delete fw-stack-1x"></i></span>' + html +=
'<span class="hidden-xs hidden-on-grid-view">Delete</span>'; '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view remove-device-link" '
+
'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '">' +
'<span class="fw-stack"><i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i></span>' +
'<span class="hidden-xs hidden-on-grid-view">Delete</span>';
} }
return html; return html;
}} }
],
"createdRow": function( row, data, dataIndex ) {
$(row).attr('data-type', 'selectable');
$(row).attr('data-deviceid', data.deviceIdentifier);
$(row).attr('data-devicetype', data.type);
var model = getPropertyValue(data.properties, 'DEVICE_MODEL');
var vendor = getPropertyValue(data.properties, 'VENDOR');
var owner = data.enrolmentInfo.owner;
var status = data.enrolmentInfo.status;
var ownership = data.enrolmentInfo.ownership;
var deviceType = data.type;
var category = getDeviceTypeCategory(deviceType);
$.each($('td', row), function (colIndex) {
switch(colIndex) {
case 1:
$(this).attr('data-search', model + ',' + vendor);
$(this).attr('data-display', model);
break;
case 2:
$(this).attr('data-grid-label', "Owner");
$(this).attr('data-search', owner);
$(this).attr('data-display', owner);
break;
case 3:
$(this).attr('data-grid-label', "Status");
$(this).attr('data-search', status);
$(this).attr('data-display', status);
break;
case 4:
$(this).attr('data-grid-label', "Type");
$(this).attr('data-search', deviceType);
$(this).attr('data-display', getDeviceTypeLabel(deviceType));
break;
case 5:
if (category == 'mobile') {
$(this).attr('data-grid-label', "Ownership");
$(this).attr('data-search', ownership);
$(this).attr('data-display', ownership);
}
break;
}
});
},
"fnDrawCallback": function( oSettings ) {
$(".icon .text").res_text(0.2);
attachDeviceEvents();
} }
}); ];
var fnCreatedRow = function (row, data, dataIndex) {
$(row).attr('data-type', 'selectable');
$(row).attr('data-deviceid', data.deviceIdentifier);
$(row).attr('data-devicetype', data.type);
var model = getPropertyValue(data.properties, 'DEVICE_MODEL');
var vendor = getPropertyValue(data.properties, 'VENDOR');
var owner = data.user;
var status = data.status;
var ownership = data.ownership;
var deviceType = data.type;
var category = getDeviceTypeCategory(deviceType);
$.each($('td', row), function (colIndex) {
switch (colIndex) {
case 1:
$(this).attr('data-search', model + ',' + vendor);
$(this).attr('data-display', model);
break;
case 2:
$(this).attr('data-grid-label', "Owner");
$(this).attr('data-search', owner);
$(this).attr('data-display', owner);
break;
case 3:
$(this).attr('data-grid-label', "Status");
$(this).attr('data-search', status);
$(this).attr('data-display', status);
break;
case 4:
$(this).attr('data-grid-label', "Type");
$(this).attr('data-search', deviceType);
$(this).attr('data-display', getDeviceTypeLabel(deviceType));
break;
case 5:
if (category == 'mobile') {
$(this).attr('data-grid-label', "Ownership");
$(this).attr('data-search', ownership);
$(this).attr('data-display', ownership);
}
break;
}
});
};
var dataFilter = function (data) {
data = JSON.parse(data);
var objects = [];
$(data.devices).each(function (index) {
objects.push(
{
model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"),
vendor: getPropertyValue(data.devices[index].properties, "VENDOR"),
user: data.devices[index].enrolmentInfo.owner,
status: data.devices[index].enrolmentInfo.status,
ownership: data.devices[index].enrolmentInfo.ownership,
deviceType: data.devices[index].type,
deviceIdentifier: data.devices[index].deviceIdentifier,
name: data.devices[index].name
}
);
});
var json = {
"recordsTotal": data.count,
"recordsFiltered": data.count,
"data": objects
};
return JSON.stringify(json);
};
$('#device-grid').datatables_extended_serverside_paging(
null,
serviceURL,
dataFilter,
columns,
fnCreatedRow,
function () {
$(".icon .text").res_text(0.2);
$('#device-grid').removeClass('hidden');
$("#loading-content").remove();
attachDeviceEvents();
}, {
"placeholder": "Search By Device Name",
"searchKey": "name"
}
);
$(deviceCheckbox).click(function () { $(deviceCheckbox).click(function () {
addDeviceSelectedClass(this); addDeviceSelectedClass(this);
}); });
@ -403,7 +466,7 @@ $(document).ready(function () {
var permissionList = $("#permission").data("permission"); var permissionList = $("#permission").data("permission");
for (var key in permissionList) { for (var key in permissionList) {
if (permissionList.hasOwnProperty(key)){ if (permissionList.hasOwnProperty(key)) {
$.setPermission(key); $.setPermission(key);
} }
} }
@ -412,29 +475,29 @@ $(document).ready(function () {
/* for device list sorting drop down */ /* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({ $(".ctrl-filter-type-switcher").popover({
html : true, html: true,
content : function () { content: function () {
return $("#content-filter-types").html(); return $("#content-filter-types").html();
} }
}); });
/* for data tables*/ /* for data tables*/
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();
$("[data-toggle=popover]").popover(); $("[data-toggle=popover]").popover();
$(".ctrl-filter-type-switcher").popover ({ $(".ctrl-filter-type-switcher").popover({
html : true, html: true,
content: function() { content: function () {
return $('#content-filter-types').html(); return $('#content-filter-types').html();
} }
}); });
$('#nav').affix ({ $('#nav').affix({
offset: { offset: {
top: $('header').height() top: $('header').height()
} }
}); });
}); });
@ -464,7 +527,7 @@ function showPopup() {
function hidePopup() { function hidePopup() {
$(modalPopupContent).html(''); $(modalPopupContent).html('');
$(modalPopup).modal('hide'); $(modalPopup).modal('hide');
$('body').removeClass('modal-open').css('padding-right','0px'); $('body').removeClass('modal-open').css('padding-right', '0px');
$('.modal-backdrop').remove(); $('.modal-backdrop').remove();
} }
@ -483,16 +546,17 @@ function attachDeviceEvents() {
var deviceId = $(this).data("deviceid"); var deviceId = $(this).data("deviceid");
var deviceType = $(this).data("devicetype"); var deviceType = $(this).data("devicetype");
$(modalPopupContent).html($('#group-device-modal-content').html()); $(modalPopupContent).html($('#group-device-modal-content').html());
$('#user-groups').html('<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>'); $('#user-groups').html(
'<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>');
$("a#group-device-yes-link").hide(); $("a#group-device-yes-link").hide();
showPopup(); showPopup();
var serviceURL; var serviceURL;
if ($.hasPermission("LIST_ALL_GROUPS")) { if ($.hasPermission("LIST_ALL_GROUPS")) {
serviceURL = "/devicemgt_admin/groups/all"; serviceURL = "/api/device-mgt/v1.0/groups/all";
} else if ($.hasPermission("LIST_GROUPS")) { } else if ($.hasPermission("LIST_GROUPS")) {
//Get authenticated users groups //Get authenticated users groups
serviceURL = "/devicemgt_admin/groups/user/" + currentUser + "/all"; serviceURL = "/api/device-mgt/v1.0/groups/user/" + currentUser + "/all";
} }
invokerUtil.get(serviceURL, function (data) { invokerUtil.get(serviceURL, function (data) {
@ -507,7 +571,7 @@ function attachDeviceEvents() {
$("a#group-device-yes-link").show(); $("a#group-device-yes-link").show();
$("a#group-device-yes-link").click(function () { $("a#group-device-yes-link").click(function () {
var selectedGroup = $('#assign-group-selector').val(); var selectedGroup = $('#assign-group-selector').val();
serviceURL = "/devicemgt_admin/groups/owner/" + selectedGroup + "/devices"; serviceURL = "/api/device-mgt/v1.0/groups/owner/" + selectedGroup + "/devices";
var device = {"id": deviceId, "type": deviceType}; var device = {"id": deviceId, "type": deviceType};
invokerUtil.post(serviceURL, device, function (data) { invokerUtil.post(serviceURL, device, function (data) {
$(modalPopupContent).html($('#group-associate-device-200-content').html()); $(modalPopupContent).html($('#group-associate-device-200-content').html());
@ -545,7 +609,7 @@ function attachDeviceEvents() {
$("a.remove-device-link").click(function () { $("a.remove-device-link").click(function () {
var deviceId = $(this).data("deviceid"); var deviceId = $(this).data("deviceid");
var deviceType = $(this).data("devicetype"); var deviceType = $(this).data("devicetype");
var serviceURL = "/devicemgt_admin/devices/type/" + deviceType + "/id/" + deviceId; var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceType + "/id/" + deviceId;
$(modalPopupContent).html($('#remove-device-modal-content').html()); $(modalPopupContent).html($('#remove-device-modal-content').html());
showPopup(); showPopup();
@ -576,7 +640,7 @@ function attachDeviceEvents() {
var deviceId = $(this).data("deviceid"); var deviceId = $(this).data("deviceid");
var deviceType = $(this).data("devicetype"); var deviceType = $(this).data("devicetype");
var deviceName = $(this).data("devicename"); var deviceName = $(this).data("devicename");
var serviceURL = "/devicemgt_admin/devices/type/" + deviceType + "/id/" + deviceId; var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceType + "/id/" + deviceId;
$(modalPopupContent).html($('#edit-device-modal-content').html()); $(modalPopupContent).html($('#edit-device-modal-content').html());
$('#edit-device-name').val(deviceName); $('#edit-device-name').val(deviceName);
@ -630,6 +694,6 @@ function displayDeviceErrors(jqXHR) {
function getParameterByName(name) { function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search); results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
} }

View File

@ -54,7 +54,7 @@
<div> <div>
<span id="permission" data-permission="{{permissions.list}}"></span> <span id="permission" data-permission="{{permissions.list}}"></span>
{{#if groupCount}} {{#if groupCount}}
<div class="container-fluid" id="group-listing" data-current-user="{{currentUser.username}}"> <div class="container-fluid" id="group-listing" data-current-user="{{@user.username}}">
<table class="table table-striped table-hover list-table display responsive nowrap data-table table-selectable grid-view" <table class="table table-striped table-hover list-table display responsive nowrap data-table table-selectable grid-view"
id="group-grid"> id="group-grid">
<thead> <thead>

View File

@ -47,24 +47,6 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{!
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
}}
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
{{#if removePermitted}} {{#if removePermitted}}
<input type="hidden" id="can-remove" value="true" /> <input type="hidden" id="can-remove" value="true" />
@ -87,7 +69,7 @@ under the License.
<th colspan="3"></th> <th colspan="3"></th>
</tr> </tr>
</thead> </thead>
<tbody id="ast-container" data-app-context="{{appContext}}"></tbody> <tbody id="ast-container" data-app-context="{{@app.context}}/"></tbody>
</table> </table>
</div> </div>
@ -154,7 +136,7 @@ under the License.
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<script id="role-listing" data-current-user="{{currentUser.username}}" <script id="role-listing" data-current-user="{{@user.username}}"
src="{{@page.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template"></script> src="{{@page.publicUri}}/templates/role-listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/role-listing.js"}} {{js "js/role-listing.js"}}
{{/zone}} {{/zone}}

View File

@ -31,7 +31,6 @@ function onRequest(context) {
context["removePermitted"] = true; context["removePermitted"] = true;
} }
context["appContext"] = deviceMgtProps["appContext"];
context["adminRole"] = deviceMgtProps["adminRole"]; context["adminRole"] = deviceMgtProps["adminRole"];
return context; return context;

View File

@ -327,7 +327,7 @@
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget --> <!--suppress HtmlUnknownTarget -->
<script id="user-listing" data-current-user="{{currentUser.username}}" <script id="user-listing" data-current-user="{{@user.username}}"
src="{{@page.publicUri}}/templates/listing.hbs" type="text/x-handlebars-template"></script> src="{{@page.publicUri}}/templates/listing.hbs" type="text/x-handlebars-template"></script>
{{js "js/listing.js"}} {{js "js/listing.js"}}
{{/zone}} {{/zone}}

View File

@ -52,7 +52,7 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
filter: false, filter: false,
bSortCellsTop: true, bSortCellsTop: true,
ajax : { ajax : {
url: "/emm/api/data-tables/invoker", url: context + "/api/data-tables/invoker",
data : function (params) { data : function (params) {
var i; var i;
var searchParams = {}; var searchParams = {};

View File

@ -70,7 +70,7 @@
{{css "css/listing-grid.css"}} {{css "css/listing-grid.css"}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="device-listing" data-current-user="{{currentUser.username}}" <script id="device-listing" data-current-user="{{@user.username}}"
src="{{@unit.publicUri}}/templates/listing.hbs" src="{{@unit.publicUri}}/templates/listing.hbs"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -41,11 +41,11 @@ $(document).ready(function () {
/* for device list sorting drop down */ /* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({ $(".ctrl-filter-type-switcher").popover({
html : true, html : true,
content : function () { content : function () {
return $("#content-filter-types").html(); return $("#content-filter-types").html();
} }
}); });
$(".ast-container").on("click", ".claim-btn", function(e){ $(".ast-container").on("click", ".claim-btn", function(e){
e.stopPropagation(); e.stopPropagation();
@ -142,7 +142,13 @@ function loadDevices(searchType, searchParam){
} }
} else { } else {
$('#device-grid').addClass('hidden'); $('#device-grid').addClass('hidden');
$('#device-listing-status-msg').text('No device is available to be displayed.'); $('#device-listing-status-msg').html(
'<div class="col-centered text-center"><h3 class="text-muted"><i class="fw fw-mobile fw-3x"></i>' +
'</h3><h3 class="text-muted">No device type is available to be displayed.</h3>' +
'<a href="https://docs.wso2.com/display/IoTS100/Quick+Start+Guide" target="_blank" ' +
'class="btn-operations btn-default"><span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-document fw-stack-1x"></i></span>' +
'&nbsp;&nbsp;Quick Startup Guide</a></div>');
} }
$(".icon .text").res_text(0.2); $(".icon .text").res_text(0.2);
@ -197,11 +203,11 @@ $(document).ready(function () {
/* for device list sorting drop down */ /* for device list sorting drop down */
$(".ctrl-filter-type-switcher").popover({ $(".ctrl-filter-type-switcher").popover({
html : true, html : true,
content : function () { content : function () {
return $("#content-filter-types").html(); return $("#content-filter-types").html();
} }
}); });
$(".ast-container").on("click", ".claim-btn", function(e){ $(".ast-container").on("click", ".claim-btn", function(e){
e.stopPropagation(); e.stopPropagation();
@ -223,17 +229,17 @@ $(document).ready(function () {
$("[data-toggle=popover]").popover(); $("[data-toggle=popover]").popover();
$(".ctrl-filter-type-switcher").popover({ $(".ctrl-filter-type-switcher").popover({
html : true, html : true,
content: function() { content: function() {
return $('#content-filter-types').html(); return $('#content-filter-types').html();
} }
}); });
$('#nav').affix({ $('#nav').affix({
offset: { offset: {
top: $('header').height() top: $('header').height()
} }
}); });
$(document).on("click", "tr.clickable-row", function(){ $(document).on("click", "tr.clickable-row", function(){
window.document.location = $(this).data('href'); window.document.location = $(this).data('href');

View File

@ -1,5 +1,5 @@
<tr data-type="selectable" data-deviceid="{{deviceTypeId}}" data-devicetype="{{deviceTypeName}}" <tr data-type="selectable" data-deviceid="{{deviceTypeId}}" data-devicetype="{{deviceTypeName}}"
data-href="{{appContext}}/device/{{deviceTypeName}}/enroll" class="clickable-row"> data-href="{{@app.context}}/device/{{deviceTypeName}}/enroll" class="clickable-row">
<td class="remove-padding icon-only content-fill" data-search="{{deviceCategory}}" data-display="{{deviceCategory}}"> <td class="remove-padding icon-only content-fill" data-search="{{deviceCategory}}" data-display="{{deviceCategory}}">
<div class="thumbnail icon"> <div class="thumbnail icon">
<!--<i class="square-element text fw fw-mobile"></i>--> <!--<i class="square-element text fw fw-mobile"></i>-->
@ -9,7 +9,7 @@
<td class="remove-padding-top" data-search="{{deviceTypeLabel}}" data-display="{{deviceTypeLabel}}"> <td class="remove-padding-top" data-search="{{deviceTypeLabel}}" data-display="{{deviceTypeLabel}}">
{{deviceTypeLabel}}</td> {{deviceTypeLabel}}</td>
<td class="text-right content-fill text-left-on-grid-view no-wrap"> <td class="text-right content-fill text-left-on-grid-view no-wrap">
<a href="{{appContext}}/device/{{deviceTypeName}}/enroll" <a href="{{@app.context}}/device/{{deviceTypeName}}/enroll"
data-click-event="remove-form" class="btn col-md-12"> data-click-event="remove-form" class="btn col-md-12">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>

View File

@ -17,6 +17,10 @@
*/ */
(function () { (function () {
var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type");
$(document).ready(function () { $(document).ready(function () {
$(".panel-body").removeClass("hidden"); $(".panel-body").removeClass("hidden");
$("#loading-content").remove(); $("#loading-content").remove();
@ -25,10 +29,6 @@
loadOperationsLog(); loadOperationsLog();
} }
if ($('#policies').length) {
loadPolicies();
}
if ($('#policy_compliance').length) { if ($('#policy_compliance').length) {
loadPolicyCompliance(); loadPolicyCompliance();
} }
@ -47,158 +47,157 @@
}); });
function loadOperationsLog(update) { function loadOperationsLog(update) {
var operationsLog = $("#operations-log"); var operationsLogTable = "#operations-log-table";
var deviceListingSrc = operationsLog.attr("src"); if (update) {
var deviceId = operationsLog.data("device-id"); operationTable = $(operationsLogTable).DataTable();
var deviceType = operationsLog.data("device-type"); operationTable.ajax.reload(false);
return;
$.template("operations-log", deviceListingSrc, function (template) { }
var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId; operationTable = $(operationsLogTable).datatables_extended({
serverSide: true,
var successCallback = function (data) { processing: false,
data = JSON.parse(data); searching: false,
$('#operations-spinner').addClass('hidden'); ordering: false,
var viewModel = {}; pageLength : 10,
viewModel.operations = data; order: [],
if (data.length > 0) { ajax: {
var content = template(viewModel); url: context + "/api/operation/paginate",
if (!update) { data: {deviceId : deviceIdentifier, deviceType: deviceType},
$("#operations-log-container").html(content); dataSrc: function (json) {
$('#operations-log-table').datatables_extended(); $("#operations-spinner").addClass("hidden");
} else { $("#operations-log-container").empty();
$('#operations-log-table').dataTable().fnClearTable(); return json.data;
for (var i = 0; i < data.length; i++) { }
var status; },
if (data[i].status == "COMPLETED") { columnDefs: [
status = "<span><i class='fw fw-ok icon-success'></i> Completed</span>"; {targets: 0, data: "code" },
} else if (data[i].status == "PENDING") { {targets: 1, data: "status", render:
status = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>"; function (status) {
} else if (data[i].status == "ERROR") { var html;
status = "<span><i class='fw fw-error icon-danger'></i> Error</span>"; switch (status) {
} else if (data[i].status == "IN_PROGRESS") { case "COMPLETED" :
status = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>"; html = "<span><i class='fw fw-ok icon-success'></i> Completed</span>";
} break;
case "PENDING" :
$('#operations-log-table').dataTable().fnAddData([ html = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
data[i].code, break;
status, case "ERROR" :
data[i].createdTimeStamp html = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
]); break;
} case "IN_PROGRESS" :
} html = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>";
} break;
case "REPEATED" :
}; html = "<span><i class='fw fw-ok icon-warning'></i> Repeated</span>";
invokerUtil.get(serviceURL, break;
successCallback, function (message) { }
console.log(message); return html;
}); }
}); },
{targets: 2, data: "createdTimeStamp", render:
} function (date) {
var value = String(date);
function loadPolicies() { return value.slice(0, 16);
var policyList = $("#policy-list"); }
var policyListingSrc = policyList.attr("src"); }
var deviceId = policyList.data("device-id"); ],
var deviceType = policyList.data("device-type"); "createdRow": function(row, data) {
$(row).attr("data-type", "selectable");
$.template("policy-list", policyListingSrc, function (template) { $(row).attr("data-id", data["id"]);
var serviceURL = "/devicemgt_admin/policies"; $.each($("td", row),
function(colIndex) {
var successCallback = function (data) { switch(colIndex) {
data = JSON.parse(data); case 1:
$('#policy-spinner').addClass('hidden'); $(this).attr("data-grid-label", "Code");
var policyListFromRestEndpoint = data.responseContent; $(this).attr("data-display", data["code"]);
if (policyListFromRestEndpoint.length > 0) { break;
var viewModel = {}; case 2:
var policyListToView = []; $(this).attr("data-grid-label", "Status");
var i, policyObjectFromRestEndpoint, policyObjectToView; $(this).attr("data-display", data["status"]);
for (i = 0; i < policyListFromRestEndpoint.length; i++) { break;
// get list object case 3:
policyObjectFromRestEndpoint = policyListFromRestEndpoint[i]; $(this).attr("data-grid-label", "Created Timestamp");
// populate list object values to view-object $(this).attr("data-display", data["createdTimeStamp"]);
policyObjectToView = {}; break;
policyObjectToView["id"] = policyObjectFromRestEndpoint["id"]; }
policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"]; }
policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"]; );
policyObjectToView["platform"] = policyObjectFromRestEndpoint["profile"]["deviceType"]["name"]; }
policyObjectToView["ownershipType"] = policyObjectFromRestEndpoint["ownershipType"]; });
policyObjectToView["compliance"] = policyObjectFromRestEndpoint["compliance"];
if (policyObjectFromRestEndpoint["active"] == true && policyObjectFromRestEndpoint["updated"] == true) {
policyObjectToView["status"] = "Active/Updated";
} else if (policyObjectFromRestEndpoint["active"] == true && policyObjectFromRestEndpoint["updated"] == false) {
policyObjectToView["status"] = "Active";
} else if (policyObjectFromRestEndpoint["active"] == false && policyObjectFromRestEndpoint["updated"] == true) {
policyObjectToView["status"] = "Inactive/Updated";
} else if (policyObjectFromRestEndpoint["active"] == false && policyObjectFromRestEndpoint["updated"] == false) {
policyObjectToView["status"] = "Inactive";
}
// push view-objects to list
policyListToView.push(policyObjectToView);
}
viewModel.policies = policyListToView;
var content = template(viewModel);
$("#policy-list-container").html(content);
$('#policy-table').datatables_extended();
}
};
invokerUtil.get(serviceURL,
successCallback, function (message) {
console.log(message);
});
});
} }
function loadPolicyCompliance() { function loadPolicyCompliance() {
var policyCompliance = $("#policy-view"); var policyCompliance = $("#policy-view");
var policySrc = policyCompliance.attr("src"); var policyComplianceTemplate = policyCompliance.attr("src");
var deviceId = policyCompliance.data("device-id"); var deviceId = policyCompliance.data("device-id");
var deviceType = policyCompliance.data("device-type"); var deviceType = policyCompliance.data("device-type");
var activePolicy = null; var activePolicy = null;
$.template("policy-view", policySrc, function (template) { $.template(
var serviceURLPolicy = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId + "/active-policy" "policy-view",
var serviceURLCompliance = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId; policyComplianceTemplate,
function (template) {
var successCallbackCompliance = function (data) { var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy";
var viewModel = {}; var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data";
viewModel.policy = activePolicy;
viewModel.deviceType = deviceType;
if (data != null && data.complianceFeatures != null && data.complianceFeatures != undefined && data.complianceFeatures.length > 0) {
viewModel.compliance = "NON-COMPLIANT";
viewModel.complianceFeatures = data.complianceFeatures;
var content = template(viewModel);
$("#policy-list-container").html(content);
} else {
viewModel.compliance = "COMPLIANT";
var content = template(viewModel);
$("#policy-list-container").html(content);
$("#policy-compliance-table").addClass("hidden");
}
};
var successCallbackPolicy = function (data) {
data = JSON.parse(data);
$('#policy-spinner').addClass('hidden');
if (data != null && data.active == true) {
activePolicy = data;
invokerUtil.get(serviceURLCompliance,
successCallbackCompliance, function (message) {
console.log(message);
});
}
};
invokerUtil.get(serviceURLPolicy,
successCallbackPolicy, function (message) {
console.log(message);
});
});
invokerUtil.get(
getEffectivePolicyURL,
// success-callback
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200 && data) {
data = JSON.parse(data);
$("#policy-spinner").addClass("hidden");
if (data["active"] == true) {
activePolicy = data;
invokerUtil.get(
getDeviceComplianceURL,
// success-callback
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200 && data) {
var viewModel = {};
viewModel["policy"] = activePolicy;
viewModel["deviceType"] = deviceType;
data = JSON.parse(data);
var content;
if (data["complianceData"]) {
if (data["complianceData"]["complianceFeatures"] &&
data["complianceData"]["complianceFeatures"].length > 0) {
viewModel["compliance"] = "NON-COMPLIANT";
viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"];
content = template(viewModel);
$("#policy-list-container").html(content);
} else {
viewModel["compliance"] = "COMPLIANT";
content = template(viewModel);
$("#policy-list-container").html(content);
$("#policy-compliance-table").addClass("hidden");
}
} else {
$("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> This device " +
"has no policy applied.<p></div>");
}
}
},
// error-callback
function () {
$("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
"was not successful. please try refreshing data in a while.<p></div>");
}
);
}
}
},
// error-callback
function () {
$("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
"was not successful. please try refreshing data in a while.<p></div>");
}
);
}
);
} }
}()); }());

View File

@ -23,11 +23,11 @@ function onRequest(context) {
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId)["content"];
if (device) { if (device) {
var viewModel = {}; var viewModel = {};
var deviceInfo = device.properties.DEVICE_INFO; var deviceInfo = (device.properties) ? device.properties.DEVICE_INFO : null;
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) { if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) {
deviceInfo = parse(stringify(deviceInfo)); deviceInfo = parse(stringify(deviceInfo));
if (device.type == "ios") { if (device.type == "ios") {
@ -111,7 +111,6 @@ function onRequest(context) {
} }
} }
log.info(device);
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var configs = utility.getDeviceTypeConfig(deviceType); var configs = utility.getDeviceTypeConfig(deviceType);
return {"device": device, "label" : configs["deviceType"]["label"]}; return {"device": device, "label" : configs["deviceType"]["label"]};

View File

@ -55,7 +55,7 @@
</div> </div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="notification-listing" data-current-user="{{currentUser.username}}" <script id="notification-listing" data-current-user="{{@user.username}}"
data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notification-listing.hbs" data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notification-listing.hbs"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
{{js "js/notification-listing.js"}} {{js "js/notification-listing.js"}}

View File

@ -44,6 +44,7 @@ function loadNotifications() {
if (data["notifications"] && data["notifications"].length > 0) { if (data["notifications"] && data["notifications"].length > 0) {
var viewModel = {}; var viewModel = {};
viewModel["notifications"] = data["notifications"]; viewModel["notifications"] = data["notifications"];
viewModel["appContext"] = context;
var content = template(viewModel); var content = template(viewModel);
$("#ast-container").html(content); $("#ast-container").html(content);
$("#unread-notifications").datatables_extended(); $("#unread-notifications").datatables_extended();

View File

@ -57,7 +57,7 @@
<tr data-type="selectable" data-id="{{id}}"> <tr data-type="selectable" data-id="{{id}}">
<td data-display="{{description}}" data-grid-label="Description">{{description}}</td> <td data-display="{{description}}" data-grid-label="Description">{{description}}</td>
<td style="text-align: center;"> <td style="text-align: center;">
<a href="device/{{deviceType}}?id={{deviceIdentifier}}" data-click-event="remove-form"> <a href="{{appContext}}/device/{{deviceType}}?id={{deviceIdentifier}}" data-click-event="remove-form">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-view fw-stack-1x"></i> <i class="fw fw-view fw-stack-1x"></i>

View File

@ -90,99 +90,106 @@
</div> </div>
<div id="apply-changes-modal-content" class="hide"> <div id="apply-changes-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>Do you really want to apply changes to all policies?</h3> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h3>Do you really want to apply changes to all policies?</h3>
<a href="javascript:void(0)" id="apply-changes-yes-link" class="btn-operations"> </div>
Yes <div class="modal-footer">
</a> <div class="buttons">
<a href="javascript:void(0)" id="apply-changes-cancel-link" class="btn-operations"> <a href="javascript:void(0)" id="apply-changes-yes-link" class="btn-operations">
No Yes
</a> </a>
</div> <a href="javascript:void(0)" id="apply-changes-cancel-link" class="btn-operations">
</div> No
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="apply-changes-success-content" class="hide"> <div id="apply-changes-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>Done. Changes applied successfully.</h3> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h3>Done. Changes applied successfully.</h3>
<a href="javascript:void(0)" id="apply-changes-success-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="javascript:void(0)" id="apply-changes-success-link" class="btn-operations">
</div> Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="apply-changes-error-content" class="hide"> <div id="apply-changes-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>An unexpected error occurred. Please try again later.</h3> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h3>An unexpected error occurred. Please try again later.</h3>
<a href="javascript:void(0)" id="apply-changes-error-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="javascript:void(0)" id="apply-changes-error-link" class="btn-operations">
</div> Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-policy-error-content" class="hide"> <div id="remove-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>An unexpected error occurred. Please try again later.</h3> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h3>An unexpected error occurred. Please try again later.</h3>
<a href="javascript:void(0)" id="remove-policy-error-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="javascript:void(0)" id="remove-policy-error-link" class="btn-operations">
</div> Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="save-policy-priorities-success-content" class="hide"> <div id="save-policy-priorities-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>Done. New Policy priorities were successfully updated.</h3> </div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> <h3>Done. New Policy priorities were successfully updated.</h3>
<a href="javascript:void(0)" id="save-policy-priorities-success-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="javascript:void(0)" id="save-policy-priorities-success-link" class="btn-operations">
</div> Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="save-policy-priorities-error-content" class="hide"> <div id="save-policy-priorities-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>An unexpected error occurred. Please try again later.</h3> </div>
<div class="buttons"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<a href="javascript:void(0)" id="save-policy-priorities-error-link" class="btn-operations"> <h3>An unexpected error occurred. Please try again later.</h3>
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="javascript:void(0)" id="save-policy-priorities-error-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -82,16 +82,18 @@
</div> </div>
</div> </div>
<div id="child-deselect-error-content" class="hide"> <div id="child-deselect-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
<div class="col-lg-5 col-md-6 col-centered"> </button>
<h3>Can't deselect child permissions when parent permission is selected.</h3> </div>
<div class="buttons"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<a href="#" id="child-deselect-error-link" class="btn-operations"> <h3>Can't deselect child permissions when parent permission is selected.</h3>
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="child-deselect-error-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -87,7 +87,7 @@
{{#zone "navbarCollapsableRightItems"}} {{#zone "navbarCollapsableRightItems"}}
<ul id="notification-bubble-wrapper" class="nav navbar-nav navbar-right"> <ul id="notification-bubble-wrapper" class="nav navbar-nav navbar-right">
<li class="visible-inline-block"> <li class="visible-inline-block">
<!--<a href="{{appContext}}notification-listing" title="Failures of operations on the device side will be listed here">--> <!--<a href="{{@app.context}}notification-listing" title="Failures of operations on the device side will be listed here">-->
<a data-toggle="sidebar" data-target="#right-sidebar" data-container=".page-content" <a data-toggle="sidebar" data-target="#right-sidebar" data-container=".page-content"
aria-expanded="false" rel="notifications-sidebar"> aria-expanded="false" rel="notifications-sidebar">
<span class="icon fw-stack"> <span class="icon fw-stack">
@ -105,12 +105,12 @@
data-offset-top="80"> data-offset-top="80">
<ul class="sidebar-messages"> <ul class="sidebar-messages">
</ul> </ul>
<div class="text-center"><a href="{{appContext}}notification-listing" class="btn btn-primary">Show All Notifications</a></div> <div class="text-center"><a href="{{@app.context}}/notification-listing" class="btn btn-primary">Show All Notifications</a></div>
</div> </div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="notifications" data-current-user="{{currentUser.username}}" <script id="notifications" data-current-user="{{@user.username}}"
data-image-resource="{{self.publicURL}}/images/" src="{{self.publicURL}}/templates/notifications.hbs" data-image-resource="{{@unit.publicUri}}/images/" src="{{@unit.publicUri}}/templates/notifications.hbs"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
{{js "js/nav-menu.js"}} {{js "js/nav-menu.js"}}
{{/zone}} {{/zone}}

View File

@ -4562,7 +4562,7 @@ a.wr-side-panel-toggle-btn.selected {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: -900px; left: -1000px;
z-index: 10000; z-index: 10000;
-moz-transition: left 0.4s ease; -moz-transition: left 0.4s ease;
transition: left 0.4s ease 0s; transition: left 0.4s ease 0s;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,16 +23,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO;
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.ntask.core.Task;
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService; import org.wso2.carbon.policy.mgt.common.spi.PolicyMonitoringService;
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager;
import org.wso2.carbon.policy.mgt.core.mgt.impl.MonitoringManagerImpl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -62,35 +58,25 @@ public class MonitoringTask implements Task {
} }
MonitoringManager monitoringManager = PolicyManagementDataHolder.getInstance().getMonitoringManager(); MonitoringManager monitoringManager = PolicyManagementDataHolder.getInstance().getMonitoringManager();
List<String> deviceTypes = new ArrayList<>(); List<String> deviceTypes = new ArrayList<>();
try { try {
deviceTypes = monitoringManager.getDeviceTypes(); deviceTypes = monitoringManager.getDeviceTypes();
} catch (PolicyComplianceException e) { } catch (PolicyComplianceException e) {
log.error("Error occurred while getting the device types."); log.error("Error occurred while getting the device types.");
} }
if (!deviceTypes.isEmpty()) { if (!deviceTypes.isEmpty()) {
try { try {
DeviceManagementProviderService deviceManagementProviderService = DeviceManagementProviderService deviceManagementProviderService =
PolicyManagementDataHolder.getInstance().getDeviceManagementService(); PolicyManagementDataHolder.getInstance().getDeviceManagementService();
for (String deviceType : deviceTypes) { for (String deviceType : deviceTypes) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Running task for device type : " + deviceType); log.debug("Running task for device type : " + deviceType);
} }
PolicyMonitoringService monitoringService = PolicyMonitoringService monitoringService =
PolicyManagementDataHolder.getInstance().getPolicyMonitoringService(deviceType); PolicyManagementDataHolder.getInstance().getPolicyMonitoringService(deviceType);
List<Device> devices = deviceManagementProviderService.getAllDevices(deviceType); List<Device> devices = deviceManagementProviderService.getAllDevices(deviceType);
if (monitoringService != null && !devices.isEmpty()) { if (monitoringService != null && !devices.isEmpty()) {
List<Device> notifiableDevices = new ArrayList<>(); List<Device> notifiableDevices = new ArrayList<>();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Removing inactive and blocked devices from the list for the device type : " + log.debug("Removing inactive and blocked devices from the list for the device type : " +
deviceType); deviceType);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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