コード例 #1
0
  @Override
  public List<RenditionData> getRenditions(
      CallContext callContext,
      String repositoryId,
      String objectId,
      String renditionFilter,
      BigInteger maxItems,
      BigInteger skipCount,
      ExtensionsData extension) {

    Lock lock = threadLockService.getReadLock(repositoryId, objectId);
    try {
      lock.lock();

      List<Rendition> renditions = contentService.getRenditions(repositoryId, objectId);

      List<RenditionData> results = new ArrayList<RenditionData>();
      for (Rendition rnd : renditions) {
        RenditionDataImpl data =
            new RenditionDataImpl(
                rnd.getId(),
                rnd.getMimetype(),
                BigInteger.valueOf(rnd.getLength()),
                rnd.getKind(),
                rnd.getTitle(),
                BigInteger.valueOf(rnd.getWidth()),
                BigInteger.valueOf(rnd.getHeight()),
                rnd.getRenditionDocumentId());
        results.add(data);
      }
      return results;
    } finally {
      lock.unlock();
    }
  }
コード例 #2
0
  private ContentStream getRenditionStream(String repositoryId, Content content, String streamId) {
    if (!content.isDocument() && !content.isFolder()) {
      exceptionService.constraint(
          content.getId(),
          "getRenditionStream cannnot be invoked to other than document or folder type.");
    }

    exceptionService.constraintRenditionStreamDownload(content, streamId);

    Rendition rendition = contentService.getRendition(repositoryId, streamId);

    BigInteger length = BigInteger.valueOf(rendition.getLength());
    String mimeType = rendition.getMimetype();
    InputStream is = rendition.getInputStream();
    ContentStream cs = new ContentStreamImpl("preview_" + streamId, length, mimeType, is);

    return cs;
  }