Autocad samples
Basics
Section titled “Basics”Suggested code sample
Section titled “Suggested code sample”First, you must create the webservice object:
OKMWebservices ws = OKMWebservicesFactory.getInstance(host);Then should login using the method “login”. You can access the “login” method from webservice object “ws” as is shown below:
ws.login(user, password);At this point you can use all the Autocad methods from “autocad” class as is shown below:
List<XRef> xrefList = ws.autocad.getXrefs("1be884f4-5758-4985-94d1-f18bfe004db8");Methods
Section titled “Methods”getXRefs
Section titled “getXRefs”Description:
| Method | Return values | Description |
|---|---|---|
| getXRefs(String uuid) | List |
Returns a list of the document references of a 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.autocad.getXrefs("5ce6dd37-7472-404a-878e-274005a2d6db")) { System.out.println(xRef); } } catch (Exception e) { e.printStackTrace(); } }}refresh
Section titled “refresh”Description:
| Method | Return values | Description |
|---|---|---|
| refresh(String uuid) | void | refresh 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.autocad.refresh("5ce6dd37-7472-404a-878e-274005a2d6db"); } catch (Exception e) { e.printStackTrace(); } }}