OKMProperty
Basics
Section titled “Basics”In most methods you’ll see a parameter named “nodeId”. The value of this parameter can be a valid document, folder, mail, or record UUID.
About the parameter named “catId”: the value of this parameter can be the UUID of a categories folder node.
In all methods you’ll see a parameter named “token”. Because Cron tasks are executed in the background without authentication, the methods used in this scenario might use the token parameter. From the default application execution context you must use the “null” value, which indicates that the application must use the “user session”.
Methods
Section titled “Methods”addCategory
Section titled “addCategory”Description:
| Method | Return values | Description |
|---|---|---|
| addCategory(String token, String nodeId, String catId) | void | Sets a relation between a category and a node. |
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.addCategory(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", "5cbc35fc-23c0-48f5-a7bc-3cfa1e7be25f"); } catch (Exception e) { e.printStackTrace(); } }}removeCategory
Section titled “removeCategory”Description:
| Method | Return values | Description |
|---|---|---|
| removeCategory(String token, String nodeId, String catId) | void | Removes a relation between a category and a node. |
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.removeCategory(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", "5cbc35fc-23c0-48f5-a7bc-3cfa1e7be25f"); } catch (Exception e) { e.printStackTrace(); } }}addKeyword
Section titled “addKeyword”Description:
| Method | Return values | Description |
|---|---|---|
| addKeyword(String token, String nodeId, String keyword) | String | Adds a keyword to a node. |
- The keyword should be a single word without spaces, formats allowed:
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); String keyword = okmProperty.addKeyword(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", "test"); System.out.println(keyword); } catch (Exception e) { e.printStackTrace(); } }}removeKeyword
Section titled “removeKeyword”Description:
| Method | Return values | Description |
|---|---|---|
| removeKeyword(String token, String nodeId, String keyword) | void | Removes a keyword from a node. |
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.removeKeyword(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", "test"); } catch (Exception e) { e.printStackTrace(); } }}setEncryption
Section titled “setEncryption”Description:
| Method | Return values | Description |
|---|---|---|
| setEncryption(String token, String nodeId, String cipherName) | void | Marks a document as encrypted binary data in the repository. |
- The parameter nodeId should be a document node.
- The parameter cipherName saves information about the encryption mechanism.
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.setEncryption(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", "phrase"); } catch (Exception e) { e.printStackTrace(); } }}unsetEncryption
Section titled “unsetEncryption”Description:
| Method | Return values | Description |
|---|---|---|
| unsetEncryption(String token, String nodeId) | void | Marks a document as normal binary data in the repository. |
- The parameter nodeId should be a document node.
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.unsetEncryption(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338"); } catch (Exception e) { e.printStackTrace(); } }}setSigned
Section titled “setSigned”Description:
| Method | Return values | Description |
|---|---|---|
| setSigned(String token, String nodeId, boolean signed) | void | Marks a document as signed or unsigned binary data in the repository. |
- The parameter nodeId should be a document node.
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); okmProperty.setSigned(null, "b153c4b7-3d1c-4589-bd42-0ed0f34fd338", true); } catch (Exception e) { e.printStackTrace(); } }}isSigned
Section titled “isSigned”Description:
| Method | Return values | Description |
|---|---|---|
| isSigned(String token, String nodeId) | boolean | Returns a boolean that indicates whether the document is signed or not. |
- The parameter nodeId should be a document node.
Example:
package com.openkm;
import com.openkm.api.OKMProperty;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMProperty okmProperty = ContextWrapper.getContext().getBean(OKMProperty.class); System.out.println("Is the document signed: " + okmProperty.isSigned(null, "6330d2a0-529f-4c14-baa1-ce6a92004e01")); } catch (Exception e) { e.printStackTrace(); } }}