Repository samples

Methods

getRootFolder

Description:

MethodReturn valuesDescription

getRootFolder()

Folder

Returns the object Folder of node "/okm:root"

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getRootFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getTrashFolder

Description:

MethodReturn valuesDescription

getTrashFolder()

Folder

Returns the object Folder of node "/okm:trash/{userId}"

The returned folder will be the user trash folder.

For example if the method is executed by "okmAdmin" user then the folder returned will be "/okm:trash/okmAdmin".

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getTrashFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getTemplatesFolder

Description:

MethodReturn valuesDescription

getTemplatesFolder()

Folder

Returns the object Folder of node "/okm:templates"

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getTemplatesFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getPersonalFolder

Description:

MethodReturn valuesDescription

getPersonalFolder()

Folder

Returns the object Folder of node "/okm:personal/{userId}"

The returned folder will be the user personal folder.

For example if the method is executed by "okmAdmin" user then the folder returned will be "/okm:personal/okmAdmin".

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getPersonalFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getMailFolder

Description:

MethodReturn valuesDescription

getMailFolder()

Folder

Returns the object Folder of node "/okm:mail/{userId}"

The returned folder will be the user mail folder.

For example if the method is executed by "okmAdmin" user then the folder returned will be "/okm:mail/okmAdmin".

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getMailFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getThesaurusFolder

Description:

MethodReturn valuesDescription

getThesaurusFolder()

Folder

Returns the object Folder of node "/okm:thesaurus"

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getThesaurusFolder()); } catch (Exception e) { e.printStackTrace(); } } }

getCategoriesFolder

Description:

MethodReturn valuesDescription

getCategoriesFolder()

Folder

Returns the object Folder of node "/okm:categories"

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getCategoriesFolder()); } catch (Exception e) { e.printStackTrace(); } } }

purgeTrash

Description:

MethodReturn valuesDescription

purgeTrash()

void

Definitively removes from repository all nodes into "/okm:trash/{userId}"

For example if the method is executed by "okmAdmin" user then the purged trash will be "/okm:trash/okmAdmin".

When a node is purged, it only will be able to be restored from a previously repository backup. The purge action remove the node definitely from the repository.

 

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             ws.purgeTrash(); } catch (Exception e) { e.printStackTrace(); } } }

getUpdateMessage

Description:

MethodReturn valuesDescription

getUpdateMessage()

String

Retrieves a message in case there is a newer OpenKM release.

There's an official OpenKM update message service available which is based on your local OpenKM version. 

The most common message is that a new OpenKM version has been released.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getUpdateMessage()); } catch (Exception e) { e.printStackTrace(); } } }

getRepositoryUuid

Description:

MethodReturn valuesDescription

getRepositoryUuid()

String

Retrieves installation unique identifier.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getRepositoryUuid()); } catch (Exception e) { e.printStackTrace(); } } }

hasNode

Description:

MethodReturn valuesDescription

hasNode(String nodeId)

Boolean

Returns a node that indicate if a node exists or not.
The value of the parameter nodeId can be a valid UUID or path.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
try {             System.out.println("Exists node:"+ws.hasNode("064ff51a-b815-4f48-a096-b4946876784f")); } catch (Exception e) { e.printStackTrace(); } } }

getNodePath

Description:

MethodReturn valuesDescription

getNodePath(String uuid)

String Converts node UUID to path.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
try {             System.out.println(ws.getNodePath("064ff51a-b815-4f48-a096-b4946876784f")); } catch (Exception e) { e.printStackTrace(); } } }

getNodeUuid

Description:

MethodReturn valuesDescription

getNodeUuid(String path)

String

Converts node path to UUID.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             System.out.println(ws.getNodeUuid("/okm:root/tmp")); } catch (Exception e) { e.printStackTrace(); } } }

getAppVersion

Description:

MethodReturn valuesDescription

getAppVersion()

AppVersion

Returns information about OpenKM version.

Example:

package com.openkm;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
try {             System.out.println(ws.getAppVersion()); } catch (Exception e) { e.printStackTrace(); } } }