mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-07 17:48:35 +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:
@@ -114,7 +114,7 @@ public class AlfrescoPdfRendererController extends AbstractTransformerController
|
||||
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
||||
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||
|
||||
final String options = OptionsBuilder
|
||||
final String options = PdfRendererOptionsBuilder
|
||||
.builder()
|
||||
.withPage(transformOptions.get("page"))
|
||||
.withWidth(transformOptions.get("width"))
|
||||
@@ -147,7 +147,7 @@ public class AlfrescoPdfRendererController extends AbstractTransformerController
|
||||
File targetFile = createTargetFile(request, targetFilename);
|
||||
// Both files are deleted by TransformInterceptor.afterCompletion
|
||||
|
||||
final String options = OptionsBuilder
|
||||
final String options = PdfRendererOptionsBuilder
|
||||
.builder()
|
||||
.withPage(page)
|
||||
.withWidth(width)
|
||||
|
@@ -1,2 +1,5 @@
|
||||
queue:
|
||||
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.alfresco-pdf-renderer.acs}
|
||||
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.alfresco-pdf-renderer.acs}
|
||||
transform:
|
||||
config:
|
||||
location: classpath:pdfrenderer_engine_config.json
|
@@ -86,6 +86,9 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
@WebMvcTest(AlfrescoPdfRendererController.class)
|
||||
public class AlfrescoPdfRendererControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
|
||||
private static final String ENGINE_CONFIG_NAME = "pdfrenderer_engine_config.json";
|
||||
|
||||
@Mock
|
||||
private ExecutionResult mockExecutionResult;
|
||||
|
||||
@@ -110,6 +113,12 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
|
||||
mockTransformCommand("pdf", "png", "application/pdf", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEngineConfigName()
|
||||
{
|
||||
return ENGINE_CONFIG_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mockTransformCommand(String sourceExtension,
|
||||
String targetExtension, String sourceMimetype,
|
||||
|
@@ -36,7 +36,7 @@ import java.util.StringJoiner;
|
||||
*
|
||||
* @author Cezar Leahu
|
||||
*/
|
||||
final class OptionsBuilder
|
||||
public final class PdfRendererOptionsBuilder
|
||||
{
|
||||
private Integer page;
|
||||
private Integer width;
|
||||
@@ -44,58 +44,58 @@ final class OptionsBuilder
|
||||
private Boolean allowPdfEnlargement;
|
||||
private Boolean maintainPdfAspectRatio;
|
||||
|
||||
private OptionsBuilder() {}
|
||||
private PdfRendererOptionsBuilder() {}
|
||||
|
||||
public OptionsBuilder withPage(final String page)
|
||||
public PdfRendererOptionsBuilder withPage(final String page)
|
||||
{
|
||||
return withPage(stringToInteger(page));
|
||||
}
|
||||
|
||||
public OptionsBuilder withPage(final Integer page)
|
||||
public PdfRendererOptionsBuilder withPage(final Integer page)
|
||||
{
|
||||
this.page = page;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withWidth(final String width)
|
||||
public PdfRendererOptionsBuilder withWidth(final String width)
|
||||
{
|
||||
return withWidth(stringToInteger(width));
|
||||
}
|
||||
|
||||
public OptionsBuilder withWidth(final Integer width)
|
||||
public PdfRendererOptionsBuilder withWidth(final Integer width)
|
||||
{
|
||||
this.width = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withHeight(final String height)
|
||||
public PdfRendererOptionsBuilder withHeight(final String height)
|
||||
{
|
||||
return withHeight(stringToInteger(height));
|
||||
}
|
||||
|
||||
public OptionsBuilder withHeight(final Integer height)
|
||||
public PdfRendererOptionsBuilder withHeight(final Integer height)
|
||||
{
|
||||
this.height = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withAllowPdfEnlargement(final String allowPdfEnlargement)
|
||||
public PdfRendererOptionsBuilder withAllowPdfEnlargement(final String allowPdfEnlargement)
|
||||
{
|
||||
return withAllowPdfEnlargement(stringToBoolean(allowPdfEnlargement));
|
||||
}
|
||||
|
||||
public OptionsBuilder withAllowPdfEnlargement(final Boolean allowPdfEnlargement)
|
||||
public PdfRendererOptionsBuilder withAllowPdfEnlargement(final Boolean allowPdfEnlargement)
|
||||
{
|
||||
this.allowPdfEnlargement = allowPdfEnlargement;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder withMaintainPdfAspectRatio(final String maintainPdfAspectRatio)
|
||||
public PdfRendererOptionsBuilder withMaintainPdfAspectRatio(final String maintainPdfAspectRatio)
|
||||
{
|
||||
return withMaintainPdfAspectRatio(stringToBoolean(maintainPdfAspectRatio));
|
||||
}
|
||||
|
||||
public OptionsBuilder withMaintainPdfAspectRatio(final Boolean maintainPdfAspectRatio)
|
||||
public PdfRendererOptionsBuilder withMaintainPdfAspectRatio(final Boolean maintainPdfAspectRatio)
|
||||
{
|
||||
this.maintainPdfAspectRatio = maintainPdfAspectRatio;
|
||||
return this;
|
||||
@@ -127,8 +127,8 @@ final class OptionsBuilder
|
||||
return args.toString();
|
||||
}
|
||||
|
||||
public static OptionsBuilder builder()
|
||||
public static PdfRendererOptionsBuilder builder()
|
||||
{
|
||||
return new OptionsBuilder();
|
||||
return new PdfRendererOptionsBuilder();
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"transformOptions": {
|
||||
"pdfRendererOptions": [
|
||||
{"value": {"name": "page"}},
|
||||
{"value": {"name": "width"}},
|
||||
{"value": {"name": "height"}},
|
||||
{"value": {"name": "allowPdfEnlargement"}},
|
||||
{"value": {"name": "maintainPdfAspectRatio"}}
|
||||
]
|
||||
},
|
||||
"transformers": [
|
||||
{
|
||||
"transformerName": "pdfrenderer",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "application/illustrator", "targetMediaType": "image/png" }
|
||||
],
|
||||
"transformOptions": [
|
||||
"pdfRendererOptions"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user