/**
   * 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);
          }
        }
      }
    }
  }