mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
REPO-4331: Add remaining core transformers (#45)
* REPO-4331: Add remaining core transformers * HtmlParserContentTransformer * AppleIWorksContentTransformer * StringExtractingContentTransformer * TextToPdfContentTransformer * OOXMLThumbnailContentTransformer
This commit is contained in:
parent
f44e675423
commit
ff0f659ded
@ -0,0 +1,29 @@
|
|||||||
|
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Already used licenses in project :
|
||||||
|
# - Apache 2
|
||||||
|
# - Apache License 2.0
|
||||||
|
# - Apache License, Version 2.0
|
||||||
|
# - Apache License, version 2.0
|
||||||
|
# - CDDL + GPLv2 with classpath exception
|
||||||
|
# - CDDL+GPL License
|
||||||
|
# - Eclipse Public License - v 1.0
|
||||||
|
# - GNU Lesser General Public License
|
||||||
|
# - GNU Lesser General Public License v2.1
|
||||||
|
# - MIT License
|
||||||
|
# - Public Domain, per Creative Commons CC0
|
||||||
|
# - The Apache License, Version 2.0
|
||||||
|
# - The Apache Software License, Version 2.0
|
||||||
|
# - The JSON License
|
||||||
|
# - The SAX License
|
||||||
|
# - The W3C License
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Please fill the missing licenses for dependencies :
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Wed Jun 19 15:25:06 EEST 2019
|
||||||
|
javax.servlet--servlet-api--2.5=CDDL License
|
||||||
|
javax.transaction--jta--1.0.1b=Sun Binary Code License Agreement
|
||||||
|
commons-httpclient--commons-httpclient--3.1-HTTPCLIENT-1265=Apache License 2.0
|
||||||
|
org.codehaus.guessencoding--guessencoding--1.4=Apache License 2.0
|
||||||
|
dom4j--dom4j--1.6.1=BSD
|
@ -0,0 +1,29 @@
|
|||||||
|
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Already used licenses in project :
|
||||||
|
# - Apache 2
|
||||||
|
# - Apache License 2.0
|
||||||
|
# - Apache License, Version 2.0
|
||||||
|
# - Apache License, version 2.0
|
||||||
|
# - CDDL + GPLv2 with classpath exception
|
||||||
|
# - CDDL+GPL License
|
||||||
|
# - Eclipse Public License - v 1.0
|
||||||
|
# - GNU Lesser General Public License
|
||||||
|
# - GNU Lesser General Public License v2.1
|
||||||
|
# - MIT License
|
||||||
|
# - Public Domain, per Creative Commons CC0
|
||||||
|
# - The Apache License, Version 2.0
|
||||||
|
# - The Apache Software License, Version 2.0
|
||||||
|
# - The JSON License
|
||||||
|
# - The SAX License
|
||||||
|
# - The W3C License
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Please fill the missing licenses for dependencies :
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Wed Jun 19 15:25:21 EEST 2019
|
||||||
|
javax.servlet--servlet-api--2.5=CDDL License
|
||||||
|
javax.transaction--jta--1.0.1b=Sun Binary Code License Agreement
|
||||||
|
commons-httpclient--commons-httpclient--3.1-HTTPCLIENT-1265=Apache License 2.0
|
||||||
|
org.codehaus.guessencoding--guessencoding--1.4=Apache License 2.0
|
||||||
|
dom4j--dom4j--1.6.1=BSD
|
@ -0,0 +1,29 @@
|
|||||||
|
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Already used licenses in project :
|
||||||
|
# - Apache 2
|
||||||
|
# - Apache License 2.0
|
||||||
|
# - Apache License, Version 2.0
|
||||||
|
# - Apache License, version 2.0
|
||||||
|
# - CDDL + GPLv2 with classpath exception
|
||||||
|
# - CDDL+GPL License
|
||||||
|
# - Eclipse Public License - v 1.0
|
||||||
|
# - GNU Lesser General Public License
|
||||||
|
# - GNU Lesser General Public License v2.1
|
||||||
|
# - MIT License
|
||||||
|
# - Public Domain, per Creative Commons CC0
|
||||||
|
# - The Apache License, Version 2.0
|
||||||
|
# - The Apache Software License, Version 2.0
|
||||||
|
# - The JSON License
|
||||||
|
# - The SAX License
|
||||||
|
# - The W3C License
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Please fill the missing licenses for dependencies :
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Wed Jun 19 15:25:36 EEST 2019
|
||||||
|
javax.servlet--servlet-api--2.5=CDDL License
|
||||||
|
javax.transaction--jta--1.0.1b=Sun Binary Code License Agreement
|
||||||
|
commons-httpclient--commons-httpclient--3.1-HTTPCLIENT-1265=Apache License 2.0
|
||||||
|
org.codehaus.guessencoding--guessencoding--1.4=Apache License 2.0
|
||||||
|
dom4j--dom4j--1.6.1=BSD
|
67
alfresco-docker-tika/src/license/THIRD-PARTY.properties
Normal file
67
alfresco-docker-tika/src/license/THIRD-PARTY.properties
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Already used licenses in project :
|
||||||
|
# - (MIT-style) netCDF C library license
|
||||||
|
# - Apache 2
|
||||||
|
# - Apache 2.0
|
||||||
|
# - Apache License 2.0
|
||||||
|
# - Apache License v2.0
|
||||||
|
# - Apache License, Version 2.0
|
||||||
|
# - Apache License, version 2.0
|
||||||
|
# - Apache Software License - Version 2.0
|
||||||
|
# - BSD
|
||||||
|
# - BSD License
|
||||||
|
# - BSD licence
|
||||||
|
# - Bouncy Castle Licence
|
||||||
|
# - CDDL + GPLv2 with classpath exception
|
||||||
|
# - CDDL 1.1
|
||||||
|
# - CDDL License
|
||||||
|
# - CDDL+GPL License
|
||||||
|
# - CDDL, v1.0
|
||||||
|
# - CDDL/GPLv2+CE
|
||||||
|
# - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
|
||||||
|
# - CPL
|
||||||
|
# - Common Development and Distribution License (CDDL) v1.0
|
||||||
|
# - Dual license consisting of the CDDL v1.1 and GPL v2
|
||||||
|
# - Eclipse Distribution License - v 1.0
|
||||||
|
# - Eclipse Public License - v 1.0
|
||||||
|
# - GNU General Public Library
|
||||||
|
# - GNU Lesser General Public License
|
||||||
|
# - GNU Lesser General Public License v2.1
|
||||||
|
# - GPL2 w/ CPE
|
||||||
|
# - LGPL, v2.1 or later
|
||||||
|
# - LGPL, version 2.1
|
||||||
|
# - MIT License
|
||||||
|
# - MIT License (MIT)
|
||||||
|
# - Mozilla Public License 1.1 (MPL 1.1)
|
||||||
|
# - New BSD license
|
||||||
|
# - OGC copyright
|
||||||
|
# - Public Domain
|
||||||
|
# - Public Domain, per Creative Commons CC0
|
||||||
|
# - Similar to Apache License but with the acknowledgment clause removed
|
||||||
|
# - Specification License
|
||||||
|
# - Sun Binary Code License Agreement
|
||||||
|
# - The Apache License, Version 2.0
|
||||||
|
# - The Apache Software License, Version 2.0
|
||||||
|
# - The BSD License
|
||||||
|
# - The JSON License
|
||||||
|
# - The MIT License
|
||||||
|
# - The SAX License
|
||||||
|
# - The W3C License
|
||||||
|
# - UnRar License
|
||||||
|
# - http://jaxen.codehaus.org/license.html
|
||||||
|
# - lgpl
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Please fill the missing licenses for dependencies :
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Wed Jun 19 15:51:55 EEST 2019
|
||||||
|
org.acegisecurity--acegi-security--0.8.2_patched=Apache License 2.0
|
||||||
|
javax.servlet--servlet-api--2.5=CDDL License
|
||||||
|
javax.transaction--jta--1.0.1b=Sun Binary Code License Agreement
|
||||||
|
net.jcip--jcip-annotations--1.0=Public
|
||||||
|
xerces--xercesImpl--2.11.0-alfresco-patched-20180402=Apache License 2.0
|
||||||
|
commons-httpclient--commons-httpclient--3.1-HTTPCLIENT-1265=Apache License 2.0
|
||||||
|
xpp3--xpp3--1.1.3_8=Apache 1.1
|
||||||
|
org.codehaus.guessencoding--guessencoding--1.4=Apache License 2.0
|
||||||
|
dom4j--dom4j--1.6.1=BSD
|
1
alfresco-docker-transform-misc/.maven-dockerignore
Normal file
1
alfresco-docker-transform-misc/.maven-dockerignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
target/docker/
|
32
alfresco-docker-transform-misc/Dockerfile
Normal file
32
alfresco-docker-transform-misc/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Image provides a container in which to run miscellaneous transformations for Alfresco Content Services.
|
||||||
|
|
||||||
|
FROM alfresco/alfresco-base-java:11.0.1-openjdk-centos-7-3e4e9f4e5d6a
|
||||||
|
|
||||||
|
ENV APACHE_LICENSE_FILE=https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/Apache%202.0.txt
|
||||||
|
ENV JAVA_OPTS=""
|
||||||
|
|
||||||
|
# Set default user information
|
||||||
|
ARG GROUPNAME=Alfresco
|
||||||
|
ARG GROUPID=1000
|
||||||
|
ARG USERNAME=transform-misc
|
||||||
|
ARG USERID=33004
|
||||||
|
|
||||||
|
COPY target/alfresco-docker-transform-misc-${env.project_version}.jar /usr/bin
|
||||||
|
|
||||||
|
RUN ln /usr/bin/alfresco-docker-transform-misc-${env.project_version}.jar /usr/bin/alfresco-docker-transform-misc.jar && \
|
||||||
|
curl -s -S $APACHE_LICENSE_FILE -o Apache\ 2.0.txt && \
|
||||||
|
yum clean all
|
||||||
|
|
||||||
|
ADD target/generated-resources/licenses /licenses
|
||||||
|
ADD target/generated-resources/licenses.xml /licenses/
|
||||||
|
ADD target/generated-sources/license/THIRD-PARTY.txt /licenses/
|
||||||
|
|
||||||
|
RUN groupadd -g ${GROUPID} ${GROUPNAME} && \
|
||||||
|
useradd -u ${USERID} -G ${GROUPNAME} ${USERNAME} && \
|
||||||
|
chgrp -R ${GROUPNAME} /usr/bin/alfresco-docker-transform-misc.jar
|
||||||
|
|
||||||
|
EXPOSE 8090
|
||||||
|
|
||||||
|
USER ${USERNAME}
|
||||||
|
|
||||||
|
ENTRYPOINT java $JAVA_OPTS -jar /usr/bin/alfresco-docker-transform-misc.jar
|
9
alfresco-docker-transform-misc/LICENSES.md
Normal file
9
alfresco-docker-transform-misc/LICENSES.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
### Licenses
|
||||||
|
|
||||||
|
* htmlparser http://htmlparser.sourceforge.net/license.html
|
||||||
|
* commons-compress http://jakarta.apache.org/commons/
|
||||||
|
* pdfbox-tools http://pdfbox.apache.org/
|
||||||
|
* poi-ooxml http://poi.apache.org/
|
||||||
|
* commons-compress, PDFBox and poi-ooxml are from Apache. See the license at http://www.apache.org/licenses/LICENSE-2.0 or the
|
||||||
|
[Apache 2.0.txt](https://github.com/Alfresco/acs-community-packaging/blob/master/distribution/src/main/resources/licenses/3rd-party/Apache%202.0.txt)
|
||||||
|
file placed in the root directory of the docker image.
|
261
alfresco-docker-transform-misc/pom.xml
Normal file
261
alfresco-docker-transform-misc/pom.xml
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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-docker-transform-misc</artifactId>
|
||||||
|
<name>Alfresco Docker Miscellaneous Transformers</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>alfresco-transform-core</artifactId>
|
||||||
|
<version>2.1.0-EA3-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<image.name>alfresco/alfresco-transform-misc</image.name>
|
||||||
|
<image.registry>quay.io</image.registry>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>alfresco-transformer-base</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>alfresco-transformer-base</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.vaadin.external.google</groupId>
|
||||||
|
<artifactId>android-json</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.alfresco</groupId>
|
||||||
|
<artifactId>alfresco-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- HtmlParserContentTransformer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.htmlparser</groupId>
|
||||||
|
<artifactId>htmlparser</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- AppleIWorksContentTransformer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-compress</artifactId>
|
||||||
|
<version>1.18</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- TextToPdfContentTransformer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.pdfbox</groupId>
|
||||||
|
<artifactId>pdfbox-tools</artifactId>
|
||||||
|
<version>2.0.15</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- OOXMLThumbnailContentTransformer -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.17</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>fabric8-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||||
|
<buildOptions>
|
||||||
|
<squash>true</squash>
|
||||||
|
</buildOptions>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>docker-it-setup</id>
|
||||||
|
<!-- raises an ActiveMq container for the Integration Tests -->
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>docker-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>local</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>fabric8-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-image</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>internal</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>fabric8-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<images>
|
||||||
|
<!-- QuayIO image -->
|
||||||
|
<image>
|
||||||
|
<name>${image.name}:${image.tag}</name>
|
||||||
|
<registry>${image.registry}</registry>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||||
|
<buildOptions>
|
||||||
|
<squash>true</squash>
|
||||||
|
</buildOptions>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
<!-- DockerHub image -->
|
||||||
|
<image>
|
||||||
|
<name>${image.name}:${image.tag}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||||
|
<buildOptions>
|
||||||
|
<squash>true</squash>
|
||||||
|
</buildOptions>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-push-image</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>release</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.fabric8</groupId>
|
||||||
|
<artifactId>fabric8-maven-plugin</artifactId>
|
||||||
|
<configuration combine.self="override">
|
||||||
|
<images>
|
||||||
|
<!-- QuayIO image -->
|
||||||
|
<image>
|
||||||
|
<name>${image.name}:${project.version}</name>
|
||||||
|
<registry>${image.registry}</registry>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||||
|
<buildOptions>
|
||||||
|
<squash>true</squash>
|
||||||
|
</buildOptions>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
<!-- DockerHub image -->
|
||||||
|
<image>
|
||||||
|
<name>${image.name}:${project.version}</name>
|
||||||
|
<build>
|
||||||
|
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||||
|
<buildOptions>
|
||||||
|
<squash>true</squash>
|
||||||
|
</buildOptions>
|
||||||
|
</build>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>build-push-image</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>push</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
@ -0,0 +1,31 @@
|
|||||||
|
# Generated by org.codehaus.mojo.license.AddThirdPartyMojo
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Already used licenses in project :
|
||||||
|
# - Apache 2
|
||||||
|
# - Apache License 2.0
|
||||||
|
# - Apache License, Version 2.0
|
||||||
|
# - Apache License, version 2.0
|
||||||
|
# - BSD License
|
||||||
|
# - CDDL + GPLv2 with classpath exception
|
||||||
|
# - CDDL+GPL License
|
||||||
|
# - Common Public License
|
||||||
|
# - Eclipse Public License - v 1.0
|
||||||
|
# - GNU Lesser General Public License
|
||||||
|
# - GNU Lesser General Public License v2.1
|
||||||
|
# - MIT License
|
||||||
|
# - Public Domain, per Creative Commons CC0
|
||||||
|
# - The Apache License, Version 2.0
|
||||||
|
# - The Apache Software License, Version 2.0
|
||||||
|
# - The JSON License
|
||||||
|
# - The SAX License
|
||||||
|
# - The W3C License
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Please fill the missing licenses for dependencies :
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#Wed Jun 19 15:25:51 EEST 2019
|
||||||
|
javax.servlet--servlet-api--2.5=CDDL License
|
||||||
|
javax.transaction--jta--1.0.1b=Sun Binary Code License Agreement
|
||||||
|
commons-httpclient--commons-httpclient--3.1-HTTPCLIENT-1265=Apache License 2.0
|
||||||
|
org.codehaus.guessencoding--guessencoding--1.4=Apache License 2.0
|
||||||
|
dom4j--dom4j--1.6.1=BSD
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import io.micrometer.core.instrument.MeterRegistry;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
|
||||||
|
public class Application
|
||||||
|
{
|
||||||
|
@Value("${container.name}")
|
||||||
|
private String containerName;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
|
||||||
|
return registry -> registry.config().commonTags("containerName", containerName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
SpringApplication.run(Application.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import org.alfresco.transformer.transformers.SelectingTransformer;
|
||||||
|
import org.alfresco.transformer.logging.LogEntry;
|
||||||
|
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
import static org.alfresco.transformer.transformers.HtmlParserContentTransformer.SOURCE_ENCODING;
|
||||||
|
import static org.alfresco.transformer.transformers.HtmlParserContentTransformer.TARGET_ENCODING;
|
||||||
|
import static org.alfresco.transformer.fs.FileManager.createAttachment;
|
||||||
|
import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||||
|
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||||
|
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||||
|
import static org.alfresco.transformer.logging.StandardMessages.ENTERPRISE_LICENCE;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class MiscController extends AbstractTransformerController
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MiscController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SelectingTransformer transformer;
|
||||||
|
|
||||||
|
public MiscController()
|
||||||
|
{
|
||||||
|
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||||
|
logger.info("The transformers in this project use libraries from Apache. See the license at http://www.apache.org/licenses/LICENSE-2.0. or in /Apache\\\\ 2.0.txt");
|
||||||
|
logger.info("Additional libraries used:");
|
||||||
|
logger.info("* htmlparser http://htmlparser.sourceforge.net/license.html");
|
||||||
|
logger.info("--------------------------------------------------------------------------------------------------------------------------------------------------------------");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTransformerName()
|
||||||
|
{
|
||||||
|
return "Miscellaneous Transformers";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String version()
|
||||||
|
{
|
||||||
|
return getTransformerName() + " available";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProbeTestTransform getProbeTestTransform()
|
||||||
|
{
|
||||||
|
// HtmlParserContentTransformer html -> text
|
||||||
|
// See the Javadoc on this method and Probes.md for the choice of these values.
|
||||||
|
return new ProbeTestTransform(this, "quick.html", "quick.txt",
|
||||||
|
119, 30, 150, 1024,
|
||||||
|
60*2+1,60*2)
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void executeTransformCommand(File sourceFile, File targetFile)
|
||||||
|
{
|
||||||
|
Map<String, String> parameters = new HashMap<>();
|
||||||
|
parameters.put(SOURCE_ENCODING, "UTF-8");
|
||||||
|
parameters.put(TARGET_ENCODING, "UTF-8");
|
||||||
|
transformer.transform(sourceFile, targetFile, MIMETYPE_HTML, MIMETYPE_TEXT_PLAIN, parameters);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void processTransform(File sourceFile, File targetFile, Map<String, String> transformOptions, Long timeout)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
||||||
|
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sourceMimetype = transformOptions.get("sourceMimetype");
|
||||||
|
String targetMimetype = transformOptions.get("targetMimetype");
|
||||||
|
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, transformOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
|
||||||
|
public ResponseEntity<Resource> transform(HttpServletRequest request,
|
||||||
|
@RequestParam("file") MultipartFile sourceMultipartFile,
|
||||||
|
@RequestParam(value = "targetExtension") String targetExtension,
|
||||||
|
@RequestParam(value = "targetMimetype") String targetMimetype,
|
||||||
|
@RequestParam(value = "sourceMimetype") String sourceMimetype,
|
||||||
|
@RequestParam(value = "testDelay", required = false) Long testDelay,
|
||||||
|
@RequestParam Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Processing request with: sourceMimetype '{}', targetMimetype '{}' , targetExtension '{}' " +
|
||||||
|
", parameters '{}'", sourceMimetype, targetMimetype, targetExtension, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
String targetFilename = createTargetFileName(sourceMultipartFile.getOriginalFilename(), targetExtension);
|
||||||
|
getProbeTestTransform().incrementTransformerCount();
|
||||||
|
File sourceFile = createSourceFile(request, sourceMultipartFile);
|
||||||
|
File targetFile = createTargetFile(request, targetFilename);
|
||||||
|
|
||||||
|
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, parameters);
|
||||||
|
|
||||||
|
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
|
||||||
|
LogEntry.setTargetSize(targetFile.length());
|
||||||
|
long time = LogEntry.setStatusCodeAndMessage(OK.value(), "Success");
|
||||||
|
time += LogEntry.addDelay(testDelay);
|
||||||
|
getProbeTestTransform().recordTransformTime(time);
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.transform.client.model.Mimetype;
|
||||||
|
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||||
|
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_KEYNOTE;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_NUMBERS;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_PAGES;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts Apple iWorks files to JPEGs for thumbnailing & previewing.
|
||||||
|
* The transformer will only work for iWorks 2013/14 files. Support for iWorks 2008/9 has been dropped as we cannot
|
||||||
|
* support both, because the newer format does not contain a PDF. If we say this transformer supports PDF, Share will
|
||||||
|
* assume incorrectly that we can convert to PDF and we would only get a preview for the older format and never the
|
||||||
|
* newer one. Both formats have the same mimetype.
|
||||||
|
*
|
||||||
|
* @author Neil Mc Erlean
|
||||||
|
* @author eknizat
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public class AppleIWorksContentTransformer implements SelectableTransformer
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(AppleIWorksContentTransformer.class);
|
||||||
|
|
||||||
|
// Apple's zip entry names for previews in iWorks have changed over time.
|
||||||
|
private static final List<String> PDF_PATHS = Arrays.asList(
|
||||||
|
"QuickLook/Preview.pdf"); // iWorks 2008/9
|
||||||
|
private static final List<String> JPG_PATHS = Arrays.asList(
|
||||||
|
"QuickLook/Thumbnail.jpg", // iWorks 2008/9
|
||||||
|
"preview.jpg"); // iWorks 2013/14 (720 x 552) We use the best quality image. Others are:
|
||||||
|
// (225 x 173) preview-web.jpg
|
||||||
|
// (53 x 41) preview-micro.jpg
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
boolean transformable = MIMETYPE_IWORK_KEYNOTE.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_IWORK_NUMBERS.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_IWORK_PAGES.equals(sourceMimetype);
|
||||||
|
return transformable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
final String sourceMimetype = parameters.get(SOURCE_MIMETYPE);
|
||||||
|
final String targetMimetype = parameters.get(TARGET_MIMETYPE);
|
||||||
|
|
||||||
|
if(logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Performing IWorks to jpeg transform with sourceMimetype=" + sourceMimetype
|
||||||
|
+ " targetMimetype=" + targetMimetype);
|
||||||
|
}
|
||||||
|
// iWorks files are zip (or package) files.
|
||||||
|
// If it's not a zip file, the resultant ZipException will be caught as an IOException below.
|
||||||
|
try (ZipArchiveInputStream iWorksZip = new ZipArchiveInputStream( new BufferedInputStream( new FileInputStream(sourceFile))))
|
||||||
|
{
|
||||||
|
// Look through the zip file entries for the preview/thumbnail.
|
||||||
|
List<String> paths = Mimetype.MIMETYPE_IMAGE_JPEG.equals(targetMimetype) ? JPG_PATHS : PDF_PATHS;
|
||||||
|
ZipArchiveEntry entry;
|
||||||
|
boolean found = false;
|
||||||
|
while ((entry=iWorksZip.getNextZipEntry()) != null)
|
||||||
|
{
|
||||||
|
String name = entry.getName();
|
||||||
|
if (paths.contains(name))
|
||||||
|
{
|
||||||
|
Files.copy(iWorksZip, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! found)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("The source " + sourceMimetype + " file did not contain a " + targetMimetype + " preview");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to transform " + sourceMimetype + " file. It should have been a zip format file.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.htmlparser.Parser;
|
||||||
|
import org.htmlparser.beans.StringBean;
|
||||||
|
import org.htmlparser.util.ParserException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.IllegalCharsetNameException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Content transformer which wraps the HTML Parser library for
|
||||||
|
* parsing HTML content.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This code is based on a class of the same name originally implemented in alfresco-repository.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Since HTML Parser was updated from v1.6 to v2.1, META tags
|
||||||
|
* defining an encoding for the content via http-equiv=Content-Type
|
||||||
|
* will ONLY be respected if the encoding of the content item
|
||||||
|
* itself is set to ISO-8859-1.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Tika Note - could be converted to use the Tika HTML parser,
|
||||||
|
* but we'd potentially need a custom text handler to replicate
|
||||||
|
* the current settings around links and non-breaking spaces.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @see <a href="http://htmlparser.sourceforge.net/">http://htmlparser.sourceforge.net</a>
|
||||||
|
* @see org.htmlparser.beans.StringBean
|
||||||
|
* @see <a href="http://sourceforge.net/tracker/?func=detail&aid=1644504&group_id=24399&atid=381401">HTML Parser</a>
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
* @author eknizat
|
||||||
|
*/
|
||||||
|
public class HtmlParserContentTransformer implements SelectableTransformer
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(HtmlParserContentTransformer.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
return MIMETYPE_HTML.equals(sourceMimetype) && MIMETYPE_TEXT_PLAIN.equals(targetMimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||||
|
checkEncodingParameter(sourceEncoding, SOURCE_ENCODING);
|
||||||
|
|
||||||
|
if(logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Performing HTML to text transform with sourceEncoding=" + sourceEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the extractor
|
||||||
|
EncodingAwareStringBean extractor = new EncodingAwareStringBean();
|
||||||
|
extractor.setCollapse(false);
|
||||||
|
extractor.setLinks(false);
|
||||||
|
extractor.setReplaceNonBreakingSpaces(false);
|
||||||
|
extractor.setURL(sourceFile, sourceEncoding);
|
||||||
|
// get the text
|
||||||
|
String text = extractor.getStrings();
|
||||||
|
|
||||||
|
// write it to the writer
|
||||||
|
try ( Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(targetFile))))
|
||||||
|
{
|
||||||
|
writer.write(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkEncodingParameter(String encoding, String paramterName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (encoding != null && !Charset.isSupported(encoding))
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(paramterName + "=" + encoding + " is not supported by the JVM.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalCharsetNameException e)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(paramterName + "=" + encoding + " is not a valid encoding.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This code is based on a class of the same name, originally implemented in alfresco-repository.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* A version of {@link StringBean} which allows control of the
|
||||||
|
* encoding in the underlying HTML Parser.
|
||||||
|
* Unfortunately, StringBean doesn't allow easy over-riding of
|
||||||
|
* this, so we have to duplicate some code to control this.
|
||||||
|
* This allows us to correctly handle HTML files where the encoding
|
||||||
|
* is specified against the content property (rather than in the
|
||||||
|
* HTML Head Meta), see ALF-10466 for details.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private class EncodingAwareStringBean extends StringBean
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -9033414360428669553L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the File to extract strings from, and the encoding
|
||||||
|
* it's in (if known to Alfresco)
|
||||||
|
*
|
||||||
|
* @param file The File that text should be fetched from.
|
||||||
|
* @param encoding The encoding of the input
|
||||||
|
*/
|
||||||
|
public void setURL(File file, String encoding)
|
||||||
|
{
|
||||||
|
String previousURL = getURL();
|
||||||
|
String newURL = file.getAbsolutePath();
|
||||||
|
|
||||||
|
if ( (previousURL == null) || (!newURL.equals(previousURL)) )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
URLConnection conn = getConnection();
|
||||||
|
|
||||||
|
if (null == mParser)
|
||||||
|
{
|
||||||
|
mParser = new Parser(newURL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mParser.setURL(newURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoding != null)
|
||||||
|
{
|
||||||
|
mParser.setEncoding(encoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
mPropertySupport.firePropertyChange(StringBean.PROP_URL_PROPERTY, previousURL, getURL());
|
||||||
|
mPropertySupport.firePropertyChange(StringBean.PROP_CONNECTION_PROPERTY, conn, mParser.getConnection());
|
||||||
|
setStrings();
|
||||||
|
}
|
||||||
|
catch (ParserException pe)
|
||||||
|
{
|
||||||
|
updateStrings(pe.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEncoding(){
|
||||||
|
return mParser.getEncoding();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,159 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.transform.client.model.Mimetype;
|
||||||
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
||||||
|
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extracts out Thumbnail JPEGs from OOXML files for thumbnailing & previewing.
|
||||||
|
* This transformer will only work for OOXML files where thumbnailing was enabled,
|
||||||
|
* which isn't on by default on Windows, but is more common on Mac.
|
||||||
|
*
|
||||||
|
* @author Nick Burch
|
||||||
|
* @author eknizat
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OOXMLThumbnailContentTransformer implements SelectableTransformer
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OOXMLThumbnailContentTransformer.class);
|
||||||
|
|
||||||
|
private static final List<String> OOXML_MIMETYPES = Arrays.asList(new String[]{
|
||||||
|
Mimetype.MIMETYPE_OPENXML_WORDPROCESSING,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_WORDPROCESSING_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_WORD_TEMPLATE,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_WORD_TEMPLATE_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_TEMPLATE,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_TEMPLATE_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_ADDIN,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDE,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDE_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET_ADDIN_MACRO,
|
||||||
|
Mimetype.MIMETYPE_OPENXML_SPREADSHEET_BINARY_MACRO});
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
// only support [OOXML] -> JPEG
|
||||||
|
return Mimetype.MIMETYPE_IMAGE_JPEG.equals(targetMimetype) && OOXML_MIMETYPES.contains(sourceMimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
final String sourceMimetype = parameters.get(SOURCE_MIMETYPE);
|
||||||
|
final String targetMimetype = parameters.get(TARGET_MIMETYPE);
|
||||||
|
|
||||||
|
if(logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Performing OOXML to jpeg transform with sourceMimetype=" + sourceMimetype
|
||||||
|
+ " targetMimetype=" + targetMimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (OPCPackage pkg = OPCPackage.open(sourceFile.getPath()))
|
||||||
|
{
|
||||||
|
|
||||||
|
// Does it have a thumbnail?
|
||||||
|
PackageRelationshipCollection rels = pkg.getRelationshipsByType(PackageRelationshipTypes.THUMBNAIL);
|
||||||
|
if (rels.size() > 0)
|
||||||
|
{
|
||||||
|
// Get the thumbnail part
|
||||||
|
PackageRelationship tRel = rels.getRelationship(0);
|
||||||
|
PackagePart tPart = pkg.getPart(tRel);
|
||||||
|
|
||||||
|
// Write it to the target
|
||||||
|
InputStream tStream = tPart.getInputStream();
|
||||||
|
Files.copy(tStream, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
tStream.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.debug("No thumbnail present in file.");
|
||||||
|
throw new Exception("No thumbnail present in file, unable to generate " + targetMimetype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to transform file.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// TODO Add this back to engine_config.json when the transformer is fixed for java 11
|
||||||
|
{
|
||||||
|
"transformerName": "ooxmlThumbnail",
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "image/jpeg"}
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.alfresco.transformer.logging.LogEntry;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Implemented by transformers used by {@link SelectingTransformer}.
|
||||||
|
*
|
||||||
|
* @author eknizat
|
||||||
|
*/
|
||||||
|
public interface SelectableTransformer
|
||||||
|
{
|
||||||
|
String SOURCE_ENCODING = "sourceEncoding";
|
||||||
|
String TARGET_ENCODING = "targetEncoding";
|
||||||
|
String SOURCE_MIMETYPE = "sourceMimetype";
|
||||||
|
String TARGET_MIMETYPE = "targetMimetype";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of the actual transformation.
|
||||||
|
* @param sourceFile
|
||||||
|
* @param targetFile
|
||||||
|
* @param parameters
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether this transformer is applicable for the given MIME types.
|
||||||
|
* @param sourceMimetype
|
||||||
|
* @param targetMimetype
|
||||||
|
* @param parameters
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.transform.exceptions.TransformException;
|
||||||
|
import org.alfresco.transformer.logging.LogEntry;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
|
||||||
|
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||||
|
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* The SelectingTransformer selects a registered {@link SelectableTransformer}
|
||||||
|
* and delegates the transformation to its implementation.
|
||||||
|
*
|
||||||
|
* @author eknizat
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class SelectingTransformer
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SelectingTransformer.class);
|
||||||
|
|
||||||
|
private List<SelectableTransformer> transformers = new LinkedList<>();
|
||||||
|
|
||||||
|
public SelectingTransformer()
|
||||||
|
{
|
||||||
|
transformers.add(new AppleIWorksContentTransformer());
|
||||||
|
transformers.add(new HtmlParserContentTransformer());
|
||||||
|
transformers.add(new StringExtractingContentTransformer());
|
||||||
|
transformers.add(new TextToPdfContentTransformer());
|
||||||
|
// transformers.add(new OOXMLThumbnailContentTransformer()); // Doesn't work with java 11, comment put and disabled test
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs a transform using a transformer selected based on the provided sourceMimetype and targetMimetype
|
||||||
|
* @param sourceFile File to transform from
|
||||||
|
* @param targetFile File to transform to
|
||||||
|
* @param sourceMimetype Mimetype of the source file
|
||||||
|
* @throws TransformException
|
||||||
|
*/
|
||||||
|
public void transform(File sourceFile, File targetFile, String sourceMimetype, String targetMimetype,
|
||||||
|
Map<String, String> parameters) throws TransformException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SelectableTransformer transformer = selectTransformer(sourceMimetype, targetMimetype, parameters);
|
||||||
|
logOptions(sourceFile, targetFile, parameters);
|
||||||
|
transformer.transform(sourceFile, targetFile, parameters);
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
|
throw new TransformException(BAD_REQUEST.value(), getMessage(e));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new TransformException(INTERNAL_SERVER_ERROR.value(), getMessage(e));
|
||||||
|
}
|
||||||
|
if (!targetFile.exists() || targetFile.length() == 0)
|
||||||
|
{
|
||||||
|
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
|
||||||
|
"Transformer failed to create an output file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectableTransformer selectTransformer(String sourceMimetype, String targetMimetype,
|
||||||
|
Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
for (SelectableTransformer transformer : transformers)
|
||||||
|
{
|
||||||
|
if (transformer.isTransformable(sourceMimetype, targetMimetype, parameters))
|
||||||
|
{
|
||||||
|
return transformer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new AlfrescoRuntimeException( "Could not select a transformer for sourceMimetype=" + sourceMimetype
|
||||||
|
+ " targetMimetype=" + targetMimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getMessage(Exception e)
|
||||||
|
{
|
||||||
|
return e.getMessage() == null || e.getMessage().isEmpty() ? e.getClass().getSimpleName() : e.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void logOptions(File sourceFile, File targetFile, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
StringJoiner sj = new StringJoiner(" ");
|
||||||
|
parameters.forEach( (k, v) -> sj.add("--" + k + "=" + v)); // keeping the existing style used in other T-Engines
|
||||||
|
sj.add(getExtension(sourceFile));
|
||||||
|
sj.add(getExtension(targetFile));
|
||||||
|
LogEntry.setOptions(sj.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getExtension(File file)
|
||||||
|
{
|
||||||
|
String name = file.getName();
|
||||||
|
int i = name.lastIndexOf('.');
|
||||||
|
String ext = i == -1 ? "???" : name.substring(i + 1);
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,168 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.IllegalCharsetNameException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_JAVASCRIPT;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts any textual format to plain text.
|
||||||
|
* <p>
|
||||||
|
* The transformation is sensitive to the source and target string encodings.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This code is based on a class of the same name originally implemented in alfresco-repository.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
* @author eknizat
|
||||||
|
*/
|
||||||
|
public class StringExtractingContentTransformer implements SelectableTransformer
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(StringExtractingContentTransformer.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
boolean transformable = (sourceMimetype.startsWith("text/")
|
||||||
|
|| MIMETYPE_JAVASCRIPT.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_DITA.equals(sourceMimetype))
|
||||||
|
&& MIMETYPE_TEXT_PLAIN.equals(targetMimetype);
|
||||||
|
return transformable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text to text conversions are done directly using the content reader and writer string
|
||||||
|
* manipulation methods.
|
||||||
|
* <p>
|
||||||
|
* Extraction of text from binary content attempts to take the possible character
|
||||||
|
* encoding into account. The text produced from this will, if the encoding was correct,
|
||||||
|
* be unformatted but valid.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||||
|
String targetEncoding = parameters.get(TARGET_ENCODING);
|
||||||
|
|
||||||
|
if(logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Performing text to text transform with sourceEncoding=" + sourceEncoding
|
||||||
|
+ " targetEncoding=" + targetEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reader charReader = null;
|
||||||
|
Writer charWriter = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Build reader
|
||||||
|
if (sourceEncoding == null)
|
||||||
|
{
|
||||||
|
charReader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkEncodingParameter(sourceEncoding, SOURCE_ENCODING);
|
||||||
|
charReader = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile), sourceEncoding));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build writer
|
||||||
|
if (targetEncoding == null)
|
||||||
|
{
|
||||||
|
charWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkEncodingParameter( targetEncoding, TARGET_ENCODING);
|
||||||
|
charWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(targetFile), targetEncoding));
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy from the one to the other
|
||||||
|
char[] buffer = new char[8192];
|
||||||
|
int readCount = 0;
|
||||||
|
while (readCount > -1)
|
||||||
|
{
|
||||||
|
// write the last read count number of bytes
|
||||||
|
charWriter.write(buffer, 0, readCount);
|
||||||
|
// fill the buffer again
|
||||||
|
readCount = charReader.read(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (charReader != null)
|
||||||
|
{
|
||||||
|
try { charReader.close(); } catch (Throwable e) { logger.error(e); }
|
||||||
|
}
|
||||||
|
if (charWriter != null)
|
||||||
|
{
|
||||||
|
try { charWriter.close(); } catch (Throwable e) { logger.error(e); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// done
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkEncodingParameter(String encoding, String paramterName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Charset.isSupported(encoding))
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(paramterName + "=" + encoding + " is not supported by the JVM.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalCharsetNameException e)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(paramterName + "=" + encoding + " is not a valid encoding.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,332 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDPage;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDPageContentStream;
|
||||||
|
import org.apache.pdfbox.pdmodel.font.PDType1Font;
|
||||||
|
import org.apache.pdfbox.tools.TextToPDF;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_CSV;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_XML;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* This code is based on a class of the same name originally implemented in alfresco-repository.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* Makes use of the <a href="http://www.pdfbox.org/">PDFBox</a> library's <code>TextToPDF</code> utility.
|
||||||
|
*
|
||||||
|
* @author Derek Hulley
|
||||||
|
* @author eknizat
|
||||||
|
*/
|
||||||
|
public class TextToPdfContentTransformer implements SelectableTransformer
|
||||||
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(TextToPdfContentTransformer.class);
|
||||||
|
|
||||||
|
public static final String PAGE_LIMIT = "pageLimit";
|
||||||
|
|
||||||
|
private PagedTextToPDF transformer;
|
||||||
|
|
||||||
|
public TextToPdfContentTransformer()
|
||||||
|
{
|
||||||
|
transformer = new PagedTextToPDF();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandardFont(String fontName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer.setFont(transformer.getStandardFont(fontName));
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to set Standard Font for PDF generation: " + fontName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFontSize(int fontSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transformer.setFontSize(fontSize);
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to set Font Size for PDF generation: " + fontSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||||
|
{
|
||||||
|
boolean transformable = ( (MIMETYPE_TEXT_PLAIN.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_TEXT_CSV.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_DITA.equals(sourceMimetype)
|
||||||
|
|| MIMETYPE_XML.equals(sourceMimetype) )
|
||||||
|
&& MIMETYPE_PDF.equals(targetMimetype));
|
||||||
|
|
||||||
|
return transformable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(File sourceFile, File targetFile, Map<String, String> parameters) throws Exception
|
||||||
|
{
|
||||||
|
String sourceEncoding = parameters.get(SOURCE_ENCODING);
|
||||||
|
String stringPageLimit = parameters.get(PAGE_LIMIT);
|
||||||
|
int pageLimit = -1;
|
||||||
|
if ( stringPageLimit != null)
|
||||||
|
{
|
||||||
|
pageLimit = parseInt(stringPageLimit, PAGE_LIMIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
PDDocument pdf = null;
|
||||||
|
try (InputStream is = new FileInputStream(sourceFile);
|
||||||
|
Reader ir = new BufferedReader(buildReader(is, sourceEncoding));
|
||||||
|
OutputStream os = new BufferedOutputStream(new FileOutputStream(targetFile)))
|
||||||
|
{
|
||||||
|
//TransformationOptionLimits limits = getLimits(reader, writer, options);
|
||||||
|
//TransformationOptionPair pageLimits = limits.getPagesPair();
|
||||||
|
pdf = transformer.createPDFFromText(ir, pageLimit);
|
||||||
|
pdf.save(os);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (pdf != null)
|
||||||
|
{
|
||||||
|
try { pdf.close(); } catch (Throwable e) {e.printStackTrace(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InputStreamReader buildReader(InputStream is, String encoding)
|
||||||
|
{
|
||||||
|
// If they gave an encoding, try to use it
|
||||||
|
if(encoding != null)
|
||||||
|
{
|
||||||
|
Charset charset = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
charset = Charset.forName(encoding);
|
||||||
|
} catch(Exception e)
|
||||||
|
{
|
||||||
|
logger.warn("JVM doesn't understand encoding '" + encoding +
|
||||||
|
"' when transforming text to pdf");
|
||||||
|
}
|
||||||
|
if(charset != null)
|
||||||
|
{
|
||||||
|
logger.debug("Processing plain text in encoding " + charset.displayName());
|
||||||
|
return new InputStreamReader(is, charset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back on the system default
|
||||||
|
logger.debug("Processing plain text using system default encoding");
|
||||||
|
return new InputStreamReader(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class PagedTextToPDF extends TextToPDF
|
||||||
|
{
|
||||||
|
// REPO-1066: duplicating the following lines from org.apache.pdfbox.tools.TextToPDF because they made them private
|
||||||
|
// before the upgrade to pdfbox 2.0.8, in pdfbox 1.8, this piece of code was public in org.apache.pdfbox.pdmodel.font.PDType1Font
|
||||||
|
static PDType1Font getStandardFont(String name) {
|
||||||
|
return (PDType1Font)STANDARD_14.get(name);
|
||||||
|
}
|
||||||
|
private static final Map<String, PDType1Font> STANDARD_14 = new HashMap<String, PDType1Font>();
|
||||||
|
static
|
||||||
|
{
|
||||||
|
STANDARD_14.put(PDType1Font.TIMES_ROMAN.getBaseFont(), PDType1Font.TIMES_ROMAN);
|
||||||
|
STANDARD_14.put(PDType1Font.TIMES_BOLD.getBaseFont(), PDType1Font.TIMES_BOLD);
|
||||||
|
STANDARD_14.put(PDType1Font.TIMES_ITALIC.getBaseFont(), PDType1Font.TIMES_ITALIC);
|
||||||
|
STANDARD_14.put(PDType1Font.TIMES_BOLD_ITALIC.getBaseFont(), PDType1Font.TIMES_BOLD_ITALIC);
|
||||||
|
STANDARD_14.put(PDType1Font.HELVETICA.getBaseFont(), PDType1Font.HELVETICA);
|
||||||
|
STANDARD_14.put(PDType1Font.HELVETICA_BOLD.getBaseFont(), PDType1Font.HELVETICA_BOLD);
|
||||||
|
STANDARD_14.put(PDType1Font.HELVETICA_OBLIQUE.getBaseFont(), PDType1Font.HELVETICA_OBLIQUE);
|
||||||
|
STANDARD_14.put(PDType1Font.HELVETICA_BOLD_OBLIQUE.getBaseFont(), PDType1Font.HELVETICA_BOLD_OBLIQUE);
|
||||||
|
STANDARD_14.put(PDType1Font.COURIER.getBaseFont(), PDType1Font.COURIER);
|
||||||
|
STANDARD_14.put(PDType1Font.COURIER_BOLD.getBaseFont(), PDType1Font.COURIER_BOLD);
|
||||||
|
STANDARD_14.put(PDType1Font.COURIER_OBLIQUE.getBaseFont(), PDType1Font.COURIER_OBLIQUE);
|
||||||
|
STANDARD_14.put(PDType1Font.COURIER_BOLD_OBLIQUE.getBaseFont(), PDType1Font.COURIER_BOLD_OBLIQUE);
|
||||||
|
STANDARD_14.put(PDType1Font.SYMBOL.getBaseFont(), PDType1Font.SYMBOL);
|
||||||
|
STANDARD_14.put(PDType1Font.ZAPF_DINGBATS.getBaseFont(), PDType1Font.ZAPF_DINGBATS);
|
||||||
|
}
|
||||||
|
//duplicating until here
|
||||||
|
|
||||||
|
// The following code is based on the code in TextToPDF with the addition of
|
||||||
|
// checks for page limits.
|
||||||
|
// The calling code must close the PDDocument once finished with it.
|
||||||
|
public PDDocument createPDFFromText(Reader text, int pageLimit)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
//int pageLimit = (int)pageLimits.getValue();
|
||||||
|
PDDocument doc = null;
|
||||||
|
int pageCount = 0;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final int margin = 40;
|
||||||
|
float height = getFont().getFontDescriptor().getFontBoundingBox().getHeight()/1000;
|
||||||
|
|
||||||
|
//calculate font height and increase by 5 percent.
|
||||||
|
height = height*getFontSize()*1.05f;
|
||||||
|
doc = new PDDocument();
|
||||||
|
BufferedReader data = new BufferedReader( text );
|
||||||
|
String nextLine = null;
|
||||||
|
PDPage page = new PDPage();
|
||||||
|
PDPageContentStream contentStream = null;
|
||||||
|
float y = -1;
|
||||||
|
float maxStringLength = page.getMediaBox().getWidth() - 2*margin;
|
||||||
|
|
||||||
|
// There is a special case of creating a PDF document from an empty string.
|
||||||
|
boolean textIsEmpty = true;
|
||||||
|
|
||||||
|
outer:
|
||||||
|
while( (nextLine = data.readLine()) != null )
|
||||||
|
{
|
||||||
|
|
||||||
|
// The input text is nonEmpty. New pages will be created and added
|
||||||
|
// to the PDF document as they are needed, depending on the length of
|
||||||
|
// the text.
|
||||||
|
textIsEmpty = false;
|
||||||
|
|
||||||
|
String[] lineWords = nextLine.trim().split( " " );
|
||||||
|
int lineIndex = 0;
|
||||||
|
while( lineIndex < lineWords.length )
|
||||||
|
{
|
||||||
|
StringBuffer nextLineToDraw = new StringBuffer();
|
||||||
|
float lengthIfUsingNextWord = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
nextLineToDraw.append( lineWords[lineIndex] );
|
||||||
|
nextLineToDraw.append( " " );
|
||||||
|
lineIndex++;
|
||||||
|
if( lineIndex < lineWords.length )
|
||||||
|
{
|
||||||
|
String lineWithNextWord = nextLineToDraw.toString() + lineWords[lineIndex];
|
||||||
|
lengthIfUsingNextWord =
|
||||||
|
(getFont().getStringWidth( lineWithNextWord )/1000) * getFontSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( lineIndex < lineWords.length &&
|
||||||
|
lengthIfUsingNextWord < maxStringLength );
|
||||||
|
if( y < margin )
|
||||||
|
{
|
||||||
|
int test = pageCount +1;
|
||||||
|
if (pageLimit > 0 && (pageCount++ >= pageLimit))
|
||||||
|
{
|
||||||
|
// pageLimits.getAction().throwIOExceptionIfRequired("Page limit ("+pageLimit+
|
||||||
|
// ") reached.", transformerDebug);
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have crossed the end-of-page boundary and need to extend the
|
||||||
|
// document by another page.
|
||||||
|
page = new PDPage();
|
||||||
|
doc.addPage( page );
|
||||||
|
if( contentStream != null )
|
||||||
|
{
|
||||||
|
contentStream.endText();
|
||||||
|
contentStream.close();
|
||||||
|
}
|
||||||
|
contentStream = new PDPageContentStream(doc, page);
|
||||||
|
contentStream.setFont(getFont(), getFontSize());
|
||||||
|
contentStream.beginText();
|
||||||
|
y = page.getMediaBox().getHeight() - margin + height;
|
||||||
|
contentStream.moveTextPositionByAmount(
|
||||||
|
margin, y );
|
||||||
|
}
|
||||||
|
//System.out.println( "Drawing string at " + x + "," + y );
|
||||||
|
|
||||||
|
if( contentStream == null )
|
||||||
|
{
|
||||||
|
throw new IOException( "Error:Expected non-null content stream." );
|
||||||
|
}
|
||||||
|
contentStream.moveTextPositionByAmount( 0, -height);
|
||||||
|
y -= height;
|
||||||
|
contentStream.drawString( nextLineToDraw.toString() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the input text was the empty string, then the above while loop will have short-circuited
|
||||||
|
// and we will not have added any PDPages to the document.
|
||||||
|
// So in order to make the resultant PDF document readable by Adobe Reader etc, we'll add an empty page.
|
||||||
|
if (textIsEmpty)
|
||||||
|
{
|
||||||
|
doc.addPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( contentStream != null )
|
||||||
|
{
|
||||||
|
contentStream.endText();
|
||||||
|
contentStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( IOException io )
|
||||||
|
{
|
||||||
|
if( doc != null )
|
||||||
|
{
|
||||||
|
doc.close();
|
||||||
|
}
|
||||||
|
throw io;
|
||||||
|
}
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int parseInt(String s, String paramName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Integer.valueOf(s);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(paramName + " parameter must be an integer.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
queue:
|
||||||
|
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.misc.acs}
|
@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
"transformOptions": {
|
||||||
|
"textToPdfOptions": [
|
||||||
|
{"value": {"name": "pageLimit"}},
|
||||||
|
{"value": {"name": "sourceEncoding"}}
|
||||||
|
],
|
||||||
|
"stringOptions": [
|
||||||
|
{"value": {"name": "sourceEncoding"}},
|
||||||
|
{"value": {"name": "targetEncoding"}}
|
||||||
|
],
|
||||||
|
"htmlOptions": [
|
||||||
|
{"value": {"name": "sourceEncoding"}}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"transformers": [
|
||||||
|
{
|
||||||
|
"transformerName": "html",
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"}
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
"htmlOptions"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"transformerName": "string",
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "text/plain", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/javascript", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/x-javascript", "targetMediaType": "text/plain"},
|
||||||
|
{"sourceMediaType": "application/dita+xml", "targetMediaType": "text/plain"}
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
"stringOptions"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"transformerName": "appleIWorks",
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "application/vnd.apple.keynote", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.apple.numbers", "targetMediaType": "image/jpeg"},
|
||||||
|
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "image/jpeg"}
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"transformerName": "textToPdf",
|
||||||
|
"supportedSourceAndTargetList": [
|
||||||
|
{"sourceMediaType": "text/plain", "targetMediaType": "application/pdf"},
|
||||||
|
{"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
|
||||||
|
{"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
|
||||||
|
{"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
|
||||||
|
],
|
||||||
|
"transformOptions": [
|
||||||
|
"textToPdfOptions"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
17
alfresco-docker-transform-misc/src/main/resources/quick.html
Normal file
17
alfresco-docker-transform-misc/src/main/resources/quick.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||||
|
<title>The quick brown fox jumps over the lazy dog</title>
|
||||||
|
<meta name="author" content="Nevin Nollop">
|
||||||
|
<meta name="keywords" content="Pangram, fox, dog">
|
||||||
|
<meta name="description" content="Gym class featuring a brown fox and lazy dog">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body lang=EN-US>
|
||||||
|
|
||||||
|
The quick brown fox jumps over the lazy dog
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,29 @@
|
|||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h2>Miscellaneous Transformers Test Transformation</h2>
|
||||||
|
<form method="POST" enctype="multipart/form-data" action="/transform">
|
||||||
|
<table>
|
||||||
|
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">sourceExtension *</div></td><td><input type="text" name="sourceExtension" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">sourceMimetype *</div></td><td><input type="text" name="sourceMimetype" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">targetMimetype *</div></td><td><input type="text" name="targetMimetype" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">sourceEncoding *</div></td><td><input type="text" name="sourceEncoding" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">targetEncoding *</div></td><td><input type="text" name="targetEncoding" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">timeout</div></td><td><input type="text" name="timeout" value="" /></td></tr>
|
||||||
|
<tr><td><div style="text-align:right">testDelay</div></td><td><input type="text" name="testDelay" value="" /></td></tr>
|
||||||
|
|
||||||
|
|
||||||
|
<tr><td></td><td><input type="submit" value="Transform" /></td></tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="/log">Log entries</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,294 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.alfresco.transformer.transformers.AppleIWorksContentTransformer;
|
||||||
|
import org.alfresco.transformer.transformers.HtmlParserContentTransformer;
|
||||||
|
import org.alfresco.transformer.transformers.SelectingTransformer;
|
||||||
|
import org.alfresco.transformer.transformers.StringExtractingContentTransformer;
|
||||||
|
import org.alfresco.transformer.transformers.TextToPdfContentTransformer;
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.text.PDFTextStripper;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_KEYNOTE;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_NUMBERS;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_PAGES;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@WebMvcTest(MiscController.class)
|
||||||
|
@Import({SelectingTransformer.class})
|
||||||
|
public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||||
|
{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MiscController controller;
|
||||||
|
|
||||||
|
private String sourceEncoding = "UTF-8";
|
||||||
|
private String targetEncoding = "UTF-8";
|
||||||
|
private String targetMimetype = MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() throws Exception
|
||||||
|
{
|
||||||
|
sourceMimetype = MIMETYPE_HTML;
|
||||||
|
sourceExtension = "html";
|
||||||
|
targetExtension = "txt";
|
||||||
|
expectedOptions = null;
|
||||||
|
expectedSourceSuffix = null;
|
||||||
|
expectedSourceFileBytes = readTestFile(sourceExtension);
|
||||||
|
expectedTargetFileBytes = readTestFile(targetExtension);
|
||||||
|
//expectedTargetFileBytes = null;
|
||||||
|
sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype, expectedSourceFileBytes);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mockTransformCommand(String sourceExtension, String targetExtension, String sourceMimetype, boolean readTargetFileBytes) throws IOException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractTransformerController getController()
|
||||||
|
{
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateTransformRequestWithSpecificOptions(TransformRequest transformRequest)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
// Add extra required parameters to the request.
|
||||||
|
protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile, String... params)
|
||||||
|
{
|
||||||
|
return super.mockMvcRequest(url, sourceFile, params)
|
||||||
|
.param("targetEncoding", targetEncoding)
|
||||||
|
.param("sourceEncoding", sourceEncoding)
|
||||||
|
.param("targetMimetype", targetMimetype)
|
||||||
|
.param("sourceMimetype", sourceMimetype);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
public void noTargetFileTest()
|
||||||
|
{
|
||||||
|
// Ignore the test in super class as the Misc transforms are real rather than mocked up.
|
||||||
|
// It is the mock that returns a zero length file for other transformers, when we supply an invalid targetExtension.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHTMLtoString() throws Exception
|
||||||
|
{
|
||||||
|
final String NEWLINE = System.getProperty ("line.separator");
|
||||||
|
final String TITLE = "Testing!";
|
||||||
|
final String TEXT_P1 = "This is some text in English";
|
||||||
|
final String TEXT_P2 = "This is more text in English";
|
||||||
|
final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
|
||||||
|
String partA = "<html><head><title>" + TITLE + "</title></head>" + NEWLINE;
|
||||||
|
String partB = "<body><p>" + TEXT_P1 + "</p>" + NEWLINE +
|
||||||
|
"<p>" + TEXT_P2 + "</p>" + NEWLINE +
|
||||||
|
"<p>" + TEXT_P3 + "</p>" + NEWLINE;
|
||||||
|
String partC = "</body></html>";
|
||||||
|
final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
|
||||||
|
|
||||||
|
MvcResult result = sendText("html",
|
||||||
|
"UTF-8",
|
||||||
|
MIMETYPE_HTML,
|
||||||
|
"txt",
|
||||||
|
MIMETYPE_TEXT_PLAIN,
|
||||||
|
"UTF-8",
|
||||||
|
expected.getBytes());
|
||||||
|
|
||||||
|
String contentResult = new String(result.getResponse().getContentAsByteArray(), targetEncoding);
|
||||||
|
assertTrue("The content did not include \""+expected, contentResult.contains(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringtoString() throws Exception
|
||||||
|
{
|
||||||
|
String expected = null;
|
||||||
|
byte[] content = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
content = "azAz10!<21>$%^&*()\t\r\n".getBytes("UTF-8");
|
||||||
|
expected = new String(content, "MacDingbat");
|
||||||
|
}
|
||||||
|
catch (UnsupportedEncodingException e)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Encoding not recognised", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
MvcResult result = sendText("txt",
|
||||||
|
"MacDingbat",
|
||||||
|
MIMETYPE_TEXT_PLAIN,
|
||||||
|
"txt",
|
||||||
|
MIMETYPE_TEXT_PLAIN,
|
||||||
|
"UTF-8",
|
||||||
|
content);
|
||||||
|
|
||||||
|
String contentResult = new String(result.getResponse().getContentAsByteArray(), targetEncoding);
|
||||||
|
assertTrue("The content did not include \""+expected, contentResult.contains(expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void textToPdf() throws Exception
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String expected = null;
|
||||||
|
for (int i=1; i<=5; i++)
|
||||||
|
{
|
||||||
|
sb.append(i);
|
||||||
|
sb.append(" I must not talk in class or feed my homework to my cat.\n");
|
||||||
|
}
|
||||||
|
sb.append("\nBart\n");
|
||||||
|
expected = sb.toString();
|
||||||
|
|
||||||
|
MvcResult result = sendText("txt",
|
||||||
|
"UTF-8",
|
||||||
|
MIMETYPE_TEXT_PLAIN,
|
||||||
|
"pdf",
|
||||||
|
MIMETYPE_PDF,
|
||||||
|
"UTF-8",
|
||||||
|
expected.getBytes());
|
||||||
|
|
||||||
|
// Read back in the PDF and check it
|
||||||
|
PDDocument doc = PDDocument.load(result.getResponse().getContentAsByteArray());
|
||||||
|
PDFTextStripper textStripper = new PDFTextStripper();
|
||||||
|
StringWriter textWriter = new StringWriter();
|
||||||
|
textStripper.writeText(doc, textWriter);
|
||||||
|
doc.close();
|
||||||
|
|
||||||
|
expected = clean(expected);
|
||||||
|
String actual = clean(textWriter.toString());
|
||||||
|
|
||||||
|
assertEquals("The content did not match.", expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAppleIWorksPages() throws Exception
|
||||||
|
{
|
||||||
|
imageBasedTransform("pages", MIMETYPE_IWORK_PAGES, MIMETYPE_IMAGE_JPEG, "jpeg");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAppleIWorksNumbers() throws Exception
|
||||||
|
{
|
||||||
|
imageBasedTransform("numbers", MIMETYPE_IWORK_NUMBERS, MIMETYPE_IMAGE_JPEG, "jpeg");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAppleIWorksKey() throws Exception
|
||||||
|
{
|
||||||
|
imageBasedTransform("key", MIMETYPE_IWORK_KEYNOTE, MIMETYPE_IMAGE_JPEG, "jpeg");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Doesn't wotk with java 11, enable when fixed
|
||||||
|
// @Test
|
||||||
|
public void testOOXML() throws Exception
|
||||||
|
{
|
||||||
|
imageBasedTransform("docx", MIMETYPE_OPENXML_WORDPROCESSING, MIMETYPE_IMAGE_JPEG, "jpeg");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void imageBasedTransform(String sourceExtension, String sourceMimetype, String targetMimetype, String targetExtension) throws Exception
|
||||||
|
{
|
||||||
|
MockMultipartFile sourceFilex = new MockMultipartFile("file", "test_file." + sourceExtension, sourceMimetype, readTestFile(sourceExtension));
|
||||||
|
|
||||||
|
MockHttpServletRequestBuilder requestBuilder = super.mockMvcRequest("/transform", sourceFilex)
|
||||||
|
.param("targetExtension", "jpeg")
|
||||||
|
.param("targetMimetype", targetMimetype)
|
||||||
|
.param("sourceMimetype", sourceMimetype);
|
||||||
|
|
||||||
|
MvcResult result = mockMvc.perform(requestBuilder)
|
||||||
|
.andExpect(status().is(OK.value()))
|
||||||
|
.andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''test_file." + targetExtension))
|
||||||
|
.andReturn();
|
||||||
|
assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private MvcResult sendText(String sourceExtension,
|
||||||
|
String sourceEncoding,
|
||||||
|
String sourceMimetype,
|
||||||
|
String targetExtension,
|
||||||
|
String targetMimetype,
|
||||||
|
String targetEncoding,
|
||||||
|
byte[] content) throws Exception
|
||||||
|
{
|
||||||
|
MockMultipartFile sourceFilex = new MockMultipartFile("file", "test_file." + sourceExtension, sourceMimetype, content);
|
||||||
|
|
||||||
|
MockHttpServletRequestBuilder requestBuilder = super.mockMvcRequest("/transform", sourceFilex)
|
||||||
|
.param("targetExtension", targetExtension)
|
||||||
|
.param("targetEncoding", targetEncoding)
|
||||||
|
.param("targetMimetype", targetMimetype)
|
||||||
|
.param("sourceEncoding", sourceEncoding)
|
||||||
|
.param("sourceMimetype", sourceMimetype);
|
||||||
|
|
||||||
|
|
||||||
|
MvcResult result = mockMvc.perform(requestBuilder)
|
||||||
|
.andExpect(status().is(OK.value()))
|
||||||
|
.andExpect(header().string("Content-Disposition", "attachment; filename*= "+targetEncoding+"''test_file." + targetExtension)).
|
||||||
|
andReturn();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String clean(String text)
|
||||||
|
{
|
||||||
|
text = text.replaceAll("\\s+\\r", "");
|
||||||
|
text = text.replaceAll("\\s+\\n", "");
|
||||||
|
text = text.replaceAll("\\r", "");
|
||||||
|
text = text.replaceAll("\\n", "");
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class MiscQueueTransformServiceIT extends AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected TransformRequest buildRequest()
|
||||||
|
{
|
||||||
|
return TransformRequest.builder()
|
||||||
|
.withRequestId(UUID.randomUUID().toString())
|
||||||
|
.withSourceMediaType(MIMETYPE_HTML)
|
||||||
|
.withTargetMediaType(MIMETYPE_TEXT_PLAIN)
|
||||||
|
.withTargetExtension("txt")
|
||||||
|
.withSchema(1)
|
||||||
|
.withClientData("ACS")
|
||||||
|
.withSourceReference(UUID.randomUUID().toString())
|
||||||
|
.withSourceSize(32L).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class MiscTransformerHttpRequestTest extends AbstractHttpRequestTest
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected String getTransformerName()
|
||||||
|
{
|
||||||
|
return "Miscellaneous Transformers";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSourceExtension()
|
||||||
|
{
|
||||||
|
return "html";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,173 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transformer.transformers.StringExtractingContentTransformer.SOURCE_ENCODING;
|
||||||
|
import static org.alfresco.transformer.transformers.StringExtractingContentTransformer.TARGET_ENCODING;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@Import(HtmlParserContentTransformer.class)
|
||||||
|
public class HtmlParserContentTransformerTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
HtmlParserContentTransformer transformer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that we correctly handle text in different encodings,
|
||||||
|
* no matter if the encoding is specified on the Content Property
|
||||||
|
* or in a meta tag within the HTML itself. (ALF-10466)
|
||||||
|
*
|
||||||
|
* On Windows, org.htmlparser.beans.StringBean.carriageReturn() appends a new system dependent new line
|
||||||
|
* so we must be careful when checking the returned text
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testEncodingHandling() throws Exception
|
||||||
|
{
|
||||||
|
final String NEWLINE = System.getProperty ("line.separator");
|
||||||
|
final String TITLE = "Testing!";
|
||||||
|
final String TEXT_P1 = "This is some text in English";
|
||||||
|
final String TEXT_P2 = "This is more text in English";
|
||||||
|
final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol";
|
||||||
|
String partA = "<html><head><title>" + TITLE + "</title></head>" + NEWLINE;
|
||||||
|
String partB = "<body><p>" + TEXT_P1 + "</p>" + NEWLINE +
|
||||||
|
"<p>" + TEXT_P2 + "</p>" + NEWLINE +
|
||||||
|
"<p>" + TEXT_P3 + "</p>" + NEWLINE;
|
||||||
|
String partC = "</body></html>";
|
||||||
|
final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE;
|
||||||
|
|
||||||
|
File tmpS = null;
|
||||||
|
File tmpD = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Content set to ISO 8859-1
|
||||||
|
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||||
|
writeToFile(tmpS, partA+partB+partC, "ISO-8859-1");
|
||||||
|
|
||||||
|
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||||
|
|
||||||
|
Map<String, String> parameters = new HashMap<>();
|
||||||
|
parameters.put(SOURCE_ENCODING, "ISO-8859-1");
|
||||||
|
transformer.transform(tmpS, tmpD, parameters);
|
||||||
|
|
||||||
|
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||||
|
tmpS.delete();
|
||||||
|
tmpD.delete();
|
||||||
|
|
||||||
|
// Content set to UTF-8
|
||||||
|
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||||
|
writeToFile(tmpS, partA+partB+partC, "UTF-8");
|
||||||
|
|
||||||
|
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||||
|
parameters = new HashMap<>();
|
||||||
|
parameters.put(SOURCE_ENCODING, "UTF-8");
|
||||||
|
transformer.transform(tmpS, tmpD, parameters);
|
||||||
|
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||||
|
tmpS.delete();
|
||||||
|
tmpD.delete();
|
||||||
|
|
||||||
|
|
||||||
|
// Content set to UTF-16
|
||||||
|
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||||
|
writeToFile(tmpS, partA+partB+partC, "UTF-16");
|
||||||
|
|
||||||
|
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||||
|
parameters = new HashMap<>();
|
||||||
|
parameters.put(SOURCE_ENCODING, "UTF-16");
|
||||||
|
transformer.transform(tmpS, tmpD, parameters);
|
||||||
|
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||||
|
tmpS.delete();
|
||||||
|
tmpD.delete();
|
||||||
|
|
||||||
|
// Note - since HTML Parser 2.0 META tags specifying the
|
||||||
|
// document encoding will ONLY be respected if the original
|
||||||
|
// content type was set to ISO-8859-1.
|
||||||
|
//
|
||||||
|
// This means there is now only one test which we can perform
|
||||||
|
// to ensure that this now-limited overriding of the encoding
|
||||||
|
// takes effect.
|
||||||
|
|
||||||
|
// Content set to ISO 8859-1, meta set to UTF-8
|
||||||
|
tmpS = File.createTempFile("AlfrescoTestSource_", ".html");
|
||||||
|
String str = partA+
|
||||||
|
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
|
||||||
|
partB+partC;
|
||||||
|
|
||||||
|
writeToFile(tmpS, str, "UTF-8");
|
||||||
|
|
||||||
|
tmpD = File.createTempFile("AlfrescoTestTarget_", ".txt");
|
||||||
|
|
||||||
|
parameters = new HashMap<>();
|
||||||
|
parameters.put(SOURCE_ENCODING, "ISO-8859-1");
|
||||||
|
transformer.transform(tmpS, tmpD, parameters);
|
||||||
|
assertEquals(expected, readFromFile(tmpD, "UTF-8"));
|
||||||
|
tmpS.delete();
|
||||||
|
tmpD.delete();
|
||||||
|
|
||||||
|
|
||||||
|
// Note - we can't test UTF-16 with only a meta encoding,
|
||||||
|
// because without that the parser won't know about the
|
||||||
|
// 2 byte format so won't be able to identify the meta tag
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (tmpS != null && tmpS.exists()) tmpS.delete();
|
||||||
|
if (tmpD != null && tmpD.exists()) tmpD.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeToFile(File file, String content, String encoding) throws Exception
|
||||||
|
{
|
||||||
|
try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
|
||||||
|
{
|
||||||
|
ow.append(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String readFromFile(File file, String encoding) throws Exception
|
||||||
|
{
|
||||||
|
String content = "wrong content";
|
||||||
|
content = new String(Files.readAllBytes(file.toPath()), encoding);
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Transform Core
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer.transformers;
|
||||||
|
|
||||||
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
import org.apache.pdfbox.text.PDFTextStripper;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.transformer.transformers.TextToPdfContentTransformer.PAGE_LIMIT;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@Import(TextToPdfContentTransformer.class)
|
||||||
|
public class TextToPdfContentTransformerTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
TextToPdfContentTransformer transformer;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp()
|
||||||
|
{
|
||||||
|
transformer.setStandardFont("Times-Roman");
|
||||||
|
transformer.setFontSize(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUnlimitedPages() throws Exception
|
||||||
|
{
|
||||||
|
transformTextAndCheckPageLength(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLimitedTo1Page() throws Exception
|
||||||
|
{
|
||||||
|
transformTextAndCheckPageLength(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLimitedTo2Pages() throws Exception
|
||||||
|
{
|
||||||
|
transformTextAndCheckPageLength(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testLimitedTo50Pages() throws Exception
|
||||||
|
{
|
||||||
|
transformTextAndCheckPageLength(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformTextAndCheckPageLength(int pageLimit) throws Exception
|
||||||
|
{
|
||||||
|
int pageLength = 32;
|
||||||
|
int lines = (pageLength+10) * ((pageLimit > 0) ? pageLimit : 1);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String checkText = null;
|
||||||
|
int cutoff = pageLimit * pageLength;
|
||||||
|
for (int i=1; i<=lines; i++)
|
||||||
|
{
|
||||||
|
sb.append(i);
|
||||||
|
sb.append(" I must not talk in class or feed my homework to my cat.\n");
|
||||||
|
if (i == cutoff)
|
||||||
|
checkText = sb.toString();
|
||||||
|
}
|
||||||
|
sb.append("\nBart\n");
|
||||||
|
String text = sb.toString();
|
||||||
|
checkText = (checkText == null) ? clean(text) : clean(checkText);
|
||||||
|
transformTextAndCheck(text, "UTF-8", checkText, String.valueOf(pageLimit));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformTextAndCheck(String text, String encoding, String checkText, String pageLimit) throws Exception
|
||||||
|
{
|
||||||
|
// Get a reader for the text
|
||||||
|
File sourceFile = File.createTempFile("AlfrescoTestSource_", ".txt");
|
||||||
|
writeToFile(sourceFile,text, encoding);
|
||||||
|
|
||||||
|
|
||||||
|
// And a temp writer
|
||||||
|
File targetFile = File.createTempFile("AlfrescoTestTarget_", ".pdf");
|
||||||
|
|
||||||
|
// Transform to PDF
|
||||||
|
Map<String, String> parameters = new HashMap<>();
|
||||||
|
parameters.put(PAGE_LIMIT, pageLimit);
|
||||||
|
transformer.transform(sourceFile, targetFile, parameters);
|
||||||
|
|
||||||
|
// Read back in the PDF and check it
|
||||||
|
PDDocument doc = PDDocument.load(targetFile);
|
||||||
|
PDFTextStripper textStripper = new PDFTextStripper();
|
||||||
|
StringWriter textWriter = new StringWriter();
|
||||||
|
textStripper.writeText(doc, textWriter);
|
||||||
|
doc.close();
|
||||||
|
|
||||||
|
String roundTrip = clean(textWriter.toString());
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"Incorrect text in PDF when starting from text in " + encoding,
|
||||||
|
checkText, roundTrip
|
||||||
|
);
|
||||||
|
|
||||||
|
sourceFile.delete();
|
||||||
|
targetFile.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String clean(String text)
|
||||||
|
{
|
||||||
|
text = text.replaceAll("\\s+\\r", "");
|
||||||
|
text = text.replaceAll("\\s+\\n", "");
|
||||||
|
text = text.replaceAll("\\r", "");
|
||||||
|
text = text.replaceAll("\\n", "");
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeToFile(File file, String content, String encoding) throws Exception
|
||||||
|
{
|
||||||
|
try (OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), encoding))
|
||||||
|
{
|
||||||
|
ow.append(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
alfresco-docker-transform-misc/src/test/resources/quick.docx
Normal file
BIN
alfresco-docker-transform-misc/src/test/resources/quick.docx
Normal file
Binary file not shown.
BIN
alfresco-docker-transform-misc/src/test/resources/quick.key
Normal file
BIN
alfresco-docker-transform-misc/src/test/resources/quick.key
Normal file
Binary file not shown.
BIN
alfresco-docker-transform-misc/src/test/resources/quick.numbers
Normal file
BIN
alfresco-docker-transform-misc/src/test/resources/quick.numbers
Normal file
Binary file not shown.
BIN
alfresco-docker-transform-misc/src/test/resources/quick.pages
Normal file
BIN
alfresco-docker-transform-misc/src/test/resources/quick.pages
Normal file
Binary file not shown.
18
alfresco-docker-transform-misc/src/test/resources/quick.txt
Normal file
18
alfresco-docker-transform-misc/src/test/resources/quick.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The quick brown fox jumps over the lazy dog
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The quick brown fox jumps over the lazy dog
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.clients;
|
package org.alfresco.transformer.clients;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.config;
|
package org.alfresco.transformer.config;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.executors;
|
package org.alfresco.transformer.executors;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.executors;
|
package org.alfresco.transformer.executors;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.executors;
|
package org.alfresco.transformer.executors;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.fs;
|
package org.alfresco.transformer.fs;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.logging;
|
package org.alfresco.transformer.logging;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.logging;
|
package org.alfresco.transformer.logging;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.model;
|
package org.alfresco.transformer.model;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.model;
|
package org.alfresco.transformer.model;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.probes;
|
package org.alfresco.transformer.probes;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer.util;
|
package org.alfresco.transformer.util;
|
||||||
|
@ -24,6 +24,7 @@ logging:
|
|||||||
org.alfresco.transformer.AlfrescoPdfRendererController: debug
|
org.alfresco.transformer.AlfrescoPdfRendererController: debug
|
||||||
org.alfresco.transformer.ImageMagickController: debug
|
org.alfresco.transformer.ImageMagickController: debug
|
||||||
org.alfresco.transformer.TikaController: debug
|
org.alfresco.transformer.TikaController: debug
|
||||||
|
org.alfresco.transformer.MiscellaneousTransformersController: debug
|
||||||
|
|
||||||
fileStoreUrl: ${FILE_STORE_URL:http://localhost:8099/alfresco/api/-default-/private/sfs/versions/1/file}
|
fileStoreUrl: ${FILE_STORE_URL:http://localhost:8099/alfresco/api/-default-/private/sfs/versions/1/file}
|
||||||
|
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
@ -4,19 +4,24 @@
|
|||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
* Copyright (C) 2005 - 2019 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This file is part of the Alfresco software.
|
||||||
* it under the terms of the GNU Lesser General Public License as
|
* -
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* License, or (at your option) any later version.
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
*
|
* provided under the following open source license terms:
|
||||||
* This program is distributed in the hope that it will be useful,
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Lesser Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
* -
|
||||||
* You should have received a copy of the GNU General Lesser Public
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* License along with this program. If not, see
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* <http://www.gnu.org/licenses/lgpl-3.0.html>.
|
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
9
pom.xml
9
pom.xml
@ -33,6 +33,7 @@
|
|||||||
<module>alfresco-docker-alfresco-pdf-renderer</module>
|
<module>alfresco-docker-alfresco-pdf-renderer</module>
|
||||||
<module>alfresco-docker-imagemagick</module>
|
<module>alfresco-docker-imagemagick</module>
|
||||||
<module>alfresco-docker-libreoffice</module>
|
<module>alfresco-docker-libreoffice</module>
|
||||||
|
<module>alfresco-docker-transform-misc</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
@ -161,6 +162,11 @@
|
|||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>license-maven-plugin</artifactId>
|
<artifactId>license-maven-plugin</artifactId>
|
||||||
<version>1.20</version>
|
<version>1.20</version>
|
||||||
|
<configuration>
|
||||||
|
<inceptionYear>2005</inceptionYear>
|
||||||
|
<organizationName>Alfresco Software Limited</organizationName>
|
||||||
|
<projectName>Alfresco Transform Core</projectName>
|
||||||
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>third-party-licenses</id>
|
<id>third-party-licenses</id>
|
||||||
@ -181,9 +187,6 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<phase>process-sources</phase>
|
<phase>process-sources</phase>
|
||||||
<configuration>
|
<configuration>
|
||||||
<inceptionYear>2005</inceptionYear>
|
|
||||||
<organizationName>Alfresco Software Limited</organizationName>
|
|
||||||
<projectName>Alfresco Transform Core</projectName>
|
|
||||||
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
|
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
|
||||||
<canUpdateCopyright>true</canUpdateCopyright>
|
<canUpdateCopyright>true</canUpdateCopyright>
|
||||||
<canUpdateDescription>true</canUpdateDescription>
|
<canUpdateDescription>true</canUpdateDescription>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user