Skip to content
juliusse edited this page Apr 6, 2013 · 43 revisions

** WORK IN PROGRESS **

Table Of Content

User Related Actions

Login User
jsRoutes.controllers.User.login()

Logout User
jsRoutes.controllers.User.logout()

Get Maps of User on Server
jsRoutes.controllers.User.mapListFromDB()

Mindmap Related Actions

Get Information

Get (complete/chunked) Mindmap as Json
jsRoutes.controllers.MindMap.map(String mapId)
jsRoutes.controllers.MindMap.map(String mapId, Integer nodeCount)

Get Node with all/some Children as Json
jsRoutes.controllers.MindMap.getNode(String mapId, String nodeId
jsRoutes.controllers.MindMap.getNode(String mapId, String nodeId, Integer nodeCount
Requires: Logged in User

Gaining and Releasing locks

Request Lock for a Node
jsRoutes.controllers.MindMap.requestLock(String mapId)
Note: POST-data required
Requires:

  • Logged in User
  • Authorisation to access Map
  • No one else has Lock on Node

**Create Node in Map**
[jsRoutes.controllers.MindMap.createNode(String mapId)](#createNode)
_Note: POST-data required_
_Requires: [Logged in User](#login)_

Modifying a Mindmap

Create Node in Map
jsRoutes.controllers.MindMap.createNode(String mapId)
Note: POST-data required
Requires: Logged in User

Change Node in Map
jsRoutes.controllers.MindMap.changeNode(String mapId)
Note: POST-data required
Requires: Logged in User

Delete Node in Map
jsRoutes.controllers.MindMap.deleteNode(String mapId)
Note: POST-data required
Requires: Logged in User, No lock on Node or on Children

Detailed Informations

Login

Method POST
Action jsRoutes.controllers.User.login()
Form Data
  • username: String
  • password: String
Requires Nothing
Returns 303 Redirect

Logout

Method GET
Action jsRoutes.controllers.User.logout()
Form Data ---
Requires
Returns 303 Redirect

Maps From Database

Method GET
Action jsRoutes.controllers.User.mapListFromDB()
Form Data ---
Requires
Returns List with MindMapInfo Objects

Mindmap As Json

Method GET
Action jsRoutes.controllers.MindMap.map(String mapId)
jsRoutes.controllers.MindMap.map(String mapId, Integer nodeCount)
Form Data ---
Requires
Returns A MindMap Object

Routes
/map/json/:mapId
/map/json/:mapId/nodeCount/:nodeCount

Request Parameter
String mapId Map Id (= mmIdOnServer)
optinal: int nodeCount weak definition of node count in response (default: -1 = all Nodes)

Response
String jsonString Map as JSON

{
	"id":"135602876213936955604606025812499.mm",
	"isReadonly":"false",
	"root":{
		"id":"ID_1723255651",
		"nodeText":"New Mindmap",
		"isHtml":"false",
		"folded":"false",
		"leftChildren":{...},
		"rightChildren":[...]}
}

Get Node

Method
GET

Route
/map/{mapId}/node/{nodeId}

Request Parameter
String mapId Map Id (= mmIdOnServer)
String nodeId Node Id

Response
String nodeAsJson Node as JSON

{
	"id":"ID_87205452",
	"nodeText":"",
	...
}

Add Node

Method
POST

Routes
/map/{mapId}/addNode

Body
Type: application/x-www-form-urlencoded

String parentNodeId Node Id of parent

parentNodeId=ID_1

Response
String nodeAsJson Added node as JSON

{
	"id":"ID_87205452",
	"nodeText":""
}

Delete Node

Method
DELETE

Routes
/map/{mapId}/node/{nodeId}

Request Parameter
String mapId Map Id (= mmIdOnServer)
String nodeId Node Id

Response
No response.

Change Node

Method
POST

Route
/map/{mapId}/changeNode

Body
Type: application/x-www-form-urlencoded

Only 'id' is required!

nodeJson={"id": "ID_1", 
    "nodeText": "This is a new nodeText",
    "isHtml": false,
    "folded": true,
    "icons": [
        "yes"
    ],
    "image": NOT_HANDLED,
    "link": "http://www.google.de",
    "locked": null,
    "hGap": 10,
    "shiftY": 10,
    "attributes": {
        "key": "value"
    },
}

Get map list from DB

Method
GET

Routes
/maps

Response
JSON list of mindmap informations

{
	[{2", "2", "Dec 02, 2012 6:38:31 PM", "/not/available", "2.mm"},
	{"3", "3", "Dec 03, 2012 1:25:14 PM", "/not/available", "3.mm"}]
}

Defined Objects

MindMapInfo

{
  "mmIdOnServer" : String,
  "mmIdInternal" : String,
  "revision" : Time,
  "filePath" : String,
  "fileName" : String
}

Mind Map

A mind map contains a root node, which is slightly different to a normal node.

{
  "id" : String
  "isReadonly" : boolean,
  "revision" : integer
  "name" : string
  "root" : RootNode
}

Node

  • hGap: horizontal distance to parent
  • shiftY: used to calculate the vertical position
  • icons: List with names of predefined icons
    • We need the icons on the server
    • Exit in freeplane project: \freeplane\bin\classes\images\icons
  • prefferedChild: appears to be important
  • nodeText: plain text or HTML, defined by isHtml
  • isHtml: defines if nodeText is plain text or HTML
  • link: external link or link to another node
    • http:// for hyperlinks
    • node:// for nodes
    • workspace:// for workspace files
  • attributes: Table with attributes of node
    • self definde table
    • information from JabRef
  • locked: name of user, which has lock on node
  • children: list with children, when they have been loaded
  • childrenIds: list with ids of children, when due to chunking they haven't been loaded

Note: children and childrenIds do not appear together!

{
  "id" : string,
  "hGap" : integer,
  "shiftY" : integer,
  "folded" : boolean,
  "icons" : [string,string,...], //names of icons
  "prefferedChild" : DefaultNode,
  "nodeText" : string,
  "isHtml" : boolean,
  "isFree" : boolean,
  "isSummary" : boolean,
  "defaultStyle" : string,
  "edgeStyle" : Edge, // edge to parent node, not specified parameters are inherited from parent
  "image" : Image,
  "link" : string,
  "children" : [DefaultNode,DefaultNode...],
  "childrenIds" : [string, string,...],
  "attributes" : map<string,string> | null
  "locked" : string
}

Root Node (Special case)

Very similar to a normal node with some small changes.
At the root node it is possible to have children on the right and on the left side.

  • leftChildren: sorted list with children on the left side
  • rightChildren: sorted list with children on the right side *For further descriptions see Normal Node
{
    "id" : string,
    "folded" : boolean,
    "icons" : [string,string,...], //names of icons
    "prefferedChild" : DefaultNode,
    "nodeText" : string,
    "isHtml" : boolean,
    "image" : Image,
    "link" : string,
    "leftChildren" : [DefaultNode,DefaultNode,...],
    "rightChildren" :  [DefaultNode,DefaultNode,...]
}

Clone this wiki locally