Skip to content
Other versions

Loading…

Document samples

First, you must create the webservice object:

OKMWebservices ws = OKMWebservicesFactory.getInstance(host);

Then you should log in using the “login” method. You can access the “login” method from the web service object “ws” as shown below:

ws.login(user, password);

At this point you can use all the Document methods from the “document” class as shown below:

ws.document.create("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is);

Description:

Method Return values Description
create(String uuid, String name, InputStream is) Document Creates a new document. Returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
Document doc = ws.document.create("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is);
System.out.println(doc);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
create(String uuid, String name, InputStream is, long nodeClass) Document Creates a new document with a nodeClass. Returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.
  • The nodeClass parameter should be a valid business type (series) value. A nodeClass with value 0 means there is no business type (series) selected.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
long nodeClass = 0;
Document doc = ws.document.create("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is, nodeClass);
System.out.println(doc);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
create(String uuid, File file) Document Creates a new document and returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.

Example:

package com.openkm;
import java.io.File;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
File file = new File("/home/openkm/okm/logo.png");
Document doc = ws.document.create("151f3a54-f370-47d6-801a-d20faecec180", file);
System.out.println(doc);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
create(String uuid, String name, InputStream is, Calendar created) Document Creates a new document with a custom creation date. Returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.
  • The created parameter sets the creation date of the document. If null, the current date will be used.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Calendar;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
Calendar created = Calendar.getInstance();
created.add(Calendar.DAY_OF_MONTH, -1);
Document doc = ws.document.create("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is, created);
System.out.println(doc);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
create(String uuid, String name, InputStream is, long nodeClass, Calendar created) Document Creates a new document with a nodeClass and a custom creation date. Returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.
  • The nodeClass parameter should be a valid business type (series) value. A nodeClass with value 0 means there is no business type (series) selected.
  • The created parameter sets the creation date of the document. If null, the current date will be used.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Calendar;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
long nodeClass = 0;
Calendar created = Calendar.getInstance();
created.add(Calendar.DAY_OF_MONTH, -1);
Document doc = ws.document.create("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is, nodeClass, created);
System.out.println(doc);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
createWithPropertyGroup(String uuid, String name, InputStream is, long nodeClass, String grpName, Map<String, String> properties) Document Creates a new document and sets a property group’s properties in the same call. Returns a Document object with the properties of the created document.
  • The value of the uuid parameter should be a folder or record node UUID.
  • The nodeClass parameter should be a valid business type (series) value. A nodeClass with value 0 means there is no business type (series) selected.
  • The grpName should be a valid Metadata group name.
  • It is not mandatory to set all field values in the properties parameter; only the properties belonging to grpName are applied.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
long nodeClass = 0;
Map<String, String> properties = new HashMap<>();
properties.put("okp:technology.comment", "comment sample");
properties.put("okp:technology.description", "description sample");
Document doc = ws.document.createWithPropertyGroup("1be884f4-5758-4985-94d1-f18bfe004db8", "logo.png", is, nodeClass, "okg:technology", properties);
System.out.println(doc);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
delete(String uuid) void Deletes a document.

Example:

package com.openkm;
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);
ws.document.delete("1ec49da9-1746-4875-ae32-9281d7303a62");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getProperties(String uuid) Document Returns the document properties.

Example:

package com.openkm;
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);
System.out.println(ws.document.getProperties("1ec49da9-1746-4875-ae32-9281d7303a62"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getContent(String uuid) InputStream Retrieves the document content - binary data - of the current document version.

Example:

package com.openkm;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
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);
OutputStream fos = new FileOutputStream("/home/openkm/logo.png");
InputStream is = ws.document.getContent("1ec49da9-1746-4875-ae32-9281d7303a62");
IOUtils.copy(is, fos);
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fos);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getContentByVersion(String uuid, String versionName) InputStream Retrieves document content (binary data) from a specific document version.

Example:

package com.openkm;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
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);
OutputStream fos = new FileOutputStream("/home/openkm/logo.png");
InputStream is = ws.document.getContentByVersion("/okm:root/logo.png", "1.1");
IOUtils.copy(is, fos);
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fos);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getChildren(String fldId) List Returns a list of all documents whose parent is fldId.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
for (Document doc : ws.document.getChildren("1be884f4-5758-4985-94d1-f18bfe004db8")) {
System.out.println(doc);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
rename(String uuid, String newName) Document Changes the name of a document.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
Document doc = ws.document.rename("1ec49da9-1746-4875-ae32-9281d7303a62", "logo_rename.png");
System.out.print(doc);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setProperties(String uuid, String title, String description, String lang, List keywords, List categories) void Changes some document properties.
  • The parameter lang must be ISO 639-1 compliant.

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> keywords = new ArrayList<>();
keywords.add("test");
keywords.add("invoice");
List<String> categories = new ArrayList<>();
categories.add("58c9b25f-d83e-4006-bd78-e26d7c6fb648");
ws.document.setProperties("1ec49da9-1746-4875-ae32-9281d7303a62", "new title", "some description", "es", keywords, categories);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setLanguage(String uuid, String lang) void Sets the document language.
  • The parameter lang must be ISO 639-1 compliant.

Example:

package com.openkm;
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);
ws.document.setLanguage("1ec49da9-1746-4875-ae32-9281d7303a62", "en");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setTitle(String uuid, String title) void Sets the document title.

Example:

package com.openkm;
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);
ws.document.setTitle("1ec49da9-1746-4875-ae32-9281d7303a62", "Some title here");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
checkout(String uuid) void Marks the document for editing.
  • Only one user can modify a document at a time.
  • Before starting editing, you must perform a checkout action that locks the editing process for other users and allows editing only to the user who executed the action.

