Exemplo n.º 1
0
  protected void migrateDLFileEntry(
      long companyId, String portletId, long groupId, long repositoryId, DLFileEntry fileEntry)
      throws Exception {

    String fileName = fileEntry.getName();
    long fileEntryId = fileEntry.getFileEntryId();
    String properties = fileEntry.getLuceneProperties();

    List<DLFileVersion> dlFileVersions =
        DLFileVersionLocalServiceUtil.getFileVersions(
            groupId, repositoryId, fileName, WorkflowConstants.STATUS_ANY);

    if (dlFileVersions.isEmpty()) {
      String versionNumber = Hook.DEFAULT_VERSION;
      Date modifiedDate = fileEntry.getModifiedDate();

      migrateFile(
          companyId,
          portletId,
          groupId,
          repositoryId,
          fileName,
          versionNumber,
          fileEntryId,
          properties,
          modifiedDate);

      return;
    }

    for (DLFileVersion dlFileVersion : dlFileVersions) {
      String versionNumber = dlFileVersion.getVersion();
      Date modifiedDate = dlFileVersion.getCreateDate();

      migrateFile(
          companyId,
          portletId,
          groupId,
          repositoryId,
          fileName,
          versionNumber,
          fileEntryId,
          properties,
          modifiedDate);
    }
  }
Exemplo n.º 2
0
 @Override
 public List<DLFileVersion> getFileVersions(int status) {
   return DLFileVersionLocalServiceUtil.getFileVersions(getFileEntryId(), status);
 }