|
|
@ -149,16 +149,18 @@ public class AndroidDeviceManager implements DeviceManager {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
boolean isEnrolled = this.isEnrolled(
|
|
|
|
|
|
|
|
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier());
|
|
|
|
log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean isEnrolled = this.isEnrolled(
|
|
|
|
|
|
|
|
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
if (isEnrolled) {
|
|
|
|
if (isEnrolled) {
|
|
|
|
this.modifyEnrollment(device);
|
|
|
|
this.modifyEnrollment(device);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
AndroidDAOFactory.beginTransaction();
|
|
|
|
AndroidDAOFactory.beginTransaction();
|
|
|
|
status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice);
|
|
|
|
status = daoFactory.getMobileDeviceDAO().addMobileDevice(mobileDevice);
|
|
|
|
AndroidDAOFactory.commitTransaction();
|
|
|
|
AndroidDAOFactory.commitTransaction();
|
|
|
|