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 ecb5c43552..3b2214ef5c 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 2.0.72-SNAPSHOT + 2.0.75-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 1a951226ec..a19d647605 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.75-SNAPSHOT ../pom.xml 4.0.0 - 2.0.72-SNAPSHOT + 2.0.75-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 bee95700ee..364ca2a2f8 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.75-SNAPSHOT ../pom.xml 4.0.0 - 2.0.72-SNAPSHOT + 2.0.75-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 a219d50173..229798b1ba 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 2.0.72-SNAPSHOT + 2.0.75-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 faaeec3fec..56a638d9e5 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 2.0.72-SNAPSHOT + 2.0.75-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 50de0206f2..d759d6269b 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 2.0.72-SNAPSHOT + 2.0.75-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 de6bca2ef1..c642f1d1ca 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 2.0.72-SNAPSHOT + 2.0.75-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 ab32ee8afe..9e20f94684 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.75-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 2.0.72-SNAPSHOT + 2.0.75-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 0dd8d73e3b..f558612689 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.75-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 91f37cd5a3..79ffbeb7f4 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.75-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 0d23d871db..0cfea0b470 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 2.0.72-SNAPSHOT + 2.0.75-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 4c04d1b26c..17eee82b94 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 2.0.72-SNAPSHOT + 2.0.75-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 0ca0760adc..b6ea950695 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.75-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 a3167b5db8..a7baa258ab 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.75-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 da488c5435..7085f1244b 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.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 8b4db4831e..009d7d2900 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.75-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 cbe62f5659..a434335eda 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.75-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index d0292faf3d..96dc56e09b 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.75-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 821e60a06f..c2bbc6b31d 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.75-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 9c20e2ed78..21bb5214b3 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.75-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 ee4a3b8baa..8e4a006ccd 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.75-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 ddbdfcdc08..e337fc88fa 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 @@ -267,6 +267,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.", @@ -333,6 +340,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 6ef0a8664d..d06b8a8180 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 b201bfd80c..73da222752 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 @@ -18,7 +18,6 @@ */ package org.wso2.carbon.device.mgt.jaxrs.service.impl; -import io.swagger.annotations.ApiParam; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -97,6 +96,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 { @@ -180,7 +180,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(); @@ -196,14 +201,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(); @@ -229,7 +242,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); @@ -241,7 +255,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(); @@ -261,7 +279,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(); } @@ -287,7 +305,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(); @@ -586,7 +604,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 f51ebfd928..01dd4880c1 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 cb4b1bb37c..9a968a3ac5 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 a0af499da5..3ce9dd6a3d 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.75-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 563c81f086..7980dd3aa7 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.75-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 0bc04e6e61..756f09e32a 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 e13ff130d6..e356802117 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 @@ -61,7 +61,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()); @@ -93,7 +93,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() + @@ -129,8 +129,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())) { @@ -160,7 +160,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()); @@ -203,7 +203,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() + @@ -232,7 +232,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 9117468541..d1d3f5f03d 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 @@ -54,6 +54,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. * @@ -63,6 +75,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. * @@ -73,6 +117,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. * @@ -83,21 +139,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. @@ -109,6 +235,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. * @@ -119,6 +257,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. * @@ -129,16 +279,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. * @@ -150,32 +326,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. @@ -187,7 +381,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. @@ -199,14 +403,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. @@ -247,21 +490,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 120d430b43..12b873a228 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 @@ -176,7 +176,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(); @@ -414,9 +414,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(); @@ -430,60 +466,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(); @@ -497,62 +492,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(); @@ -570,43 +523,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; @@ -614,168 +537,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 @@ -855,57 +685,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(); @@ -917,43 +745,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(); @@ -965,41 +778,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; } @@ -1288,7 +1078,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(); @@ -1302,61 +1096,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(); @@ -1370,66 +1123,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 { @@ -1445,56 +1156,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; @@ -1503,8 +1170,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(); @@ -1522,47 +1194,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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; @@ -1570,6 +1207,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(); @@ -1592,45 +1235,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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; @@ -1666,70 +1272,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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); @@ -1747,47 +1323,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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; } @@ -1830,8 +1370,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(); @@ -1844,54 +1390,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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) + public PaginationResult getDevicesByStatus(PaginationRequest request) throws DeviceManagementException { + return this.getDevicesByStatus(request, true); + } + + @Override + 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(); @@ -1910,47 +1423,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(); - } - - Device dmsDevice = this.getDeviceManager(device.getType()). - 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; } @@ -1996,7 +1473,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv public boolean changeDeviceStatus(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status newStatus) throws DeviceManagementException { boolean isDeviceUpdated = false; - Device device = getDevice(deviceIdentifier); + Device device = getDevice(deviceIdentifier, false); int deviceId = device.getId(); EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo(); enrolmentInfo.setStatus(newStatus); @@ -2148,4 +1625,105 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return defaultGroup; } } + + /** + * 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; + } } \ No newline at end of file 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 44a5995b55..57e232dbb7 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 16fff9ce13..83850b3182 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 08735ecb7c..665ffff1c4 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 @@ -444,7 +444,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 55ed8327a0..4c5ae6c639 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.75-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 110b1dc8c2..8c19621e32 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.75-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 059aa68899..e03ea2f90d 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 5727b6f06d..81f193ca9d 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 = {}; @@ -60,6 +60,8 @@ function onRequest(context) { if (data) { for (var i = 0; i < data.length; i++) { var config = utility.getDeviceTypeConfig(data[i]); + var log = new Log("devices.js"); + if (!config) { continue; } @@ -70,7 +72,8 @@ function onRequest(context) { "label": deviceType.label, "thumb": utility.getDeviceThumb(data[i]), "analyticsEnabled": deviceType.analyticsEnabled, - "groupingEnabled": deviceType.groupingEnabled + "groupingEnabled": deviceType.groupingEnabled, + "analyticsView" : deviceType.analyticsView }); } } @@ -80,9 +83,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 8876c06928..f864927186 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.75-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 9050741194..e6ffd8b50a 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.75-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 d765509e98..679c3ef1e6 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.75-SNAPSHOT ../pom.xml diff --git a/components/email-sender/pom.xml b/components/email-sender/pom.xml index f9d4af2b82..08709af4c4 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.75-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 8bee9f283c..10aa4315a2 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.75-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 94ec69b1cf..4e3a1e48db 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.75-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 52398ff040..fdafc3d853 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration - 2.0.72-SNAPSHOT + 2.0.75-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 f8bd39fd2a..579693adba 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.web.app.registration - 2.0.72-SNAPSHOT + 2.0.75-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 5fc92ad4c7..4962015147 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration - 2.0.72-SNAPSHOT + 2.0.75-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 2546ec4713..02a3c6e7b6 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions - 2.0.72-SNAPSHOT + 2.0.75-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 0000000000..40d87a17ec --- /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 0000000000..c3f323df4d --- /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 3be089a695..6235e5578f 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.75-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 e8f19d1032..f0294a6155 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.75-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 3040eb7d93..705e3577f3 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.75-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 1081b222ba..f0ae7bdb9d 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.complex.policy.decision.point - 2.0.72-SNAPSHOT + 2.0.75-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 a3609d012f..c5a8f71a31 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.decision.point - 2.0.72-SNAPSHOT + 2.0.75-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 bd59f7da97..b2bcd188b1 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.75-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.75-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 b24c140cfa..d607a0d8ea 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.common - 2.0.72-SNAPSHOT + 2.0.75-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 a025447895..d94f02d63e 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.policy.mgt.core - 2.0.72-SNAPSHOT + 2.0.75-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 adccce9723..bae2b48623 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 a9add947bf..0f4ca3ad60 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 9fade918e1..4dd4d3054d 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 b8c0efd98f..5307c5f29f 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 eb28b9e7d8..a70fb4db75 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 889a29415a..a2d8d4b725 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 04d4cfdf43..d056f8a1ff 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 e60bb6deaf..03eb400364 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 431c171916..62aead89d8 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.75-SNAPSHOT ../../pom.xml 4.0.0 policy-mgt - 2.0.72-SNAPSHOT + 2.0.75-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 877c80d672..544abeb9d2 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.devicemgt org.wso2.carbon.webapp.authenticator.framework - 2.0.72-SNAPSHOT + 2.0.75-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 ece31dfc59..d09c200b5d 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework - 2.0.72-SNAPSHOT + 2.0.75-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 caba6dcd6a..43ae826f60 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.application.extension.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 a407404e89..6fba428c67 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handler.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 c9a210d3bf..ed61a4a115 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 ff5c8469d8..6e0e082156 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client.feature - 2.0.72-SNAPSHOT + 2.0.75-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 8c7b805fe5..aaaf56302e 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 2f4406afda..fb15d3e402 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt apimgt-extensions-feature - 2.0.72-SNAPSHOT + 2.0.75-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 8b5a21fdec..d5aa7497d1 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.75-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 edb9fcc497..3f0ebaec9b 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.75-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 55bcba11d3..3cb6443ee8 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 94b3ede331..caa639fb61 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt-feature - 2.0.72-SNAPSHOT + 2.0.75-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 c505021b07..cf12c137fd 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.device.type.deployer.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 654261f445..5de54b4dba 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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.mqtt.feature/pom.xml b/features/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 6a9e0aefef..05cde750f9 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 15ba7cf297..ed3d909cfd 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 9f4ff818f4..14c03d0d7c 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.75-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 4788d3facd..319a774fd2 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.dashboard.feature - 2.0.72-SNAPSHOT + 2.0.75-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 6dae0ed999..5373938076 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.analytics.data.publisher.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 38801c59dd..dc9f6a8396 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.75-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 82cc17317f..518bc1bf44 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.extensions.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 41eb39eca4..c3193d6ff3 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.75-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 45fbe7235c..f54133df2d 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 1e51aa3a38..b297337406 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.75-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 454cb2303f..6da7639eb8 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.75-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 1596d08bd0..30e6c4a11f 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.dynamic.client.registration.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 5e568a5ff8..e0466d4756 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt dynamic-client-registration-feature - 2.0.72-SNAPSHOT + 2.0.75-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 7cfdfd3a7a..2bb26ccc9e 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.email.sender.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 49978eed47..d91f8b8518 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt email-sender-feature - 2.0.72-SNAPSHOT + 2.0.75-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 c72164bec9..1bab8e9dbe 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.identity.jwt.client.extension.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 350e5ea844..998b3f61ca 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.75-SNAPSHOT ../../pom.xml 4.0.0 jwt-client-feature - 2.0.72-SNAPSHOT + 2.0.75-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 a41e845824..c8d635f2bc 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.oauth.extensions.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 c123b225f1..2c6bc79db6 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt oauth-extensions-feature - 2.0.72-SNAPSHOT + 2.0.75-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 b38a6e72bf..71be67cabb 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.policy.mgt.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 37e04a944a..666de5a8a3 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt policy-mgt-feature - 2.0.72-SNAPSHOT + 2.0.75-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 9ed16e47b2..8af6300f06 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.75-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.webapp.authenticator.framework.server.feature pom - 2.0.72-SNAPSHOT + 2.0.75-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 a128c1e7d6..b3f1d551f5 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.75-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt webapp-authenticator-framework-feature - 2.0.72-SNAPSHOT + 2.0.75-SNAPSHOT pom WSO2 Carbon - Webapp Authenticator Framework Feature http://wso2.org diff --git a/pom.xml b/pom.xml index fc5e5065a2..13026ccac3 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt pom - 2.0.72-SNAPSHOT + 2.0.75-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1828,7 +1828,7 @@ 1.2.11.wso2v10 - 2.0.72-SNAPSHOT + 2.0.75-SNAPSHOT 4.4.8