diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java index 24c99160662..2e7376ec81e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/EnrolmentInfo.java @@ -32,7 +32,7 @@ public class EnrolmentInfo implements Serializable { public enum Status { CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, DISENROLLMENT_REQUESTED, CONFIGURED, READY_TO_CONNECT, RETURN_PENDING, RETURNED, DEFECTIVE, WARRANTY_PENDING, WARRANTY_SENT, - WARRANTY_REPLACED + WARRANTY_REPLACED, ASSIGNED } public enum OwnerShip { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index f5351385211..7584b5fea7f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -73,10 +73,10 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP " + "WHERE TENANT_ID = ?"; if (StringUtils.isNotBlank(request.getGroupName())) { - sql += " AND UPPER(GROUP_NAME) LIKE ?"; + sql += " AND GROUP_NAME LIKE ?"; } if (StringUtils.isNotBlank(request.getOwner())) { - sql += " AND UPPER(OWNER) LIKE ?"; + sql += " AND OWNER LIKE ?"; } if (StringUtils.isNotBlank(request.getStatus())) { sql += " AND STATUS = ?"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 99cacfd9506..a1e52109488 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -68,7 +68,9 @@ public class MDMAndroidOperationUtil { WebApplication webApplication = new WebApplication(); webApplication.setUrl(application.getLocation()); webApplication.setName(application.getName()); - webApplication.setType(application.getType().toString()); +// webApplication.setType(application.getType().toString()); +// Hard-corded "type" to "webapp". Some agent versions accept only "webapp" as the type. + webApplication.setType("webapp"); webApplication.setProperties(application.getProperties()); operation.setPayLoad(webApplication.toJSON()); break; @@ -111,7 +113,9 @@ public class MDMAndroidOperationUtil { WebApplication webApplication = new WebApplication(); webApplication.setUrl(application.getLocation()); webApplication.setName(application.getName()); - webApplication.setType(application.getType().toString()); +// webApplication.setType(application.getType().toString()); +// Hard-corded "type" to "webapp". Some agent versions accept only "webapp" as the type. + webApplication.setType("webapp"); operation.setPayLoad(webApplication.toJSON()); break; default: diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java index 2022447e646..7e65a244e91 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -489,13 +489,14 @@ public class DeviceTypeManager implements DeviceManager { throws DeviceManagementException { boolean status = false; if (propertiesExist) { + Device updatedDevice = new Device(); + updatedDevice.setDeviceIdentifier(deviceId.getId()); + updatedDevice.setProperties(propertyList); try { if (log.isDebugEnabled()) { - log.debug("Getting the details of " + deviceType + " device : '" + deviceId.getId() + "'"); + log.debug("Updating device properties of " + deviceType + " device : '" + + deviceId.getId() + "'"); } - Device updatedDevice = new Device(); - updatedDevice.setDeviceIdentifier(deviceId.getId()); - updatedDevice.setProperties(propertyList); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction(); status = deviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction(); @@ -506,6 +507,24 @@ public class DeviceTypeManager implements DeviceManager { } finally { deviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection(); } + if (propertyBasedDeviceTypePluginDAOManager != null && status) { + try { + if (log.isDebugEnabled()) { + log.debug("Updating device properties of " + deviceType + " device : '" + + deviceId.getId() + "'"); + } + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction(); + status = propertyBasedDeviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice); + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction(); + } catch (DeviceTypeMgtPluginException e) { + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().rollbackTransaction(); + String msg = "Error while updating properties for " + deviceType + " device : " + + deviceId.getId(); + throw new DeviceManagementException(msg, e); + } finally { + propertyBasedDeviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection(); + } + } } return status; } diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index aa3f169a33d..88d9b47d294 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -183,6 +183,7 @@ perm:metadata:update perm:android:google-account perm:android:update-default-sim + perm:android:info device-mgt