Example:

package com.openkm;
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);
ws.document.checkout("1ec49da9-1746-4875-ae32-9281d7303a62");
// At this point the document is locked for other users except for the user who executed the action
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
cancelCheckout(String uuid) void Cancels document editing.

Example:

package com.openkm;
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);
// At this point the document is locked for other users except for the user who executed the action
ws.document.cancelCheckout("1ec49da9-1746-4875-ae32-9281d7303a62");
// At this point other users are allowed to execute a checkout and modify the document
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
forceCancelCheckout(String uuid) void Cancels document editing.
  • This method allows cancelling editing on any document.
  • It is not mandatory for this action to be executed by the same user who previously executed the checkout action.

Example:

package com.openkm;
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);
// At this point the document is locked for other users except for the user who executed the action
ws.document.forceCancelCheckout("1ec49da9-1746-4875-ae32-9281d7303a62");
// At this point other users are allowed to execute a checkout and modify the document
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
isCheckedOut(String docId) Boolean Returns a boolean that indicates whether the document is being edited or not.

Example:

package com.openkm;
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);
System.out.println("Is the document checkout:" + ws.document.isCheckedOut("1ec49da9-1746-4875-ae32-9281d7303a62"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
checkin(String uuid, InputStream is, String comment) Version Updates a document with a new version and returns an object with the new version values.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
InputStream is = new FileInputStream("/home/openkm/logo.png");
ws.document.checkin("1ec49da9-1746-4875-ae32-9281d7303a62", is, "optional some comment");
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
checkin(String docId, InputStream is, String comment, int increment) Version Updates a document with a new version and returns an object with the new version values.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
InputStream is = new FileInputStream("/home/openkm/logo.png");
ws.document.checkin("1ec49da9-1746-4875-ae32-9281d7303a62", is, "optional some comment", 2);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
purge(String uuid) void The document is permanently removed from the repository.
  • Usually you will purge documents into /okm:trash/userId - the personal trash user locations - but it is possible to directly purge any document from the whole repository.

Example:

package com.openkm;
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);
ws.document.purge("1ec49da9-1746-4875-ae32-9281d7303a62");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
move(String uuid, String dstId) void Moves a document into a folder or record.

Example:

package com.openkm;
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);
ws.document.move("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e", "8599eab7-ae61-4628-8010-1103d6950c63");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
copy(String uuid, String dstId, String newName) void Copies a document into a folder or record.
  • The values of the dstId parameter should be a folder or record UUID.
  • When the parameter newName value is null, the document will preserve the same name.

Example:

package com.openkm;
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);
ws.document.copyDocument("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e", "8599eab7-ae61-4628-8010-1103d6950c63", "new_logo.png");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getVersionHistorySize(String uuid) long Returns the total size in bytes of all documents in the document history.

Example:

