public ImageEditorDLDisplayContextHelper(FileVersion fileVersion, HttpServletRequest request) {

    _fileVersion = fileVersion;
    _request = request;

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

    try {
      FileEntry fileEntry = null;

      if (fileVersion != null) {
        fileEntry = fileVersion.getFileEntry();
      }

      _fileEntry = fileEntry;
    } catch (PortalException pe) {
      throw new SystemException(
          "Unable to create image editor document library display "
              + "context helper for file version "
              + fileVersion,
          pe);
    }
  }
  @Override
  public AssetRenderer getAssetRenderer(long classPK, int type)
      throws PortalException, SystemException {

    FileEntry fileEntry = null;
    FileVersion fileVersion = null;

    if (type == TYPE_LATEST) {
      fileVersion = DLAppLocalServiceUtil.getFileVersion(classPK);

      fileEntry = fileVersion.getFileEntry();
    } else {
      fileEntry = DLAppLocalServiceUtil.getFileEntry(classPK);

      fileVersion = fileEntry.getFileVersion();
    }

    DLFileEntryAssetRenderer dlFileEntryAssetRenderer =
        new DLFileEntryAssetRenderer(fileEntry, fileVersion);

    dlFileEntryAssetRenderer.setAssetRendererType(type);

    return dlFileEntryAssetRenderer;
  }