@Override
  protected Repository getRepository(long classPK) throws PortalException, SystemException {

    DLFileShortcut dlFileShortcut = getDLFileShortcut(classPK);

    Repository repository =
        RepositoryServiceUtil.getRepositoryImpl(0, dlFileShortcut.getToFileEntryId(), 0);

    if (!(repository instanceof LiferayRepository)) {
      throw new InvalidRepositoryException(
          "Repository " + repository.getRepositoryId() + " does not support trash operations");
    }

    return repository;
  }
Esempio n. 2
0
  public static void getRepository(HttpServletRequest request) throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    long repositoryId = ParamUtil.getLong(request, "repositoryId");

    Repository repository = null;

    if (repositoryId > 0) {
      repository = RepositoryServiceUtil.getRepository(repositoryId);
    } else {
      DLPermission.check(
          themeDisplay.getPermissionChecker(), themeDisplay.getScopeGroupId(), ActionKeys.VIEW);
    }

    request.setAttribute(WebKeys.DOCUMENT_LIBRARY_REPOSITORY, repository);
  }