package com.openkm;
import java.util.Locale;
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);
String[] UNITS = new String[]{"B", "KB", "MB", "GB", "TB", "PB", "EB"};
long bytes = ws.document.getVersionHistorySize("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e");
String value = "";
for (int i = 6; i > 0; i--) {
double step = Math.pow(1024, i);
if (bytes > step) {
value = String.format(Locale.ROOT, "%3.1f %s", bytes / step, UNITS[i]);
}
}
if (value.isEmpty()) {
value = Long.toString(bytes) + " " + UNITS[0];
}
System.out.println(value);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
isValid(String docId) Boolean Returns a boolean that indicates whether the node is a document.

Example:

package com.openkm;
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);
System.out.println(ws.document.isValid("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getPath(String uuid) String Converts a document UUID to a document path.

Example:

package com.openkm;
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);
System.out.println(ws.document.getPath("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getDetectedLanguages()
List Returns a list of available document languages that OpenKM can identify.

Example:

package com.openkm;
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);
for (String lang : ws.document.getDetectedLanguages()) {
System.out.println(lang);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
extendedCopy(String nodeId, String dstId, String name, boolean categories, boolean keywords, boolean propertyGroups, boolean notes, boolean security) void
Copies a document with associated data into some folder or record.
  • The values of the nodeId parameter should be a Document UUID.
  • The values of the dstId parameter should be a folder or a record UUID.
  • When the parameter newName value is null, the document will preserve the same name.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
Document document = ws.document.extendedCopy("055b5206-35d0-4351-ba92-c304bbba7ddf", "2dccdee1-9d83-477d-ac58-1b50278a2210", "new_logo.png", true, true, true, true, true);
System.out.println(document);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getExtractedText(String uuid) String Returns a String with the extracted text produced by the text extraction process.
  • When a document is uploaded to OpenKM, it goes into the text extraction queue. There is a crontab that periodically processes this queue and extracts document contents.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.impl.OKMWebservices;
import java.io.FileInputStream;
import java.io.InputStream;
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);
InputStream is = new FileInputStream("/home/openkm/test.pdf");
ws.document.setExtractedText("301de803-f4ae-48f1-8505-e83b26716956", is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setExtractedText(String uuid, InputStream is) void Sets the extracted text.

Example:

package com.openkm;
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);
String text = ws.document.getExtractedText("46762f90-82c6-4886-8d21-ad3017dd78a7");
System.out.println(text);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getThumbnail(String uuid, ThumbnailType type) InputStream Returns thumbnail image data.
  • Available types:

Example:

package com.openkm;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.ThumbnailType;
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);
OutputStream fos = new FileOutputStream("/home/openkm/invoice.png");
InputStream is = ws.document.getThumbnail("46762f90-82c6-4886-8d21-ad3017dd78a7", ThumbnailType.THUMBNAIL_LIGHTBOX);
IOUtils.copy(is, fos);
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fos);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
createFromTemplate(String uuid, String dstPath, boolean categories,
            boolean keywords, boolean notes, Map<String, String> properties)
Document Creates a new document from the template and returns a Document object.
  • The uuid parameter is the UUID value of the template file.
  • The dstPath value is the document destination path.
  • When the template uses metadata groups to fill in fields, these values are mandatory and must be set in the properties parameter. 

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
import com.openkm.sdk4j.impl.OKMWebservices;
import com.openkm.sdk4j.util.ISO8601;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(username, password);
Map<String, String> properties = new HashMap<>();
// okg:tpl
properties.put("okp:tpl.name", "sdk name");
Calendar cal = Calendar.getInstance();
// Value must be converted to String ISO 8601 compliant
properties.put("okp:tpl.bird_date", ISO8601.formatBasic(cal));
properties.put("okp:tpl.language", "[ \"java\" ]");
// Property okg:technology
properties.put("okp:technology.comment", "sdk name");
Document document = ws.document.createFromTemplate("5e72dec8-2409-405b-ac15-d964feb3d7bb", "/okm:root/sdk/template.pdf", true, true, true, properties);
System.out.println(document);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
updateFromTemplate(String uuid, String dstId, Map<String, String> properties) Document Updates a document previously created from the template and returns a Document object.
  • The uuid value is the UUID value of the template file.
  • The dstId is the UUID of the document to be updated.
  • This method only makes sense when the template uses metadata groups to fill in fields.

Example:

