OKMBookmark
Used for managing bookmarks of users. For example add or remove bookmark of a node for a user.
Basics
Section titled “Basics”On almost methods you’ll see parameter named “nodeId”. The value of this parameter can be some valid node UUID ( folder, document, mail, record ) or node path.
Also on all methods you’ll see parameter named “token”. When accessing application across SOAP the login process returns a token, what is used to identify the user on all the exposed methods. From default application execution context you must use “null” value what indicates to the application must use the “user session”.
Methods
Section titled “Methods”Description:
| Method | Return values | Description |
|---|---|---|
| add(String token, String nodeId, String name) | Bookmark | Add a new bookmark of a node. |
Example:
package com.openkm;
import com.openkm.api.OKMBookmark;import com.openkm.dao.bean.Bookmark;
public class Test { public static void main(String[] args) { try { Bookmark bookmark = OKMBookmark.getInstance().add(null, "/okm:root/document.doc", "document.doc"); System.out.println(bookmark); } catch (Exception e) { e.printStackTrace(); } }}Description:
| Method | Return values | Description |
|---|---|---|
| get(String token, int bmId) | Bookmark | Gets the bookmark data. |
Example:
package com.openkm;
import com.openkm.api.OKMBookmark;import com.openkm.dao.bean.Bookmark;
public class Test { public static void main(String[] args) { try { int bmId = 23; Bookmark bookmark = OKMBookmark.getInstance().get(null, bmId); System.out.println(bookmark); } catch (Exception e) { e.printStackTrace(); } }}getAll
Section titled “getAll”Description:
| Method | Return values | Description |
|---|---|---|
| getAll(String token) | List |
Gets all the bookmarks of the logged user. |
Example:
package com.openkm;
import com.openkm.api.OKMBookmark;import com.openkm.dao.bean.Bookmark;
public class Test { public static void main(String[] args) { try { for (Bookmark bookmark : OKMBookmark.getInstance().getAll(null)) { System.out.println(bookmark); } } catch (Exception e) { e.printStackTrace(); } }}remove
Section titled “remove”Description:
| Method | Return values | Description |
|---|---|---|
| remove(String token, int bmId) | void | Delete a bookmark. |
Example:
package com.openkm;
import com.openkm.api.OKMBookmark;
public class Test { public static void main(String[] args) { try { int bmId = 23; OKMBookmark.getInstance().remove(null, bmId); } catch (Exception e) { e.printStackTrace(); } }}rename
Section titled “rename”Description:
| Method | Return values | Description |
|---|---|---|
| rename(String token, int bmId, String newName | Bookmark | Rename a bookmark. |
Example:
package com.openkm;
import com.openkm.api.OKMBookmark;import com.openkm.dao.bean.Bookmark;
public class Test { public static void main(String[] args) { try { int bmId = 23; Bookmark bookmark = OKMBookmark.getInstance().rename(null, bmId, "newname.doc"); System.out.println(bookmark); } catch (Exception e) { e.printStackTrace(); } }}