Map are loaded using Rest service.
This commit is contained in:
@@ -173,6 +173,15 @@ public class MindmapController extends BaseController {
|
||||
return lockInfo.getTimestamp();
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/document/xml",consumes = {"text/plain"}, produces = {"application/xml"})
|
||||
@ResponseBody
|
||||
public String retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
return mindmap.getXmlStr();
|
||||
}
|
||||
|
||||
|
||||
private void verifyLock(@NotNull Mindmap mindmap, @NotNull User user, long session, long timestamp) throws WiseMappingException {
|
||||
|
||||
// The lock was lost, reclaim as the ownership of it.
|
||||
|
@@ -31,14 +31,13 @@
|
||||
$(document).addEvent('loadcomplete', function (resource) {
|
||||
try {
|
||||
var mapId = '${mindmap.id}';
|
||||
var mapXml = '${mindmap.xmlAsJsLiteral}';
|
||||
|
||||
// Configure designer options ...
|
||||
var options = loadDesignerOptions();
|
||||
|
||||
<c:if test="${!memoryPersistence && !readOnlyMode}">
|
||||
options.persistenceManager = new mindplot.RESTPersistenceManager(
|
||||
{
|
||||
saveUrl:"c/restful/maps/{id}/document",
|
||||
documentUrl:"c/restful/maps/{id}/document",
|
||||
revertUrl:"c/restful/maps/{id}/history/latest",
|
||||
lockUrl:"c/restful/maps/{id}/lock",
|
||||
timestamp: ${lockTimestamp},
|
||||
@@ -58,12 +57,11 @@
|
||||
// Build designer ...
|
||||
var designer = buildDesigner(options);
|
||||
|
||||
// Load map from XML ...
|
||||
var parser = new DOMParser();
|
||||
var domDocument = parser.parseFromString(mapXml, "text/xml");
|
||||
|
||||
var mindmap = mindplot.PersistenceManager.loadFromDom(mapId, domDocument);
|
||||
// Load map from XML file persisted on disk...
|
||||
var persistence = mindplot.PersistenceManager.getInstance();
|
||||
var mindmap = mindmap = persistence.load(mapId);
|
||||
designer.loadMap(mindmap);
|
||||
|
||||
} catch (e) {
|
||||
logStackTrace(e);
|
||||
throw e;
|
||||
|
Reference in New Issue
Block a user