package com.openkm;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.impl.OKMWebservices;
import com.openkm.sdk4j.util.ISO8601;
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);
Map<String, String> properties = new HashMap<>();
properties.put("okp:tpl.name", "update Some name");
Calendar cal = Calendar.getInstance();
// Value must be converted to String ISO 8601 compliant
properties.put("okp:tpl.bird_date", ISO8601.formatBasic(cal));
properties.put("okp:tpl.language", "[ \"python\" ]");
ws.document.updateFromTemplate("9fa9787e-d8b0-4ff7-905a-a89f0b228ec8", "058b9379-b441-454d-8590-00d5a280ce79", properties);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getAnnotations(String uuid, String versionName) String Returns the document annotations for a given document version.

Example:

package com.openkm;
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);
System.out.println(ws.document.getAnnotations("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e", "1.0"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getDifferences(String uuid, String versionName1, String versionName2) InputStream Returns a PDF document with the differences between two document versions.

Example:

package com.openkm;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
InputStream is = ws.document.getDifferences("46762f90-82c6-4886-8d21-ad3017dd78a7", "1.0", "1.1");
FileOutputStream fos = new FileOutputStream("/home/openkm/okm/out.pdf");
IOUtils.copy(is, fos);
is.close();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getCheckedOut() List Returns a list of documents checked out by the user.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
for (Document doc : ws.document.getCheckedOut()) {
System.out.println(doc);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setDocumentNodeClass(String uuid, long ncId) void Sets the NodeClass.

Example:

package com.openkm;
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);
long ncId = 2;
ws.document.setNodeClass("7ce1b4a8-4ade-4dce-8d7d-4e99a6cd368b", ncId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setDispositionStage(String uuid, long stage) void Sets the disposition stage

Example:

package com.openkm;
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);
long stage = 1;
ws.document.setDispositionStage("7ce1b4a8-4ade-4dce-8d7d-4e99a6cd368b", stage);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setDescription(String uuid, String description) void Sets a description.

Example:

package com.openkm;
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);
ws.document.setDescription("7ce1b4a8-4ade-4dce-8d7d-4e99a6cd368b", "some description");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
createWizard(String uuid, String name, long nodeClass, InputStream is) WizardNode Creates a new document using the wizard.
  • The parameter uuid should be a valid folder or record UUID.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.WizardNode;
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);
InputStream is = new FileInputStream("/home/openkm/okm/logo.png");
WizardNode wn = ws.document.createWizard("1f323e88-64ee-4f57-91e2-9276f8c603f9", "logo.png", 0, is);
System.out.print(wn);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
isOCRDataCaptureSupported(String uuid) boolean Checks if the node supports OCR data capture.

Example:

package com.openkm;
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);
if (ws.document.isOCRDataCaptureSupported("b2f88679-e3fd-4f97-bf0e-abf76f9ec499")) {
System.out.println("Yes supported OCR Data capture");
} else {
System.out.println("No supported OCR Data capture");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
recognize(String uuid) OCRRecognise Returns an OCRRecognise object.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.OCRRecognise;
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);
OCRRecognise ocr = ws.document.recognize("b2f88679-e3fd-4f97-bf0e-abf76f9ec499");
System.out.println(ocr);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
captureData(String uuid,  long templateId) void Performs the OCR data capture using the OCR template identified by templateId.

Example:

package com.openkm;
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);
long templateId = 1;
ws.document.captureData("f123a950-0329-4d62-8328-0ff500fd42db", templateId);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getNumberOfPages(String uuid) int Gets the number of pages in a document.

Example:

package com.openkm;
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);
System.out.println("The number of pages is : " + ws.document.getNumberOfPages("b2f88679-e3fd-4f97-bf0e-abf76f9ec499"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getPageAsImage(String uuid, int pageNumber, int maxWidth, int maxHeight) String Returns a specific page as an image encoded as a Base64 string.

Example:

package com.openkm;
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);
System.out.println(ws.document.getPageAsImage("3fe350e2-69e8-4681-a97c-6ac4ba6c1524", 1, 150, 150));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
liveEditCheckin(String uuid, String comment, int increment) void Performs a live edit check-in.

Example:

package com.openkm;
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);
ws.document.liveEditCheckin("8b9a32c8-db65-41c8-a2a0-af03761f60b6", "comment 1.1", 1);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
liveEditCancelCheckout(String uuid) void Cancels live editing of a document.

Example:

