Note samples

Basics

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

Example of nodeId:

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

Methods

addNote

Description:

MethodReturn valuesDescription

addNote(String nodeId, String text)

Note

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

Example:

package com.openkm;

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 username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             ws.addNote("/okm:root/logo.png", "the note text"); } catch (Exception e) { e.printStackTrace(); } } }

getNote

Description:

MethodReturn valuesDescription

getNote(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 java.util.List;

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

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             List<Note> notes = ws.listNotes("/okm:root/logo.png");             if (notes.size() > 0) {                 System.out.println(ws.getNote(notes.get(0).getPath()));             } } catch (Exception e) { e.printStackTrace(); } } }

deleteNote

Description:

MethodReturn valuesDescription

deleteNote(String noteId)

Note

Deletes 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 java.util.List;

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

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             List<Note> notes = ws.listNotes("/okm:root/logo.png");             if (notes.size() > 0) {                 ws.deleteNote(notes.get(0).getPath());             } } catch (Exception e) { e.printStackTrace(); } } }

setNote

Description:

MethodReturn valuesDescription

setNote(String noteId, String text)

void

Change 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 java.util.List;

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

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             List<Note> notes = ws.listNotes("/okm:root/logo.png");             if (notes.size() > 0) {                 ws.setNote(notes.get(0).getPath(), "text modified");             } } catch (Exception e) { e.printStackTrace(); } } }

listNotes

Description:

MethodReturn valuesDescription

listNotes(String nodeId)

List<Note>

Retrieves a list of all notes of a node.

Example:

package com.openkm;

import java.util.List;

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

public class Test {
    public static void main(String[] args) {
        String host = "http://localhost:8080/OpenKM";
        String username = "okmAdmin";
        String password = "admin";
        OKMWebservices ws = OKMWebservicesFactory.newInstance(host, username, password);
         try {             List<Note> notes = ws.listNotes("/okm:root/logo.png");             for (Note note : notes) {                 System.out.println(note);             } } catch (Exception e) { e.printStackTrace(); } } }