C++: new COPY_PROPERTYLIST macro that actually copies a list, not just
[smartapi.git] / Common / C++ / SmartAPI / smartapi / model / Offering.cpp
1 #include "Offering.h"
2
3 #include "smartapi/common/PROPERTY.h"
4 #include "smartapi/common/RESOURCE.h"
5 #include "smartapi/common/Tools.h"
6 #include "smartapi/model/PriceSpecification.h"
7 #include "smartapi/model/SomeItems.h"
8
9
10 Offering::Offering(QString identifierUri)
11         : GrObj(identifierUri)
12 {
13         setType(RESOURCE__OFFERING);
14         INIT_PROPERTY(mBusinessFunction)
15         INIT_PROPERTYLIST(mPriceSpecifications,PROPERTY__HASPRICESPECIFICATION);
16         INIT_PROPERTYLIST(mIncludes,PROPERTY__INCLUDES);
17         INIT_PROPERTYLIST(mTypeAndQuantityNodes,PROPERTY__INCLUDESOBJECT);
18 }
19
20 Offering::Offering(QString identifierUri, QString name, QString description)
21         : Offering(identifierUri)
22 {
23         setType(RESOURCE__OFFERING);
24         setName(name);
25         setDescription(description);
26 }
27
28 Offering::Offering(Offering* o) : GrObj(o)
29 {
30         SET_PROPERTY_REFERENCE(PROPERTY__HASBUSINESSFUNCTION,mBusinessFunction,Variant);
31         SET_PROPERTYLIST_REFERENCE(PROPERTY__INCLUDES,mIncludes,SomeItems)
32         SET_PROPERTYLIST_REFERENCE(PROPERTY__INCLUDESOBJECT,mTypeAndQuantityNodes,TypeAndQuantityNode)
33         COPY_PROPERTYLIST(PROPERTY__HASPRICESPECIFICATION,mPriceSpecifications,PriceSpecification)
34         setType(RESOURCE__OFFERING);
35 }
36
37 Offering::~Offering()
38 {
39 }
40
41 void Offering::clearReferences(QSet<GraphItem*>* trash)
42 {
43         INIT_CLEAR(GrObj,trash);
44         FINISH_CLEAR(GrObj,trash);
45 }
46
47 Resource* Offering::serialize(Model *model)
48 {
49         INIT_SERIALIZE(GrObj,model)
50         FINISH_SERIALIZE(GrObj)
51 }
52
53 void Offering::parse(Statement* statement)
54 {
55         INIT_PARSE(statement)
56         PARSE_PROPERTY(PROPERTY__HASBUSINESSFUNCTION, setBusinessFunction, Variant)
57         PARSE_PROPERTY(PROPERTY__HASPRICESPECIFICATION, addPriceSpecification, PriceSpecification)
58         PARSE_PROPERTY(PROPERTY__INCLUDES, addIncludes, SomeItems)
59         PARSE_PROPERTY(PROPERTY__INCLUDESOBJECT, addTypeAndQuantityNode, TypeAndQuantityNode)
60         FINISH_PARSE(GrObj)
61 }