package com.openkm;
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);
// At this point the document is locked for other users except for the user who executed the action
ws.document.liveEditCancelCheckout("1ec49da9-1746-4875-ae32-9281d7303a62");
// At this point other users are allowed to execute a checkout and modify the document
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
liveEditForceCancelCheckout(String uuid) void Cancels live editing of a document.
  • This method allows canceling live editing on any document.
  • It is not mandatory that this action be executed by the same user who previously performed the checkout action.

Example:

package com.openkm;
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);
// At this point the document is locked for other users except for the user who executed the action
ws.document.liveEditForceCancelCheckout("1ec49da9-1746-4875-ae32-9281d7303a62");
// At this point other users are allowed to execute a checkout and modify the document
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
mergePdf(String destinationUuid, String docName, List uuids) String Merges two or more PDF files.
  • The parameter destinationUuid should be a valid folder or record UUID.

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("3fe350e2-69e8-4681-a97c-6ac4ba6c1524");
uuids.add("8b9a32c8-db65-41c8-a2a0-af03761f60b6");
String fldUuid = "7213e597-c147-46c9-a90b-ac3966b3114b";
String uuid = ws.document.mergePdf(fldUuid, "MergePdf.pdf", uuids);
Document pdfDoc = ws.document.getDocumentProperties(uuid);
System.out.println(pdfDoc.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
liveEditSetContent(String uuid, InputStream is) void Updates the content of the document edited using the live edit feature.

Example:

package com.openkm;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
InputStream is = new FileInputStream("/home/openkm/logo.png");
ws.document.liveEditSetContent("1ec49da9-1746-4875-ae32-9281d7303a62", is);
IOUtils.closeQuietly(is);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
isAttachment(String docId) boolean Returns a boolean indicating whether the node is a mail attachment.

Example:

package com.openkm;
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);
System.out.println(ws.document.isAttachment("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
isConvertibleToPDF(String docId) boolean Returns a boolean indicating whether the node is convertible to PDF.

Example:

package com.openkm;
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);
System.out.println(ws.document.isConvertibleToPDF("9ed5c7b1-9314-4479-8f80-fd8e2b47f55e"));
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getPdf(String uuid) InputStream Returns a PDF of the document.

Example:

package com.openkm;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
Document doc = ws.document.getProperties("7f6c5c0b-a66b-4782-9595-e14b402a18b0");
InputStream is = ws.document.getPdf(doc.getUuid());
OutputStream fos = new FileOutputStream("/home/openkm/book.pdf");
IOUtils.copy(is, fos);
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(fos);
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
saveAsPdf(String uuid, String newName, boolean propertyGroups, boolean security) Document Saves the document as a PDF in the OpenKM repository.
  • When the newName parameter value is null, the document will preserve the same name.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
Document doc = ws.document.getProperties("7f6c5c0b-a66b-4782-9595-e14b402a18b0");
Document docPdf = ws.document.saveAsPdf(doc.getUuid(), "book.pdf", true, true);
System.out.println("Document pdf: " + docPdf.getPath());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
webPageImport(String uuid, String url) void Saves a document as a PDF containing the content of the web page.
  • The value of the uuid parameter should be a folder or record node UUID.
  • The value of the url parameter is any web page URL.

Example:

package com.openkm;
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);
ws.document.webPageImport("271cc3aa-218e-4574-8065-c34c704f4a20", "https://www.google.com/");
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
setIndexable(String uuid, boolean enabled) void Sets whether the document is indexable.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
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);
ws.document.setIndexable("19938640-fd34-421c-90c8-6b435e4b7d79", true);
Document document = ws.document.getDocumentProperties("19938640-fd34-421c-90c8-6b435e4b7d79");
System.out.println("Document indexable:" + document.isIndexable());
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
getXRefs(String uuid) List Returns a list of document references for an AutoCAD document.

Example:

package com.openkm;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.XRef;
import com.openkm.sdk4j.impl.OKMWebservices;
public class Test {
public static void main(String[] args) {
String host = "http://localhost:8080/openkm";
String username = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(username, password);
for (XRef xRef : ws.document.getXrefs("5ce6dd37-7472-404a-878e-274005a2d6db")) {
System.out.println(xRef);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Description:

Method Return values Description
refresh(String uuid) void Refreshes the references of an AutoCAD document.

Example:

package com.openkm;
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 username = "okmAdmin";
String password = "admin";
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);
try {
ws.login(username, password);
ws.document.refresh("5ce6dd37-7472-404a-878e-274005a2d6db");
} catch (Exception e) {
e.printStackTrace();
}
}
}