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:
* 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/])
### 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/
## Maintenance
## Members
### 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”);
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>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.4</version>
<version>4.0.5-SNAPSHOT</version>
</parent>
<scm>
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>

View File

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

View File

@ -4,7 +4,7 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<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>
</properties>
@ -16,7 +16,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<name>WiseMapping Project</name>
<version>4.0.4</version>
<version>4.0.5-SNAPSHOT</version>
<packaging>pom</packaging>
<licenses>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
<div class="row jumbotron" id="loginPanel">
<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">
<div class="form-group">
<label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label>
@ -49,7 +49,7 @@
</div>
</div>
<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 class="form-group">
<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"
data-loading-text="<spring:message code="SENDING"/>"/>
<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>
<div id="register">

View File

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