KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > ArticleWithStockDetail


1 package org.apache.ojb.broker;
2
3 public class ArticleWithStockDetail implements java.io.Serializable JavaDoc
4 {
5
6     /** return a string representation of an article*/
7     public String JavaDoc toString()
8     {
9         return "----\n" +
10                 "Article No: " + articleId + "\n" +
11                 "Description: " + articleName + "\n" +
12                 "stock: " + stock + "\n" +
13                 "price: " + price + "\n" +
14                 "stock-value " + getStockValue() + "\n";
15
16     }
17
18     /** maps to db-column "Artikel-Nr";INT;PrimaryKey*/
19     protected int articleId;
20     /** maps to db-column Artikelname;CHAR*/
21     protected String JavaDoc articleName;
22     /** maps to db-column Auslaufartikel;SMALL INT*/
23     boolean isSelloutArticle;
24     /** maps to db-column Mindestbestand;INT*/
25     int minimumStock;
26     /** maps to db-column BestellteEinheiten;INT*/
27     int orderedUnits;
28
29     /** this attribute is not filled through a reference lookup but with a RowReader !*/
30     protected StockDetail stockDetail;
31
32
33     /** maps to db-column Einzelpreis;DECIMAL*/
34     protected double price;
35     /** maps to db-column Kategorie-Nr;INT*/
36     protected int productGroupId;
37     /** maps to db-column Lagerbestand;INT*/
38     int stock;
39     /** maps to db-column Lieferanten-Nr;INT*/
40     protected int supplierId;
41     /** maps to db-column Liefereinheit;CHAR*/
42     String JavaDoc unit;
43
44     /** increase the amount of articles in stock by diff*/
45     public void addToStock(int diff)
46     {
47         stock += diff;
48     }
49
50     /**
51      * return an articles unique id.
52      * @return int the articles unique id
53      */

54     public int getArticleId()
55     {
56         return articleId;
57     }
58
59     /**
60      * return an articles name.
61      * @return java.lang.String
62      */

63     public String JavaDoc getArticleName()
64     {
65         return articleName;
66     }
67
68     /** return an articles ProductGroup*/
69
70     public double getStockValue()
71     {
72         return price * stockDetail.getStock();
73     }
74
75     /**
76      * set an articles unique id.
77      * @param newArticleId int
78      */

79     public void setArticleId(int newArticleId)
80     {
81         articleId = newArticleId;
82     }
83
84     /**
85      * set an articles name.
86      * @param newArticleName java.lang.String
87      */

88     public void setArticleName(String JavaDoc newArticleName)
89     {
90         articleName = newArticleName;
91     }
92
93     /**
94      * Insert the method's description here.
95      * Creation date: (05.01.2001 19:31:04)
96      */

97     public ArticleWithStockDetail()
98     {
99     }
100
101     /**
102      * Insert the method's description here.
103      * Creation date: (05.01.2001 19:21:38)
104      */

105     public ArticleWithStockDetail(
106             int artId,
107             String JavaDoc artName,
108             int suppId,
109             int pgId,
110             String JavaDoc uni,
111             double pric,
112             int sto,
113             int ordUnits,
114             int minStock,
115             boolean isSellout)
116     {
117         articleId = artId;
118         articleName = artName;
119         supplierId = suppId;
120         productGroupId = pgId;
121         unit = uni;
122         price = pric;
123         stock = sto;
124         orderedUnits = ordUnits;
125         minimumStock = minStock;
126         isSelloutArticle = isSellout;
127     }
128
129     /**
130      * Insert the method's description here.
131      * Creation date: (10.12.2000 14:40:04)
132      * @return boolean
133      */

134     public boolean getIsSelloutArticle()
135     {
136         return isSelloutArticle;
137     }
138
139     /**
140      * Insert the method's description here.
141      * Creation date: (10.12.2000 14:40:04)
142      * @return int
143      */

144     public int getMinimumStock()
145     {
146         return minimumStock;
147     }
148
149     /**
150      * Insert the method's description here.
151      * Creation date: (10.12.2000 14:40:04)
152      * @return int
153      */

154     public int getOrderedUnits()
155     {
156         return orderedUnits;
157     }
158
159     /**
160      * Insert the method's description here.
161      * Creation date: (10.12.2000 14:40:04)
162      * @return double
163      */

164     public double getPrice()
165     {
166         return price;
167     }
168
169
170     /**
171      * Insert the method's description here.
172      * Creation date: (10.12.2000 14:40:04)
173      * @return int
174      */

175     public int getProductGroupId()
176     {
177         return productGroupId;
178     }
179
180
181     /**
182      * Insert the method's description here.
183      * Creation date: (10.12.2000 14:40:04)
184      * @return int
185      */

186     public int getSupplierId()
187     {
188         return supplierId;
189     }
190
191     /**
192      * Insert the method's description here.
193      * Creation date: (10.12.2000 14:40:04)
194      * @return java.lang.String
195      */

196     public String JavaDoc getUnit()
197     {
198         return unit;
199     }
200
201     /**
202      * Insert the method's description here.
203      * Creation date: (10.12.2000 14:40:04)
204      * @param newIsSelloutArticle int
205      */

206     public void setIsSelloutArticle(boolean newIsSelloutArticle)
207     {
208         isSelloutArticle = newIsSelloutArticle;
209     }
210
211     /**
212      * Insert the method's description here.
213      * Creation date: (10.12.2000 14:40:04)
214      * @param newMinimumStock int
215      */

216     public void setMinimumStock(int newMinimumStock)
217     {
218         minimumStock = newMinimumStock;
219     }
220
221     /**
222      * Insert the method's description here.
223      * Creation date: (10.12.2000 14:40:04)
224      * @param newOrderedUnits int
225      */

226     public void setOrderedUnits(int newOrderedUnits)
227     {
228         orderedUnits = newOrderedUnits;
229     }
230
231     /**
232      * Insert the method's description here.
233      * Creation date: (10.12.2000 14:40:04)
234      * @param newPrice double
235      */

236     public void setPrice(double newPrice)
237     {
238         price = newPrice;
239     }
240
241
242     /**
243      * Insert the method's description here.
244      * Creation date: (10.12.2000 14:40:04)
245      * @param newProductGroupId int
246      */

247     public void setProductGroupId(int newProductGroupId)
248     {
249         productGroupId = newProductGroupId;
250     }
251
252
253     /**
254      * Insert the method's description here.
255      * Creation date: (10.12.2000 14:40:04)
256      * @param newSupplierId int
257      */

258     public void setSupplierId(int newSupplierId)
259     {
260         supplierId = newSupplierId;
261     }
262
263     /**
264      * Insert the method's description here.
265      * Creation date: (10.12.2000 14:40:04)
266      * @param newUnit java.lang.String
267      */

268     public void setUnit(String JavaDoc newUnit)
269     {
270         unit = newUnit;
271     }
272
273     public StockDetail getDetail()
274     {
275         return stockDetail;
276     }
277     /**
278      * Gets the stock.
279      * @return Returns a int
280      */

281     public int getStock()
282     {
283         return stock;
284     }
285
286     /**
287      * Sets the stock.
288      * @param stock The stock to set
289      */

290     public void setStock(int stock)
291     {
292         this.stock = stock;
293     }
294
295 }
296
Popular Tags