Initial commit
[smartapi.git] / Common / C++ / SmartAPI / smartapi / model / DependentPriceSpecification.cpp
1 #include "DependentPriceSpecification.h"
2
3 #include "smartapi/common/RESOURCE.h"
4 #include <QtDebug>
5
6 DependentPriceSpecification::DependentPriceSpecification(QString identifierUri) :
7         PriceSpecification(identifierUri)
8 {
9         INIT_PROPERTYLIST(mConditions, PROPERTY__LIST);
10         mConditions.setListType(List::ListLinked);
11 }
12
13 DependentPriceSpecification::DependentPriceSpecification(QString unit, QString secondaryUnit, QString secondaryQuantity, QDateTime validFrom, QDateTime validThrough) :
14         DependentPriceSpecification()
15 {
16         setQuantity(RESOURCE__CURRENCY);
17         setUnit(unit);
18         setSecondaryUnit(secondaryUnit);
19         setSecondaryQuantity(secondaryQuantity);
20         setValidFrom(validFrom);
21         setValidThrough(validThrough);
22 }
23
24 DependentPriceSpecification::DependentPriceSpecification(DependentPriceSpecification* o) :
25         PriceSpecification(o)
26 {
27         SET_PROPERTYLIST_REFERENCE(PROPERTY__LIST,mConditions,Condition);
28 }
29
30 DependentPriceSpecification::~DependentPriceSpecification()
31 {
32 }
33
34 void DependentPriceSpecification::clearReferences(QSet<GraphItem*>* trash)
35 {
36         INIT_CLEAR(PriceSpecification,trash);
37         FINISH_CLEAR(PriceSpecification,trash);
38 }
39
40 Resource* DependentPriceSpecification::serialize(Model* model)
41 {
42         INIT_SERIALIZE(PriceSpecification,model)
43         FINISH_SERIALIZE(PriceSpecification)
44 }
45
46 void DependentPriceSpecification::parse(Statement* statement)
47 {
48         INIT_PARSE(statement)
49 //    PARSE_LIST(PROPERTY__LIST, setConditions)
50     PARSE_LIST_AS(PROPERTY__LIST, setConditions, Condition)
51         FINISH_PARSE(PriceSpecification)
52 }
53
54 //PropertyList<Condition*> DependentPriceSpecification::getConditions()
55 //{
56 //    PropertyList<Condition*> ret;
57 //    for (int i = 0; i < mConditions.length(); i++) {
58 //        ret.append((Condition*)mConditions.at(i));
59 //    }
60 //    return ret;
61 //}