Skip to content
Other versions

Loading…

Notification 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 Notification methods from the “notification” class as shown below:

ws.notification.notify(uuids, users, roles, mails, message, false);

Description:

Method Return values Description
notify(List uuids, List users, List roles, List mails, String message, boolean attachment) void Sends a mail notification.

Example:

package com.openkm;
import java.util.ArrayList;
import java.util.List;
import com.openkm.sdk4j.OKMWebservicesFactory;
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);
List<String> uuids = new ArrayList<>();
uuids.add("b153c4b7-3d1c-4589-bd42-0ed0f34fd338");
List<String> users = new ArrayList<>();
users.add("test");
users.add("sochoa");
List<String> roles = new ArrayList<>();
roles.add("ROLE_TEST");
List<String> mails = new ArrayList<>();
String message = "Body of the message";
ws.notification.notify(uuids, users, roles, mails, message, false);
} catch (Exception e) {
e.printStackTrace();
}
}
}