Merge branch 'develop'

This commit is contained in:
Paulo Veiga 2018-09-16 18:29:02 -07:00
commit 585b01f7d4
13 changed files with 54 additions and 40 deletions

View File

@ -8,7 +8,7 @@ The goal of this project is to provide a high quality product that can be deploy
The following products must be installed: The following products must be installed:
* Java Development Kit 7 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html]) * Java Development Kit 8 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html])
* Maven 3.x or higher ([http://maven.apache.org/]) * Maven 3.x or higher ([http://maven.apache.org/])
### Compiling ### Compiling
@ -49,6 +49,10 @@ To test the javascript frontend you then do:
Now open a browser using the URL http://localhost:8000/wise-editor/src/main/webapp/ Now open a browser using the URL http://localhost:8000/wise-editor/src/main/webapp/
## Maintenance
## Members ## Members
### Founders ### Founders
@ -70,3 +74,4 @@ Now open a browser using the URL http://localhost:8000/wise-editor/src/main/weba
The source code is Licensed under the WiseMapping Open License, Version 1.0 (the “License”); The source code is Licensed under the WiseMapping Open License, Version 1.0 (the “License”);
You may obtain a copy of the License at: [https://wisemapping.atlassian.net/wiki/display/WS/License] You may obtain a copy of the License at: [https://wisemapping.atlassian.net/wiki/display/WS/License]

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
</parent> </parent>
<scm> <scm>
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection> <developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -4,7 +4,7 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd"> http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties> <properties>
<com.wisemapping.version>4.0.4</com.wisemapping.version> <com.wisemapping.version>4.0.5-SNAPSHOT</com.wisemapping.version>
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir> <superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
</properties> </properties>
@ -16,7 +16,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<name>WiseMapping Project</name> <name>WiseMapping Project</name>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<licenses> <licenses>

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
</parent> </parent>
<build> <build>

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId> <groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId> <artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
<version>4.0.4</version> <version>4.0.5-SNAPSHOT</version>
</parent> </parent>
<repositories> <repositories>
@ -211,7 +211,7 @@
<dependency> <dependency>
<groupId>org.apache.xmlgraphics</groupId> <groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId> <artifactId>batik-transcoder</artifactId>
<version>1.9.1</version> <version>1.10</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <exclusions>
<exclusion> <exclusion>
@ -223,13 +223,8 @@
<dependency> <dependency>
<groupId>org.apache.xmlgraphics</groupId> <groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-codec</artifactId> <artifactId>batik-codec</artifactId>
<version>1.9.1</version> <version>1.10</version>
</dependency> </dependency>
<!--<dependency>-->
<!--<groupId>xml-apis</groupId>-->
<!--<artifactId>xml-apis</artifactId>-->
<!--<version>1.4.01</version>-->
<!--</dependency>-->
<dependency> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-api</artifactId> <artifactId>javaee-api</artifactId>
@ -576,6 +571,7 @@
<configuration> <configuration>
<baseAppFirst>false</baseAppFirst> <baseAppFirst>false</baseAppFirst>
<stopKey>foo</stopKey> <stopKey>foo</stopKey>
<nonBlocking>true</nonBlocking>
<stopPort>9999</stopPort> <stopPort>9999</stopPort>
<war>${project.build.directory}/wisemapping.war</war> <war>${project.build.directory}/wisemapping.war</war>
<reload>automatic</reload> <reload>automatic</reload>

View File

@ -48,7 +48,7 @@ public class ExportProperties {
this.version = version; this.version = version;
} }
static public class GenericProperties extends ExportProperties { private static class GenericProperties extends ExportProperties {
private GenericProperties(ExportFormat format) { private GenericProperties(ExportFormat format) {
super(format); super(format);
} }
@ -65,7 +65,7 @@ public class ExportProperties {
this.size = size; this.size = size;
} }
public ImageProperties(ExportFormat format) { ImageProperties(ExportFormat format) {
super(format); super(format);
} }

View File

@ -19,6 +19,7 @@
package com.wisemapping.exporter; package com.wisemapping.exporter;
import com.wisemapping.importer.VersionNumber; import com.wisemapping.importer.VersionNumber;
import org.apache.batik.ext.awt.image.rendered.TileCache;
import org.apache.batik.parser.AWTTransformProducer; import org.apache.batik.parser.AWTTransformProducer;
import org.apache.batik.parser.ParseException; import org.apache.batik.parser.ParseException;
import org.apache.batik.parser.TransformListParser; import org.apache.batik.parser.TransformListParser;
@ -49,26 +50,33 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.*; import javax.xml.xpath.*;
import java.awt.geom.AffineTransform; import java.awt.geom.AffineTransform;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class ExporterFactory { public class ExporterFactory {
static {
// Try to prevent OOM.
TileCache.setSize(0);
}
private static final String GROUP_NODE_NAME = "g"; private static final String GROUP_NODE_NAME = "g";
private static final String IMAGE_NODE_NAME = "image"; private static final String IMAGE_NODE_NAME = "image";
public static final int MANGING = 50; private static final int MANGING = 50;
public static final String UTF_8_CHARSET_NAME = "UTF-8"; private static final String UTF_8_CHARSET_NAME = "UTF-8";
private File baseImgDir; private File baseImgDir;
public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException { public ExporterFactory(@NotNull final ServletContext servletContext) {
this.baseImgDir = new File(servletContext.getRealPath("/")); this.baseImgDir = new File(servletContext.getRealPath("/"));
} }
public ExporterFactory(@NotNull final File baseImgDir) throws ParserConfigurationException { public ExporterFactory(@NotNull final File baseImgDir) {
this.baseImgDir = baseImgDir; this.baseImgDir = baseImgDir;
} }
public void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws ExportException, IOException, TranscoderException { public void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws ExportException, IOException, TranscoderException {
final ExportFormat format = properties.getFormat(); final ExportFormat format = properties.getFormat();
switch (format) { switch (format) {
case PNG: { case PNG: {
// Create a JPEG transcoder // Create a JPEG transcoder
@ -80,18 +88,20 @@ public class ExporterFactory {
// Create the transcoder input. // Create the transcoder input.
final String svgString = normalizeSvg(mapSvg); final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); final CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output); TranscoderOutput transcoderOutput = new TranscoderOutput(output);
// Save the image. // Save the image.
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, transcoderOutput);
reader.close();
break; break;
} }
case JPG: { case JPG: {
// Create a JPEG transcoder // Create a JPEG transcoder
final Transcoder transcoder = new JPEGTranscoder(); final Transcoder transcoder = new JPEGTranscoder();
transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99)); transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .99f);
final ExportProperties.ImageProperties imageProperties = final ExportProperties.ImageProperties imageProperties =
(ExportProperties.ImageProperties) properties; (ExportProperties.ImageProperties) properties;
@ -100,12 +110,13 @@ public class ExporterFactory {
// Create the transcoder input. // Create the transcoder input.
final String svgString = normalizeSvg(mapSvg); final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output); TranscoderOutput trascoderOutput = new TranscoderOutput(output);
// Save the image. // Save the image.
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, trascoderOutput);
reader.close();
break; break;
} }
case PDF: { case PDF: {
@ -114,31 +125,32 @@ public class ExporterFactory {
// Create the transcoder input. // Create the transcoder input.
final String svgString = normalizeSvg(mapSvg); final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray())); CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output); TranscoderOutput trascoderOutput = new TranscoderOutput(output);
// Save the image. // Save the image.
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, trascoderOutput);
reader.close();
break; break;
} }
case SVG: { case SVG: {
final String svgString = normalizeSvg(mapSvg); final String svgString = normalizeSvg(mapSvg);
output.write(svgString.getBytes(UTF_8_CHARSET_NAME)); output.write(svgString.getBytes(StandardCharsets.UTF_8));
break; break;
} }
case TEXT: { case TEXT: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.TEXT); final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.TEXT);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break; break;
} }
case OPEN_OFFICE_WRITER: { case OPEN_OFFICE_WRITER: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.OPEN_OFFICE); final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.OPEN_OFFICE);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break; break;
} }
case MICROSOFT_EXCEL: { case MICROSOFT_EXCEL: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MICROSOFT_EXCEL); final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MICROSOFT_EXCEL);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output); exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break; break;
} }
case FREEMIND: { case FREEMIND: {
@ -155,6 +167,9 @@ public class ExporterFactory {
default: default:
throw new UnsupportedOperationException("Export method not supported."); throw new UnsupportedOperationException("Export method not supported.");
} }
output.flush();
output.close();
} }
private String normalizeSvg(@NotNull String svgXml) throws ExportException { private String normalizeSvg(@NotNull String svgXml) throws ExportException {

View File

@ -41,9 +41,7 @@ public class XSLTExporter implements Exporter {
final CharArrayReader reader = new CharArrayReader(mmos.toString("iso-8859-1").toCharArray()); final CharArrayReader reader = new CharArrayReader(mmos.toString("iso-8859-1").toCharArray());
final Source mmSource = new StreamSource(reader); final Source mmSource = new StreamSource(reader);
transformer.transform(mmSource, new StreamResult(outputStream)); transformer.transform(mmSource, new StreamResult(outputStream));
} catch (TransformerException e) { } catch (TransformerException | UnsupportedEncodingException e) {
throw new ExportException(e);
} catch (UnsupportedEncodingException e) {
throw new ExportException(e); throw new ExportException(e);
} }

View File

@ -21,7 +21,7 @@
<div class="row jumbotron" id="loginPanel"> <div class="row jumbotron" id="loginPanel">
<h1><spring:message code="SIGN_IN"/></h1> <h1><spring:message code="SIGN_IN"/></h1>
<form action="<c:url value='/c/j_spring_security_check'/>" method="POST" class="form-horizontal" <form action="/c/j_spring_security_check" method="POST" class="form-horizontal"
id="loginForm"> id="loginForm">
<div class="form-group"> <div class="form-group">
<label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label> <label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label>
@ -49,7 +49,7 @@
</div> </div>
</div> </div>
<div class="form-group" style="text-align: center"> <div class="form-group" style="text-align: center">
<a href="<c:url value="/c/user/resetPassword"/>"><spring:message code="FORGOT_PASSWORD"/></a> <a href="/c/user/resetPassword"><spring:message code="FORGOT_PASSWORD"/></a>
</div> </div>
<div class="form-group"> <div class="form-group">
<c:if test="${not empty param.login_error}"> <c:if test="${not empty param.login_error}">

View File

@ -23,7 +23,7 @@
<input type="submit" value="<spring:message code="SEND_ME_A_NEW_PASSWORD"/>" class="btn btn-primary" <input type="submit" value="<spring:message code="SEND_ME_A_NEW_PASSWORD"/>" class="btn btn-primary"
data-loading-text="<spring:message code="SENDING"/>"/> data-loading-text="<spring:message code="SENDING"/>"/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn" <input type="button" value="<spring:message code="CANCEL"/>" class="btn"
onclick="window.location='<c:url value="c/maps/"/>'"/> onclick="window.location='/c/maps/'"/>
</form:form> </form:form>
<div id="register"> <div id="register">

View File

@ -49,7 +49,7 @@
<div class="col-md-10 col-md-offset-2"> <div class="col-md-10 col-md-offset-2">
<c:if test="${requestScope.recaptchaEnabled}"> <c:if test="${requestScope.recaptchaEnabled}">
<div class="g-recaptcha" data-sitekey="${requestScope.recaptchaSiteKey}"></div> <div class="g-recaptcha" data-sitekey="${requestScope.recaptchaSiteKey}"></div>
<p>${requestScope.captcha}</p> <p cssClass="errorMsg">${requestScope.captcha}</p>
</c:if> </c:if>
</div> </div>
</div> </div>