diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index ecb5c435526..8349d4cf307 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 1a951226ec3..d3ea62d7ea4 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index bee95700eed..d56e0f79c32 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index a219d50173e..3c28ae241fa 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index faaeec3fecd..3e776dac708 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 50de0206f26..563357ce4a2 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index de6bca2ef15..ccf4ba859c8 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index ab32ee8afe9..d1eb5b1edac 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index 0dd8d73e3bf..3d6a2d007d2 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index 91f37cd5a35..dca99910b75 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index 0d23d871db7..523a122618b 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 4c04d1b26c4..b6cc103ff78 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 0453f346065..1a2bd498885 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index e6e557ada90..69df3be2126 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index a3167b5db8b..8cb0103d4cf 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java index da488c54353..7085f1244b0 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/src/main/java/org/wso2/carbon/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java @@ -57,7 +57,7 @@ public class FCMNotificationStrategy implements NotificationStrategy { public void execute(NotificationContext ctx) throws PushNotificationExecutionFailedException { try { Device device = - FCMDataHolder.getInstance().getDeviceManagementProviderService().getDevice(ctx.getDeviceId()); + FCMDataHolder.getInstance().getDeviceManagementProviderService().getDeviceWithTypeProperties(ctx.getDeviceId()); this.sendWakeUpCall(ctx.getOperation().getCode(), device); } catch (DeviceManagementException e) { throw new PushNotificationExecutionFailedException("Error occurred while retrieving device information", e); diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index dda338e82d6..de9fbb36db0 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 8b4db4831ee..59307f4248c 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index cbe62f5659a..1dfee97cde7 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 5b236e779d5..6a46e5ddc26 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index 821e60a06fa..4054e08d5c0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index e60ba6cc8dc..e21f8a1dad4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 39f42e330a1..f60e41bbf94 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java index e74bc20073f..f4e3920faac 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceManagementService.java @@ -273,6 +273,13 @@ public interface DeviceManagementService { required = false) @HeaderParam("If-Modified-Since") String timestamp, + @ApiParam( + name = "requireDeviceInfo", + value = "Boolean flag indicating whether to include device-info (location, application list etc) \n" + + " to the device object.", + required = false) + @QueryParam("requireDeviceInfo") + boolean requireDeviceInfo, @ApiParam( name = "offset", value = "The starting pagination index for the complete list of qualified items.", @@ -339,6 +346,13 @@ public interface DeviceManagementService { }) @Path("/user-devices") Response getDeviceByUser( + @ApiParam( + name = "requireDeviceInfo", + value = "Boolean flag indicating whether to include device-info (location, application list etc) \n" + + " to the device object.", + required = false) + @QueryParam("requireDeviceInfo") + boolean requireDeviceInfo, @ApiParam( name = "offset", value = "The starting pagination index for the complete list of qualified items.", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java index 6ef0a8664d9..d06b8a81806 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -83,6 +83,10 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService long timestamp = 0; boolean isIfModifiedSinceSet = false; boolean isSinceSet = false; + if (log.isDebugEnabled()) { + log.debug("getActivities since: " + since + " , offset: " + offset + " ,limit: " + limit + " ," + + "ifModifiedSince: " + ifModifiedSince); + } RequestValidationUtil.validatePaginationParameters(offset, limit); if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { Date ifSinceDate; @@ -112,14 +116,32 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService timestamp = sinceTimestamp / 1000; } + if (timestamp == 0) { + //If timestamp is not sent by the user, a default value is set, that is equal to current time-12 hours. + long time = System.currentTimeMillis() / 1000; + timestamp = time - 42300; + } + if (log.isDebugEnabled()) { + log.debug("getActivities final timestamp " + timestamp); + } + List activities; ActivityList activityList = new ActivityList(); DeviceManagementProviderService dmService; try { + if (log.isDebugEnabled()) { + log.debug("Calling database to get activities."); + } dmService = DeviceMgtAPIUtils.getDeviceManagementService(); activities = dmService.getActivitiesUpdatedAfter(timestamp, limit, offset); activityList.setList(activities); + if (log.isDebugEnabled()) { + log.debug("Calling database to get activity count."); + } int count = dmService.getActivityCountUpdatedAfter(timestamp); + if (log.isDebugEnabled()) { + log.debug("Activity count: " + count); + } activityList.setCount(count); if (activities == null || activities.size() == 0) { if (isIfModifiedSinceSet) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index a3b0a8186b3..c609cdd9dc0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -125,6 +125,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @QueryParam("groupId") int groupId, @QueryParam("since") String since, @HeaderParam("If-Modified-Since") String ifModifiedSince, + @QueryParam("requireDeviceInfo") boolean requireDeviceInfo, @QueryParam("offset") int offset, @QueryParam("limit") int limit) { try { @@ -208,7 +209,12 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { "string is provided in 'If-Modified-Since' header").build()).build(); } request.setSince(sinceDate); - result = dms.getAllDevices(request); + if (requireDeviceInfo) { + result = dms.getAllDevices(request); + } else { + result = dms.getAllDevices(request, false); + } + if (result == null || result.getData() == null || result.getData().size() <= 0) { return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + "after the timestamp provided in 'If-Modified-Since' header").build(); @@ -224,14 +230,22 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { "string is provided in 'since' filter").build()).build(); } request.setSince(sinceDate); - result = dms.getAllDevices(request); + if (requireDeviceInfo) { + result = dms.getAllDevices(request); + } else { + result = dms.getAllDevices(request, false); + } if (result == null || result.getData() == null || result.getData().size() <= 0) { devices.setList(new ArrayList()); devices.setCount(0); return Response.status(Response.Status.OK).entity(devices).build(); } } else { - result = dms.getAllDevices(request); + if (requireDeviceInfo) { + result = dms.getAllDevices(request); + } else { + result = dms.getAllDevices(request, false); + } int resultCount = result.getRecordsTotal(); if (resultCount == 0) { Response.status(Response.Status.OK).entity(devices).build(); @@ -257,7 +271,8 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @GET @Override @Path("/user-devices") - public Response getDeviceByUser(@QueryParam("offset") int offset, + public Response getDeviceByUser(@QueryParam("requireDeviceInfo") boolean requireDeviceInfo, + @QueryParam("offset") int offset, @QueryParam("limit") int limit) { RequestValidationUtil.validatePaginationParameters(offset, limit); @@ -269,7 +284,11 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { request.setOwner(currentUser); try { - result = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(request); + if (requireDeviceInfo) { + result = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(request); + } else { + result = DeviceMgtAPIUtils.getDeviceManagementService().getDevicesOfUser(request, false); + } devices.setList((List) result.getData()); devices.setCount(result.getRecordsTotal()); return Response.status(Response.Status.OK).entity(devices).build(); @@ -289,7 +308,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { DeviceMgtAPIUtils.getDeviceManagementService(); try { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(deviceId, deviceType); - Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier); + Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier, true); if (persistedDevice == null) { return Response.status(Response.Status.NOT_FOUND).build(); } @@ -315,7 +334,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { DeviceManagementProviderService deviceManagementProviderService = DeviceMgtAPIUtils.getDeviceManagementService(); try { Device persistedDevice = deviceManagementProviderService.getDevice(new DeviceIdentifier - (deviceId, deviceType)); + (deviceId, deviceType), true); persistedDevice.setName(device.getName()); boolean response = deviceManagementProviderService.modifyEnrollment(persistedDevice); return Response.status(Response.Status.CREATED).entity(response).build(); @@ -614,7 +633,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { DeviceMgtAPIUtils.getDeviceManagementService(); try { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, type); - Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier); + Device persistedDevice = deviceManagementProviderService.getDevice(deviceIdentifier, false); if (persistedDevice == null) { return Response.status(Response.Status.NOT_FOUND).build(); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java index f51ebfd9282..01dd4880c11 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -128,7 +128,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { List deviceIdentifiers = policyWrapper.getDeviceIdentifiers(); if (deviceIdentifiers != null) { for (DeviceIdentifier id : deviceIdentifiers) { - devices.add(DeviceMgtAPIUtils.getDeviceManagementService().getDevice(id)); + devices.add(DeviceMgtAPIUtils.getDeviceManagementService().getDevice(id, false)); } } policy.setDevices(devices); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index cb4b1bb37ce..9a968a3ac50 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -25,6 +25,7 @@ import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.service.api.admin.DeviceManagementAdminService; @@ -64,8 +65,11 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(DeviceMgtAPIUtils.getTenantId(tenantDomain)); + PaginationRequest request = new PaginationRequest(offset, limit); + request.setDeviceType(type); + request.setDeviceName(name); List devices = DeviceMgtAPIUtils.getDeviceManagementService(). - getDevicesByNameAndType(name, type, offset, limit); + getDevicesByNameAndType(request, false); // setting up paginated result DeviceList deviceList = new DeviceList(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index d6bdd402128..08691a24b42 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 6f4578a4bd4..8da1225709c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 0bc04e6e61f..756f09e32a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -114,7 +114,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem for (String user : userNameList) { userName = user; deviceList = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevicesOfUser - (user); + (user, false); for (Device device : deviceList) { deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(Integer.toString(device.getId())); @@ -156,7 +156,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem for (String role : userRoleList) { userRole = role; deviceList = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider() - .getAllDevicesOfRole(userRole); + .getAllDevicesOfRole(userRole, false); for (Device device : deviceList) { deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setId(Integer.toString(device.getId())); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index 127216f27be..caf594c113f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -55,7 +55,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { public void addDeviceInfo(DeviceIdentifier deviceId, DeviceInfo deviceInfo) throws DeviceDetailsMgtException { try { Device device = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getDevice(deviceId); + getDeviceManagementProvider().getDevice(deviceId, false); DeviceManagementDAOFactory.beginTransaction(); deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId()); @@ -87,7 +87,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { Device device; try { device = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getDevice(deviceId); + getDeviceManagementProvider().getDevice(deviceId, false); if (device == null) { if (log.isDebugEnabled()) { log.debug("No device is found upon the device identifier '" + deviceId.getId() + @@ -123,8 +123,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { } try { List deviceIds = new ArrayList<>(); - List devices = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getAllDevices(); + List devices = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getAllDevices(false); for (Device device : devices) { if (identifierMap.containsKey(device.getDeviceIdentifier()) && device.getType().equals(identifierMap.get(device.getDeviceIdentifier()).getType())) { @@ -154,7 +154,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { try { Device device = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getDevice(deviceLocation.getDeviceIdentifier()); + getDeviceManagementProvider().getDevice(deviceLocation.getDeviceIdentifier(), false); deviceLocation.setDeviceId(device.getId()); DeviceManagementDAOFactory.beginTransaction(); deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId()); @@ -183,7 +183,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { public DeviceLocation getDeviceLocation(DeviceIdentifier deviceId) throws DeviceDetailsMgtException { Device device; try { - device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId); + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, false); if (device == null) { if (log.isDebugEnabled()) { log.debug("No device is found upon the device identifier '" + deviceId.getId() + @@ -212,7 +212,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { try { List devices = DeviceManagementDataHolder.getInstance(). - getDeviceManagementProvider().getAllDevices(deviceIdentifiers.get(0).getType()); + getDeviceManagementProvider().getAllDevices(deviceIdentifiers.get(0).getType(), false); List deviceLocations = new ArrayList<>(); DeviceManagementDAOFactory.openConnection(); for (Device device : devices) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java index a9313320421..fd631f8ce69 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderService.java @@ -57,6 +57,18 @@ public interface DeviceManagementProviderService { */ List getAllDevices(String deviceType) throws DeviceManagementException; + /** + * Method to retrieve all the devices of a given device type. + * + * @param deviceType Device-type of the required devices + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices of given device-type. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + List getAllDevices(String deviceType, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to retrieve all the devices registered in the system. * @@ -66,6 +78,38 @@ public interface DeviceManagementProviderService { */ List getAllDevices() throws DeviceManagementException; + /** + * Method to retrieve all the devices registered in the system. + * + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of registered devices. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + List getAllDevices(boolean requireDeviceInfo) throws DeviceManagementException; + + /** + * Method to retrieve all the devices registered in the system. + * + * @param since - Date value where the resource was last modified + * @return List of registered devices. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + List getDevices(Date since) throws DeviceManagementException; + + /** + * Method to retrieve all the devices registered in the system. + * + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of registered devices. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + List getDevices(Date since, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to retrieve all the devices with pagination support. * @@ -76,6 +120,18 @@ public interface DeviceManagementProviderService { */ PaginationResult getDevicesByType(PaginationRequest request) throws DeviceManagementException; + /** + * Method to retrieve all the devices with pagination support. + * + * @param request PaginationRequest object holding the data for pagination + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return PaginationResult - Result including the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + PaginationResult getDevicesByType(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to retrieve all the devices with pagination support. * @@ -86,21 +142,91 @@ public interface DeviceManagementProviderService { */ PaginationResult getAllDevices(PaginationRequest request) throws DeviceManagementException; - void sendEnrolmentInvitation(String templateName, EmailMetaInfo metaInfo) throws DeviceManagementException; + /** + * Method to retrieve all the devices with pagination support. + * + * @param request PaginationRequest object holding the data for pagination + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return PaginationResult - Result including the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * devices. + */ + PaginationResult getAllDevices(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; - void sendRegistrationEmail(EmailMetaInfo metaInfo) throws DeviceManagementException; + /** + * Returns the device of specified id. + * + * @param deviceId device Id + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException; - FeatureManager getFeatureManager(String deviceType) throws DeviceManagementException; + /** + * Returns the device of specified id. + * + * @param deviceId device Id + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDeviceWithTypeProperties(DeviceIdentifier deviceId) throws DeviceManagementException; /** - * Proxy method to get the tenant configuration of a given platform. + * Returns the device of specified id. * - * @param deviceType Device platform - * @return Tenant configuration settings of the particular tenant and platform. - * @throws DeviceManagementException If some unusual behaviour is observed while fetching the - * configuration. + * @param deviceId device Id + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return Device returns null when device is not available. + * @throws DeviceManagementException */ - PlatformConfiguration getConfiguration(String deviceType) throws DeviceManagementException; + Device getDevice(DeviceIdentifier deviceId, boolean requireDeviceInfo) throws DeviceManagementException; + + /** + * Returns the device of specified id. + * + * @param deviceId device Id + * @param since - Date value where the resource was last modified + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDevice(DeviceIdentifier deviceId, Date since) throws DeviceManagementException; + + /** + * Returns the device of specified id. + * + * @param deviceId device Id + * @param since - Date value where the resource was last modified + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDevice(DeviceIdentifier deviceId, Date since, boolean requireDeviceInfo) throws DeviceManagementException; + + /** + * Returns the device of specified id with the given status. + * + * @param deviceId device Id + * @param status - Status of the device + * + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException; + + /** + * Returns the device of specified id with the given status. + * + * @param deviceId device Id + * @param status - Status of the device + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return Device returns null when device is not available. + * @throws DeviceManagementException + */ + Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status, boolean requireDeviceInfo) throws DeviceManagementException; /** * Method to get the list of devices owned by an user with paging information. @@ -112,6 +238,18 @@ public interface DeviceManagementProviderService { */ PaginationResult getDevicesOfUser(PaginationRequest request) throws DeviceManagementException; + /** + * Method to get the list of devices owned by an user with paging information. + * + * @param request PaginationRequest object holding the data for pagination + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices owned by a particular user along with the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + PaginationResult getDevicesOfUser(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to get the list of devices filtered by the ownership with paging information. * @@ -122,6 +260,18 @@ public interface DeviceManagementProviderService { */ PaginationResult getDevicesByOwnership(PaginationRequest request) throws DeviceManagementException; + /** + * Method to get the list of devices filtered by the ownership with paging information. + * + * @param request PaginationRequest object holding the data for pagination + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices owned by a particular user along with the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + PaginationResult getDevicesByOwnership(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to get the list of devices owned by an user. * @@ -132,16 +282,42 @@ public interface DeviceManagementProviderService { */ List getDevicesOfUser(String userName) throws DeviceManagementException; + /** + * Method to get the list of devices owned by an user. + * + * @param userName Username of the user + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices owned by a particular user + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + List getDevicesOfUser(String userName, boolean requireDeviceInfo) throws DeviceManagementException; + /** * This method returns the list of device owned by a user of given device type. * * @param userName user name. * @param deviceType device type name - * @return - * @throws DeviceManagementException + * @return List of device owned by the given user and type. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list */ List getDevicesOfUser(String userName, String deviceType) throws DeviceManagementException; + /** + * This method returns the list of device owned by a user of given device type. + * + * @param userName user name. + * @param deviceType device type name + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of device owned by the given user and type. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + List getDevicesOfUser(String userName, String deviceType, boolean requireDeviceInfo) throws DeviceManagementException; + /** * Method to get the list of devices owned by users of a particular user-role. * @@ -153,32 +329,50 @@ public interface DeviceManagementProviderService { List getAllDevicesOfRole(String roleName) throws DeviceManagementException; /** - * Method to get the device count of user. + * Method to get the list of devices owned by users of a particular user-role. * - * @return device count - * @throws DeviceManagementException If some unusual behaviour is observed while counting - * the devices + * @param roleName Role name of the users + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices owned by users of a particular role + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list */ - int getDeviceCount(String username) throws DeviceManagementException; + List getAllDevicesOfRole(String roleName, boolean requireDeviceInfo) throws DeviceManagementException; /** - * Method to get the count of all types of devices. + * This method is used to retrieve list of devices based on the device status with paging information. * - * @return device count - * @throws DeviceManagementException If some unusual behaviour is observed while counting - * the devices + * @param request PaginationRequest object holding the data for pagination and filter info + * @return List of devices in given status along with the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list */ - int getDeviceCount() throws DeviceManagementException; + PaginationResult getDevicesByStatus(PaginationRequest request) throws DeviceManagementException; + + /** + * This method is used to retrieve list of devices based on the device status with paging information. + * + * @param request PaginationRequest object holding the data for pagination and filter info + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices in given status along with the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + PaginationResult getDevicesByStatus(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; /** * Method to get the list of devices that matches with the given device name. * - * @param deviceName name of the device + * @param request PaginationRequest object holding the data for pagination and filter info + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. * @return List of devices that matches with the given device name. * @throws DeviceManagementException If some unusual behaviour is observed while fetching the * device list */ - List getDevicesByNameAndType(String deviceName, String type, int offset, int limit) throws DeviceManagementException; + List getDevicesByNameAndType(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; /** * This method is used to retrieve list of devices that matches with the given device name with paging information. @@ -190,7 +384,17 @@ public interface DeviceManagementProviderService { */ PaginationResult getDevicesByName(PaginationRequest request) throws DeviceManagementException; - void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status active) throws DeviceManagementException; + /** + * This method is used to retrieve list of devices that matches with the given device name with paging information. + * + * @param request PaginationRequest object holding the data for pagination + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices in given status along with the required parameters necessary to do pagination. + * @throws DeviceManagementException If some unusual behaviour is observed while fetching the + * device list + */ + PaginationResult getDevicesByName(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException; /** * This method is used to retrieve list of devices based on the device status. @@ -202,14 +406,53 @@ public interface DeviceManagementProviderService { List getDevicesByStatus(EnrolmentInfo.Status status) throws DeviceManagementException; /** - * This method is used to retrieve list of devices based on the device status with paging information. + * This method is used to retrieve list of devices based on the device status. * - * @param request PaginationRequest object holding the data for pagination - * @return List of devices in given status along with the required parameters necessary to do pagination. + * @param status Device status + * @param requireDeviceInfo - A boolean indicating whether the device-info (location, app-info etc) is also required + * along with the device data. + * @return List of devices + * @throws DeviceManagementException + */ + List getDevicesByStatus(EnrolmentInfo.Status status, boolean requireDeviceInfo) throws DeviceManagementException; + + /** + * Method to get the device count of user. + * + * @return device count + * @throws DeviceManagementException If some unusual behaviour is observed while counting + * the devices + */ + int getDeviceCount(String username) throws DeviceManagementException; + + /** + * Method to get the count of all types of devices. + * + * @return device count + * @throws DeviceManagementException If some unusual behaviour is observed while counting + * the devices + */ + int getDeviceCount() throws DeviceManagementException; + + HashMap getTenantedDevice(DeviceIdentifier deviceIdentifier) throws DeviceManagementException; + + void sendEnrolmentInvitation(String templateName, EmailMetaInfo metaInfo) throws DeviceManagementException; + + void sendRegistrationEmail(EmailMetaInfo metaInfo) throws DeviceManagementException; + + FeatureManager getFeatureManager(String deviceType) throws DeviceManagementException; + + /** + * Proxy method to get the tenant configuration of a given platform. + * + * @param deviceType Device platform + * @return Tenant configuration settings of the particular tenant and platform. * @throws DeviceManagementException If some unusual behaviour is observed while fetching the - * device list + * configuration. */ - PaginationResult getDevicesByStatus(PaginationRequest request) throws DeviceManagementException; + PlatformConfiguration getConfiguration(String deviceType) throws DeviceManagementException; + + void updateDeviceEnrolmentInfo(Device device, EnrolmentInfo.Status active) throws DeviceManagementException; /** * This method is used to check whether the device is enrolled with the give user. @@ -250,21 +493,6 @@ public interface DeviceManagementProviderService { boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException; - /** - * Returns the device of specified id. - * - * @param deviceId device Id - * @return Device returns null when device is not avaialble. - * @throws DeviceManagementException - */ - Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException; - - Device getDevice(DeviceIdentifier deviceId, Date since) throws DeviceManagementException; - - HashMap getTenantedDevice(DeviceIdentifier deviceIdentifier) throws DeviceManagementException; - - Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException; - List getAvailableDeviceTypes() throws DeviceManagementException; boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index ac4b4f05506..da7ab6483ad 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -178,7 +178,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } int tenantId = this.getTenantId(); - Device existingDevice = this.getDevice(deviceIdentifier); + Device existingDevice = this.getDevice(deviceIdentifier, false); if (existingDevice != null) { EnrolmentInfo existingEnrolmentInfo = existingDevice.getEnrolmentInfo(); @@ -416,9 +416,45 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return deviceManager.setActive(deviceId, status); } + @Override + public List getAllDevices(String deviceType) throws DeviceManagementException { + return this.getAllDevices(deviceType, true); + } + + @Override + public List getAllDevices(String deviceType, boolean requireDeviceInfo) throws DeviceManagementException { + List allDevices; + try { + DeviceManagementDAOFactory.openConnection(); + allDevices = deviceDAO.getDevices(deviceType, this.getTenantId()); + if (allDevices == null) { + if (log.isDebugEnabled()) { + log.debug("No device is found upon the type '" + deviceType + "'"); + } + return null; + } + } catch (DeviceManagementDAOException e) { + throw new DeviceManagementException("Error occurred while retrieving all devices of type '" + + deviceType + "' that are being managed within the scope of current tenant", e); + } catch (SQLException e) { + throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + + if (requireDeviceInfo) { + return this.getAllDeviceInfo(allDevices); + } + return allDevices; + } + @Override public List getAllDevices() throws DeviceManagementException { - List devices = new ArrayList<>(); + return this.getAllDevices(true); + } + + @Override + public List getAllDevices(boolean requireDeviceInfo) throws DeviceManagementException { List allDevices; try { DeviceManagementDAOFactory.openConnection(); @@ -432,60 +468,19 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(allDevices); } - return devices; + return allDevices; } + @Override public List getDevices(Date since) throws DeviceManagementException { - List devices = new ArrayList<>(); + return this.getDevices(since, true); + } + + @Override + public List getDevices(Date since, boolean requireDeviceInfo) throws DeviceManagementException { List allDevices; try { DeviceManagementDAOFactory.openConnection(); @@ -499,62 +494,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(allDevices); } - return devices; + return allDevices; } @Override public PaginationResult getDevicesByType(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesByType(request, true); + } + + @Override + public PaginationResult getDevicesByType(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException { PaginationResult paginationResult = new PaginationResult(); - List devices = new ArrayList<>(); List allDevices = new ArrayList<>(); int count = 0; int tenantId = this.getTenantId(); @@ -572,43 +525,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - device.setDeviceInfo(info); - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + + if (requireDeviceInfo) { + paginationResult.setData(this.getAllDeviceInfo(allDevices)); + } else { + paginationResult.setData(allDevices); } - paginationResult.setData(devices); + paginationResult.setRecordsFiltered(count); paginationResult.setRecordsTotal(count); return paginationResult; @@ -616,168 +539,75 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public PaginationResult getAllDevices(PaginationRequest request) throws DeviceManagementException { + return this.getAllDevices(request, true); + } + + @Override + public PaginationResult getAllDevices(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException { List devicesForRoles = null; PaginationResult paginationResult = new PaginationResult(); - List devices = new ArrayList<>(); List allDevices = new ArrayList<>(); int count = 0; int tenantId = this.getTenantId(); request = DeviceManagerUtil.validateDeviceListPageSize(request); if (!StringUtils.isEmpty(request.getOwnerRole())) { - devicesForRoles = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider() - .getAllDevicesOfRole(request.getOwnerRole()); - } - try { - DeviceManagementDAOFactory.openConnection(); - allDevices = deviceDAO.getDevices(request, tenantId); - count = deviceDAO.getDeviceCount(request, tenantId); - } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving device list pertaining to " + - "the current tenant", e); - } catch (SQLException e) { - throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - devices = processDevices(devices, allDevices); - - if (devicesForRoles != null) { - count += devicesForRoles.size(); - devices = processDevices(devices, devicesForRoles); - } - paginationResult.setData(devices); - paginationResult.setRecordsFiltered(count); - paginationResult.setRecordsTotal(count); - return paginationResult; - } - - private List processDevices(List devices, List allDevices) throws DeviceManagementException { - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); + devicesForRoles = this.getAllDevicesOfRole(request.getOwnerRole(), false); + if (devicesForRoles != null) { + count = devicesForRoles.size(); + if (requireDeviceInfo) { + paginationResult.setData(getAllDeviceInfo(devicesForRoles)); } - device.setDeviceInfo(info); - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); } - device.setDeviceInfo(info); - + } else { try { DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); + allDevices = deviceDAO.getDevices(request, tenantId); + count = deviceDAO.getDeviceCount(request, tenantId); } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); + throw new DeviceManagementException("Error occurred while retrieving device list pertaining to " + + "the current tenant", e); } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); + throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); + if (requireDeviceInfo) { + paginationResult.setData(getAllDeviceInfo(allDevices)); + } else { + paginationResult.setData(allDevices); } - devices.add(device); } - return devices; + paginationResult.setRecordsFiltered(count); + paginationResult.setRecordsTotal(count); + return paginationResult; } @Override - public List getAllDevices(String deviceType) throws DeviceManagementException { - List devices = new ArrayList<>(); - List allDevices; + public Device getDevice(DeviceIdentifier deviceId, boolean requireDeviceInfo) throws DeviceManagementException { + Device device; try { DeviceManagementDAOFactory.openConnection(); - allDevices = deviceDAO.getDevices(deviceType, this.getTenantId()); - if (allDevices == null) { + device = deviceDAO.getDevice(deviceId, this.getTenantId()); + if (device == null) { + String msg = "No device is found upon the type '" + deviceId.getType() + "' and id '" + + deviceId.getId() + "'"; if (log.isDebugEnabled()) { - log.debug("No device is found upon the type '" + deviceType + "'"); + log.debug(msg); } return null; } } catch (DeviceManagementDAOException e) { - throw new DeviceManagementException("Error occurred while retrieving all devices of type '" + - deviceType + "' that are being managed within the scope of current tenant", e); + throw new DeviceManagementException("Error occurred while obtaining the device for id " + + "'" + deviceId.getId() + "'", e); } catch (SQLException e) { throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(deviceType); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + deviceType + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + device = this.getAllDeviceInfo(device); } - return devices; + return device; } @Override @@ -857,57 +687,55 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + return this.getDevice(deviceId, true); + } + + @Override + public Device getDeviceWithTypeProperties(DeviceIdentifier deviceId) throws DeviceManagementException { Device device; try { DeviceManagementDAOFactory.openConnection(); device = deviceDAO.getDevice(deviceId, this.getTenantId()); if (device == null) { - String msg = "No device is found upon the type '" + deviceId.getType() + "' and id '" + - deviceId.getId() + "'"; if (log.isDebugEnabled()) { - log.debug(msg); + log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" + + deviceId.getId() + "'"); } return null; } - DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - device.setDeviceInfo(info); - - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); } catch (DeviceManagementDAOException e) { throw new DeviceManagementException("Error occurred while obtaining the device for id " + "'" + deviceId.getId() + "'", e); } catch (SQLException e) { throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } catch (DeviceDetailsMgtDAOException e) { - throw new DeviceManagementException("Error occurred while fetching advanced device information", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - // The changes made here to prevent unit tests getting failed. They failed because when running the unit - // tests there is no osgi services. So getDeviceManager() returns a null. - DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); + + DeviceManager deviceManager = this.getDeviceManager(device.getType()); if (deviceManager == null) { if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + deviceId.getType() + "' is null. " + - "Therefore, not attempting method 'getDevice'"); + log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + + "Therefore, not attempting method 'isEnrolled'"); } return device; } - Device pluginSpecificInfo = deviceManager.getDevice(deviceId); - if (pluginSpecificInfo != null) { - device.setFeatures(pluginSpecificInfo.getFeatures()); - device.setProperties(pluginSpecificInfo.getProperties()); + Device dmsDevice = + deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); + if (dmsDevice != null) { + device.setFeatures(dmsDevice.getFeatures()); + device.setProperties(dmsDevice.getProperties()); } return device; } @Override public Device getDevice(DeviceIdentifier deviceId, Date since) throws DeviceManagementException { + return this.getDevice(deviceId, since, true); + } + + @Override + public Device getDevice(DeviceIdentifier deviceId, Date since, boolean requireDeviceInfo) throws DeviceManagementException { Device device; try { DeviceManagementDAOFactory.openConnection(); @@ -919,43 +747,28 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } return null; } - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (device.getDeviceInfo() != null) { - device.getDeviceInfo().setLocation(location); - } - - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); } catch (DeviceManagementDAOException e) { throw new DeviceManagementException("Error occurred while obtaining the device for id " + "'" + deviceId.getId() + "'", e); } catch (SQLException e) { throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } catch (DeviceDetailsMgtDAOException e) { - throw new DeviceManagementException("Error occurred while fetching advanced device information", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - // The changes made here to prevent unit tests getting failed. They failed because when running the unit - // tests there is no osgi services. So getDeviceManager() returns a null. - DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + deviceId.getType() + "' is null. " + - "Therefore, not attempting method 'getDevice'"); - } - return device; - } - Device pluginSpecificInfo = deviceManager.getDevice(deviceId); - if (pluginSpecificInfo != null) { - device.setFeatures(pluginSpecificInfo.getFeatures()); - device.setProperties(pluginSpecificInfo.getProperties()); + if (requireDeviceInfo) { + device = this.getAllDeviceInfo(device); } return device; } @Override public Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException { + return this.getDevice(deviceId, status, true); + } + + @Override + public Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status, boolean requireDeviceInfo) + throws DeviceManagementException { Device device; try { DeviceManagementDAOFactory.openConnection(); @@ -967,41 +780,18 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } return null; } - DeviceInfo info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - device.setDeviceInfo(info); - - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); } catch (DeviceManagementDAOException e) { throw new DeviceManagementException("Error occurred while obtaining the device for id " + "'" + deviceId.getId() + "'", e); } catch (SQLException e) { throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); - } catch (DeviceDetailsMgtDAOException e) { - throw new DeviceManagementException("Error occurred while obtaining information of the device with id " + - "'" + deviceId.getId() + "'", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - // The changes made here to prevent unit tests getting failed. They failed because when running the unit - // tests there is no osgi services. So getDeviceManager() returns a null. - DeviceManager deviceManager = this.getDeviceManager(deviceId.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + deviceId.getType() + "' is null. " + - "Therefore, not attempting method 'getDevice'"); - } - return device; - } - Device pluginSpecificInfo = deviceManager.getDevice(deviceId); - if (pluginSpecificInfo != null) { - device.setFeatures(pluginSpecificInfo.getFeatures()); - device.setProperties(pluginSpecificInfo.getProperties()); + if (requireDeviceInfo) { + device = this.getAllDeviceInfo(device); } + return device; } @@ -1291,7 +1081,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public List getDevicesOfUser(String username) throws DeviceManagementException { - List devices = new ArrayList<>(); + return this.getDevicesOfUser(username, true); + } + + @Override + public List getDevicesOfUser(String username, boolean requireDeviceInfo) throws DeviceManagementException { List userDevices; try { DeviceManagementDAOFactory.openConnection(); @@ -1305,61 +1099,20 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.closeConnection(); } - for (Device device : userDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(userDevices); } - return devices; + return userDevices; } @Override public List getDevicesOfUser(String username, String deviceType) throws DeviceManagementException { - List devices = new ArrayList<>(); + return this.getDevicesOfUser(username, deviceType, true); + } + + @Override + public List getDevicesOfUser(String username, String deviceType, boolean requireDeviceInfo) throws + DeviceManagementException { List userDevices; try { DeviceManagementDAOFactory.openConnection(); @@ -1373,66 +1126,24 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.closeConnection(); } - for (Device device : userDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(userDevices); } - return devices; + return userDevices; } @Override - public PaginationResult getDevicesOfUser(PaginationRequest request) + public PaginationResult getDevicesOfUser(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesOfUser(request, true); + } + + @Override + public PaginationResult getDevicesOfUser(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException { PaginationResult result = new PaginationResult(); int deviceCount = 0; int tenantId = this.getTenantId(); String username = request.getOwner(); - List devices = new ArrayList<>(); List userDevices = new ArrayList<>(); request = DeviceManagerUtil.validateDeviceListPageSize(request); try { @@ -1448,56 +1159,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.closeConnection(); } - for (Device device : userDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - if (log.isDebugEnabled()) { - log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + - "Therefore, not attempting method 'isEnrolled'"); - } - devices.add(device); - continue; - } - Device dmsDevice = - deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + result.setData(this.getAllDeviceInfo(userDevices)); + } else { + result.setData(userDevices); } - result.setData(devices); + result.setRecordsTotal(deviceCount); result.setRecordsFiltered(deviceCount); return result; @@ -1506,8 +1173,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public PaginationResult getDevicesByOwnership(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesByOwnership(request, true); + } + + @Override + public PaginationResult getDevicesByOwnership(PaginationRequest request, boolean requireDeviceInfo) + throws DeviceManagementException { PaginationResult result = new PaginationResult(); - List devices = new ArrayList<>(); List allDevices; int deviceCount = 0; int tenantId = this.getTenantId(); @@ -1525,51 +1197,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - throw new DeviceManagementException("Failed to retrieve device type definition for " - + device.getType()); - } - Device dmsDevice = deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), - device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + result.setData(this.getAllDeviceInfo(allDevices)); + } else { + result.setData(allDevices); } - result.setData(devices); + result.setRecordsTotal(deviceCount); result.setRecordsFiltered(deviceCount); return result; @@ -1577,6 +1210,12 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public List getAllDevicesOfRole(String role) throws DeviceManagementException { + return this.getAllDevicesOfRole(role, true); + } + + //TODO FIX THIS + @Override + public List getAllDevicesOfRole(String role, boolean requireDeviceInfo) throws DeviceManagementException { List devices = new ArrayList<>(); String[] users; int tenantId = this.getTenantId(); @@ -1599,48 +1238,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : userDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - continue; - } - Device dmsDevice = deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), - device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + this.getAllDeviceInfo(userDevices); } } return devices; @@ -1676,74 +1275,40 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } @Override - public List getDevicesByNameAndType(String deviceName, String type, int offset, int limit) throws DeviceManagementException { + public List getDevicesByNameAndType(PaginationRequest request, boolean requireDeviceInfo) + throws DeviceManagementException { List devices = new ArrayList<>(); List allDevices; - limit = DeviceManagerUtil.validateDeviceListPageSize(limit); + int limit = DeviceManagerUtil.validateDeviceListPageSize(request.getRowCount()); try { DeviceManagementDAOFactory.openConnection(); - allDevices = deviceDAO.getDevicesByNameAndType(deviceName, type, this.getTenantId(), offset, limit); + allDevices = deviceDAO.getDevicesByNameAndType(request.getDeviceName(), request.getDeviceType(), + this.getTenantId(), request.getStartIndex(), limit); } catch (DeviceManagementDAOException e) { throw new DeviceManagementException("Error occurred while fetching the list of devices that matches to '" - + deviceName + "'", e); + + request.getDeviceName() + "'", e); } catch (SQLException e) { throw new DeviceManagementException("Error occurred while opening a connection to the data source", e); } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - throw new DeviceManagementException("Failed to retrieve device type definition for " - + device.getType()); - } - Device dmsDevice = deviceManager. - getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(allDevices); } - return devices; + return allDevices; } @Override - public PaginationResult getDevicesByName(PaginationRequest request) - throws DeviceManagementException { + public PaginationResult getDevicesByName(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesByName(request, true); + } + + @Override + public PaginationResult getDevicesByName(PaginationRequest request, boolean requireDeviceInfo) throws + DeviceManagementException { PaginationResult result = new PaginationResult(); int tenantId = this.getTenantId(); - List devices = new ArrayList<>(); List allDevices = new ArrayList<>(); String deviceName = request.getDeviceName(); request = DeviceManagerUtil.validateDeviceListPageSize(request); @@ -1761,50 +1326,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - continue; - } - Device dmsDevice = deviceManager. - getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + result.setData(this.getAllDeviceInfo(allDevices)); + } else { + result.setData(allDevices); } - result.setData(devices); return result; } @@ -1847,8 +1373,14 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } } + @Override public List getDevicesByStatus(EnrolmentInfo.Status status) throws DeviceManagementException { - List devices = new ArrayList<>(); + return this.getDevicesByStatus(status, true); + } + + @Override + public List getDevicesByStatus(EnrolmentInfo.Status status, boolean requireDeviceInfo) throws + DeviceManagementException { List allDevices; try { DeviceManagementDAOFactory.openConnection(); @@ -1861,57 +1393,21 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - continue; - } - Device dmsDevice = deviceManager. - getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + return this.getAllDeviceInfo(allDevices); } - return devices; + return allDevices; + } + + @Override + public PaginationResult getDevicesByStatus(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesByStatus(request, true); } @Override - public PaginationResult getDevicesByStatus(PaginationRequest request) + public PaginationResult getDevicesByStatus(PaginationRequest request, boolean requireDeviceInfo) throws DeviceManagementException { PaginationResult result = new PaginationResult(); - List devices = new ArrayList<>(); List allDevices = new ArrayList<>(); int tenantId = this.getTenantId(); String status = request.getStatus(); @@ -1930,50 +1426,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } finally { DeviceManagementDAOFactory.closeConnection(); } - for (Device device : allDevices) { - DeviceInfo info = null; - try { - DeviceManagementDAOFactory.openConnection(); - info = deviceInfoDAO.getDeviceInformation(device.getId()); - DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); - if (info != null) { - info.setLocation(location); - } - } catch (DeviceDetailsMgtDAOException e) { - log.error("Error occurred while retrieving advance info of '" + device.getType() + - "' that carries the id '" + device.getDeviceIdentifier() + "'"); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - device.setDeviceInfo(info); - - try { - DeviceManagementDAOFactory.openConnection(); - List applications = applicationDAO.getInstalledApplications(device.getId()); - device.setApplications(applications); - } catch (DeviceManagementDAOException e) { - log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + - "which carries the id '" + device.getId() + "'", e); - } catch (SQLException e) { - log.error("Error occurred while opening a connection to the data source", e); - } finally { - DeviceManagementDAOFactory.closeConnection(); - } - DeviceManager deviceManager = this.getDeviceManager(device.getType()); - if (deviceManager == null) { - continue; - } - Device dmsDevice = deviceManager. - getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); - if (dmsDevice != null) { - device.setFeatures(dmsDevice.getFeatures()); - device.setProperties(dmsDevice.getProperties()); - } - devices.add(device); + if (requireDeviceInfo) { + result.setData(this.getAllDeviceInfo(allDevices)); + } else { + result.setData(allDevices); } - result.setData(devices); return result; } @@ -2018,8 +1475,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv @Override public boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus) throws DeviceManagementException { - boolean isDeviceUpdated; - Device device = getDevice(deviceIdentifier); + boolean isDeviceUpdated = false; + Device device = getDevice(deviceIdentifier, false); int deviceId = device.getId(); EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo(); enrolmentInfo.setStatus(newStatus); @@ -2230,4 +1687,105 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } pullNotificationSubscriber.execute(deviceIdentifier, operation); } + + /** + * Returns all the device-info including location of the given device. + */ + private DeviceInfo getDeviceInfo(Device device) { + DeviceInfo info = null; + try { + DeviceManagementDAOFactory.openConnection(); + info = deviceInfoDAO.getDeviceInformation(device.getId()); + DeviceLocation location = deviceInfoDAO.getDeviceLocation(device.getId()); + if (info != null) { + info.setLocation(location); + } + } catch (DeviceDetailsMgtDAOException e) { + log.error("Error occurred while retrieving advance info of '" + device.getType() + + "' that carries the id '" + device.getDeviceIdentifier() + "'"); + } catch (SQLException e) { + log.error("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + return info; + } + + /** + * Returns all the installed apps of the given device. + */ + private List getInstalledApplications(Device device) { + List applications = new ArrayList<>(); + try { + DeviceManagementDAOFactory.openConnection(); + applications = applicationDAO.getInstalledApplications(device.getId()); + device.setApplications(applications); + } catch (DeviceManagementDAOException e) { + log.error("Error occurred while retrieving the application list of '" + device.getType() + "', " + + "which carries the id '" + device.getId() + "'", e); + } catch (SQLException e) { + log.error("Error occurred while opening a connection to the data source", e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + return applications; + } + + /** + * Returns all the available information (device-info, location, applications and plugin-db data) + * of the given device list. + */ + private List getAllDeviceInfo(List allDevices) + throws DeviceManagementException { + List devices = new ArrayList<>(); + if (allDevices != null) { + for (Device device : allDevices) { + device.setDeviceInfo(this.getDeviceInfo(device)); + device.setApplications(this.getInstalledApplications(device)); + + DeviceManager deviceManager = this.getDeviceManager(device.getType()); + if (deviceManager == null) { + if (log.isDebugEnabled()) { + log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + + "Therefore, not attempting method 'isEnrolled'"); + } + devices.add(device); + continue; + } + Device dmsDevice = + deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); + if (dmsDevice != null) { + device.setFeatures(dmsDevice.getFeatures()); + device.setProperties(dmsDevice.getProperties()); + } + devices.add(device); + } + } + return devices; + } + + /** + * Returns all the available information (device-info, location, applications and plugin-db data) + * of a given device. + */ + private Device getAllDeviceInfo(Device device) throws DeviceManagementException { + device.setDeviceInfo(this.getDeviceInfo(device)); + device.setApplications(this.getInstalledApplications(device)); + + DeviceManager deviceManager = this.getDeviceManager(device.getType()); + if (deviceManager == null) { + if (log.isDebugEnabled()) { + log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " + + "Therefore, not attempting method 'isEnrolled'"); + } + return device; + } + Device dmsDevice = + deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); + if (dmsDevice != null) { + device.setFeatures(dmsDevice.getFeatures()); + device.setProperties(dmsDevice.getProperties()); + } + return device; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 44a5995b559..57e232dbb73 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -472,7 +472,8 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.beginTransaction(); for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) { - device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier); + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getDevice(deviceIdentifier, false); if (device == null) { throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'"); } @@ -504,7 +505,8 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); GroupManagementDAOFactory.beginTransaction(); for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) { - device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier); + device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider(). + getDevice(deviceIdentifier, false); if (device == null) { throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'"); } @@ -553,7 +555,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid public List getGroups(DeviceIdentifier deviceIdentifier) throws GroupManagementException { DeviceManagementProviderService managementProviderService = new DeviceManagementProviderServiceImpl(); try { - Device device = managementProviderService.getDevice(deviceIdentifier); + Device device = managementProviderService.getDevice(deviceIdentifier, false); GroupManagementDAOFactory.openConnection(); return groupDAO.getGroups(device.getId(), PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java index 16fff9ce13b..83850b31823 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/task/impl/DeviceTaskManagerImpl.java @@ -90,7 +90,7 @@ public class DeviceTaskManagerImpl implements DeviceTaskManager { List operations; operations = this.getValidOperationNames(); //list operations for each device type - devices = deviceManagementProviderService.getAllDevices(deviceType);//list devices for each type + devices = deviceManagementProviderService.getAllDevices(deviceType, false);//list devices for each type if (!devices.isEmpty()) { for (String str : operations) { CommandOperation operation = new CommandOperation(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 5b5f6706427..f3116c73a5e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -439,7 +439,8 @@ public final class DeviceManagerUtil { } public static boolean isValidDeviceIdentifier(DeviceIdentifier deviceIdentifier) throws DeviceManagementException { - Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier); + Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier, + false); if (device == null || device.getDeviceIdentifier() == null || device.getDeviceIdentifier().isEmpty() || device.getEnrolmentInfo() == null) { return false; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml index 645d4d0a0ae..2cd67fe3171 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 110b1dc8c29..5cf0ae0b3fd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index 059aa68899d..e03ea2f90dc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs @@ -519,8 +519,8 @@ {{/zone}} {{#zone "bottomJs"}} - + {{js "js/listing.js"}} {{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js index 9f13ffd696f..c973d079851 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.js @@ -21,7 +21,7 @@ function onRequest(context) { var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"]; - + var groupId = request.getParameter("groupId"); var viewModel = {}; @@ -64,12 +64,14 @@ function onRequest(context) { var label = data[i]; var analyticsEnabled = "false"; var groupingEnabled = "true"; + var analyticsView = null; if (config) { var deviceType = config.deviceType; category = deviceType.category; label = deviceType.label; analyticsEnabled = deviceType.analyticsEnabled; groupingEnabled = deviceType.groupingEnabled; + analyticsView = deviceType.analyticsView; } deviceTypes.push({ @@ -78,7 +80,8 @@ function onRequest(context) { "label": label, "thumb": utility.getDeviceThumb(data[i]), "analyticsEnabled": analyticsEnabled, - "groupingEnabled": groupingEnabled + "groupingEnabled": groupingEnabled, + "analyticsView" : analyticsView }); } } @@ -88,9 +91,11 @@ function onRequest(context) { } var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; - var analyticsServer = mdmProps["dashboardServerURL"]; - var analyticsURL = analyticsServer + "/portal/t/" + context.user.userDomain + "/dashboards/android-iot/battery?owner=" + context.user.username + "&deviceId="; - viewModel.analyticsURL = analyticsURL; - + var serverUrl = mdmProps["httpsURL"]; + var portalUrl = mdmProps["portalURL"]; + var userDomain = context.user.domain; + viewModel.serverUrl = serverUrl; + viewModel.portalUrl = portalUrl; + viewModel.userDomain = userDomain; return viewModel; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index 8876c069281..f8649271860 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -224,6 +224,22 @@ function loadDevices(searchType, searchParam) { return true; } + // Read "analyticsView" from config.json and return value if exists + function getAnalyticsView(type) { + var deviceTypes = deviceListing.data("deviceTypes"); + for (var i = 0; i < deviceTypes.length; i++) { + if (deviceTypes[i].type == type) { + var analyticsView = deviceTypes[i].analyticsView; + if (analyticsEnabled == undefined) { + // if undefined go to default analytics view + return "none"; + } + return analyticsView; + } + } + return "none"; + } + function groupingEnabled(type) { var deviceTypes = deviceListing.data("deviceTypes"); for (var i = 0; i < deviceTypes.length; i++) { @@ -323,12 +339,20 @@ function loadDevices(searchType, searchParam) { var deviceType = row.deviceType; var deviceIdentifier = row.deviceIdentifier; var html = ''; - var statURL = $("#device-listing").data("analitics-url"); + var portalUrl = $("#device-listing").data("portal-url"); + var serverUrl = $("#device-listing").data("server-url"); + var userDomain = $("#device-listing").data("userDomain"); + var statURL; if (status != 'REMOVED') { html = ''; if (analyticsEnabled(row.deviceType)) { + // redirecting to respective analytics view depending on device configs + switch (getAnalyticsView(deviceType)) { + case "DAS" : { statURL =portalUrl + "/portal/t/"+ userDomain+ "/dashboards/android-iot/battery?owner=" +currentUser+"&deviceId=";break;} + default : {statURL=context+ "/device/" + row.deviceType +"/analytics?deviceId="} + } html += ' device-mgt org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 90507411948..6acab23a9d9 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml diff --git a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml index d765509e984..409e1516d1e 100644 --- a/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml +++ b/components/email-sender/org.wso2.carbon.email.sender.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt email-sender - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index f9d4af2b82d..2849e9bf5f5 100644 --- a/components/email-sender/pom.xml +++ b/components/email-sender/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml index 8bee9f283cd..9ea09e45cea 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web-proxy/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml index 94ec69b1cfb..af77db8c341 100644 --- a/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/dynamic-client-web/pom.xml @@ -21,7 +21,7 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml index 52398ff0408..b3c0da99a3c 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Dynamic client registration service WSO2 Carbon - Dynamic Client Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml index f8bd39fd2a0..49b5a571c65 100644 --- a/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/org.wso2.carbon.dynamic.client.web.app.registration/pom.xml @@ -21,13 +21,13 @@ dynamic-client-registration org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.web.app.registration - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Dynamic client web app registration WSO2 Carbon - Dynamic Client Web-app Registration Service diff --git a/components/identity-extensions/dynamic-client-registration/pom.xml b/components/identity-extensions/dynamic-client-registration/pom.xml index 5fc92ad4c78..008a4d1ce46 100644 --- a/components/identity-extensions/dynamic-client-registration/pom.xml +++ b/components/identity-extensions/dynamic-client-registration/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Dynamic client registration http://wso2.org diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml index 2546ec47132..efd91358999 100644 --- a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/pom.xml @@ -22,18 +22,22 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - OAuth Extensions http://wso2.org + + org.wso2.carbon.devicemgt + org.wso2.carbon.identity.authenticator.backend.oauth + commons-codec.wso2 commons-codec @@ -87,13 +91,18 @@ org.wso2.carbon.device.mgt.oauth.extensions.* + org.wso2.carbon.identity.authenticator.backend.oauth.*, org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}", + org.apache.commons.lang, org.apache.commons.logging, org.osgi.service.component, org.wso2.carbon.identity.application.common.model;version="${carbon.identity.framework.version.range}", + org.wso2.carbon.identity.application.common;version="${carbon.identity.framework.version.range}", + org.wso2.carbon.identity.application.mgt.*;version="${carbon.identity.framework.version.range}", org.wso2.carbon.user.api, org.wso2.carbon.user.core.service, org.wso2.carbon.user.core.tenant, + org.wso2.carbon.user.core.util, org.json.simple, javax.cache, org.wso2.carbon.identity.core.util;version="${carbon.identity.framework.version.range}", @@ -105,7 +114,8 @@ org.wso2.carbon.identity.application.authentication.framework.model;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.base;version="${carbon.identity.framework.version.range}", org.wso2.carbon.identity.oauth2.*;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.utils.multitenancy + org.wso2.carbon.utils.multitenancy, + org.apache.oltu.oauth2.common.validators diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java new file mode 100644 index 00000000000..40d87a17eca --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.keymgt.ScopesIssuer; +import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; +import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; +import org.wso2.carbon.identity.application.common.model.ServiceProvider; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuth2TokenValidator; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationResponse; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidatorFactory; +import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; +import org.wso2.carbon.identity.oauth2.dto.OAuth2AccessTokenReqDTO; +import org.wso2.carbon.identity.oauth2.internal.OAuth2ServiceComponentHolder; +import org.wso2.carbon.identity.oauth2.model.RequestParameter; +import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext; +import org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizationGrantHandler; +import org.wso2.carbon.identity.oauth2.util.OAuth2Util; +import org.wso2.carbon.user.core.util.UserCoreUtil; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; +import java.rmi.RemoteException; + +/** + * This allows user to generate a new access token using an existing access token. + */ +@SuppressWarnings("unused") +public class AccessTokenGrantHandler extends AbstractAuthorizationGrantHandler { + private static Log log = LogFactory.getLog(AccessTokenGrantHandler.class); + private static final String TENANT_DOMAIN_KEY = "tenantDomain"; + + private OAuth2TokenValidator tokenValidator; + public static final String TOKEN_GRANT_PARAM = "admin_access_token"; + + public AccessTokenGrantHandler() { + try { + tokenValidator = OAuthValidatorFactory.getValidator(); + } catch (IllegalArgumentException e) { + log.error("Failed to initialise Authenticator", e); + } + } + + @Override + public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) { + return ScopesIssuer.getInstance().setScopes(tokReqMsgCtx); + } + + @Override + public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { + if (!super.validateGrant(tokReqMsgCtx)) { + return false; + } else { + OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO = tokReqMsgCtx.getOauth2AccessTokenReqDTO(); + String username = null; + String userTenantDomain = null; + String clientId = oAuth2AccessTokenReqDTO.getClientId(); + String spTenantDomain = null; + OAuthValidationResponse response; + ServiceProvider serviceProvider; + boolean authStatus = false; + + String accessToken = null; + RequestParameter[] parameters = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getRequestParameters(); + + for (RequestParameter parameter : parameters) { + if (TOKEN_GRANT_PARAM.equals(parameter.getKey())) { + if (parameter.getValue() != null && parameter.getValue().length > 0) { + accessToken = parameter.getValue()[0]; + } + } + } + + if (accessToken != null && !accessToken.isEmpty()) { + try { + response = tokenValidator.validateToken(accessToken); + } catch (RemoteException e) { + log.error("Failed to validate the OAuth token provided.", e); + return false; + } + if (response != null && response.isValid()) { + authStatus = true; + username = response.getUserName(); + userTenantDomain = MultitenantUtils.getTenantDomain(username); + spTenantDomain = response.getTenantDomain(); + } + } + + try { + serviceProvider = OAuth2ServiceComponentHolder.getApplicationMgtService() + .getServiceProviderByClientId(clientId, "oauth2", spTenantDomain); + } catch (IdentityApplicationManagementException var15) { + throw new IdentityOAuth2Exception("Error occurred while retrieving OAuth2 application data for client id " + + clientId, var15); + } + + if (!serviceProvider.isSaasApp() && !userTenantDomain.equals(spTenantDomain)) { + if (log.isDebugEnabled()) { + log.debug("Non-SaaS service provider tenant domain is not same as user tenant domain; " + + spTenantDomain + " != " + userTenantDomain); + } + + return false; + } else { + String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(username); + username = tenantAwareUserName + "@" + userTenantDomain; + if (authStatus) { + if (!username.contains("/") && StringUtils.isNotBlank(UserCoreUtil.getDomainFromThreadLocal())) { + username = UserCoreUtil.getDomainFromThreadLocal() + "/" + username; + } + + AuthenticatedUser user = OAuth2Util.getUserFromUserName(username); + user.setAuthenticatedSubjectIdentifier(user.toString()); + tokReqMsgCtx.setAuthorizedUser(user); + tokReqMsgCtx.setScope(oAuth2AccessTokenReqDTO.getScope()); + return authStatus; + } else { + throw new IdentityOAuth2Exception("Authentication failed for " + username); + } + } + } + } +} diff --git a/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/AccessTokenGrantValidator.java b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/AccessTokenGrantValidator.java new file mode 100644 index 00000000000..c3f323df4d9 --- /dev/null +++ b/components/identity-extensions/org.wso2.carbon.device.mgt.oauth.extensions/src/main/java/org/wso2/carbon/device/mgt/oauth/extensions/validators/AccessTokenGrantValidator.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.oauth.extensions.validators; + +import org.apache.oltu.oauth2.common.validators.AbstractValidator; +import org.wso2.carbon.device.mgt.oauth.extensions.handlers.grant.AccessTokenGrantHandler; + +import javax.servlet.http.HttpServletRequest; + +@SuppressWarnings("unused") +public class AccessTokenGrantValidator extends AbstractValidator { + + public AccessTokenGrantValidator() { + requiredParams.add(AccessTokenGrantHandler.TOKEN_GRANT_PARAM); + } + +} diff --git a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml index 3be089a6958..13c60eaef72 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.authenticator.backend.oauth/pom.xml @@ -21,7 +21,7 @@ identity-extensions org.wso2.carbon.devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT 4.0.0 diff --git a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml index e8f19d1032d..702d3fccdb7 100644 --- a/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/org.wso2.carbon.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt identity-extensions - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 3040eb7d934..ce9eee400b7 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml @@ -34,10 +34,10 @@ http://wso2.org + org.wso2.carbon.identity.authenticator.backend.oauth org.wso2.carbon.device.mgt.oauth.extensions org.wso2.carbon.identity.jwt.client.extension dynamic-client-registration - org.wso2.carbon.identity.authenticator.backend.oauth diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index 1081b222ba6..26f4197aef3 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml index a3609d012f6..c1bdafa9245 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.decision.point/pom.xml @@ -3,14 +3,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml index bd59f7da979..ebde928bfeb 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.information.point/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml @@ -11,7 +11,7 @@ 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.information.point - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml index b24c140cfa6..bbcc65622cc 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml index a025447895e..2f481860204 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java index adccce97230..bae2b48623d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/enforcement/DelegationTask.java @@ -22,7 +22,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.core.dto.DeviceType; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ntask.core.Task; import org.wso2.carbon.policy.mgt.common.PolicyManagementException; @@ -64,15 +63,15 @@ public class DelegationTask implements Task { log.debug("Number of device types which policies are changed .......... : " + deviceTypes.size()); } if (!deviceTypes.isEmpty()) { - DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance() - .getDeviceManagementService(); + DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance(). + getDeviceManagementService(); List devices; List toBeNotified; for (String deviceType : deviceTypes) { try { devices = new ArrayList<>(); toBeNotified = new ArrayList<>(); - devices.addAll(service.getAllDevices(deviceType)); + devices.addAll(service.getAllDevices(deviceType, false)); //HashMap deviceIdPolicy = policyManager.getAppliedPolicyIdsDeviceIds(); for (Device device : devices) { // if (deviceIdPolicy.containsKey(device.getId())) { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/ComplianceDecisionPointImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/ComplianceDecisionPointImpl.java index a9add947bf5..0f4ca3ad600 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/ComplianceDecisionPointImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/ComplianceDecisionPointImpl.java @@ -54,7 +54,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) { - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.UNREACHABLE); } @@ -71,7 +71,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) { - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.INACTIVE); } @@ -106,7 +106,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.ACTIVE); @@ -213,7 +213,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.ACTIVE); @@ -231,7 +231,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.INACTIVE); @@ -248,7 +248,7 @@ public class ComplianceDecisionPointImpl implements ComplianceDecisionPoint { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.ACTIVE); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index 9fade918e13..4dd4d3054de 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -79,7 +79,7 @@ public class MonitoringManagerImpl implements MonitoringManager { DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); PolicyManager manager = PolicyManagementDataHolder.getInstance().getPolicyManager(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); Policy policy = manager.getAppliedPolicyToDevice(deviceIdentifier); if (policy != null) { PolicyMonitoringManager monitoringService = PolicyManagementDataHolder.getInstance(). @@ -177,7 +177,7 @@ public class MonitoringManagerImpl implements MonitoringManager { try { DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); PolicyManagementDAOFactory.openConnection(); NonComplianceData complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo() .getId()); @@ -207,7 +207,7 @@ public class MonitoringManagerImpl implements MonitoringManager { PolicyManagementDAOFactory.openConnection(); DeviceManagementProviderService service = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); complianceData = monitoringDAO.getCompliance(device.getId(), device.getEnrolmentInfo().getId()); List complianceFeatures = monitoringDAO.getNoneComplianceFeatures(complianceData.getId()); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index b8c0efd98f1..5307c5f29f1 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -392,7 +392,7 @@ public class PolicyManagerImpl implements PolicyManager { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); for (DeviceIdentifier deviceIdentifier : deviceIdentifierList) { try { - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); deviceList.add(device); } catch (DeviceManagementException e) { throw new PolicyManagementException("Error occurred while retrieving device information", e); @@ -641,7 +641,7 @@ public class PolicyManagerImpl implements PolicyManager { try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); PolicyManagementDAOFactory.openConnection(); policyIdList = policyDAO.getPolicyIdsOfDevice(device); @@ -807,7 +807,7 @@ public class PolicyManagerImpl implements PolicyManager { int deviceId = -1; try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); deviceId = device.getId(); PolicyManagementDAOFactory.beginTransaction(); @@ -879,7 +879,7 @@ public class PolicyManagerImpl implements PolicyManager { int deviceId = -1; try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); deviceId = device.getId(); PolicyManagementDAOFactory.beginTransaction(); @@ -909,7 +909,7 @@ public class PolicyManagerImpl implements PolicyManager { int deviceId = -1; try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); deviceId = device.getId(); PolicyManagementDAOFactory.beginTransaction(); @@ -937,7 +937,7 @@ public class PolicyManagerImpl implements PolicyManager { boolean exist; try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); PolicyManagementDAOFactory.openConnection(); exist = policyDAO.checkPolicyAvailable(device.getId(), device.getEnrolmentInfo().getId()); } catch (PolicyManagerDAOException e) { @@ -958,7 +958,7 @@ public class PolicyManagerImpl implements PolicyManager { public boolean setPolicyApplied(DeviceIdentifier deviceIdentifier) throws PolicyManagementException { try { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - Device device = service.getDevice(deviceIdentifier); + Device device = service.getDevice(deviceIdentifier, false); PolicyManagementDAOFactory.openConnection(); policyDAO.setPolicyApplied(device.getId(), device.getEnrolmentInfo().getId()); @@ -996,7 +996,7 @@ public class PolicyManagerImpl implements PolicyManager { DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); Device device; try { - device = service.getDevice(deviceId); + device = service.getDevice(deviceId, false); if (device == null) { if (log.isDebugEnabled()) { log.debug("No device is found upon the device identifier '" + deviceId.getId() + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java index eb28b9e7d8e..a70fb4db757 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java @@ -24,11 +24,9 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; -import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; -import org.wso2.carbon.device.mgt.core.config.policy.PolicyConfiguration; +import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ntask.core.Task; -import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder; import org.wso2.carbon.policy.mgt.core.mgt.MonitoringManager; @@ -83,7 +81,7 @@ public class MonitoringTask implements Task { PolicyMonitoringManager monitoringService = PolicyManagementDataHolder.getInstance().getDeviceManagementService() .getPolicyMonitoringManager(deviceType); - List devices = deviceManagementProviderService.getAllDevices(deviceType); + List devices = deviceManagementProviderService.getAllDevices(deviceType, false); if (monitoringService != null && !devices.isEmpty()) { List notifiableDevices = new ArrayList<>(); if (log.isDebugEnabled()) { diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java index 889a29415a6..a2d8d4b7250 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/MonitoringTestCase.java @@ -140,7 +140,7 @@ public class MonitoringTestCase extends BasePolicyManagementDAOTest { MonitoringManager monitoringManager = new MonitoringManagerImpl(); DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - List devices = service.getAllDevices(ANDROID); + List devices = service.getAllDevices(ANDROID, false); // monitoringManager.addMonitoringOperation(devices); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java index 04d4cfdf43d..d056f8a1ff0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyDAOTestCase.java @@ -118,7 +118,7 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest { if (log.isDebugEnabled()) { log.debug("Printing device taken by calling the service layer with device type."); } - List devices3 = service.getAllDevices("android"); + List devices3 = service.getAllDevices("android", false); log.debug("Device list size ...! " + devices3.size()); for (Device device : devices3) { @@ -437,7 +437,7 @@ public class PolicyDAOTestCase extends BasePolicyManagementDAOTest { PolicyManagerService policyManagerService = new PolicyManagerServiceImpl(); List policies = policyManagerService.getPolicies("android"); - List devices = service.getAllDevices("android"); + List devices = service.getAllDevices("android", false); for (Policy policy : policies) { log.debug("Policy Name : " + policy.getPolicyName()); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java index e60bb6deaf9..03eb400364a 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/java/org/wso2/carbon/policy/mgt/core/PolicyEvaluationTestCase.java @@ -95,7 +95,7 @@ public class PolicyEvaluationTestCase extends BasePolicyManagementDAOTest { log.debug("Getting effective policy for device started .........."); DeviceManagementProviderService service = new DeviceManagementProviderServiceImpl(); - List devices = service.getAllDevices(ANDROID); + List devices = service.getAllDevices(ANDROID, false); PolicyEvaluationPoint evaluationPoint = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint(); diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 431c1719162..5cd78038f31 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Policy Management Component http://wso2.org diff --git a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml index 877c80d672a..8f93ab0b74f 100644 --- a/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index ece31dfc59d..f2d4863f845 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml index caba6dcd6ab..300b32b3185 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - API Management Application Extension Feature http://wso2.org This feature contains an implementation of a api application registration, which takes care of subscription diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index a407404e895..ea9b7d5790b 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Management - APIM handler Server Feature http://wso2.org This feature contains the handler for the api authentications diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml index c9a210d3bf2..ed61a4a1151 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/src/main/resources/conf/iot-api-config.xml @@ -19,20 +19,20 @@ - https://localhost:9443/ + https://${iot.core.host}:${iot.core.https.port}/ - https://localhost:9443/api/certificate-mgt/v1.0/admin/certificates/verify/ + https://${iot.core.host}:${iot.core.https.port}/api/certificate-mgt/v1.0/admin/certificates/verify/ admin admin - https://localhost:9443/dynamic-client-web/register + https://${iot.keymanager.host}:${iot.keymanager.https.port}/client-registration/v0.11/register - https://localhost:9443/oauth2/token + https://${iot.keymanager.host}:${iot.keymanager.https.port}/oauth2/token /services diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index ff5c8469d88..d9f5a335715 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - APIM Integration Client Feature http://wso2.org diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml index 8c7b805fe5a..af805c880f8 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher.feature/pom.xml @@ -21,14 +21,14 @@ org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - API Management Webapp Publisher Feature http://wso2.org This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 2f4406afdaf..faa0af291dc 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - API Management Extensions Feature http://wso2.org diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml index 8b5a21fdec9..72fa3051357 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml index edb9fcc4971..cee873611ae 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml index 55bcba11d35..ac057143aee 100644 --- a/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/org.wso2.carbon.certificate.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Certificate Management Server Feature http://wso2.org This feature contains the core bundles required for back-end Certificate Management functionality diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 94b3ede331f..4f529ef7af9 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Certificate Management Feature http://wso2.org diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml index c505021b07b..fa2580b5608 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Type Deployer Feature http://wso2.org WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 654261f4459..6e5cd1f7712 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - FCM Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index b8c527d5ca5..c3c42301b73 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.http.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 6a9e0aefeff..d3c0299469b 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - MQTT Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 15ba7cf297c..6d2a2a65c7f 100644 --- a/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - XMPP Based Push Notification Provider Feature http://wso2.org WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index b0f59e3c0cd..1a9ca1af1d1 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml index 4788d3facdd..8fc065d8a48 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard.feature/pom.xml @@ -3,13 +3,13 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Device Management Dashboard Analytics Feature WSO2 Carbon - Device Management Dashboard Analytics Feature diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml index 6dae0ed9992..f0863d3edc5 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains bundles related to device analytics data publisher diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml index 38801c59ddd..b17cff86682 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml index 82cc17317f8..69e12580236 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.extensions.feature/pom.xml @@ -4,14 +4,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Management Extensions Feature http://wso2.org This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml index 41eb39eca49..175216ea09e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml index d4fa513103d..4f083020c29 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml index 1e51aa3a389..c7302af438d 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.ui.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 454cb2303f5..2920532d314 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml diff --git a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml index 1596d08bd01..00e6f0f8dff 100644 --- a/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml +++ b/features/dynamic-client-registration/org.wso2.carbon.dynamic.client.registration.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Dynamic Client Registration Server Feature http://wso2.org This feature contains dynamic client registration features diff --git a/features/dynamic-client-registration/pom.xml b/features/dynamic-client-registration/pom.xml index 5e568a5ff8e..7bc1c90e285 100644 --- a/features/dynamic-client-registration/pom.xml +++ b/features/dynamic-client-registration/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml index 7cfdfd3a7a3..c0b3e1dad06 100644 --- a/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml +++ b/features/email-sender/org.wso2.carbon.email.sender.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt email-sender-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Email Sender Feature http://wso2.org This feature contains the core bundles required for email sender related functionality diff --git a/features/email-sender/pom.xml b/features/email-sender/pom.xml index 49978eed475..e6968fd81e6 100644 --- a/features/email-sender/pom.xml +++ b/features/email-sender/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Email Sender Feature http://wso2.org diff --git a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml index c72164bec93..da864800e98 100644 --- a/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/org.wso2.carbon.identity.jwt.client.extension.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt jwt-client-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - JWT Client Feature http://wso2.org This feature contains jwt client implementation from which we can get a access token using the jwt diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 350e5ea844a..5554559cc08 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,13 +23,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Dynamic Client Registration Feature http://wso2.org diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index a41e8458240..b686fbc64fd 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Mgt OAuth Extensions Feature http://wso2.org This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index c123b225f1b..1ffa97f2401 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Device Management OAuth Extensions Feature http://wso2.org diff --git a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml index b38a6e72bfa..e35d60b80ea 100644 --- a/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/org.wso2.carbon.policy.mgt.server.feature/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Policy Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 37e04a944ad..65d83c9012d 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,14 +23,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Policy Management Feature http://wso2.org diff --git a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml index 9ed16e47b2e..6bf120fb7fe 100644 --- a/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/org.wso2.carbon.webapp.authenticator.framework.server.feature/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Webapp Authenticator Framework Server Feature http://wso2.org This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index a128c1e7d60..b352f1b3049 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index 19d69acaea3..1cc1c9117cf 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1858,7 +1858,7 @@ 1.2.11.wso2v10 - 2.0.72-SNAPSHOT + 2.0.74-SNAPSHOT 4.4.8