blob: 6e60102d9f8a92da3a1f9d5cee8b08eb413240f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#include "XJsonObjectImp.h"
XJsonObjectImp::XJsonObjectImp(const XString& objectName,
const XArrayOfXJsonObjectInstance& objectInstances
):
objectInstances_(objectInstances),
objectName_(objectName)
{
}
void XJsonObjectImp::setObjectSchema(const XString& objectSchema)
{
comVals_["objectSchema"] = objectSchema;
}
void XJsonObjectImp::setObjectName(const XString& objectName)
{
comVals_["objectName"] = objectName;
}
void XJsonObjectImp::setNfSubscriptionId(const XString& nfSubscriptionId)
{
comVals_["nfSubscriptionId"] = nfSubscriptionId;
}
void XJsonObjectImp::setObjectInstances(const XArrayOfXJsonObjectInstance& objectInstances)
{
objectInstances_ = objectInstances;
}
void XJsonObjectImp::setNfSubscribedObjectName(const XString& nfSubscribedObjectName)
{
comVals_["nfSubscribedObjectName"] = nfSubscribedObjectName;
}
void XJsonObjectImp::setObjectSchemaUrl(const XString& objectSchemaUrl)
{
comVals_["objectSchemaUrl"] = objectSchemaUrl;
}
json XJsonObjectImp::toJson()
{
try
{
json field = {
{"objectName", objectName_}
};
field["objectInstances"] = fromArray(objectInstances_);
//optional val
field = mergeCommonValues(field, comVals_);
return field;
}
catch (json::exception& e)
{
SPDLOG_ERROR("Fail to build XJsonObject to json object:{}.", e.what());
return json();
}
}
|