Notification samples
Basics
Section titled “Basics”Suggested code sample
Section titled “Suggested code sample”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);Methods
Section titled “Methods”notify
Section titled “notify”Description:
| Method | Return values | Description |
|---|---|---|
| notify(List |
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(); } }}