KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > ipanema > accounting > PriceFragment


1 /*
2  * Created on 30.10.2004
3  */

4 package com.nightlabs.ipanema.accounting;
5
6 import java.io.Serializable JavaDoc;
7
8
9 /**
10  * PriceFragments are optional, that means the sum of all priceFragments is usually
11  * less or equal the total price. It may theoretically happen that a fragment
12  * is negative and therefor the sum of the known fragments might be greater
13  * than the total price.
14  *
15  * @author Marco Schulze - marco at nightlabs dot de
16  *
17  * @jdo.persistence-capable
18  * identity-type = "application"
19  * objectid-class = "com.nightlabs.ipanema.accounting.id.PriceFragmentID"
20  * detachable = "true"
21  *
22  * @jdo.inheritance strategy = "new-table"
23  */

24 public class PriceFragment
25     implements Serializable JavaDoc
26 {
27     /**
28      * @jdo.field primary-key="true"
29      * @jdo.column length="100"
30      */

31     private String JavaDoc organisationID;
32     
33     /**
34      * @jdo.field primary-key="true"
35      */

36     private long priceConfigID;
37
38     /**
39      * @jdo.field primary-key="true"
40      */

41     private long priceID;
42
43     /**
44      * @jdo.field primary-key="true"
45      * @jdo.column length="100"
46      */

47     private String JavaDoc priceFragmentTypeOrganisationID;
48     
49     /**
50      * @jdo.field primary-key="true"
51      * @jdo.column length="100"
52      */

53     private String JavaDoc priceFragmentTypeID;
54
55     private PriceFragmentType priceFragmentType;
56
57     private Price price;
58
59     private Currency currency;
60
61     private long amount = 0;
62
63     protected PriceFragment() { }
64
65     public PriceFragment(Price price, PriceFragmentType priceFragmentType)
66     {
67         this.price = price;
68         this.organisationID = price.getOrganisationID();
69         this.priceConfigID = price.getPriceConfigID();
70         this.priceID = price.getPriceID();
71         this.currency = price.getCurrency();
72         this.priceFragmentTypeOrganisationID = priceFragmentType.getOrganisationID();
73         this.priceFragmentTypeID = priceFragmentType.getPriceFragmentTypeID();
74         this.priceFragmentType = priceFragmentType;
75     }
76
77     public PriceFragment(Price price, PriceFragment origPriceFragment)
78     {
79         this.price = price;
80         this.organisationID = price.getOrganisationID();
81         this.priceConfigID = price.getPriceConfigID();
82         this.priceID = price.getPriceID();
83         this.currency = price.getCurrency();
84         this.priceFragmentTypeOrganisationID = origPriceFragment.priceFragmentTypeOrganisationID;
85         this.priceFragmentTypeID = origPriceFragment.getPriceFragmentTypeID();
86         this.priceFragmentType = origPriceFragment.getPriceFragmentType();
87         this.amount = origPriceFragment.getAmount();
88     }
89
90     /**
91      * @return Returns the organisationID.
92      */

93     public String JavaDoc getOrganisationID()
94     {
95         return organisationID;
96     }
97     /**
98      * @return Returns the priceConfigID.
99      */

100     public long getPriceConfigID()
101     {
102         return priceConfigID;
103     }
104     /**
105      * @return Returns the priceID.
106      */

107     public long getPriceID()
108     {
109         return priceID;
110     }
111     /**
112      * @return Returns the priceFragmentTypeOrganisationID.
113      */

114     public String JavaDoc getPriceFragmentTypeOrganisationID()
115     {
116         return priceFragmentTypeOrganisationID;
117     }
118     /**
119      * @return Returns the priceFragmentTypeID.
120      */

121     public String JavaDoc getPriceFragmentTypeID()
122     {
123         return priceFragmentTypeID;
124     }
125     /**
126      * @return Returns the priceFragmentType.
127      */

128     public PriceFragmentType getPriceFragmentType()
129     {
130         return priceFragmentType;
131     }
132     /**
133      * @return Returns the amount.
134      */

135     public long getAmount()
136     {
137         return amount;
138     }
139     /**
140      * @param amount The amount to set.
141      */

142     public void setAmount(long amount)
143     {
144         this.amount = amount;
145     }
146 }
147
Popular Tags