adding Device Info to win10

revert-dabc3590
Hasunie 8 years ago
parent 69ebf70484
commit 6857ba1b74

@ -28,10 +28,13 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.InvalidDeviceException;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException;
import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse;
@ -222,4 +225,14 @@ public class WindowsAPIUtils {
return null;
}
}
private static void updateDeviceInfo(DeviceIdentifier deviceId, DeviceInfo deviceInfo)
throws DeviceDetailsMgtException {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
DeviceInformationManager informationManager =
(DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null);
informationManager.addDeviceInfo(deviceId, deviceInfo);
}
}

@ -26,6 +26,7 @@ import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.device.details.*;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
@ -40,6 +41,7 @@ import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.*;
import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.DeviceInfo;
import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -89,6 +91,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
if (modifyEnrollWithMoreDetail(request)) {
pendingOperations = operationHandler.getPendingOperations(syncmlDocument);
response = operationReply.generateReply(syncmlDocument,pendingOperations);
return Response.status(Response.Status.OK).entity(response).build();
} else {
@ -196,18 +199,34 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
existingDevice.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
status = WindowsAPIUtils.getDeviceManagementService().modifyEnrollment(existingDevice);
// call effective policy for the enrolling device.
PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService();
policyManagerService.getEffectivePolicy(deviceIdentifier);
//PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService();
//policyManagerService.getEffectivePolicy(deviceIdentifier);
return status;
}
} catch (DeviceManagementException e) {
throw new WindowsDeviceEnrolmentException("Failure occurred while enrolling device.", e);
} catch (PolicyManagementException e) {
throw new WindowsOperationException("Error occurred while getting effective policy.", e);
// } catch (PolicyManagementException e) {
// throw new WindowsOperationException("Error occurred while getting effective policy.", e);
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
return status;
}
// public void generateDeviceInfo(Document requestedInfo) {
// SyncmlDocument syncmlDocument;
// syncmlDocument = SyncmlParser.parseSyncmlPayload(requestedInfo);
// DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument.
// getHeader().getSource().getLocURI());
// try {
// List<ItemTag> itemList = syncmlDocument.getBody().getResults().getItem();
// Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
// org.wso2.carbon.device.mgt.common.device.details.DeviceInfo existingDeviceInfo = existingDevice.getDeviceInfo();
// existingDeviceInfo.s
// } catch (DeviceManagementException e) {
// e.printStackTrace();
// }
//
// }
}

Loading…
Cancel
Save