/**
   * Handle update
   *
   * @param onem2mResponse response
   */
  public void handleOperationUpdate(ResponsePrimitive onem2mResponse) {

    // Use table TS0004: 7.1.1.1-1 to validate UPDATE specific parameters that were not handled in
    // the calling routine

    // ensure the update has content ...
    String cf = getPrimitive(RequestPrimitive.CONTENT_FORMAT);
    if (cf == null) {
      onem2mResponse.setRSC(
          Onem2m.ResponseStatusCode.INSUFFICIENT_ARGUMENTS,
          "CONTENT_FORMAT(" + RequestPrimitive.CONTENT_FORMAT + ") not specified");
      return;
    } else if (!cf.contentEquals(Onem2m.ContentFormat.JSON)
        && !cf.contentEquals(Onem2m.ContentFormat.XML)) {
      onem2mResponse.setRSC(
          Onem2m.ResponseStatusCode.CONTENTS_UNACCEPTABLE,
          "CONTENT_FORMAT(" + RequestPrimitive.CONTENT_FORMAT + ") not accepted (" + cf + ")");
      return;
    }
    String cn = getPrimitive(RequestPrimitive.CONTENT);
    if (cn == null) {
      onem2mResponse.setRSC(
          Onem2m.ResponseStatusCode.INSUFFICIENT_ARGUMENTS,
          "CONTENT(" + RequestPrimitive.CONTENT_FORMAT + ") not specified");
      return;
    }

    // validate result content options for Update
    String rc = getPrimitive(RequestPrimitive.RESULT_CONTENT);
    if (rc != null) {
      if (!(rc.contentEquals(Onem2m.ResultContent.ATTRIBUTES)
          || rc.contentEquals(Onem2m.ResultContent.NOTHING)
          || rc.contentEquals(Onem2m.ResultContent.CHILD_RESOURCE_REFS)
          || rc.contentEquals(Onem2m.ResultContent.ATTRIBUTES_CHILD_RESOURCE_REFS))) {
        onem2mResponse.setRSC(
            Onem2m.ResponseStatusCode.CONTENTS_UNACCEPTABLE,
            "RESULT_CONTENT(" + RequestPrimitive.RESULT_CONTENT + ") not accepted (" + rc + ")");
        return;
      }
    }

    // now find the resource from the database
    String to = this.getPrimitive(RequestPrimitive.TO);
    if (Onem2mDb.getInstance().findResourceUsingURI(to, this, onem2mResponse) == false) {
      onem2mResponse.setRSC(
          Onem2m.ResponseStatusCode.NOT_FOUND, "Resource target URI not found: " + to);
      return;
    }

    // cannot update contentInstance resources so check resource type
    String rt = this.getOnem2mResource().getResourceType();
    if (rt != null && rt.contentEquals(Onem2m.ResourceType.CONTENT_INSTANCE)) {
      onem2mResponse.setRSC(
          Onem2m.ResponseStatusCode.OPERATION_NOT_ALLOWED,
          "Not permitted to update content instance: " + this.getPrimitive(RequestPrimitive.TO));
      return;
    }

    ResourceContentProcessor.handleUpdate(this, onem2mResponse);
    if (onem2mResponse.getPrimitive(ResponsePrimitive.RESPONSE_STATUS_CODE) != null) {
      return;
    }

    ResultContentProcessor.handleUpdate(this, onem2mResponse);
    if (onem2mResponse.getPrimitive(ResponsePrimitive.RESPONSE_STATUS_CODE) != null) {
      return;
    }

    NotificationProcessor.handleUpdate(this);

    // TODO: see TS0004 6.8
    // if FOUND, and all went well, send back CHANGED
    if (onem2mResponse.getPrimitive(ResponsePrimitive.RESPONSE_STATUS_CODE) == null) {
      onem2mResponse.setPrimitive(
          ResponsePrimitive.RESPONSE_STATUS_CODE, Onem2m.ResponseStatusCode.CHANGED);
    }
  }