コード例 #1
0
  public InputStream getThumbnailStream(WorkflowThumbnailParams params) throws Exception {

    String widthName = Integer.toString(params.getWidth());
    String heightName = Integer.toString(params.getHeight());
    InputStream is =
        getStreamFromCache(
            params.getWorkflow(),
            params.getStepId(),
            widthName,
            heightName,
            params.showLabels(),
            params.maintainAspect());

    if (is == null) {
      BufferedImage image = delegateImageManager.getThumbnailImage(params);
      if (image != null) {
        File cacheFile =
            addImageToCache(
                image,
                params.getWorkflow(),
                params.getStepId(),
                widthName,
                heightName,
                params.showLabels(),
                params.maintainAspect());
        try {
          is = new FileInputStream(cacheFile);
        } catch (Exception e) {
          log.error("Workflow Thumbnail File Missing!", e);
        }
      }
    }

    return is;
  }
コード例 #2
0
  public BufferedImage getThumbnailImage(WorkflowThumbnailParams params) throws Exception {
    String widthName = Integer.toString(params.getWidth());
    String heightName = Integer.toString(params.getHeight());
    BufferedImage image = null;

    if (cacheHasValidImage(
        params.getWorkflow(),
        params.getStepId(),
        widthName,
        heightName,
        params.showLabels(),
        params.maintainAspect())) {
      image =
          ImageIO.read(
              getCacheFile(
                  params.getWorkflow(),
                  params.getStepId(),
                  widthName,
                  heightName,
                  params.showLabels(),
                  params.maintainAspect()));
    } else {
      image = delegateImageManager.getThumbnailImage(params);
    }

    return image;
  }