OKMUserConfig
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”.
Methods
Section titled “Methods”setHome
Section titled “setHome”Description:
| Method | Return values | Description |
|---|---|---|
| setHome(String token, String nodeId) | void | Sets the user’s home. |
Example:
package com.openkm;
import com.openkm.api.OKMUserConfig;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMUserConfig okmUserConfig = ContextWrapper.getContext().getBean(OKMUserConfig.class); okmUserConfig.setHome(null, "/okm:root/test"); } catch (Exception e) { e.printStackTrace(); } }}getConfig
Section titled “getConfig”Description:
| Method | Return values | Description |
|---|---|---|
| getConfig(String token) | UserConfig | Returns the user configuration. |
- Returned values are:
Example:
package com.openkm;
import com.openkm.api.OKMUserConfig;import com.openkm.db.bean.UserConfig;import com.openkm.util.ContextWrapper;
public class Test {
public static void main(String[] args) { try { OKMUserConfig okmUserConfig = ContextWrapper.getContext().getBean(OKMUserConfig.class); UserConfig uc = okmUserConfig.getConfig(null); System.out.println(uc); } catch (Exception e) { e.printStackTrace(); } }}