Import samples
We suggest executing the methods below for huge import or for simple creation cases.
These methods execute fewer steps in the background either what is described in Document samples and Folder samples. That means you will get extra performance in the action because there are executed less logic in the server side.
Basics
Example of uuid:
- Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
Methods
createDocument
Description:
Method | Return values | Description |
---|---|---|
importDocument(String uuid, File file) |
String |
Creates a new document. Return an the UUID of the Document. |
The values of the uuid parameter should be a folder or record node UUID. |
Example:
package com.openkm;
import java.io.File;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
File file = new File("/home/gnujavasergio/okm/logo.png");
String uuid = ws.importDocument("1be884f4-5758-4985-94d1-f18bfe004db8", file);
System.out.println(uuid);
} catch (Exception e) {
e.printStackTrace();
}
}
}
createDocument
Description:
Method | Return values | Description |
---|---|---|
importFolder(String uuid, String name) |
String |
Creates a new folder. Return an the UUID of the folder. |
The values of the uuid parameter should be a folder or record node UUID. |
Example:
package com.openkm;
import java.io.File;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
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);
String uuid = ws.importFolder("1be884f4-5758-4985-94d1-f18bfe004db8", "folder-name");
System.out.println(uuid);
} catch (Exception e) {
e.printStackTrace();
}
}
}