Note samples
Esta página aún no está disponible en tu idioma.
Basics
Section titled “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.
Methods
Section titled “Methods”addNote
Section titled “addNote”Description:
| Method | Return values | Description |
|---|---|---|
| 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
Section titled “getNote”Description:
| Method | Return values | Description |
|---|---|---|
| getNote(String noteId) | Note | Retrieves the note. |
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
Section titled “deleteNote”Description:
| Method | Return values | Description |
|---|---|---|
| deleteNote(String noteId) | Note | Delete a note. |
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
Section titled “setNote”Description:
| Method | Return values | Description |
|---|---|---|
| setNote(String noteId, String text) | void | Changes the note text. |
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
Section titled “listNotes”Description:
| Method | Return values | Description |
|---|---|---|
| listNotes(String nodeId) | List |
Retrieves a list of all the 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(); } }}