OKMProperty

Basics

On most methods you'll see parameter named "nodeId". The value of this parameter can be a valid document, folder, mail UUID or path  node.

Example of nodeId:

  • Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
  • Using path -> "/okm:root/logo.png"

About the parameter named "catId", the value of this parameter can be a valid categories folder UUID or path node.

Example of nodeId:

  • Using UUID -> "f1678435-0329-4d62-8328-09846e6739823";
  • Using path -> "/okm:categories/category1"

About the parameter named "nodePath",  the value of this parameter can be a valid document, folder, or mail path node.

Example of nodePath:

  • Using path -> "/okm:root/logo.png"

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

addCategory

Description:

MethodReturn valuesDescription

addCategory(String token, String nodeId, String catId)

void

Set a relation between a category and a node.

The value of the catId parameter should be a category folder UUID or path. 

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().addCategory(null, "/okm:root/logo.png", "/okm:categories/test");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

removeCategory

Description:

MethodReturn valuesDescription

removeCategory(String token, String nodeId, String catId)

void

Removes a relation between a category and a node.

The value of the catId parameter should be a category folder UUID or path. 

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().removeCategory(null, "/okm:root/logo.png", "/okm:categories/test");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

addKeyword

Description:

MethodReturn valuesDescription

addKeyword(String token, String nodeId, String keyword)

String

Add a keyword in a node.

The keyword should be a single word without spaces, formats allowed:

  • "test"
  • "two_words" ( the character "_" is used for the junction ).

We also we suggest you to add keyword in lowercase format, because OpenKM is case sensitive.

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            String keyword = OKMProperty.getInstance().addKeyword(null, "/okm:root/logo.png", "test");
            System.out.println(keyword);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

removeKeyword

Description:

MethodReturn valuesDescription

removeKeyword(String token, String nodeId, String keyword)

void

Removes a keyword from a node.

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().removeKeyword(null, "/okm:root/logo.png", "test");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

setEncryption

Description:

MethodReturn valuesDescription

setEncryption(String token, String nodePath, String cipherName)

void

Marks a document as an en cripted binary data in the repository.

The parameter nodeId should be a document node. 

The parameter cipherName saves information about the encription mechanism.

This method does not perform any kind of encryption, simply mark in the database that a document is encrypted.

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().setEncryption(null, "/okm:root/logo.png", "phrase");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

unsetEncryption

Description:

MethodReturn valuesDescription

unsetEncryption(String token, String nodePath)

void

Marks a document is a normal binary data into repository.

The parameter nodeId should be a document node. 

This method does not perform any kind of encryption, simply mark into the database that a document has been uncrypted.

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().unsetEncryption(null, "/okm:root/logo.png");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

setSigned

Description:

MethodReturn valuesDescription

setSigned(String token, String nodePath, boolean signed)

void

Marks a document as signed or unsigned binary data into the repository.

The parameter nodeId should be a document node.

This method does not perform any kind of digital signature process, simply mark into the database that a document is signed.

Example:

package com.openkm;

import com.openkm.api.OKMProperty;

public class Test {
    public static void main(String[] args) {
        try {           
            OKMProperty.getInstance().setSigned(null, "/okm:root/logo.png", true);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}