|
|
@ -47,7 +47,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status;
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addDevice(mobileDevice);
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addDevice(mobileDevice);
|
|
|
@ -62,7 +62,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
|
|
|
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status;
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
@ -78,7 +78,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
|
|
|
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
|
.deleteDevice(deviceId.getId());
|
|
|
|
.deleteDevice(deviceId.getId());
|
|
|
@ -122,7 +122,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
|
|
|
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
|
|
|
Device device = null;
|
|
|
|
Device device;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().
|
|
|
|
getDevice(deviceId.getId());
|
|
|
|
getDevice(deviceId.getId());
|
|
|
@ -143,14 +143,13 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
|
|
|
|
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status;
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
|
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
|
|
|
.updateDevice(mobileDevice);
|
|
|
|
.updateDevice(mobileDevice);
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
String msg =
|
|
|
|
String msg = "Error while updating the Android device : " + device.getDeviceIdentifier();
|
|
|
|
"Error while updating the Android device : " + device.getDeviceIdentifier();
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new DeviceManagementException(msg, e);
|
|
|
|
throw new DeviceManagementException(msg, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -166,8 +165,8 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
|
|
|
|
getAllDevices();
|
|
|
|
getAllDevices();
|
|
|
|
if (mobileDevices != null) {
|
|
|
|
if (mobileDevices != null) {
|
|
|
|
devices = new ArrayList<Device>();
|
|
|
|
devices = new ArrayList<Device>();
|
|
|
|
for (int x = 0; x < mobileDevices.size(); x++) {
|
|
|
|
for (MobileDevice mobileDevice : mobileDevices) {
|
|
|
|
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevices.get(x)));
|
|
|
|
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|