@Test public void transformNenengWidthOnlyMany() throws InterruptedException, ExecutionException { final ImageVariantImpl sourceVariant = new ImageVariantImpl("o", "o", "jpg"); final ImageVariantImpl destVariant1 = new ImageVariantImpl("s", "s", "jpg"); final ImageVariantImpl destVariant2 = new ImageVariantImpl("n", "n", "jpg"); final ImageVariantImpl destVariant3 = new ImageVariantImpl("l", "l", "jpg"); final ResizeToFitImpl transform = new ResizeToFitImpl(75, null); final Map<ImageTransform, ImageVariant> transforms = ImmutableMap.<ImageTransform, ImageVariant>of( EcoreUtil.copy(transform), destVariant1, EcoreUtil.copy(transform), destVariant2, EcoreUtil.copy(transform), destVariant3); final List<UploadedImage> uploadeds = transformer.transform( conn, null, "product", "neneng", sourceVariant, transforms).get(); log.info("Result: {}", uploadeds); }
@Override public ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms) { final AsyncFunction<File, List<UploadedImage>> processor = new AsyncFunction<File, List<UploadedImage>>() { @Override public ListenableFuture<List<UploadedImage>> apply(final File originalFile) throws Exception { final TransformFunc transformFunc = new TransformFunc(namespace, originalFile, imageId); final List<ListenableFuture<UploadedImage>> taskFutures = new ArrayList<>(); for (Entry<ImageTransform, ImageVariant> entry : transforms.entrySet()) { taskFutures.add(transformFunc.apply(entry)); } final ListenableFuture<List<UploadedImage>> styledImagesFuture = Futures.allAsList(taskFutures); return styledImagesFuture; } }; return processLocallyThenDelete(source, sourceFile, namespace, imageId, sourceVariant, transforms, processor); }
ImageMagickTransformerImpl extends ImageTransformerImpl implements ImageMagickTransformer { @Override public ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms) { final AsyncFunction<File, List<UploadedImage>> processor = new AsyncFunction<File, List<UploadedImage>>() { @Override public ListenableFuture<List<UploadedImage>> apply(final File originalFile) throws Exception { final TransformFunc transformFunc = new TransformFunc(namespace, originalFile, imageId); final List<ListenableFuture<UploadedImage>> taskFutures = new ArrayList<>(); for (Entry<ImageTransform, ImageVariant> entry : transforms.entrySet()) { taskFutures.add(transformFunc.apply(entry)); } final ListenableFuture<List<UploadedImage>> styledImagesFuture = Futures.allAsList(taskFutures); return styledImagesFuture; } }; return processLocallyThenDelete(source, sourceFile, namespace, imageId, sourceVariant, transforms, processor); } }
ImageMagickTransformerImpl extends ImageTransformerImpl implements ImageMagickTransformer { @Override public ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms) { final AsyncFunction<File, List<UploadedImage>> processor = new AsyncFunction<File, List<UploadedImage>>() { @Override public ListenableFuture<List<UploadedImage>> apply(final File originalFile) throws Exception { final TransformFunc transformFunc = new TransformFunc(namespace, originalFile, imageId); final List<ListenableFuture<UploadedImage>> taskFutures = new ArrayList<>(); for (Entry<ImageTransform, ImageVariant> entry : transforms.entrySet()) { taskFutures.add(transformFunc.apply(entry)); } final ListenableFuture<List<UploadedImage>> styledImagesFuture = Futures.allAsList(taskFutures); return styledImagesFuture; } }; return processLocallyThenDelete(source, sourceFile, namespace, imageId, sourceVariant, transforms, processor); } protected  ImageMagickTransformerImpl();  ImageMagickTransformerImpl(ImageConnector destination);  ImageMagickTransformerImpl(ExecutorService executor, ImageConnector destination); }
ImageMagickTransformerImpl extends ImageTransformerImpl implements ImageMagickTransformer { @Override public ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms) { final AsyncFunction<File, List<UploadedImage>> processor = new AsyncFunction<File, List<UploadedImage>>() { @Override public ListenableFuture<List<UploadedImage>> apply(final File originalFile) throws Exception { final TransformFunc transformFunc = new TransformFunc(namespace, originalFile, imageId); final List<ListenableFuture<UploadedImage>> taskFutures = new ArrayList<>(); for (Entry<ImageTransform, ImageVariant> entry : transforms.entrySet()) { taskFutures.add(transformFunc.apply(entry)); } final ListenableFuture<List<UploadedImage>> styledImagesFuture = Futures.allAsList(taskFutures); return styledImagesFuture; } }; return processLocallyThenDelete(source, sourceFile, namespace, imageId, sourceVariant, transforms, processor); } protected  ImageMagickTransformerImpl();  ImageMagickTransformerImpl(ImageConnector destination);  ImageMagickTransformerImpl(ExecutorService executor, ImageConnector destination); static String getImageMagickBin(); static String getImageMagickDir(); static void setImageMagickDir(String imageMagickDir); static byte[] quickTransform(byte[] originalImage, ImageTransform transform); static void quickTransform(File originalFile, File styledFile, ImageTransform transform); @Override ImageConnector getDestination(); ImageConnector basicGetDestination(); @Override ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, 
			final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms); @Override Object eGet(int featureID, boolean resolve, boolean coreType); @Override boolean eIsSet(int featureID); }
ImageMagickTransformerImpl extends ImageTransformerImpl implements ImageMagickTransformer { @Override public ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms) { final AsyncFunction<File, List<UploadedImage>> processor = new AsyncFunction<File, List<UploadedImage>>() { @Override public ListenableFuture<List<UploadedImage>> apply(final File originalFile) throws Exception { final TransformFunc transformFunc = new TransformFunc(namespace, originalFile, imageId); final List<ListenableFuture<UploadedImage>> taskFutures = new ArrayList<>(); for (Entry<ImageTransform, ImageVariant> entry : transforms.entrySet()) { taskFutures.add(transformFunc.apply(entry)); } final ListenableFuture<List<UploadedImage>> styledImagesFuture = Futures.allAsList(taskFutures); return styledImagesFuture; } }; return processLocallyThenDelete(source, sourceFile, namespace, imageId, sourceVariant, transforms, processor); } protected  ImageMagickTransformerImpl();  ImageMagickTransformerImpl(ImageConnector destination);  ImageMagickTransformerImpl(ExecutorService executor, ImageConnector destination); static String getImageMagickBin(); static String getImageMagickDir(); static void setImageMagickDir(String imageMagickDir); static byte[] quickTransform(byte[] originalImage, ImageTransform transform); static void quickTransform(File originalFile, File styledFile, ImageTransform transform); @Override ImageConnector getDestination(); ImageConnector basicGetDestination(); @Override ListenableFuture<List<UploadedImage>> transform(final ImageConnector source, final File sourceFile, final String namespace, 
			final String imageId, final ImageVariant sourceVariant, final Map<ImageTransform, ImageVariant> transforms); @Override Object eGet(int featureID, boolean resolve, boolean coreType); @Override boolean eIsSet(int featureID); static String imageMagickDir; }