Creates a {@link JsonLongDocument} which the document id and content.

@param id the per-bucket unique document id.
@param content the content of the document.
@return a {@link JsonLongDocument}.
12625
public static JsonLongDocument create(String id, Long content) {
        return new JsonLongDocument(id, 0, content, 0, null);
    }
934273
public static Document read(@NonNull Resource resource) throws IOException {
      Type mapType = new TypeToken<Map<String, Object>>() {
      }.getType();
      Gson gson = new Gson();
      //Load the document to a map
      Map<String, Object> json = gson.fromJson(resource.readToString(), mapType);

      //Create the initial document using raw content
      Document doc = DocumentFactory.getInstance().createRaw(json.getOrDefault("id", Val.NULL).toString(),
                                                             json.getOrDefault("content", "").toString());

      //Add document attributes
      if (json.containsKey("attributes")) {
         Map<String, Object> attributes = Cast.as(json.get("attributes"));
         attributes.forEach((k, av) -> {
            AttributeType attrType = Types.attribute(k);
            Object val = attrType.getValueType().decode(av);
            if (val != null) {
               doc.put(attrType, val);
            }
         });
      }

      //Set completed annotations
      if (json.containsKey("completed")) {
         Map<String, Object> completed = Cast.as(json.get("completed"));
         completed
            .forEach((k, av) -> {
               AnnotatableType type = Types.from(k);
               doc.getAnnotationSet().setIsCompleted(type, true, av.toString());
            });
      }

      //Create the annotations
      AtomicLong maxAnnotationId = new AtomicLong(-1);
      if (json.containsKey("annotations")) {
         List<Object> annotations = Cast.as(json.get("annotations"));
         annotations
            .forEach(v -> {
               Map<String, Object> vv = Cast.as(v);

               //Create new annotation
               Annotation annotation = doc.annotationBuilder()
                                          .type(AnnotationType.create(vv.get("type").toString()))
                                          .start(((Number) vv.get("start")).intValue())
                                          .end(((Number) vv.get("end")).intValue())
                                          .createAttached();

               //Read in and set id and update max id value
               annotation.setId(((Number) vv.get("id")).longValue());
               maxAnnotationId.getAndUpdate(old -> old < annotation.getId() ? annotation.getId() : old);

               //Read in the attributes (map of types and values)
               Cast.<Map<String, Object>>as(vv.getOrDefault("attributes", Collections.emptyMap())).forEach(
                  (k, av) -> {
                     AttributeType attrType = Types.attribute(k);
                     Object val = attrType.getValueType().decode(av);
                     if (val != null) {
                        annotation.put(attrType, val);
                     }
                  });

               if (vv.containsKey("relations")) {
                  //Read in the relations (a list of maps containing type, value, and target)
                  Cast.<List<Object>>as(vv.get("relations"))
                     .stream()
                     .map(Cast::<Map<String, Object>>as)
                     .forEach(rel -> annotation.add(new Relation(RelationType.create(rel.get("type").toString()),
                                                                 rel.get("value").toString(),
                                                                 ((Number) rel.get("target")).longValue())));
               }
            });

         //Set the next annotation id
         doc.idGenerator.set(maxAnnotationId.get() + 1);
      }

      return doc;
   }
1053441
public JsonDocument insert(String documentId, String json) {
        return this.bucket.insert(JsonDocument.create(documentId, JsonObject.fromJson(json)));
    }
1235226
public static JsonArrayDocument create(String id, JsonArray content) {
        return new JsonArrayDocument(id, 0, content, 0, null);
    }
552893
public ReadDocumentResponse readDocument(String documentId, long expireInSeconds) {
        ReadDocumentRequest request = new ReadDocumentRequest();
        request.setDocumentId(documentId);
        request.setExpireInSeconds(expireInSeconds);
        return this.readDocument(request);
    }
637581
@NonNull
    @Override
    public MutableDocument setLong(@NonNull String key, long value) {
        return setValue(key, value);
    }
894467
public Document create(@NonNull String content, @NonNull Language language, @NonNull Map<AttributeType, ?> attributeMap) {
      return create("", content, language, attributeMap);
   }
