Prerequisites steps are:
- Create the parent object (a generic object)
- Add a first child to the parent object
- Add a second child to the parent object
- Create a child inside the first child of the parent object
1. Create the parent object. The identifier of the parent object (qId ) is ParentId and the type qType is Parent.
The client sends:
{
"jsonrpc": "2.0",
"id": 2,
"method": "CreateSessionObject",
"handle": 1,
"params": [
{
"qInfo": {
"qId": "ParentId",
"qType": "Parent"
},
"qChildListDef": {
"qData": {
"id": "qInfo/qId"
}
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 2
}
},
"change": [
2
]
}
The parent object is created. Its handle is 2 (qHandle is 2).
2. Add a first child (qId is Child01 and qType is Child) to the parent object. The handle of the request is 2 because the handle of the parent object is 2.
The client sends:
{
"jsonrpc": "2.0",
"id": 3,
"method": "CreateChild",
"handle": 2,
"params": [
{
"qInfo": {
"qId": "Child01",
"qType": "Child"
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 3
},
"qInfo": {
"qId": "Child01",
"qType": "Child"
}
},
"change": [
3
]
}
The child Child01 is created. Its handle is 3.
3. Add a second child (qId is Child02 and qType is Child).
The client sends:
{
"jsonrpc": "2.0",
"id": 4,
"method": "CreateChild",
"handle": 2,
"params": [
{
"qInfo": {
"qId": "Child02",
"qType": "Child"
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 4,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 4
},
"qInfo": {
"qId": "Child02",
"qType": "Child"
}
},
"change": [
4
]
}
The child Child02 is created. Its handle is 4.
4. Add a child to the child Child01. The handle of the request is 3 because the handle of the child Child01 is 3. The identifier (qId) of the child is Child0101.
The client sends:
{
"jsonrpc": "2.0",
"id": 5,
"method": "CreateChild",
"handle": 3,
"params": [
{
"qInfo": {
"qId": "Child0101",
"qType": "Child"
}
}
]
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 5,
"result": {
"qReturn": {
"qType": "GenericObject",
"qHandle": 5
},
"qInfo": {
"qId": "Child0101",
"qType": "Child"
}
},
"change": [
5
]
}
The child Child0101 is created. Its handle is 5.
5. Get the layout of the parent object. The handle is 2.
The client sends:
{
"jsonrpc": "2.0",
"id": 6,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 6,
"result": {
"qLayout": {
"qInfo": {
"qId": "ParentId",
"qType": "Parent"
},
"qSelectionInfo": {},
"qChildList": {
"qItems": [
{
"qInfo": {
"qId": "Child01",
"qType": "Child"
},
"qData": {
"id": ""
}
},
{
"qInfo": {
"qId": "Child02",
"qType": "Child"
},
"qData": {
"id": ""
}
}
]
}
}
}
}
The parent object contains two children: Child01 and Child02.
6. List the children of the child Child01. The handle of the child is 3.
The client sends:
{
"jsonrpc": "2.0",
"id": 7,
"method": "GetChildInfos",
"handle": 3,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"qInfos": [
{
"qId": "Child0101",
"qType": "Child"
}
]
}
}
Child0101 is a child of Child01.
7. Remove all the children of the parent object. The handle of the parent object is 2.
The client sends:
{
"jsonrpc": "2.0",
"id": 8,
"method": "DestroyAllChildren",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 8,
"result": {},
"change": [
2
],
"close": [
3,
4,
5
]
}
All the children are removed:
- Child 01 (handle 3)
- Child 02 (handle 4)
- Child0101 (handle 5)
8. Check that the layout of the parent object (handle is 2) is empty.
The client sends:
{
"jsonrpc": "2.0",
"id": 9,
"method": "GetLayout",
"handle": 2,
"params": []
}
The engine returns:
{
"jsonrpc": "2.0",
"id": 9,
"result": {
"qLayout": {
"qInfo": {
"qId": "ParentId",
"qType": "Parent"
},
"qSelectionInfo": {},
"qChildList": {
"qItems": []
}
}
}
}
The children are no more listed in the layout of the parent object.