public FileEntry getFileEntry() throws PortalException, SystemException {
    Document document = null;

    List<Document> allVersions = _document.getAllVersions();

    if (allVersions.isEmpty()) {
      document = _document;
    } else {
      document = allVersions.get(0);
    }

    return CMISRepositoryLocalServiceUtil.toFileEntry(getRepositoryId(), document);
  }