OKMNote

Basics

On most methods you'll see parameter named "nodeId". The value of this parameter can be a valid document, folder, or mail UUID or path.

Example of nodeId:

  • Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
  • Using path -> "/okm:root/logo.png"

Also on all methods you'll see parameter named "token". When accessing application across SOAP the login process returns a token, what is used to identify the user on all the exposed methods. From default application execution context you must use "null" value what indicates to the application must use the "user session".

On special cases you might be "promoted as Administrator" using the "administrator token".

String systemToken = DbSessionManager.getInstance().getSystemToken();

Methods

addNote

Description:

MethodReturn valuesDescription

add(String token, String nodeId, String text)

Note

Adds a note to a node and returns an object Note.

Example:

package com.openkm;

import com.openkm.api.OKMNote;
import com.openkm.bean.Note;

public class Test {
    public static void main(String[] args) {
        try {           
            Note note = OKMNote.getInstance().add(null, "/okm:root/logo.png", "the note text");
            System.out.println(note);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

get

Description:

MethodReturn valuesDescription

get(String token, String noteId)

Note

Retrieves the note.

The noteId is an UUID.

The object Node has a variable named path, in that case the path contains an UUID.

Example:

package com.openkm;

import com.openkm.api.OKMNote;
import com.openkm.bean.Note;

public class Test {
    public static void main(String[] args) {
        try {           
            for (Note note : OKMNote.getInstance().list(null, "/okm:root/logo.png")) {
                Note data = OKMNote.getInstance().get(null, note.getPath());
                System.out.println(data);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

delete

Description:

MethodReturn valuesDescription

delete(String token, String noteId)

void

Delete a note.

The noteId is an UUID.

The object Node has a variable named path, in that case the path contains an UUID.

Example:

package com.openkm;

import com.openkm.api.OKMNote;
import com.openkm.bean.Note;

public class Test {
    public static void main(String[] args) {
        try {           
            for (Note note : OKMNote.getInstance().list(null, "/okm:root/logo.png")) {
                OKMNote.getInstance().delete(null, note.getPath());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

set

Description:

MethodReturn valuesDescription

set(String token, String noteId, String text)

void

Changes the note text.

The noteId is an UUID.

The object Node has a variable named path, in that case the path contains an UUID.

Example:

package com.openkm;

import com.openkm.api.OKMNote;
import com.openkm.bean.Note;

public class Test {
    public static void main(String[] args) {
        try {           
            for (Note note : OKMNote.getInstance().list(null, "/okm:root/logo.png")) {
                OKMNote.getInstance().set(null, note.getPath());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

list

Description:

MethodReturn valuesDescription

list(String token, String nodeId)

List<Note>

Retrieves a list of all the notes of a node.

Example:

package com.openkm;

import com.openkm.api.OKMNote;
import com.openkm.bean.Note;

public class Test {
    public static void main(String[] args) {
        try {           
            for (Note note : OKMNote.getInstance().list(null, "/okm:root/logo.png")) {
                OKMNote.getInstance().set(null, note.getPath());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}