From b56fb667b7f85ad22265c526587e912485129a17 Mon Sep 17 00:00:00 2001 From: Imesh Chandrasiri Date: Tue, 13 Sep 2016 15:16:50 +0530 Subject: [PATCH 01/25] Modal fixes --- .../app/pages/cdmf.page.roles/roles.hbs | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs index b9c4083c4e4..8524aa0051a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs @@ -101,52 +101,52 @@ under the License.
-
-
-
-

Do you really want to remove this role ?

- - -
+ + +
-
-
-
-

Done. Role was successfully removed.

- - -
+ + +
-
-
-
-

An unexpected error occurred. Please try again later.

- - -
+ + +
From 9573bce48f638f952f166fb9f570a2cad4046459 Mon Sep 17 00:00:00 2001 From: Imesh Chandrasiri Date: Wed, 14 Sep 2016 14:35:56 +0530 Subject: [PATCH 02/25] Fix for datatable icon size change on pagination --- .../app/pages/cdmf.page.roles/public/js/role-listing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index ca06c183def..0e0457ed450 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -114,7 +114,7 @@ function loadRoles() { class: "remove-padding icon-only content-fill", data: null, defaultContent: "
" + - "" + + "" + "
" }, { From 3e5064feed37530a8880a9d24a5e9d1732c52038 Mon Sep 17 00:00:00 2001 From: Imesh Chandrasiri Date: Wed, 14 Sep 2016 15:13:54 +0530 Subject: [PATCH 03/25] Fix for datatable icon size change on pagination --- .../devicemgt/app/pages/cdmf.page.users/public/js/listing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index 2b6e7170801..acceff1fc83 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -273,7 +273,7 @@ function loadUsers() { class: "remove-padding icon-only content-fill", data: null, defaultContent: '
' + - '' + + '' + '
' }, { From e2d0f7d04074ffff07ece65eea0b6e80892178fe Mon Sep 17 00:00:00 2001 From: kamidu Date: Wed, 14 Sep 2016 16:23:21 +0530 Subject: [PATCH 04/25] Fix for EMM-1559 --- .../cdmf.page.role.create/public/js/bottomJs.js | 14 ++++++-------- .../cdmf.page.user.edit/public/js/bottomJs.js | 7 +------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js index 013402bf841..93f7817db93 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.role.create/public/js/bottomJs.js @@ -99,12 +99,9 @@ function formatRepo (user) { var markup = '
' + '
' + '
' + - '
User : ' + user.username + '
'; - if (user.name) { - markup += '
' + user.name + '
'; - } - if (user.emailAddress) { - markup += '
' + user.emailAddress + '
'; + '
' + user.username + '
'; + if (user.name || user.name != undefined) { + markup += '
( ' + user.name + ' )
'; } markup += '
'; return markup; @@ -140,8 +137,9 @@ $(document).ready(function () { var user = {}; user.id = value.username; user.username = value.username; - user.name = value.firstname + " " + value.lastname; - user.emailAddress = value.emailAddress; + if(value.firstname && value.lastname) { + user.name = value.firstname + " " + value.lastname; + } newData.push(user); }); return { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js index c6ce0978ac9..13192b0cdaa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js @@ -234,13 +234,8 @@ $(document).ready(function () { addUserAPI, addUserFormData, function (data, textStatus, jqXHR) { - if (jqXHR.status == 201) { + if (jqXHR.status == 200) { // Clearing user input fields. - $("input#username").val(""); - $("input#firstname").val(""); - $("input#lastname").val(""); - $("input#email").val(""); - $("select#roles").select2("val", ""); // Refreshing with success message $("#user-create-form").addClass("hidden"); $("#user-created-msg").removeClass("hidden"); From a448959fe03334f2a48a9dd5eaa003f434cda960 Mon Sep 17 00:00:00 2001 From: kamidu Date: Thu, 15 Sep 2016 06:40:05 +0530 Subject: [PATCH 05/25] Fix for EMM-1548 --- .../pages/cdmf.page.device.search/search.hbs | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs index 983b61c66ea..84f13de6ffc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.device.search/search.hbs @@ -15,6 +15,27 @@ specific language governing permissions and limitations under the License. --> +{{#zone "breadcrumbs"}} +
  • + + + +
  • +
  • + + + Devices + +
  • +
  • + + + Search + +
  • +{{/zone}} + + {{#zone "content"}}
    @@ -32,15 +53,15 @@
    From e2576b21a864faa83b155fc82ed958f8e3455d17 Mon Sep 17 00:00:00 2001 From: Imesh Chandrasiri Date: Thu, 15 Sep 2016 10:19:22 +0530 Subject: [PATCH 06/25] Adding default button class to modal popups --- .../pages/cdmf.page.certificates/certificates.hbs | 14 +++++++------- .../app/pages/cdmf.page.devices/devices.hbs | 2 +- .../app/pages/cdmf.page.groups/groups.hbs | 8 ++++---- .../app/pages/cdmf.page.policies/policies.hbs | 8 ++++---- .../devicemgt/app/pages/cdmf.page.roles/roles.hbs | 2 +- .../devicemgt/app/pages/cdmf.page.users/users.hbs | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs index 54546481ba9..801c065221e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs @@ -15,7 +15,6 @@ specific language governing permissions and limitations under the License. }} - {{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}} {{#zone "breadcrumbs"}} @@ -25,9 +24,8 @@
  • - - Certificates + Certificate
  • {{/zone}} @@ -35,7 +33,6 @@ {{#zone "navbarActions"}} {{#if removePermitted}}
  • - @@ -100,7 +97,10 @@ - + + +
    +

  • @@ -121,7 +121,7 @@
    Remove - + Cancel
    @@ -180,9 +180,9 @@ {{/zone}} {{#zone "bottomJs"}} - + {{js "/js/certificate-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.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index 4b1975f9bfd..fafc0533746 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 @@ -199,7 +199,7 @@     Assign        - +     Cancel    
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs index 263f47d4119..ada1501a7bb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs @@ -109,7 +109,7 @@     Next        - +     Cancel    
    @@ -130,7 +130,7 @@     OK        - +     Cancel    
    @@ -160,7 +160,7 @@     Yes        - +     Cancel    
    @@ -203,7 +203,7 @@     Update        - +     Cancel    
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs index 61ba4007d54..1eb81672aa6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.policies/policies.hbs @@ -268,7 +268,7 @@ Remove - + Cancel
    @@ -337,7 +337,7 @@ @@ -390,7 +390,7 @@ Yes - + No @@ -479,7 +479,7 @@ Yes - + No diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs index 8524aa0051a..9c57bfd6e53 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/roles.hbs @@ -112,7 +112,7 @@ under the License. Remove - + Cancel diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs index 88cdc69918b..4cf5b878a00 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/users.hbs @@ -113,7 +113,7 @@ @@ -174,7 +174,7 @@ @@ -297,7 +297,7 @@ Save - + Cancel From 78cab76101ae465b35658c5f042ac1d6eef6697f Mon Sep 17 00:00:00 2001 From: harshanl Date: Thu, 15 Sep 2016 12:36:55 +0530 Subject: [PATCH 07/25] Fixed EMM-1531 --- .../impl/DeviceManagementServiceImpl.java | 20 +++++++- .../carbon/device/mgt/core/dao/DeviceDAO.java | 13 +++++ .../core/dao/impl/AbstractDeviceDAOImpl.java | 37 +++++++++++++- .../dao/util/DeviceManagementDAOUtil.java | 9 +++- .../DeviceManagementProviderService.java | 3 ++ .../DeviceManagementProviderServiceImpl.java | 48 +++++++++++++++++++ 6 files changed, 126 insertions(+), 4 deletions(-) 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 8edc3bc98dd..4693f26435d 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 @@ -189,9 +189,25 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { Device device; try { RequestValidationUtil.validateDeviceIdentifier(type, id); - DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); - device = dms.getDevice(new DeviceIdentifier(id, type)); + if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { + Date sinceDate; + SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); + try { + sinceDate = format.parse(ifModifiedSince); + } catch (ParseException e) { + return Response.status(Response.Status.BAD_REQUEST).entity( + new ErrorResponse.ErrorResponseBuilder().setMessage("Invalid date " + + "string is provided in 'If-Modified-Since' header").build()).build(); + } + device = dms.getDevice(new DeviceIdentifier(id, type), sinceDate); + if (device == null) { + return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + + "after the timestamp provided in 'If-Modified-Since' header").build(); + } + } else { + device = dms.getDevice(new DeviceIdentifier(id, type)); + } } catch (DeviceManagementException e) { String msg = "Error occurred while fetching the device information."; log.error(msg, e); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java index d6653fa892e..27d415f33ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAO.java @@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo.Status; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.core.dto.DeviceType; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -124,6 +125,18 @@ public interface DeviceDAO { */ Device getDevice(DeviceIdentifier deviceIdentifier, int tenantId) throws DeviceManagementDAOException; + /** + * This method is used to retrieve a device of a given device-identifier and tenant-id. + * + * @param deviceIdentifier device id. + * @param ifModifiedSince last modified time. + * @param tenantId tenant id. + * @return returns the device object. + * @throws DeviceManagementDAOException + */ + Device getDevice(DeviceIdentifier deviceIdentifier, Date ifModifiedSince, int tenantId) throws + DeviceManagementDAOException; + /** * This method is used to retrieve a device of a given device-identifier, enrollment status and tenant-id. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 44062cffc7e..a7af240b3af 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -128,7 +128,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { stmt.setInt(4, tenantId); rs = stmt.executeQuery(); if (rs.next()) { - device = DeviceManagementDAOUtil.loadMatchingDevice(rs); + device = DeviceManagementDAOUtil.loadMatchingDevice(rs, false); } } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while listing devices for type " + @@ -139,6 +139,41 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { return device; } + @Override + public Device getDevice(DeviceIdentifier deviceIdentifier, Date since, int tenantId) + throws DeviceManagementDAOException { + Connection conn; + PreparedStatement stmt = null; + ResultSet rs = null; + Device device = null; + try { + conn = this.getConnection(); + String sql = "SELECT d1.ID AS DEVICE_ID, d1.DESCRIPTION, d1.NAME AS DEVICE_NAME, d1.DEVICE_TYPE, " + + "d1.DEVICE_IDENTIFICATION, e.OWNER, e.OWNERSHIP, e.STATUS, e.DATE_OF_LAST_UPDATE, " + + "e.DATE_OF_ENROLMENT, e.ID AS ENROLMENT_ID FROM DM_ENROLMENT e, (SELECT d.ID, d.DESCRIPTION, d.NAME, " + + "t.NAME AS DEVICE_TYPE, d.DEVICE_IDENTIFICATION FROM DM_DEVICE d, DM_DEVICE_TYPE t, DM_DEVICE_DETAIL dt " + + "WHERE t.NAME = ? AND d.DEVICE_IDENTIFICATION = ? AND d.TENANT_ID = ? AND dt.DEVICE_ID = d.ID " + + "AND dt.UPDATE_TIMESTAMP > ?) d1 WHERE d1.ID = e.DEVICE_ID AND TENANT_ID = ?" ; + stmt = conn.prepareStatement(sql); + int paramIdx = 1; + stmt.setString(paramIdx++, deviceIdentifier.getType()); + stmt.setString(paramIdx++, deviceIdentifier.getId()); + stmt.setInt(paramIdx++, tenantId); + stmt.setLong(paramIdx++, since.getTime()); + stmt.setInt(paramIdx, tenantId); + rs = stmt.executeQuery(); + if (rs.next()) { + device = DeviceManagementDAOUtil.loadMatchingDevice(rs, true); + } + } catch (SQLException e) { + throw new DeviceManagementDAOException("Error occurred while listing device for type " + + "'" + deviceIdentifier.getType() + "'", e); + } finally { + DeviceManagementDAOUtil.cleanupResources(stmt, rs); + } + return device; + } + @Override public Device getDevice(DeviceIdentifier deviceIdentifier, EnrolmentInfo.Status status, int tenantId) throws DeviceManagementDAOException { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 39b56701090..cf4531c1721 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -160,14 +160,21 @@ public final class DeviceManagementDAOUtil { //This method will retrieve most appropriate device information when there are multiple device enrollments for //a single device. We'll give the highest priority to active devices. - public static Device loadMatchingDevice(ResultSet rs) throws SQLException { + public static Device loadMatchingDevice(ResultSet rs, boolean deviceInfoIncluded) throws SQLException { Map deviceMap = new HashMap<>(); Device device = loadDevice(rs); + if (deviceInfoIncluded) { + device.setDeviceInfo(loadDeviceInfo(rs)); + } + if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { return device; } while (rs.next()) { device = loadDevice(rs); + if (deviceInfoIncluded) { + device.setDeviceInfo(loadDeviceInfo(rs)); + } if (EnrolmentInfo.Status.ACTIVE.equals(device.getEnrolmentInfo().getStatus())) { return device; } 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 22b7530cafd..06ae1c875f0 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 @@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.dto.DeviceType; +import java.util.Date; import java.util.List; /** @@ -205,6 +206,8 @@ public interface DeviceManagementProviderService { Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException; + Device getDevice(DeviceIdentifier deviceId, Date since) throws DeviceManagementException; + Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException; List getAvailableDeviceTypes() 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 41b4aed9d92..1e308f508c7 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 @@ -807,6 +807,54 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv return device; } + @Override + public Device getDevice(DeviceIdentifier deviceId, Date since) throws DeviceManagementException { + Device device; + try { + DeviceManagementDAOFactory.openConnection(); + device = deviceDAO.getDevice(deviceId, since, this.getTenantId()); + if (device == null) { + if (log.isDebugEnabled()) { + log.debug("No device is found upon the type '" + deviceId.getType() + "' and id '" + + deviceId.getId() + "'"); + } + 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()); + } + return device; + } + @Override public Device getDevice(DeviceIdentifier deviceId, EnrolmentInfo.Status status) throws DeviceManagementException { Device device; From 5b0e99aeff2336bca993331581d550cd24daaea4 Mon Sep 17 00:00:00 2001 From: harshanl Date: Thu, 15 Sep 2016 12:37:35 +0530 Subject: [PATCH 08/25] Fixed EMM-1562 --- .../operation/SQLServerOperationDAOImpl.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java index d4768fc8760..e1189da1a3e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java @@ -46,9 +46,9 @@ public class SQLServerOperationDAOImpl extends GenericOperationDAOImpl { List operations = new ArrayList(); try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " + - "OPERATION_CODE, om.STATUS FROM DM_OPERATION o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + + String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " + + "o.OPERATION_CODE, om.STATUS, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + + "INNER JOIN (SELECT dm.OPERATION_ID, dm.ID, dm.STATUS, dm.UPDATED_TIMESTAMP FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC " + "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = conn.prepareStatement(sql); @@ -62,18 +62,19 @@ public class SQLServerOperationDAOImpl extends GenericOperationDAOImpl { operation.setId(rs.getInt("ID")); operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString()); - if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) { + if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { - operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString()); + operation.setReceivedTimeStamp( + new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } operation.setCode(rs.getString("OPERATION_CODE")); operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); operations.add(operation); } } catch (SQLException e) { - throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " + - "available for the device'" + enrolmentId + "' with status '", e); + throw new OperationManagementDAOException("SQL error occurred while retrieving the operations " + + "available for the device '" + enrolmentId + "'", e); } finally { OperationManagementDAOUtil.cleanupResources(stmt, rs); } @@ -90,9 +91,9 @@ public class SQLServerOperationDAOImpl extends GenericOperationDAOImpl { List operations = new ArrayList(); try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " + - "FROM DM_OPERATION o " + - "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + + String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " + + "om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + + "INNER JOIN (SELECT dm.OPERATION_ID, dm.ID, dm.STATUS, dm.UPDATED_TIMESTAMP FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " + "o.CREATED_TIMESTAMP DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; stmt = conn.prepareStatement(sql); @@ -107,17 +108,18 @@ public class SQLServerOperationDAOImpl extends GenericOperationDAOImpl { operation.setId(rs.getInt("ID")); operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString()); - if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) { + if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { - operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString()); + operation.setReceivedTimeStamp( + new java.sql.Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } operation.setCode(rs.getString("OPERATION_CODE")); operation.setStatus(status); operations.add(operation); } } catch (SQLException e) { - throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " + + throw new OperationManagementDAOException("SQL error occurred while retrieving the operations " + "available for the device'" + enrolmentId + "' with status '" + status.toString(), e); } finally { OperationManagementDAOUtil.cleanupResources(stmt, rs); From 2f5d90cb6cfd6d12da7c0930720d2b84b994d422 Mon Sep 17 00:00:00 2001 From: thusithakalugamage Date: Thu, 15 Sep 2016 13:46:48 +0530 Subject: [PATCH 09/25] [EMM-1571] Add policies page wizard styling and layout defects --- .../public/css/custom-common.css | 2 +- .../public/css/custom-desktop.css | 25 ++++++++++--------- .../uuf.unit.theme/public/css/theme-wso2.css | 3 ++- .../lib/theme-wso2_1.0/less/theme-wso2.less | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css index 8afcca89cec..0fede3d552a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css @@ -69,7 +69,7 @@ } .itm-wiz { - font-weight: 100; + font-weight: 300; } .itm-wiz div { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css index 4d09c238dd8..288b74b8e68 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-desktop.css @@ -3369,7 +3369,7 @@ span.ico-sort-desc { } .wr-input-label { - font-weight:100; + font-weight:300; font-size:14px; color:#555; } @@ -4060,7 +4060,7 @@ a.wr-side-panel-toggle-btn.selected { .wr-input-control.switch .text { display: none; margin-left: 5px; - font-weight: 100; + font-weight: 400; } .wr-input-control.switch input[type="checkbox"]:checked + .helper + .text { @@ -4606,28 +4606,26 @@ a.wr-side-panel-toggle-btn.selected { } .wr-hidden-operations-content .panel-body { - margin: 5px; - /*border: 1px solid #e8e8e8;*/ - padding: 5px 20px 30px; + padding: 0px 20px 20px; background: #ffffff; } - +.wr-hidden-operations-content .panel-body hr{ + margin:0px; + margin-bottom:20px; +} .wr-advance-operations.wizard-content .panel-title .fw-stack { width: 5px; } .wr-hidden-operations-content .sub-title { - font-size: 16px; + font-size: 18px; } .wr-hidden-operations-content .panel-title { - margin-left: 5px; - margin-top: 5px; - margin-right: 5px; - /*border: 1px solid #e8e8e8;*/ padding: 20px; background: #ffffff; color: #555; + font-weight:400; } .panel-title hr{ @@ -4635,10 +4633,13 @@ a.wr-side-panel-toggle-btn.selected { } .wr-hidden-operations-content .panel-title-description { - padding-right: 20px; + font-size: 16px; + padding:0px 20px; background: #ffffff; color: #555; line-height: 140%; + font-weight:300; + text-align:justify; } .wr-hidden-operations-content .panel-title a { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css index a6db82b4c6f..a7264020b96 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/css/theme-wso2.css @@ -5195,6 +5195,7 @@ button.list-group-item-danger.active:focus { color: #333333; background-color: #f5f5f5; border-color: #ddd; + border:none; } .panel-default > .panel-heading + .panel-collapse > .panel-body { border-top-color: #ddd; @@ -8084,7 +8085,7 @@ a.list-group-item:hover { * ======================================================================== */ .switch { display: inline-block; - width: 40px; + width: 90px; cursor: pointer; position: relative; margin-top: -4px; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less index 1e51ba60afa..80f7cfe4691 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/less/theme-wso2.less @@ -35,7 +35,7 @@ @base-dark-color: #222; @base-light-color: #ffffff; @base-success-color: #5cb85c; -@base-info-color: #009DA7; +@base-info-color: #526A84; @base-warning-color: #f0ad4e; @base-danger-color: #d9534f; From d9b25eda08f51aca7dc5893b4db1f553bfdc76f0 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 16 Sep 2016 09:38:22 +0530 Subject: [PATCH 10/25] Adding deviceName into notifications --- .../common/notification/mgt/Notification.java | 16 +++++++++++++++- .../dao/impl/AbstractNotificationDAOImpl.java | 4 ++-- .../mgt/dao/impl/GenericNotificationDAOImpl.java | 4 ++-- .../mgt/dao/impl/OracleNotificationDAOImpl.java | 4 ++-- .../dao/impl/PostgreSQLNotificationDAOImpl.java | 4 ++-- .../dao/impl/SQLServerNotificationDAOImpl.java | 4 ++-- .../mgt/dao/util/NotificationDAOUtil.java | 1 + 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/Notification.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/Notification.java index 3a383b19dc9..dba0f98023c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/Notification.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/notification/mgt/Notification.java @@ -62,6 +62,11 @@ public class Notification { required = false) private String deviceIdentifier; + @JsonProperty(value = "deviceName", required = false) + @ApiModelProperty(name = "deviceName", value = "Defines the device Name related to the notification.", + required = false) + private String deviceName; + @JsonProperty(value = "devieType", required = false) @ApiModelProperty(name = "devieType", value = "Defines the device type related to the notification.", required = false) @@ -107,7 +112,15 @@ public class Notification { this.deviceIdentifier = deviceIdentifier; } - public String getDevcieType() { + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getDeviceType() { return deviceType; } @@ -123,6 +136,7 @@ public class Notification { ", description='" + description + '\'' + ", operationId='" + operationId + '\'' + ", deviceIdentifier='" + deviceIdentifier + '\'' + + ", deviceName='" + deviceName + '\'' + ", deviceType='" + deviceType + '\'' + '}'; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java index 96c47cf0d26..aa6ebe316a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java @@ -156,7 +156,7 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," + - " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + + " d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?"; stmt = conn.prepareStatement(sql); @@ -226,7 +226,7 @@ public abstract class AbstractNotificationDAOImpl implements NotificationDAO { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," + - " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " + + " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM " + "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " + "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java index 0653ec30291..7b1a4e73b07 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/GenericNotificationDAOImpl.java @@ -47,7 +47,7 @@ public class GenericNotificationDAOImpl extends AbstractNotificationDAOImpl { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," + - " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + + " d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?"; @@ -86,7 +86,7 @@ public class GenericNotificationDAOImpl extends AbstractNotificationDAOImpl { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," + - " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " + + " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM " + "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " + "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java index 829e586d797..fd05f8a531b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java @@ -47,7 +47,7 @@ public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," + - " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + + " d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?"; @@ -86,7 +86,7 @@ public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," + - " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " + + " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM " + "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " + "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java index 2039c04cbc9..6ac0563f25a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/PostgreSQLNotificationDAOImpl.java @@ -47,7 +47,7 @@ public class PostgreSQLNotificationDAOImpl extends AbstractNotificationDAOImpl { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," + - " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + + " d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?"; @@ -86,7 +86,7 @@ public class PostgreSQLNotificationDAOImpl extends AbstractNotificationDAOImpl { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," + - " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " + + " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM " + "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " + "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java index 2d16f87587a..0f5e6da435d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/impl/SQLServerNotificationDAOImpl.java @@ -47,7 +47,7 @@ public class SQLServerNotificationDAOImpl extends AbstractNotificationDAOImpl { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS, n1.DESCRIPTION," + - " d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + + " d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT " + "NOTIFICATION_ID, DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID AND TENANT_ID = ?"; @@ -86,7 +86,7 @@ public class SQLServerNotificationDAOImpl extends AbstractNotificationDAOImpl { try { conn = NotificationManagementDAOFactory.getConnection(); String sql = "SELECT n1.NOTIFICATION_ID, n1.DEVICE_ID, n1.OPERATION_ID, n1.STATUS," + - " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, t.NAME AS DEVICE_TYPE FROM " + + " n1.DESCRIPTION, d.DEVICE_IDENTIFICATION, d.NAME as DEVICE_NAME, t.NAME AS DEVICE_TYPE FROM " + "DM_DEVICE d, DM_DEVICE_TYPE t, (SELECT NOTIFICATION_ID, DEVICE_ID, " + "OPERATION_ID, STATUS, DESCRIPTION FROM DM_NOTIFICATION WHERE " + "TENANT_ID = ? AND STATUS = ?) n1 WHERE n1.DEVICE_ID = d.ID AND d.DEVICE_TYPE_ID=t.ID " + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java index daa5c37d29c..abfddf13ee9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java @@ -132,6 +132,7 @@ public class NotificationDAOUtil { notification.setDescription(rs.getString("DESCRIPTION")); notification.setStatus(rs.getString("STATUS")); notification.setDeviceIdentifier(rs.getString("DEVICE_IDENTIFICATION")); + notification.setDeviceName(rs.getString("DEVICE_NAME")); notification.setDeviceType(rs.getString("DEVICE_TYPE")); return notification; } From 58f8656e946010c2fec628f807e073aa29a0fa61 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sat, 17 Sep 2016 17:22:47 +0530 Subject: [PATCH 11/25] Changing permissions - /devices/owning to /devices/owning-device --- .../api/ActivityInfoProviderService.java | 5 ++--- .../service/api/DeviceManagementService.java | 17 ++++++++--------- .../api/DeviceTypeManagementService.java | 3 +-- .../api/admin/DeviceManagementAdminService.java | 3 +-- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java index 1c23be25441..d048ea75fda 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ActivityInfoProviderService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.jaxrs.beans.ActivityList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -93,7 +92,7 @@ public interface ActivityInfoProviderService { message = "Internal Server Error. \n Server error occurred while fetching activity data.", response = ErrorResponse.class) }) - @Permission(name = "View Activities", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Activities", permission = "/device-mgt/devices/owning-device/view") Response getActivity( @ApiParam( name = "id", @@ -154,7 +153,7 @@ public interface ActivityInfoProviderService { message = "Internal Server Error. \n Server error occurred while fetching activity data.", response = ErrorResponse.class) }) - @Permission(name = "View Activities", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Activities", permission = "/device-mgt/devices/owning-device/view") Response getActivities( @ApiParam( name = "since", 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 e1240f9dd4b..b185bd368d3 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 @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Feature; import org.wso2.carbon.device.mgt.common.app.mgt.Application; @@ -93,7 +92,7 @@ public interface DeviceManagementService { message = "Internal Server Error. \n Server error occurred while fetching the device list.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getDevices( @ApiParam( name = "name", @@ -200,7 +199,7 @@ public interface DeviceManagementService { "Server error occurred while retrieving information requested device.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getDevice( @ApiParam( name = "type", @@ -282,7 +281,7 @@ public interface DeviceManagementService { "Server error occurred while retrieving feature list of the device.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getFeaturesOfDevice( @ApiParam( name = "type", @@ -358,7 +357,7 @@ public interface DeviceManagementService { "Server error occurred while enrolling the device.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response searchDevices( @ApiParam( name = "offset", @@ -437,7 +436,7 @@ public interface DeviceManagementService { "Server error occurred while retrieving installed application list of the device.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getInstalledApplications( @ApiParam( name = "type", @@ -533,7 +532,7 @@ public interface DeviceManagementService { "Server error occurred while retrieving operation list scheduled for the device.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getDeviceOperations( @ApiParam( name = "type", @@ -631,7 +630,7 @@ public interface DeviceManagementService { response = ErrorResponse.class) } ) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getEffectivePolicyOfDevice( @ApiParam( name = "type", @@ -683,7 +682,7 @@ public interface DeviceManagementService { response = ErrorResponse.class) } ) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getComplianceDataOfDevice( @ApiParam( name = "type", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java index b9a24fbafe4..79fbf424893 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/DeviceTypeManagementService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.jaxrs.beans.DeviceTypeList; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -79,7 +78,7 @@ public interface DeviceTypeManagementService { response = ErrorResponse.class) } ) - @Permission(name = "View Device Types", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Device Types", permission = "/device-mgt/devices/owning-device/view") Response getDeviceTypes( @ApiParam( name = "If-Modified-Since", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java index e6732606592..1f4e0593755 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api.admin; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -86,7 +85,7 @@ public interface DeviceManagementAdminService { message = "Internal Server Error. \n Server error occurred while fetching the device list.", response = ErrorResponse.class) }) - @Permission(name = "View Devices", permission = "/device-mgt/devices/owning/view") + @Permission(name = "View Devices", permission = "/device-mgt/devices/owning-device/view") Response getDevicesByName( @ApiParam( name = "name", From e4dae67fea43c92b6e4cf8346100c54a62d1ed8a Mon Sep 17 00:00:00 2001 From: dilanua Date: Sat, 17 Sep 2016 17:36:06 +0530 Subject: [PATCH 12/25] Changing permissions - /devices/any to /devices/any-device --- .../authorization/DeviceAccessAuthorizationServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java index 31d1be6658a..4122d8cb0f8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java @@ -47,7 +47,7 @@ import java.util.Map; */ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthorizationService { - private final static String CDM_ADMIN_PERMISSION = "/device-mgt/devices/any/permitted-actions-upon-owning-device"; + private final static String CDM_ADMIN_PERMISSION = "/device-mgt/devices/any-device/permitted-actions-under-owning-device"; private final static String CDM_ADMIN = "Device Management Administrator"; private static Log log = LogFactory.getLog(DeviceAccessAuthorizationServiceImpl.class); From 37131afb4a46351e7e4ccb836b81f79d195a7dc2 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sat, 17 Sep 2016 19:57:02 +0530 Subject: [PATCH 13/25] Adding radio:checked and input[type=hidden] support to operation mod - UI --- .../public/js/operation-mod.js | 59 +++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js index f47bbd99768..53d5d614bbf 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js @@ -80,7 +80,9 @@ var operationModule = function () { "AUTO_TIME" : "AUTO_TIME", "SET_SCREEN_CAPTURE_DISABLED" : "SET_SCREEN_CAPTURE_DISABLED", "SET_STATUS_BAR_DISABLED" : "SET_STATUS_BAR_DISABLED", - "APPLICATION_OPERATION_CODE":"APP-RESTRICTION" + "APPLICATION_OPERATION_CODE":"APP-RESTRICTION", + "SYSTEM_UPDATE_POLICY_CODE": "SYSTEM_UPDATE_POLICY", + "KIOSK_APPS_CODE": "KIOSK_APPS" }; // Constants to define Windows Operation Constants @@ -1012,6 +1014,32 @@ var operationModule = function () { } }; break; + case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + if (operationData["cosuSystemUpdatePolicyType"] != "window") { + payload = { + "operation": { + "type": operationData["cosuSystemUpdatePolicyType"] + } + }; + } else { + payload = { + "operation": { + "type": operationData["cosuSystemUpdatePolicyType"], + "startTime": operationData["cosuSystemUpdatePolicyWindowStartTime"], + "endTime": operationData["cosuSystemUpdatePolicyWindowEndTime"] + } + }; + } + break; + case androidOperationConstants["KIOSK_APPS_CODE"]: + operationType = operationTypeConstants["PROFILE"]; + payload = { + "operation": { + "whitelistedApplications": operationData["cosuWhitelistedApplications"] + } + }; + break; default: // If the operation is neither of above, it is a command operation operationType = operationTypeConstants["COMMAND"]; @@ -1272,12 +1300,18 @@ var operationModule = function () { var key = operationDataObj.data("key"); var value; if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password") || operationDataObj.is(":hidden")) { + operationDataObj.is(":password") || operationDataObj.is("input[type=hidden]")) { value = operationDataObj.val(); + operationData[key] = value; } else if (operationDataObj.is(":checkbox")) { value = operationDataObj.is(":checked"); + operationData[key] = value; + } else if (operationDataObj.is(":radio") && operationDataObj.is(":checked")) { + value = operationDataObj.val(); + operationData[key] = value; } else if (operationDataObj.is("select")) { value = operationDataObj.find("option:selected").attr("value"); + operationData[key] = value; } else if (operationDataObj.hasClass("grouped-array-input")) { value = []; var childInput; @@ -1286,7 +1320,7 @@ var operationModule = function () { $(".child-input", this).each(function () { childInput = $(this); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1313,7 +1347,7 @@ var operationModule = function () { $(".child-input", this).each(function () { childInput = $(this); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1345,7 +1379,7 @@ var operationModule = function () { childInput = $(this); childInputKey = childInput.data("child-key"); if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is(":hidden")) { + || childInput.is("input[type=hidden]")) { childInputValue = childInput.val(); } else if (childInput.is(":checkbox")) { childInputValue = childInput.is(":checked"); @@ -1369,8 +1403,8 @@ var operationModule = function () { } }); } + operationData[key] = value; } - operationData[key] = value; } ); @@ -1421,10 +1455,15 @@ var operationModule = function () { // populating input value according to the type of input if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password")) { + operationDataObj.is(":password") || + operationDataObj.is("input[type=hidden]")) { operationDataObj.val(value); } else if (operationDataObj.is(":checkbox")) { operationDataObj.prop("checked", value); + } else if (operationDataObj.is(":radio")) { + if (operationDataObj.val() == uiPayload[key]) { + operationDataObj.attr("checked", true); + } } else if (operationDataObj.is("select")) { operationDataObj.val(value); /* trigger a change of value, so that if slidable panes exist, @@ -1447,9 +1486,9 @@ var operationModule = function () { var childInputValue = value[childInputIndex]; // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { @@ -1495,9 +1534,9 @@ var operationModule = function () { } // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { @@ -1524,9 +1563,9 @@ var operationModule = function () { var childInputValue = multiColumnKeyValuePair[childInputKey]; // populating extracted value in the UI according to the input type if (childInput.is(":text") || - childInput.is(":hidden") || childInput.is("textarea") || childInput.is(":password") || + childInput.is("input[type=hidden]") || childInput.is("select")) { childInput.val(childInputValue); } else if (childInput.is(":checkbox")) { From cd66f649454dac44ce60414cf6c0299d71902c3c Mon Sep 17 00:00:00 2001 From: dilanua Date: Sat, 17 Sep 2016 20:05:34 +0530 Subject: [PATCH 14/25] Correcting typo: diableScreenCapture to disableScreenCapture - Operation-mod & Policy UI --- .../cdmf.unit.device.operation-mod/public/js/operation-mod.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js index 53d5d614bbf..8a78249105b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.operation-mod/public/js/operation-mod.js @@ -895,7 +895,7 @@ var operationModule = function () { "ALLOW_PARENT_PROFILE_APP_LINKING" : operationData["disallowParentProfileAppLinking"], "ENSURE_VERIFY_APPS" : operationData["ensureVerifyApps"], "AUTO_TIME" : operationData["enableAutoTime"], - "SET_SCREEN_CAPTURE_DISABLED" : operationData["diableScreenCapture"], + "SET_SCREEN_CAPTURE_DISABLED" : operationData["disableScreenCapture"], "SET_STATUS_BAR_DISABLED" : operationData["disableStatusBar"] } }; @@ -1736,7 +1736,7 @@ var operationModule = function () { restrictions["enableAutoTime"] = restriction["enabled"]; continue; } else if (featureCode == androidOperationConstants["SET_SCREEN_CAPTURE_DISABLED"]){ - restrictions["diableScreenCapture"] = restriction["enabled"]; + restrictions["disableScreenCapture"] = restriction["enabled"]; continue; } else if (featureCode == androidOperationConstants["SET_STATUS_BAR_DISABLED"]){ restrictions["disableStatusBar"] = restriction["enabled"]; From 713c8ac4d809e9ffd040dd174eac5c9205c18881 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sun, 18 Sep 2016 07:34:14 +0530 Subject: [PATCH 15/25] Changing permissions - /device-mgt/configurations to /device-mgt/platform-configurations --- .../jaxrs/service/api/ConfigurationManagementService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java index 0a450b6ec03..122f6883fa0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; @@ -82,7 +81,7 @@ public interface ConfigurationManagementService { "platform configuration.", response = ErrorResponse.class) }) - @Permission(name = "View Configurations", permission = "/device-mgt/configurations/view") + @Permission(name = "View Configurations", permission = "/device-mgt/platform-configurations/view") Response getConfiguration( @ApiParam( name = "If-Modified-Since", @@ -128,7 +127,7 @@ public interface ConfigurationManagementService { "Server error occurred while modifying general platform configuration.", response = ErrorResponse.class) }) - @Permission(name = "Manage configurations", permission = "/device-mgt/configurations/manage") + @Permission(name = "Manage configurations", permission = "/device-mgt/platform-configurations/manage") Response updateConfiguration( @ApiParam( name = "configuration", From 408e10a8908d29a369ae1d30354bfaa75461c049 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sun, 18 Sep 2016 08:39:41 +0530 Subject: [PATCH 16/25] Changing admin dashboard name to 'Navigating Dashboard' - UI --- .../devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs index 07f970ec6e1..706444917ba 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs @@ -15,12 +15,13 @@ specific language governing permissions and limitations under the License. }} -{{unit "cdmf.unit.ui.title" pageTitle="Dashboard"}} +{{unit "cdmf.unit.ui.title" pageTitle="Navigating Dashboard"}} {{#zone "breadcrumbs"}} +
  • - Dashboard + Navigating Dashboard
  • {{/zone}} @@ -176,10 +177,8 @@ {{else}} Permission denied {{/if}} -