/** * Update Status of the lock operation. * * @param status Status of the operation. * @param syncmlDocument parsed syncml payload. * @param deviceIdentifier Device Id. * @throws OperationManagementException * @throws DeviceManagementException * @throws NotificationManagementException */ public void lockOperationUpdate( StatusTag status, SyncmlDocument syncmlDocument, DeviceIdentifier deviceIdentifier) throws OperationManagementException, DeviceManagementException, NotificationManagementException { pendingDataOperations = WindowsAPIUtils.getDeviceManagementService() .getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING); if (Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData())) { for (Operation operation : pendingDataOperations) { if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(operation.getCode())) && operation.getId() == status.getCommandReference()) { operation.setStatus(Operation.Status.COMPLETED); new OperationUtils() .updateOperations( syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); } } } if (Constants.SyncMLResponseCodes.PIN_NOTFOUND.equals(status.getData())) { for (Operation operation : pendingDataOperations) { if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(operation.getCode()) && operation.getId() == status.getCommandReference())) { operation.setStatus(Operation.Status.ERROR); new OperationUtils() .updateOperations( syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); try { NotificationManagementService nmService = WindowsAPIUtils.getNotificationManagementService(); Notification lockResetNotification = new Notification(); lockResetNotification.setOperationId(status.getCommandReference()); lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW)); lockResetNotification.setDeviceIdentifier(deviceIdentifier); lockResetNotification.setDescription( Constants.SyncMLResponseCodes.LOCKRESET_NOTIFICATION); nmService.addNotification(lockResetNotification); } catch (NotificationManagementException e) { String msg = "Failure occurred in getting notification service"; log.error(msg, e); throw new NotificationManagementException(msg, e); } } } } }
public void endElement( String namespaceURI, String sName, // simple name String qName // qualified name ) throws SAXException { String element = qName; if (element.compareToIgnoreCase("presence") == 0) {} if (element.compareToIgnoreCase("presentity") == 0) { presenceTag.setPresentityTag(presentityTag); } if (element.compareToIgnoreCase("tuple") == 0) { presenceTag.addTupleTag(tupleTag); } if (element.compareToIgnoreCase("status") == 0) { tupleTag.setStatusTag(statusTag); } if (element.compareToIgnoreCase("basic") == 0) { statusTag.setBasicTag(basicTag); } if (element.compareToIgnoreCase("contact") == 0) { tupleTag.setContactTag(contactTag); } if (element.compareToIgnoreCase("note") == 0) { tupleTag.setNoteTag(noteTag); } }
public String toString() { String result = "<address uri=\"" + uri + "\" "; if (priority != -1) result += "priority=\"" + priority + "\""; result += " >\n"; if (statusTag != null) result += statusTag.toString(); if (msnSubStatusTag != null) result += msnSubStatusTag.toString(); result += "</address>\n"; return result; }
public String toString() { String result = "<tuple "; result += " id=\"" + id + "\" >\n"; if (statusTag != null) result += statusTag.toString(); if (contactTag != null) result += contactTag.toString(); if (noteTag != null) result += noteTag.toString(); result += "</tuple>\n"; return result; }
/** * * Update the status of the DataWipe operation. * * @param status Status of the data wipe. * @param syncmlDocument Parsed syncml payload from the syncml engine. * @param deviceIdentifier specific device id to be wiped. * @throws OperationManagementException * @throws DeviceManagementException */ public void dataWipe( StatusTag status, SyncmlDocument syncmlDocument, DeviceIdentifier deviceIdentifier) throws OperationManagementException, DeviceManagementException { if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { pendingDataOperations = WindowsAPIUtils.getDeviceManagementService() .getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING); for (Operation operation : pendingDataOperations) { if ((OperationCode.Command.WIPE_DATA.equals(operation.getCode())) && (operation.getId() == status.getCommandReference())) { operation.setStatus(Operation.Status.COMPLETED); updateOperations( syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); } } } }
/** * Update the completed/Error status of the operation which have the URI of the operation code in * the syncml payload. * * @param syncmlDocument SyncmlDocument object generated from the the syncml engine. * @throws DeviceManagementException * @throws NotificationManagementException * @throws OperationManagementException */ public void UpdateUriOperations(SyncmlDocument syncmlDocument) throws DeviceManagementException, NotificationManagementException, OperationManagementException, WindowsOperationException { DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument.getHeader().getSource().getLocURI()); List<StatusTag> statuses = syncmlDocument.getBody().getStatus(); OperationUtils operationUtils = new OperationUtils(); for (StatusTag status : statuses) { if ((Constants.EXECUTE.equals(status.getCommand()))) { if (status.getTargetReference() == null) { operationUtils.updateDeviceOperations(status, syncmlDocument, deviceIdentifier); } else { if ((OperationCode.Command.DEVICE_LOCK.equals(status.getTargetReference()))) { operationUtils.lockOperationUpdate(status, syncmlDocument, deviceIdentifier); } if ((OperationCode.Command.DEVICE_RING.equals(status.getTargetReference()))) { operationUtils.ring(status, syncmlDocument, deviceIdentifier); } if (equals(OperationCode.Command.WIPE_DATA.equals(status.getTargetReference()))) { operationUtils.dataWipe(status, syncmlDocument, deviceIdentifier); } } } if ((Constants.SEQUENCE.equals(status.getCommand()))) { if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { pendingDataOperations = WindowsAPIUtils.getDeviceManagementService() .getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING); for (Operation operation : pendingDataOperations) { if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode())) && operation.getId() == status.getCommandReference()) { operation.setStatus(Operation.Status.COMPLETED); } if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode())) && operation.getId() == status.getCommandReference()) { operation.setStatus(Operation.Status.COMPLETED); } } operationUtils.updateOperations( syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); } else { pendingDataOperations = WindowsAPIUtils.getDeviceManagementService() .getOperationsByDeviceAndStatus(deviceIdentifier, Operation.Status.PENDING); for (Operation operation : pendingDataOperations) { if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode())) && operation.getId() == status.getCommandReference()) { operation.setStatus(Operation.Status.ERROR); } if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode())) && operation.getId() == status.getCommandReference()) { operation.setStatus(Operation.Status.ERROR); } } operationUtils.updateOperations( syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); } } } }