mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-07-31 17:38:33 +00:00
ATS-675:Add All-In-One transformer (#200)
* ATS-695/ATS-675 Add aio boot project
- Added the bare bones of a spring boot project to be used by aio. Currently based loosely on transform-misc.
* ATS-674/ATS-695 Add forms for each transformer.
* ATS-675/ATS-695 add empty test to pass build during dev
* ATS-695 remove maven profile to fix build
* ATS-675 Define interface and the aio transformer
* Fix formatting and rename the module as per review comments
* ATS-675/ATS-695 Add ProbeTestTransformation
Currenly uses MiscController implementation.
* ATS-675/ATS-695 Add logger method,
This will be code repeated in the local transform method and the processTransform method
* ATS-675/ATS-695 Implement local transform method
Minimum implementation for transform method.
* ATS-675/ATS-695 Implement processTransform
* ATS-675/ATS-695 Rename project to alfresco-transform-core-aio-boot
Add alfresco-transform-core-aio dependencies
* ATS-675/ATS-695 Fix build
Update project location
Update imports and variable declarations in TODOs
Add error handling.
Formatting.
* ATS-693: Update transform-misc Dockerfile with newly reserved uid
* Revert "ATS-691: Combine the win/linux pathToFile logic"
This reverts commit 61fe4820
* ATS-693: Update transform-misc Dockerfile with newly reserved uid
* "ATS-693: Add Dockerfile to aio-boot module"
* ATS-675/ATS-695 Add resource required for ProbeTestTrasform
* ATS-675/ATS-695 Remove test resources, to be added in test implementation
* ATS-693: Fix path to jar resources
* ATS-675/ATS-703 Moved Options builder to non boot jar.
* ATS-675/ATS-703 Rename OptionsBuilder to PdfRendererOptionsBuilder
This is to avoid confilct with OptionsBuilders in other T-engines.
* ATS-675/ATS-695 Added PdfRendererApadpter.java
Added dependency to pom.xml
Required transformation of String to Long, method added to Util.java
* ATS-675/ ATS-704
Implemented LibreOfficeAdapter
* ATS-675 Parity with base aio naming convention
* ATS-675/ATS-705 Implemented ImageMagickAdapter
Moved and renamed OptionsBuilder. Moved to alfresco-transform-imagemagick, renamed ImageMagickOptionsBuilder.
Added dependencies to pom.xml
* ATS-693: Implement maven docker build
* Initial tests
* Add initial tests for config aggregation
* Update AbstractTransformerControllerTest to use the new engine config names
* Fix up controller
* Fix travis tests (#205)
* Fix engine specific properties for engine config location
* Temporarily add engine configs to test resources for the boot modules. Will need to fix this properly
* Resolve some review comments
* ATS-675 - Move static strings to util class
* Refactor classes for simpler design (#210)
* ATS-702 Fix error handling
(cherry picked from commit e30cb5fda6
)
* ATS-675 Rename test class (fixes typo)
* ATS-675: Add aio transformer to static scan
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-transform-imagemagick-boot</artifactId>
|
||||
<name>Alfresco ImageMagick Transformer SpringBoot</name>
|
||||
<name>Alfresco ImageMagick Transformer Spring Boot</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
|
@@ -154,7 +154,7 @@ public class ImageMagickController extends AbstractTransformerController
|
||||
File targetFile = createTargetFile(request, targetFilename);
|
||||
// Both files are deleted by TransformInterceptor.afterCompletion
|
||||
|
||||
final String options = OptionsBuilder
|
||||
final String options = ImageMagickOptionsBuilder
|
||||
.builder()
|
||||
.withStartPage(startPage)
|
||||
.withEndPage(endPage)
|
||||
@@ -196,7 +196,7 @@ public class ImageMagickController extends AbstractTransformerController
|
||||
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
||||
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||
|
||||
final String options = OptionsBuilder
|
||||
final String options = ImageMagickOptionsBuilder
|
||||
.builder()
|
||||
.withStartPage(transformOptions.get("startPage"))
|
||||
.withEndPage(transformOptions.get("endPage"))
|
||||
|
@@ -1,2 +1,5 @@
|
||||
queue:
|
||||
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.imagemagick.acs}
|
||||
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.imagemagick.acs}
|
||||
transform:
|
||||
config:
|
||||
location: classpath:imagemagick_engine_config.json
|
@@ -85,6 +85,8 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
@WebMvcTest(ImageMagickController.class)
|
||||
public class ImageMagickControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
private static final String ENGINE_CONFIG_NAME = "imagemagick_engine_config.json";
|
||||
|
||||
@Mock
|
||||
private ExecutionResult mockExecutionResult;
|
||||
|
||||
@@ -109,6 +111,12 @@ public class ImageMagickControllerTest extends AbstractTransformerControllerTest
|
||||
mockTransformCommand("jpg", "png", "image/jpg", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEngineConfigName()
|
||||
{
|
||||
return ENGINE_CONFIG_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mockTransformCommand(String sourceExtension,
|
||||
String targetExtension, String sourceMimetype,
|
||||
|
@@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableList;
|
||||
*
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
final class OptionsBuilder
|
||||
public final class ImageMagickOptionsBuilder
|
||||
{
|
||||
private static final List<String> GRAVITY_VALUES = ImmutableList.of("North", "NorthEast",
|
||||
"East", "SouthEast", "South", "SouthWest", "West", "NorthWest", "Center");
|
||||
@@ -65,180 +65,180 @@ final class OptionsBuilder
|
||||
private Boolean maintainAspectRatio;
|
||||
private String commandOptions;
|
||||
|
||||
private OptionsBuilder() {}
|
||||
private ImageMagickOptionsBuilder() {}
|
||||
|
||||
public OptionsBuilder withStartPage(final String startPage)
|
||||
public ImageMagickOptionsBuilder withStartPage(final String startPage)
|
||||
{
|
||||
return withStartPage(stringToInteger(startPage));
|
||||
}
|
||||
|
||||
public OptionsBuilder withStartPage(final Integer startPage)
|
||||
public ImageMagickOptionsBuilder withStartPage(final Integer startPage)
|
||||
{
|
||||
this.startPage = startPage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withEndPage(final String endPage)
|
||||
public ImageMagickOptionsBuilder withEndPage(final String endPage)
|
||||
{
|
||||
return withEndPage(stringToInteger(endPage));
|
||||
}
|
||||
|
||||
public OptionsBuilder withEndPage(final Integer endPage)
|
||||
public ImageMagickOptionsBuilder withEndPage(final Integer endPage)
|
||||
{
|
||||
this.endPage = endPage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withAlphaRemove(final String alphaRemove)
|
||||
public ImageMagickOptionsBuilder withAlphaRemove(final String alphaRemove)
|
||||
{
|
||||
return withAlphaRemove(stringToBoolean(alphaRemove));
|
||||
}
|
||||
|
||||
public OptionsBuilder withAlphaRemove(final Boolean alphaRemove)
|
||||
public ImageMagickOptionsBuilder withAlphaRemove(final Boolean alphaRemove)
|
||||
{
|
||||
this.alphaRemove = alphaRemove;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withAutoOrient(final String autoOrient)
|
||||
public ImageMagickOptionsBuilder withAutoOrient(final String autoOrient)
|
||||
{
|
||||
return withAutoOrient(stringToBoolean(autoOrient));
|
||||
}
|
||||
|
||||
public OptionsBuilder withAutoOrient(final Boolean autoOrient)
|
||||
public ImageMagickOptionsBuilder withAutoOrient(final Boolean autoOrient)
|
||||
{
|
||||
this.autoOrient = autoOrient;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropGravity(final String cropGravity)
|
||||
public ImageMagickOptionsBuilder withCropGravity(final String cropGravity)
|
||||
{
|
||||
this.cropGravity = cropGravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropWidth(final String cropWidth)
|
||||
public ImageMagickOptionsBuilder withCropWidth(final String cropWidth)
|
||||
{
|
||||
return withCropWidth(stringToInteger(cropWidth));
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropWidth(final Integer cropWidth)
|
||||
public ImageMagickOptionsBuilder withCropWidth(final Integer cropWidth)
|
||||
{
|
||||
this.cropWidth = cropWidth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropHeight(final String cropHeight)
|
||||
public ImageMagickOptionsBuilder withCropHeight(final String cropHeight)
|
||||
{
|
||||
return withCropHeight(stringToInteger(cropHeight));
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropHeight(final Integer cropHeight)
|
||||
public ImageMagickOptionsBuilder withCropHeight(final Integer cropHeight)
|
||||
{
|
||||
this.cropHeight = cropHeight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropPercentage(final String cropPercentage)
|
||||
public ImageMagickOptionsBuilder withCropPercentage(final String cropPercentage)
|
||||
{
|
||||
return withCropPercentage(stringToBoolean(cropPercentage));
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropPercentage(final Boolean cropPercentage)
|
||||
public ImageMagickOptionsBuilder withCropPercentage(final Boolean cropPercentage)
|
||||
{
|
||||
this.cropPercentage = cropPercentage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropXOffset(final String cropXOffset)
|
||||
public ImageMagickOptionsBuilder withCropXOffset(final String cropXOffset)
|
||||
{
|
||||
return withCropXOffset(stringToInteger(cropXOffset));
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropXOffset(final Integer cropXOffset)
|
||||
public ImageMagickOptionsBuilder withCropXOffset(final Integer cropXOffset)
|
||||
{
|
||||
this.cropXOffset = cropXOffset;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropYOffset(final String cropYOffset)
|
||||
public ImageMagickOptionsBuilder withCropYOffset(final String cropYOffset)
|
||||
{
|
||||
return withCropYOffset(stringToInteger(cropYOffset));
|
||||
}
|
||||
|
||||
public OptionsBuilder withCropYOffset(final Integer cropYOffset)
|
||||
public ImageMagickOptionsBuilder withCropYOffset(final Integer cropYOffset)
|
||||
{
|
||||
this.cropYOffset = cropYOffset;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withThumbnail(final String thumbnail)
|
||||
public ImageMagickOptionsBuilder withThumbnail(final String thumbnail)
|
||||
{
|
||||
return withThumbnail(stringToBoolean(thumbnail));
|
||||
}
|
||||
|
||||
public OptionsBuilder withThumbnail(final Boolean thumbnail)
|
||||
public ImageMagickOptionsBuilder withThumbnail(final Boolean thumbnail)
|
||||
{
|
||||
this.thumbnail = thumbnail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizeWidth(final String resizeWidth)
|
||||
public ImageMagickOptionsBuilder withResizeWidth(final String resizeWidth)
|
||||
{
|
||||
return withResizeWidth(stringToInteger(resizeWidth));
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizeWidth(final Integer resizeWidth)
|
||||
public ImageMagickOptionsBuilder withResizeWidth(final Integer resizeWidth)
|
||||
{
|
||||
this.resizeWidth = resizeWidth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizeHeight(final String resizeHeight)
|
||||
public ImageMagickOptionsBuilder withResizeHeight(final String resizeHeight)
|
||||
{
|
||||
return withResizeHeight(stringToInteger(resizeHeight));
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizeHeight(final Integer resizeHeight)
|
||||
public ImageMagickOptionsBuilder withResizeHeight(final Integer resizeHeight)
|
||||
{
|
||||
this.resizeHeight = resizeHeight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizePercentage(final String resizePercentage)
|
||||
public ImageMagickOptionsBuilder withResizePercentage(final String resizePercentage)
|
||||
{
|
||||
return withResizePercentage(stringToBoolean(resizePercentage));
|
||||
}
|
||||
|
||||
public OptionsBuilder withResizePercentage(final Boolean resizePercentage)
|
||||
public ImageMagickOptionsBuilder withResizePercentage(final Boolean resizePercentage)
|
||||
{
|
||||
this.resizePercentage = resizePercentage;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withAllowEnlargement(final String allowEnlargement)
|
||||
public ImageMagickOptionsBuilder withAllowEnlargement(final String allowEnlargement)
|
||||
{
|
||||
return withAllowEnlargement(stringToBoolean(allowEnlargement));
|
||||
}
|
||||
|
||||
public OptionsBuilder withAllowEnlargement(final Boolean allowEnlargement)
|
||||
public ImageMagickOptionsBuilder withAllowEnlargement(final Boolean allowEnlargement)
|
||||
{
|
||||
this.allowEnlargement = allowEnlargement;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withMaintainAspectRatio(final String maintainAspectRatio)
|
||||
public ImageMagickOptionsBuilder withMaintainAspectRatio(final String maintainAspectRatio)
|
||||
{
|
||||
return withMaintainAspectRatio(stringToBoolean(maintainAspectRatio));
|
||||
}
|
||||
|
||||
public OptionsBuilder withMaintainAspectRatio(final Boolean maintainAspectRatio)
|
||||
public ImageMagickOptionsBuilder withMaintainAspectRatio(final Boolean maintainAspectRatio)
|
||||
{
|
||||
this.maintainAspectRatio = maintainAspectRatio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withCommandOptions(final String commandOptions)
|
||||
public ImageMagickOptionsBuilder withCommandOptions(final String commandOptions)
|
||||
{
|
||||
this.commandOptions = commandOptions;
|
||||
return this;
|
||||
@@ -354,8 +354,8 @@ final class OptionsBuilder
|
||||
args.toString();
|
||||
}
|
||||
|
||||
public static OptionsBuilder builder()
|
||||
public static ImageMagickOptionsBuilder builder()
|
||||
{
|
||||
return new OptionsBuilder();
|
||||
return new ImageMagickOptionsBuilder();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user