Returns the version document of the given document, if any; returns null otherwise.
@param document the document to get the version from.
@return the version of the given document, if any; returns null otherwise.
497492
static BsonDocument getDocumentVersionDoc(final BsonDocument document) {
    if (document == null || !document.containsKey(DOCUMENT_VERSION_FIELD)) {
      return null;
    }
    return document.getDocument(DOCUMENT_VERSION_FIELD, null);
  }
1149039
public com.google.api.Documentation getDocumentation() {
    return documentation_ == null ? com.google.api.Documentation.getDefaultInstance() : documentation_;
  }
198851
public void parse(Document document) {
        responsePayLoad = document.getDocumentElement();
        status = responsePayLoad.getAttribute("stat");
        if ("ok".equals(status)) {
            Element photoIdElement = (Element) responsePayLoad.getElementsByTagName("photoid").item(0);
            if (photoIdElement != null) {
                photoId = ((Text) photoIdElement.getFirstChild()).getData();
            } else {
                photoId = null;
            }
            Element ticketIdElement = (Element) responsePayLoad.getElementsByTagName("ticketid").item(0);
            if (ticketIdElement != null) {
                ticketId = ((Text) ticketIdElement.getFirstChild()).getData();
            } else {
                ticketId = null;
            }
        } else {
            Element errElement = (Element) responsePayLoad.getElementsByTagName("err").item(0);
            errorCode = errElement.getAttribute("code");
            errorMessage = errElement.getAttribute("msg");
        }
    }
771030
public Response update(String id, Object document) {
        Misc.checkNotNullOrEmpty(id, "id");
        Misc.checkNotNull(document, "Document");

        // Get the latest rev, will throw if doc doesn't exist
        getDocumentRev(id);

        return putUpdate(id, document);
    }
1215746
public Version getDetailedVersion(String version) {
		prepareDetailedVersions();

		if (detailedVersions.containsKey(version)) {
			return detailedVersions.get(version);
		}
		
		return null;
	}
164601
public Date getExpirationDate() {
        long timestamp = database.expirationOfDocument(documentId);
        if (timestamp == 0)
            return null;
        return new Date(timestamp);
    }
797495
public static function getDocumentCompany($document)
    {
        return $document->getDataValue('firma') ? \FlexiPeeHP\FlexiBeeRO::uncode(
                $document->getDataValue('firma')) : null;
    }
952000
def _get_version(self, root):
        
        # Note: STIX and MAEC use a "version" attribute. To support CybOX, a
        # subclass will need to combine "cybox_major_version",
        # "cybox_minor_version", and "cybox_update_version".
        version = self.get_version(root)
        if version:
            return StrictVersion(version)

        raise UnknownVersionError(
            "Unable to determine the version of the input document. No "
            "version information found on the root element."
        )
178753
public static CompactChangeEvent fromBsonDocument(final BsonDocument document) {
    keyPresent(Fields.OPERATION_TYPE_FIELD, document);
    keyPresent(Fields.DOCUMENT_KEY_FIELD, document);

    final BsonDocument fullDocument;
    if (document.containsKey(Fields.FULL_DOCUMENT_FIELD)) {
      final BsonValue fdVal = document.get(Fields.FULL_DOCUMENT_FIELD);
      if (fdVal.isDocument()) {
        fullDocument = fdVal.asDocument();
      } else {
        fullDocument = null;
      }
    } else {
      fullDocument = null;
    }

    final UpdateDescription updateDescription;
    if (document.containsKey(Fields.UPDATE_DESCRIPTION_FIELD)) {
      updateDescription = UpdateDescription.fromBsonDocument(
          document.getDocument(Fields.UPDATE_DESCRIPTION_FIELD)
      );
    } else {
      updateDescription = null;
    }

    final DocumentVersionInfo.Version stitchDocumentVersion;
    if (document.containsKey(Fields.STITCH_DOCUMENT_VERSION_FIELD)) {
      stitchDocumentVersion = DocumentVersionInfo.Version
          .fromBsonDocument(document.getDocument(Fields.STITCH_DOCUMENT_VERSION_FIELD));
    } else {
      stitchDocumentVersion = null;
    }

    final Long stitchDocumentHash;
    if (document.containsKey(Fields.STITCH_DOCUMENT_HASH_FIELD)) {
      stitchDocumentHash = document.getInt64(
          Fields.STITCH_DOCUMENT_HASH_FIELD
      ).getValue();
    } else {
      stitchDocumentHash = null;
    }

    return new CompactChangeEvent<>(
        OperationType.fromRemote(document.getString(Fields.OPERATION_TYPE_FIELD).getValue()),
        fullDocument,
        document.getDocument(Fields.DOCUMENT_KEY_FIELD),
        updateDescription,
        stitchDocumentVersion,
        stitchDocumentHash,
        document.getBoolean(Fields.WRITE_PENDING_FIELD, BsonBoolean.FALSE).getValue());
  }
107419
public Document read() {
        try {
            do {
                if (stream == null) {
                    // Open the stream to the next file ...
                    stream = openNextFile();
                    if (stream == null) {
                        // No more files to read ...
                        return null;
                    }
                    documents = Json.readMultiple(stream, false);
                }
                try {
                    Document doc = documents.nextDocument();
                    if (doc != null) return doc;
                } catch (IOException e) {
                    // We'll just continue ...
                }
                // Close the stream and try opening the next stream ...
                close(stream);
                stream = null;
            } while (true);
        } catch (IOException e) {
            problems.addError(JcrI18n.problemsWritingDocumentToBackup, currentFile.getAbsolutePath(), e.getMessage());
            return null;
        }
    }
1108027
public static Document getDocument(File file) {
		SAXReader reader = new SAXReader();
		Document document = null;
		try {
			document = reader.read(file);
		} catch (DocumentException e) {
			throw new RuntimeException(e);
		}
		return document;
	}
143653
public boolean equalsTo(Object o)
    {
        if (o == null || !(o instanceof Document))
        {
            return false;
        }
        
        Document docCompared = (Document)o;
        if(getName() == null || !getName().equals(docCompared.getName())) return false;
        if(getRepository() == null || !getRepository().equals(docCompared.getRepository())) return false;
        
        return true;
    }
642836
public static void setVersion(Document doc, Version version) {
	Element root = doc.getDocumentElement();
	root.setAttribute("version", version.getMajor() + "." + version.getMinor());

    }
402625
public void setDocumentVersions(java.util.Collection<DocumentVersionInfo> documentVersions) {
        if (documentVersions == null) {
            this.documentVersions = null;
            return;
        }

        this.documentVersions = new com.amazonaws.internal.SdkInternalList<DocumentVersionInfo>(documentVersions);
    }
837061
@Nullable
  public static Document getOwnerDocument (@Nullable final Node aNode)
  {
    if (aNode == null)
      return null;
    if (aNode instanceof Document)
      return (Document) aNode;
    return aNode.getOwnerDocument ();
  }
416294
public static byte[] documentToBytes(Map<String, Object> doc) {
        return doc != null ? SerializationUtils.toByteArrayFst(doc) : ArrayUtils.EMPTY_BYTE_ARRAY;
    }
1154522
@Pure
	public static Document getDocumentFor(Node node) {
		Node localnode = node;
		while (localnode != null) {
			if (localnode instanceof Document) {
				return (Document) localnode;
			}
			localnode = localnode.getParentNode();
		}
		return null;
	}