Merge branch 'feature/migration-spring5' of bitbucket.org:wisemapping/wisemapping-open-source into feature/migration-spring5
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2011] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest;
|
||||
|
||||
|
||||
@@ -1,36 +1,39 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpInputMessage;
|
||||
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpMessageConverter {
|
||||
public class DebugMappingJacksonHttpMessageConverter extends MappingJackson2HttpMessageConverter {
|
||||
|
||||
@Override
|
||||
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException, JsonHttpMessageNotReadableException {
|
||||
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws JsonHttpMessageNotReadableException {
|
||||
try {
|
||||
final byte[] bytes = IOUtils.toByteArray(inputMessage.getBody());
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
@@ -38,9 +41,7 @@ public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpM
|
||||
|
||||
return super.readInternal(clazz, wrap);
|
||||
|
||||
} catch (org.springframework.http.converter.HttpMessageNotReadableException e) {
|
||||
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
|
||||
} catch (IOException e) {
|
||||
} catch (HttpMessageNotReadableException | IOException e) {
|
||||
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +58,7 @@ class WrapHttpInputMessage implements HttpInputMessage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getBody() throws IOException {
|
||||
public InputStream getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest;
|
||||
|
||||
@@ -73,6 +73,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
@@ -87,7 +88,8 @@ import java.util.Set;
|
||||
public class MindmapController extends BaseController {
|
||||
final Logger logger = Logger.getLogger("com.wisemapping");
|
||||
|
||||
public static final String LATEST_HISTORY_REVISION = "latest";
|
||||
private static final String LATEST_HISTORY_REVISION = "latest";
|
||||
|
||||
@Qualifier("mindmapService")
|
||||
@Autowired
|
||||
private MindmapService mindmapService;
|
||||
@@ -256,15 +258,13 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/document/xml", "/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/document/xml", "/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
||||
@ResponseBody
|
||||
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
||||
// I should not return byte, but there is some encoding issue here. Further research needed.
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
|
||||
String xmlStr = mindmap.getXmlStr();
|
||||
return xmlStr.getBytes("UTF-8");
|
||||
return xmlStr.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@ApiIgnore
|
||||
@@ -283,11 +283,9 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml"})
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
|
||||
@ResponseBody
|
||||
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
||||
// I should not return byte, but there is some encoding issue here. Further research needed.
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
|
||||
return mindmapHistory.getUnzipXml();
|
||||
}
|
||||
@@ -394,7 +392,7 @@ public class MindmapController extends BaseController {
|
||||
// Update map ...
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
mindmap.setTitle(title);
|
||||
mindmapService.updateMindmap(mindMap, !true);
|
||||
mindmapService.updateMindmap(mindMap, false);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
|
||||
@@ -463,7 +461,7 @@ public class MindmapController extends BaseController {
|
||||
// Update map ...
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
mindmap.setDescription(description);
|
||||
mindmapService.updateMindmap(mindMap, !true);
|
||||
mindmapService.updateMindmap(mindMap, false);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "application/xml"})
|
||||
@@ -479,7 +477,7 @@ public class MindmapController extends BaseController {
|
||||
|
||||
// Update map status ...
|
||||
mindMap.setPublic(Boolean.parseBoolean(value));
|
||||
mindmapService.updateMindmap(mindMap, !true);
|
||||
mindmapService.updateMindmap(mindMap, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -529,7 +527,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void batchDelete(@RequestParam(required = true) String ids) throws IOException, WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final String[] mapsIds = ids.split(",");
|
||||
final String[] mapsIds = ",".split(ids);
|
||||
for (final String mapId : mapsIds) {
|
||||
final Mindmap mindmap = findMindmapById(Integer.parseInt(mapId));
|
||||
mindmapService.removeMindmap(mindmap, user);
|
||||
@@ -650,11 +648,12 @@ public class MindmapController extends BaseController {
|
||||
final User user = Utils.getUser();
|
||||
final Label delegated = restLabel.getDelegated();
|
||||
delegated.setCreator(user);
|
||||
|
||||
final Label found = labelService.getLabelById(labelId, user);
|
||||
if (found == null) {
|
||||
throw new LabelCouldNotFoundException("Label could not be found. Id: " + labelId);
|
||||
}
|
||||
for (String id : ids.split(",")) {
|
||||
for (String id : ",".split(ids)) {
|
||||
final int mindmapId = Integer.parseInt(id);
|
||||
final Mindmap mindmap = findMindmapById(mindmapId);
|
||||
final Label label = mindmap.findLabel(labelId);
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.CollaborationRole;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -18,19 +18,16 @@
|
||||
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.util.TimeUtils;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
@XmlRootElement(name = "collaborator")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.exceptions.Severity;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.context.MessageSource;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.model.Label;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
|
||||
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
|
||||
|
||||
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
|
||||
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
|
||||
|
||||
@XmlRootElement(name = "label")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.wisemapping.model.Label;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.service.LockInfo;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.CollaborationProperties;
|
||||
import com.wisemapping.model.CollaborationRole;
|
||||
@@ -26,9 +29,6 @@ import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.util.TimeUtils;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.model.MindMapHistory;
|
||||
import com.wisemapping.model.User;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/**
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
@@ -19,7 +19,7 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.Label;
|
||||
@@ -26,9 +29,6 @@ import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.util.TimeUtils;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -36,7 +36,6 @@ import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.wisemapping.model.User;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
@@ -32,7 +32,6 @@ import java.util.Calendar;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
|
||||
@XmlRootElement(name = "user")
|
||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||
@JsonAutoDetect(
|
||||
@@ -54,6 +53,7 @@ public class RestUser {
|
||||
this.password = user.getPassword();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Calendar getCreationDate() {
|
||||
return user.getCreationDate();
|
||||
}
|
||||
@@ -82,10 +82,6 @@ public class RestUser {
|
||||
user.setLastname(lastname);
|
||||
}
|
||||
|
||||
// public boolean isActive() {
|
||||
// return user.isActive();
|
||||
// }
|
||||
|
||||
public long getId() {
|
||||
return user.getId();
|
||||
}
|
||||
@@ -102,10 +98,6 @@ public class RestUser {
|
||||
user.setEmail(email);
|
||||
}
|
||||
|
||||
public void setCreationDate(Calendar creationDate) {
|
||||
// user.setCreationDate(creationDate);
|
||||
}
|
||||
|
||||
public void setPassword(final String password) {
|
||||
this.user.setPassword(password);
|
||||
this.password = password;
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.rest.view;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class TransformView extends AbstractView {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderMergedOutputModel(@NotNull Map<String, Object> viewMap, @NotNull HttpServletRequest request, @NotNull final HttpServletResponse response) throws Exception {
|
||||
protected void renderMergedOutputModel(@NotNull Map<String, Object> viewMap, @NotNull HttpServletRequest request, @NotNull final HttpServletResponse response) {
|
||||
|
||||
final String content = (String) viewMap.get("content");
|
||||
final String filename = (String) viewMap.get("filename");
|
||||
@@ -80,21 +80,22 @@ public class TransformView extends AbstractView {
|
||||
this.setContentDisposition(request, response, fileName);
|
||||
|
||||
// Change image link URL.
|
||||
final ServletContext servletContext = request.getSession().getServletContext();
|
||||
final ServletContext servletContext = getServletContext();
|
||||
final ExporterFactory factory = new ExporterFactory(servletContext);
|
||||
try {
|
||||
// Write the conversion content ...
|
||||
final ServletOutputStream outputStream = response.getOutputStream();
|
||||
if (exportFormat == ExportFormat.FREEMIND) {
|
||||
response.setCharacterEncoding("ASCII");
|
||||
response.setContentType(String.format("%s; charset=%s", contentType, "ASCII"));
|
||||
factory.export(properties, content, outputStream, null);
|
||||
} else if (exportFormat == ExportFormat.WISEMAPPING) {
|
||||
response.setCharacterEncoding(DEFAULT_ENCODING);
|
||||
response.setContentType(String.format("%s; charset=%s", contentType, DEFAULT_ENCODING));
|
||||
final Object mindmap = viewMap.get("mindmap");
|
||||
final StreamResult result = new StreamResult(outputStream);
|
||||
jaxbMarshaller.marshal(mindmap, result);
|
||||
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER || exportFormat == ExportFormat.MINDJET) {
|
||||
response.setCharacterEncoding(DEFAULT_ENCODING);
|
||||
|
||||
response.setContentType(String.format("%s; charset=%s", contentType, DEFAULT_ENCODING));
|
||||
factory.export(properties, content, outputStream, null);
|
||||
} else {
|
||||
// Image export ...
|
||||
@@ -112,9 +113,9 @@ public class TransformView extends AbstractView {
|
||||
String disposition = fileName;
|
||||
try {
|
||||
byte[] fileNameBytes = fileName.getBytes((isInternetExplorer) ? ("windows-1250") : ("utf-8"));
|
||||
String dispositionFileName = "";
|
||||
final StringBuilder dispositionFileName = new StringBuilder();
|
||||
for (byte b : fileNameBytes) {
|
||||
dispositionFileName += (char) (b & 0xff);
|
||||
dispositionFileName.append((char) (b & 0xff));
|
||||
}
|
||||
disposition = "attachment; filename=\"" + dispositionFileName + "\"";
|
||||
} catch (UnsupportedEncodingException ence) {
|
||||
|
||||
Reference in New Issue
Block a user