Merge branch 'kernel-4.6.x' into 'kernel-4.6.x'

Sync with master

See merge request entgra/carbon-device-mgt!807
kernel-4.6.x
Pahansith Gunathilake 3 years ago
commit 9daa745001

@ -32,7 +32,7 @@ public class EnrolmentInfo implements Serializable {
public enum Status { public enum Status {
CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, DISENROLLMENT_REQUESTED, CREATED, ACTIVE, INACTIVE, UNREACHABLE, UNCLAIMED, SUSPENDED, BLOCKED, REMOVED, DISENROLLMENT_REQUESTED,
CONFIGURED, READY_TO_CONNECT, RETURN_PENDING, RETURNED, DEFECTIVE, WARRANTY_PENDING, WARRANTY_SENT, CONFIGURED, READY_TO_CONNECT, RETURN_PENDING, RETURNED, DEFECTIVE, WARRANTY_PENDING, WARRANTY_SENT,
WARRANTY_REPLACED WARRANTY_REPLACED, ASSIGNED
} }
public enum OwnerShip { public enum OwnerShip {

@ -73,10 +73,10 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP " String sql = "SELECT ID, DESCRIPTION, GROUP_NAME, OWNER, STATUS, PARENT_PATH FROM DM_GROUP "
+ "WHERE TENANT_ID = ?"; + "WHERE TENANT_ID = ?";
if (StringUtils.isNotBlank(request.getGroupName())) { if (StringUtils.isNotBlank(request.getGroupName())) {
sql += " AND UPPER(GROUP_NAME) LIKE ?"; sql += " AND GROUP_NAME LIKE ?";
} }
if (StringUtils.isNotBlank(request.getOwner())) { if (StringUtils.isNotBlank(request.getOwner())) {
sql += " AND UPPER(OWNER) LIKE ?"; sql += " AND OWNER LIKE ?";
} }
if (StringUtils.isNotBlank(request.getStatus())) { if (StringUtils.isNotBlank(request.getStatus())) {
sql += " AND STATUS = ?"; sql += " AND STATUS = ?";

@ -68,7 +68,9 @@ public class MDMAndroidOperationUtil {
WebApplication webApplication = new WebApplication(); WebApplication webApplication = new WebApplication();
webApplication.setUrl(application.getLocation()); webApplication.setUrl(application.getLocation());
webApplication.setName(application.getName()); 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()); webApplication.setProperties(application.getProperties());
operation.setPayLoad(webApplication.toJSON()); operation.setPayLoad(webApplication.toJSON());
break; break;
@ -111,7 +113,9 @@ public class MDMAndroidOperationUtil {
WebApplication webApplication = new WebApplication(); WebApplication webApplication = new WebApplication();
webApplication.setUrl(application.getLocation()); webApplication.setUrl(application.getLocation());
webApplication.setName(application.getName()); 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()); operation.setPayLoad(webApplication.toJSON());
break; break;
default: default:

@ -489,13 +489,14 @@ public class DeviceTypeManager implements DeviceManager {
throws DeviceManagementException { throws DeviceManagementException {
boolean status = false; boolean status = false;
if (propertiesExist) { if (propertiesExist) {
try {
if (log.isDebugEnabled()) {
log.debug("Getting the details of " + deviceType + " device : '" + deviceId.getId() + "'");
}
Device updatedDevice = new Device(); Device updatedDevice = new Device();
updatedDevice.setDeviceIdentifier(deviceId.getId()); updatedDevice.setDeviceIdentifier(deviceId.getId());
updatedDevice.setProperties(propertyList); updatedDevice.setProperties(propertyList);
try {
if (log.isDebugEnabled()) {
log.debug("Updating device properties of " + deviceType + " device : '"
+ deviceId.getId() + "'");
}
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction(); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().beginTransaction();
status = deviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice); status = deviceTypePluginDAOManager.getDeviceDAO().updateDevice(updatedDevice);
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction(); deviceTypePluginDAOManager.getDeviceTypeDAOHandler().commitTransaction();
@ -506,6 +507,24 @@ public class DeviceTypeManager implements DeviceManager {
} finally { } finally {
deviceTypePluginDAOManager.getDeviceTypeDAOHandler().closeConnection(); 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; return status;
} }

@ -183,6 +183,7 @@
<Scope>perm:metadata:update</Scope> <Scope>perm:metadata:update</Scope>
<Scope>perm:android:google-account</Scope> <Scope>perm:android:google-account</Scope>
<Scope>perm:android:update-default-sim</Scope> <Scope>perm:android:update-default-sim</Scope>
<Scope>perm:android:info</Scope>
</Scopes> </Scopes>
<SSOConfiguration> <SSOConfiguration>
<Issuer>device-mgt</Issuer> <Issuer>device-mgt</Issuer>

Loading…
Cancel
Save