475350
private function checkConformity(&$content, $id, $realNameId) {
        switch ($this->identifiersAi[$realNameId][self::KIND_OF_DATA]) {
            case self::NUMERIC:
                $content = str_replace(',', '.', $content);
                if (!preg_match("/^[0-9.]+$/", $content)) {
                    throw new CINParseException('gs1128', 'The value of "' . $id . '" must be numerical.');
                }

                break;
            case self::DATE_YYMMDD:
                $valid_date = true;
                if (preg_match("/^[0-9]{6}$/", $content)) {
                    $year = substr($content, 0, 2);
                    $month = substr($content, 2, 2);
                    $day = substr($content, 4, 2);

                    /* day can be 00 if we only need month and year */
                    if (intval($month) < 1 || intval($month) > 12 || intval($day) < 0 || intval($day) > 31) {
                        $valid_date = false;
                    }
                } else {
                    $valid_date = false;
                }

                if (!$valid_date) {
                    throw new CINParseException('gs1128', 'The value of "' . $id . '" must be in YYMMDD format.');
                }

                break;
        }

        // We check the length of the content
        $nbCharContent = strlen($content);
        $checksumChar = 0;
        $minlengthContent = $this->identifiersAi[$realNameId][self::MINLENGTH];
        $maxlengthContent = $this->identifiersAi[$realNameId][self::MAXLENGTH];

        if ($this->identifiersAi[$realNameId][self::CHECKSUM]) {
            $checksumChar++;
        }

        if ($nbCharContent < ($minlengthContent - $checksumChar)) {
            if ($minlengthContent === $maxlengthContent) {
                throw new CINParseException('gs1128', 'The value of "' . $id . '" must contain ' . $minlengthContent . ' character(s).');
            } else {
                throw new CINParseException('gs1128', 'The value of "' . $id . '" must contain between ' . $minlengthContent . ' and ' . $maxlengthContent . ' character(s).');
            }
        }

        return true;
    }
382522
@SafeVarargs
    public static JsonDocument toJsonDocument(final Object... a) {
        return a.length == 1 ? toJsonDocument(a[0], toJsonObject(a[0])) : toJsonDocument(a, toJsonObject(a));
    }
824350
public ReadDocumentResponse readDocument(ReadDocumentRequest request) {
        checkNotNull(request, "request should not be null.");
        checkNotNull(request.getDocumentId(), "documentId should not be null.");
        InternalRequest internalRequest = this.createRequest(
                HttpMethodName.GET, request, DOC, request.getDocumentId());
        internalRequest.addParameter("read", null);
        ReadDocumentResponse response;
        try {
            response = this.invokeHttpClient(internalRequest, ReadDocumentResponse.class);
        } finally {
            try {
                internalRequest.getContent().close();
            } catch (Exception e) {
                // ignore exception
            }
        }

        return response;
    }
1080631
public ReadDocumentResponse readDocument(String documentId) {
        ReadDocumentRequest request = new ReadDocumentRequest();
        request.setDocumentId(documentId);
        return this.readDocument(request);
    }
1029482
public   String addDocumentWithId(String indexName,  Object bean, Object docId, Object parentId) throws ElasticSearchException{
		return addDocumentWithId(  indexName,  _doc,  bean,   docId,   parentId);
	}
833764
public ContentsId create(String tableName) {

		if (!has()) {
			getOrCreateExtension();
		}

		ContentsId contentsId = new ContentsId();
		Contents contents = geoPackage.getTableContents(tableName);
		contentsId.setContents(contents);
		try {
			contentsIdDao.create(contentsId);
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to create contents id for GeoPackage: "
							+ geoPackage.getName() + ", Table Name: "
							+ tableName, e);
		}
		return contentsId;
	}
1104370
public OvhDocument document_id_GET(String id) throws IOException {
		String qPath = "/me/document/{id}";
		StringBuilder sb = path(qPath, id);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhDocument.class);
	}
595790
public String getOrGenerateDocumentId(Object entity) {
        Reference<String> idHolder = new Reference<>();
        tryGetIdFromInstance(entity, idHolder);
        String id = idHolder.value;
        if (id == null) {
            // Generate the key up front
            id = _generateId.apply(entity);
        }

        if (id != null && id.startsWith("/")) {
            throw new IllegalStateException("Cannot use value '" + id + "' as a document id because it begins with a '/'");
        }
        return id;
    }
1046111
private PublishDocumentResponse publishDocument(PublishDocumentRequest request) {
        checkNotNull(request, "request should not be null.");
        checkNotNull(request.getDocumentId(), "documentId should not be null.");
        InternalRequest internalRequest = this.createRequest(HttpMethodName.PUT, request, DOC, request.getDocumentId());
        internalRequest.addParameter("publish", null);
        // need to set content-length, otherwise auth will failed
        // cause HTTP will set Content-Length auto when send http request
        internalRequest.addHeader(Headers.CONTENT_LENGTH, "0");
        PublishDocumentResponse response;
        try {
            response = this.invokeHttpClient(internalRequest, PublishDocumentResponse.class);
        } finally {
            try {
                internalRequest.getContent().close();
            } catch (Exception e) {
                // ignore exception
            }
        }

        return response;
    }
406073
public <O extends Schema> O setId(String schemaId) {
        getJson().put("id", schemaId);
        return (O)this;
    }