Example connector usage

Connector object

To retrieve connection to DOCUframe we need to set up RemoteData object. This object need to have an information about user name, password (md5 hash), api key and url to the web service.

1
2
3
4
5
6
    GSDRemoteData connector = new GSDRemoteData(
        GSDConnectorActivity.this, 
        "http://172.16.17.30:15151/", 
        "sampleUser", 
        "aab185a0b33d014157e1519445587d1f", 
        "124333453456");

By default connection is done with use of SSL, to disable it you need to execute:

1
    connector.disableSSL();

Object

Get object

We have prepared and API that will give you a possibility to fetch objects directly from database. To achieve this you need to know exact OID of an object that you want to get from DOCUframe. Before you will be able to get this object from database you need to prepare model class that will be equivalent to DOCUframe class. If you want to use different name of field in your java object you can achieve this by using annotation before field @SerializedName("here you put original field name").

For getting object you need few parameters: * oid of an object * class that is an representation of result object (and equivalent of DOCUframe object) * callback (object that will give you an feedback about execution)

Example of model class:

1
2
3
4
5
public class SampleModel{
    String name;
    @SerializedName("name2")
    String surname;
}

Example of get object call:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
    GSDRemoteData connector = new GSDRemoteData(
        GSDConnectorActivity.this, 
        "http://172.16.17.30:15151/", 
        "sampleUser", 
        "aab185a0b33d014157e1519445587d1f", 
        "124333453456");

    connector.getObject(
        "3ER3", 
        SampleModel.class, 
        new NetDataLoadCallback<SampleModel>() {
            @Override
            public void success(SampleModel myObject) {
                //here we have got our object
            }

            @Override
            public void error(String message) {
                //executed in situation when something goes wrong.
            }
    });

Create object

Modify object

Delete object

Object list

Get object list

Modify object list

Remove elements from list

Macro

Execute macro

Our networking API gives a possibility to execute interface macros in DOCUframe. If you want to execute one, you need to provide some basic informations. Most important data to execute macro are:

  • macro name
  • input data (recommended is JSON)
  • class of an object that should be received after execution
  • callback (object that will give you an feedback about execution)

We have got two requirements for execution of macros. you need to prepare you model class that will be given as part of macro execution in the way it will fit to the JSON that you return from macro. And the second requirement is that all data connection should be done by JSON format.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
    GSDRemoteData connector = new GSDRemoteData(
        GSDConnectorActivity.this, 
        "http://172.16.17.30:15151/", 
        "sampleUser", 
        "aab185a0b33d014157e1519445587d1f", 
        "124333453456");

    connector.executeMacro(
        "InterfaceMacroName", 
        "{\"ObjectOID\":\"60VB\", \"StartTime\":\"20140706\", \"EndTime\": \"20180706\"}", 
        SampleModel.class, 
        new NetDataLoadCallback<SampleModel>() {
            @Override
            public void success(SampleModel myObject) {
                //here we have got our object
            }

            @Override
            public void error(String message) {
                //executed in situation when something goes wrong.
            }
    });