i
Value Lists
All value lists have the same structure and are administrated by a single model class and a single service class, which are included in Deyel SDK.
The model class contains properties with getters and setters, while the service class contains the operations to be performed with the model.
The "ValueList" model class has the value list structure, while the "ValueListData" model class has the data.
ValueList Model Class Content
The "ValueList" model contains:
•Model constructor.
•Getters and setters to access its properties.
•ValueListData Collection.
ValueListData Model Class Content
This class is in a "Value list" model class collection. It represents each of the values in the value list.
The "ValueListData" model contains:
•Model constructor.
•Getters and setters to access its properties.
ValueListService Service Class Content
The service allows to read the value list.
Operation |
Description |
Parameters |
---|---|---|
read(valuelist) |
Reads the value list data received as a parameter.
|
valuelist: Value list model class |
Example of Use
In order to use this example, model the “States” value list in Deyel and previously enter the values to this list.
Read these values using Deyel SDK classes, which retrieve the following:
Code |
Descriptive Value |
Low Logic |
---|---|---|
1 |
Active |
False |
2 |
Inactive |
False |
3 |
On Hold |
True |
To read the value list, instantiate the “ValueListService” service. The "ValueList" model class is instantiated and the value of the identifier property of the list to be read is indicated, using the corresponding setters.
This instance is read using the read(valueList) method of the “ValueListService” service class. The instance contains all its properties which can be shown using the corresponding getters.
To read the data, access the “ValueListData” list with the corresponding getters of the “ValueList” model class.
Having the "ValueListData" list, it is possible to iterate through it to retrieve some or all of its values. This example retrieves the first value.
ValueListService valueListService = new ValueListService(getApiClient());
ValueList valueList = new ValueList(); valueList.setId("id_value_list");
valueList = valueListService.read(valueList);
valueList.getDsDisplayName(); valueList.getDsName();
List <ValueListData> valueListData = valueList.getValueListData();
ValueListData firstValue = valueListData.get(0);
Integer code = firstValue.getCode(); // code = 1 String value= firstValue.getValue(); // value = “Active” Boolean isDeleted = firstValue.getDeleted(); // isDeleted = false
|