Merge branch 'master' into 'master'

Performance improvements

See merge request entgra/carbon-device-mgt-plugins!155
revert-dabc3590
Charitha Goonetilleke 5 years ago
commit 772d566dd5

@ -223,10 +223,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
private void updateOperations(Device device, List<? extends Operation> operations)
throws OperationManagementException, PolicyComplianceException,
ApplicationManagementException, NotificationManagementException, DeviceManagementException {
DeviceIdentifier id = new DeviceIdentifier();
id.setId(device.getDeviceIdentifier());
id.setType(AndroidConstants.DEVICE_TYPE_ANDROID);
ApplicationManagementException, NotificationManagementException {
String deviceName = device.getName();
for (Operation operation : operations) {
AndroidDeviceUtils.updateOperation(device, operation);
@ -238,7 +235,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
Status.NEW.toString());
notification.setDescription(operation.getCode() + " operation failed to execute on device " +
deviceName + " (ID: " + device.getDeviceIdentifier() + ")");
AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification);
AndroidAPIUtils.getNotificationManagementService().addNotification(device, notification);
}
if (log.isDebugEnabled()) {
log.debug("Updating operation '" + operation.toString() + "'");
@ -358,7 +355,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) {
DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id);
try {
Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
if (device != null) {
String status = String.valueOf(device.getEnrolmentInfo().getStatus());
Message responseMessage = new Message();
@ -389,7 +386,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
deviceIdentifier.setId(id);
deviceIdentifier.setType(AndroidConstants.DEVICE_TYPE_ANDROID);
try {
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
} catch (DeviceManagementException e) {
String msg = "Error occurred while getting enrollment details of the Android device that carries the id '" +
id + "'";

@ -76,7 +76,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
}
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(),
AndroidConstants.DEVICE_TYPE_ANDROID);
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false);
if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){
return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build();
} else if (device == null){

@ -167,7 +167,7 @@ public class AndroidDeviceUtils {
if (log.isDebugEnabled()) {
log.debug("Received compliance status from MONITOR operation ID: " + operation.getId());
}
AndroidAPIUtils.getPolicyManagerService().checkPolicyCompliance(deviceIdentifier,
AndroidAPIUtils.getPolicyManagerService().checkPolicyCompliance(device,
getComplianceFeatures(operation.getPayLoad()));
} else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants.
OperationCodes.APPLICATION_LIST.equals(operation.getCode())) {

@ -26,6 +26,11 @@ public class DeviceInformationManagerServiceMock implements DeviceInformationMan
return null;
}
@Override
public DeviceInfo getDeviceInfo(Device device) throws DeviceDetailsMgtException {
return null;
}
@Override
public List<DeviceInfo> getDevicesInfo(List<DeviceIdentifier> list) throws DeviceDetailsMgtException {
return null;

@ -429,13 +429,7 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
}
@Override
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return false;
}
@Override
public boolean setStatus(DeviceIdentifier deviceIdentifier, String s, EnrolmentInfo.Status status)
throws DeviceManagementException {
public boolean setStatus(Device device, EnrolmentInfo.Status status) throws DeviceManagementException {
return false;
}
@ -456,6 +450,11 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
return TestUtils.getActivity();
}
@Override
public void addTaskOperation(String s, Operation operation) throws OperationManagementException {
}
@Override
public List<? extends Operation> getOperations(DeviceIdentifier deviceIdentifier)
throws OperationManagementException {
@ -468,6 +467,11 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
return null;
}
@Override
public List<? extends Operation> getOperations(DeviceIdentifier deviceIdentifier, Operation.Status status) throws OperationManagementException {
return null;
}
@Override
public List<? extends Operation> getPendingOperations(DeviceIdentifier deviceIdentifier)
throws OperationManagementException {
@ -668,7 +672,7 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
}
@Override
public boolean updateEnrollment(String s, List<String> list) throws DeviceManagementException, UserNotFoundException, InvalidDeviceException {
public boolean updateEnrollment(String s, boolean b, List<String> list) throws DeviceManagementException, UserNotFoundException, InvalidDeviceException {
return false;
}
@ -741,4 +745,10 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv
public int getFunctioningDevicesInSystem() throws DeviceManagementException {
return 0;
}
@Override
public boolean isOperationExist(DeviceIdentifier deviceIdentifier, int i) throws OperationManagementException {
return false;
}
}

@ -285,11 +285,6 @@ public class AndroidDeviceManager implements DeviceManager {
return true;
}
@Override
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
return false;
}
@Override
public boolean setStatus(DeviceIdentifier deviceIdentifier, String currentUser,
EnrolmentInfo.Status status) throws DeviceManagementException {

Loading…
Cancel
Save