Notification samples

Methods

notify

Description:

MethodReturn valuesDescription

notify(List<String> uuids, List<String> users, List<String> roles, List<String> mails, String message, boolean attachment)

void

Send a mail notification.

The parameter uuids are the UUID of the node ( document, folder, mail or record ).

The parameter users are a set of OpenKM users to be notified.

The parameter roles are a set of OpenKM roles to be notified.

The parameter mails are a set of email addresses - usually external mails - to be notified.

The parameter message is the content body of the mail.

When attachment value is true the node is attached into the mail.

Example:

package com.openkm;

import java.util.ArrayList;
import java.util.List;

import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;

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.notify(uuids, users, roles, mails, message, false);            
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}