Skip to content
Other versions

Loading…

UserConfig samples

First, you must create the webservice object:

OKMWebservices ws = OKMWebservicesFactory.getInstance(host);

Then you should log in using the method “login”. You can access the “login” method from the webservice object “ws” as shown below:

ws.login(user, password);

At this point you can use all the UserConfig methods from the “userConfig” class as shown below:

ws.userConfig.getConfig();

Description:

Method Return values Description
getConfig() UserConfig Returns the user settings.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Node;
import com.openkm.sdk4j.bean.UserConfig;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
UserConfig userConfig = ws.userConfig.getConfig();
Node node = ws.node.getNodeByUuid(userConfig.getHomeNode());
System.out.println("User: " + userConfig.getUser());
System.out.println("Home: " + node.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}

Description:

Method Return values Description
setHome(String uuid)
void Sets the user’s home node.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Node;
import com.openkm.sdk4j.bean.UserConfig;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String user = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(user, password);
ws.userConfig.setHome("53751cb7-c462-4320-ba46-4cc33e4667ae");
UserConfig userConfig = ws.userConfig.getConfig();
Node node = ws.node.getNodeByUuid(userConfig.getHomeNode());
System.out.println("Home: " + node.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
}