Skip to content
Other versions

Loading…

OKMProperty

On 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 a valid category folder UUID node.

Also, on 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 value “null”, which indicates that the application must use the “user session”.

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();
}
}
}

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();
}
}
}

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();
}
}
}

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();
}
}
}

Description:

Method Return values Description
setSigned(String token, String nodeId, boolean signed) void Marks a document as signed or unsigned 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();
}
}
}

Description:

Method Return values Description
isSigned(String token, String nodeId) boolean Returns a boolean that indicates whether the document is signed.
  • 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();
}
}
}