protected void moveEntries(ActionRequest actionRequest) throws Exception {
    long newFolderId = ParamUtil.getLong(actionRequest, "newFolderId");

    ServiceContext serviceContext =
        ServiceContextFactory.getInstance(DLFileEntry.class.getName(), actionRequest);

    long[] folderIds = ParamUtil.getLongValues(actionRequest, "rowIdsFolder");

    for (long folderId : folderIds) {
      _dlAppService.moveFolder(folderId, newFolderId, serviceContext);
    }

    long[] fileEntryIds = ParamUtil.getLongValues(actionRequest, "rowIdsFileEntry");

    for (long fileEntryId : fileEntryIds) {
      _dlAppService.moveFileEntry(fileEntryId, newFolderId, serviceContext);
    }

    long[] fileShortcutIds = ParamUtil.getLongValues(actionRequest, "rowIdsDLFileShortcut");

    for (long fileShortcutId : fileShortcutIds) {
      if (fileShortcutId == 0) {
        continue;
      }

      FileShortcut fileShortcut = _dlAppService.getFileShortcut(fileShortcutId);

      _dlAppService.updateFileShortcut(
          fileShortcutId, newFolderId, fileShortcut.getToFileEntryId(), serviceContext);
    }
  }
  protected void deleteEntries(ActionRequest actionRequest, boolean moveToTrash) throws Exception {

    long[] deleteFolderIds = ParamUtil.getLongValues(actionRequest, "rowIdsFolder");

    List<TrashedModel> trashedModels = new ArrayList<>();

    for (int i = 0; i < deleteFolderIds.length; i++) {
      long deleteFolderId = deleteFolderIds[i];

      if (moveToTrash) {
        Folder folder = _dlAppService.moveFolderToTrash(deleteFolderId);

        if (folder.getModel() instanceof TrashedModel) {
          trashedModels.add((TrashedModel) folder.getModel());
        }
      } else {
        _dlAppService.deleteFolder(deleteFolderId);
      }
    }

    // Delete file shortcuts before file entries. See LPS-21348.

    long[] deleteFileShortcutIds = ParamUtil.getLongValues(actionRequest, "rowIdsDLFileShortcut");

    for (int i = 0; i < deleteFileShortcutIds.length; i++) {
      long deleteFileShortcutId = deleteFileShortcutIds[i];

      if (moveToTrash) {
        FileShortcut fileShortcut = _dlAppService.moveFileShortcutToTrash(deleteFileShortcutId);

        if (fileShortcut.getModel() instanceof TrashedModel) {
          trashedModels.add((TrashedModel) fileShortcut.getModel());
        }
      } else {
        _dlAppService.deleteFileShortcut(deleteFileShortcutId);
      }
    }

    long[] deleteFileEntryIds = ParamUtil.getLongValues(actionRequest, "rowIdsFileEntry");

    for (long deleteFileEntryId : deleteFileEntryIds) {
      if (moveToTrash) {
        FileEntry fileEntry = _dlAppService.moveFileEntryToTrash(deleteFileEntryId);

        if (fileEntry.getModel() instanceof TrashedModel) {
          trashedModels.add((TrashedModel) fileEntry.getModel());
        }
      } else {
        _dlAppService.deleteFileEntry(deleteFileEntryId);
      }
    }

    if (moveToTrash && !trashedModels.isEmpty()) {
      TrashUtil.addTrashSessionMessages(actionRequest, trashedModels);

      hideDefaultSuccessMessage(actionRequest);
    }
  }
  protected void deleteFileShortcut(ActionRequest actionRequest, boolean moveToTrash)
      throws Exception {

    long fileShortcutId = ParamUtil.getLong(actionRequest, "fileShortcutId");

    if (moveToTrash) {
      FileShortcut fileShortcut = DLAppServiceUtil.moveFileShortcutToTrash(fileShortcutId);

      if (fileShortcut.getModel() instanceof TrashedModel) {
        TrashUtil.addTrashSessionMessages(actionRequest, (TrashedModel) fileShortcut.getModel());
      }

      hideDefaultSuccessMessage(actionRequest);
    } else {
      DLAppServiceUtil.deleteFileShortcut(fileShortcutId);
    }
  }
  @Override
  public IGViewFileVersionDisplayContext getIGViewFileVersionDisplayContext(
      IGViewFileVersionDisplayContext parentIGViewFileVersionDisplayContext,
      HttpServletRequest request,
      HttpServletResponse response,
      FileShortcut fileShortcut) {

    try {
      long fileEntryId = fileShortcut.getToFileEntryId();

      FileEntry fileEntry = _dlAppService.getFileEntry(fileEntryId);

      FileVersion fileVersion = fileEntry.getFileVersion();

      return getIGViewFileVersionDisplayContext(
          parentIGViewFileVersionDisplayContext, request, response, fileVersion);
    } catch (PortalException pe) {
      throw new SystemException(
          "Unable to build GoogleDocsDLViewFileVersionDisplayContext "
              + "for shortcut "
              + fileShortcut.getPrimaryKey(),
          pe);
    }
  }