AutoCAD samples

Basics

Example of uuid:

  • Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";

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);

Once you are logged with the webservices the session is keep in the webservice Object. Then you can use the other API method

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

getXRefs

Description:

MethodReturn valuesDescription

getXRefs(String uuid)

List<XRef>

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

Description:

MethodReturn valuesDescription

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();
        }
    }
}