This commit is contained in:
Paulo Gustavo Veiga 2013-02-13 22:51:55 -03:00
parent 28ffead0a0
commit deca7e51b2
3 changed files with 8 additions and 6 deletions

View File

@ -18,8 +18,10 @@
package com.wisemapping.model;
import com.wisemapping.util.ZipUtils;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.Calendar;
public class MindMapHistory {
@ -71,7 +73,7 @@ public class MindMapHistory {
return xml;
}
public void setXml(byte[] xml) {
this.xml = xml;
public byte[] getUnzipXml() throws IOException {
return ZipUtils.zipToBytes(xml);
}
}

View File

@ -120,7 +120,7 @@ public class MindmapController extends BaseController {
@RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException {
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
final Mindmap mindmap = mindmapService.findMindmapById(id);
final User user = Utils.getUser();
@ -129,7 +129,7 @@ public class MindmapController extends BaseController {
List<MindMapHistory> mindmapHistory = mindmapService.findMindmapHistory(id);
if (mindmapHistory.size() > 0) {
final MindMapHistory mindMapHistory = mindmapHistory.get(0);
mindmap.setXml(mindMapHistory.getXml());
mindmap.setZippedXml(mindMapHistory.getXml());
saveMindmapDocument(true, mindmap, user);
}
} else {
@ -188,7 +188,7 @@ public class MindmapController extends BaseController {
// 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.getXml();
return mindmapHistory.getUnzipXml();
}

View File

@ -45,7 +45,7 @@
);
</c:if>
<c:if test="${memoryPersistence || readOnlyMode}">
options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/'+hid:''}/document/xml${principal!=null?'':'-pub'}");
options.persistenceManager = new mindplot.LocalStorageManager("c/restful/maps/{id}${hid!=null?'/':''}${hid!=null?hid:''}/document/xml${principal!=null?'':'-pub'}");
</c:if>
var userOptions = ${mindmap.properties};