OKMBookmark
Used for managing bookmarks of users. For example add or remove bookmark of a node for a user.
Basics
On almost methods you'll see parameter named "nodePath". The value of this parameter can be some valid node path ( folder, document, mail ).
Example of nodePath:
- Using path -> "/okm:root/sample.pdf"
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".
On special cases you might be "promoted as Administrator" using the "administrator token".
String systemToken = DbSessionManager.getInstance().getSystemToken();
Methods
add
Description:
Method | Return values | Description |
---|---|---|
add(String token, String nodePath, String name) |
Bookmark |
Add a new bookmark of a node. |
The parameter name indicates the name which will be used to store the bookmark. Usually is used the same name of the nodePath. |
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();
}
}
}
get
Description:
Method | Return values | Description |
---|---|---|
get(String token, int bmId) |
Bookmark |
Gets the bookmark data. |
The parameter bmId is the value of the unique bookmark identifier. |
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
Description:
Method | Return values | Description |
---|---|---|
getAll(String token) |
List<Bookmark> |
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
Description:
Method | Return values | Description |
---|---|---|
remove(String token, int bmId) |
void |
Delete a bookmark. |
The parameter bmId is the value of the unique bookmark identifier. |
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
Description:
Method | Return values | Description |
---|---|---|
rename(String token, int bmId, String newName |
Bookmark |
Rename a bookmark. |
The parameter bmId is the value of the unique bookmark identifier. |
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();
}
}
}