KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.ojb.broker;
2
3 /**
4  * @ojb.class generate-table-info="false"
5  */

6 public abstract class AbstractArticle implements InterfaceArticle, java.io.Serializable JavaDoc
7 {
8
9     /** return a string representaion of an article*/
10     public String JavaDoc toString()
11     {
12         String JavaDoc groupId = "" + productGroupId;
13         String JavaDoc groupName = productGroup != null ? productGroup.getName() : null;
14
15         return "----\n" +
16                 "Article No: " + articleId + "\n" +
17                 "Description: " + articleName + "\n" +
18                 "ProductGroupId: " + groupId + "\n" +
19                 "ProductGroupName: " + groupName + "\n" +
20                 "stock: " + stock + "\n" +
21                 "price: " + price + "\n" +
22                 "stock-value " + getStockValue() + "\n";
23
24     }
25
26     /** maps to db-column "Artikel-Nr";INT;PrimaryKey*/
27     protected Integer JavaDoc articleId;
28     /** maps to db-column Artikelname;CHAR*/
29     protected String JavaDoc articleName;
30
31     /**
32      * maps to db-column Auslaufartikel;SMALL INT
33      * @ojb.field column="Auslaufartikel"
34      * jdbc-type="INTEGER"
35      * conversion="org.apache.ojb.broker.accesslayer.conversions.Boolean2IntFieldConversion"
36      * id="10"
37      * @ojb.attribute attribute-name="color"
38      * attribute-value="green"
39      * @ojb.attribute attribute-name="size"
40      * attribute-value="small"
41      */

42     protected boolean isSelloutArticle;
43     /** maps to db-column Mindestbestand;INT*/
44     protected int minimumStock;
45     /** maps to db-column BestellteEinheiten;INT*/
46     protected int orderedUnits;
47     /** maps to db-column Einzelpreis;DECIMAL*/
48     protected double price;
49     /** reference to the articles category*/
50     protected InterfaceProductGroup productGroup;
51     /** maps to db-column Kategorie-Nr;INT*/
52     protected Integer JavaDoc productGroupId;
53     /** maps to db-column Lagerbestand;INT*/
54     protected int stock;
55     /** maps to db-column Lieferanten-Nr;INT*/
56     protected int supplierId;
57     /** maps to db-column Liefereinheit;CHAR*/
58     protected String JavaDoc unit;
59
60     /**
61      * Insert the method's description here.
62      * Creation date: (05.01.2001 19:31:04)
63      */

64     public AbstractArticle()
65     {
66     }
67
68     /**
69      * return an articles unique id.
70      * @return the articles unique id
71      */

72     public Integer JavaDoc getArticleId()
73     {
74         return articleId;
75     }
76
77     /**
78      * set an articles unique id.
79      * @param newArticleId int
80      */

81     public void setArticleId(Integer JavaDoc newArticleId)
82     {
83         articleId = newArticleId;
84     }
85
86     public void setProductGroup(InterfaceProductGroup newProductGroup)
87     {
88         productGroup = newProductGroup;
89     }
90
91     public void setProductGroupId(Integer JavaDoc newProductGroupId)
92     {
93         productGroupId = newProductGroupId;
94     }
95
96     public InterfaceProductGroup getProductGroup()
97     {
98         return productGroup;
99     } /** compute the total value of an articles stock*/
100
101     public Integer JavaDoc getProductGroupId()
102     {
103         return productGroupId;
104     }
105
106     /** increase the amount of articles in stock by diff*/
107     public void addToStock(int diff)
108     {
109         stock += diff;
110     }
111
112     /**
113      * return an articles name.
114      * @return java.lang.String
115      */

116     public String JavaDoc getArticleName()
117     {
118         return articleName;
119     }
120
121     /** return an articles ProductGroup*/
122
123     public double getStockValue()
124     {
125         return price * stock;
126     }
127
128     /**
129      * set an articles name.
130      * @param newArticleName java.lang.String
131      */

132     public void setArticleName(java.lang.String JavaDoc newArticleName)
133     {
134         articleName = newArticleName;
135     }
136
137     /**
138      * Insert the method's description here.
139      * Creation date: (10.12.2000 14:40:04)
140      * @return boolean
141      */

142     public boolean getIsSelloutArticle()
143     {
144         return isSelloutArticle;
145     }
146
147     /**
148      * Insert the method's description here.
149      * Creation date: (10.12.2000 14:40:04)
150      * @return int
151      */

152     public int getMinimumStock()
153     {
154         return minimumStock;
155     }
156
157     /**
158      * Insert the method's description here.
159      * Creation date: (10.12.2000 14:40:04)
160      * @return int
161      */

162     public int getOrderedUnits()
163     {
164         return orderedUnits;
165     }
166
167     /**
168      * Insert the method's description here.
169      * Creation date: (10.12.2000 14:40:04)
170      * @return double
171      */

172     public double getPrice()
173     {
174         return price;
175     }
176
177     /**
178      * Insert the method's description here.
179      * Creation date: (10.12.2000 14:40:04)
180      * @return int
181      */

182     public int getStock()
183     {
184         return stock;
185     }
186
187     /**
188      * Insert the method's description here.
189      * Creation date: (10.12.2000 14:40:04)
190      * @return int
191      */

192     public int getSupplierId()
193     {
194         return supplierId;
195     }
196
197     /**
198      * Insert the method's description here.
199      * Creation date: (10.12.2000 14:40:04)
200      * @return java.lang.String
201      */

202     public java.lang.String JavaDoc getUnit()
203     {
204         return unit;
205     }
206
207     /**
208      * Insert the method's description here.
209      * Creation date: (10.12.2000 14:40:04)
210      * @param newIsSelloutArticle int
211      */

212     public void setIsSelloutArticle(boolean newIsSelloutArticle)
213     {
214         isSelloutArticle = newIsSelloutArticle;
215     }
216
217     /**
218      * Insert the method's description here.
219      * Creation date: (10.12.2000 14:40:04)
220      * @param newMinimumStock int
221      */

222     public void setMinimumStock(int newMinimumStock)
223     {
224         minimumStock = newMinimumStock;
225     }
226
227     /**
228      * Insert the method's description here.
229      * Creation date: (10.12.2000 14:40:04)
230      * @param newOrderedUnits int
231      */

232     public void setOrderedUnits(int newOrderedUnits)
233     {
234         orderedUnits = newOrderedUnits;
235     }
236
237     /**
238      * Insert the method's description here.
239      * Creation date: (10.12.2000 14:40:04)
240      * @param newPrice double
241      */

242     public void setPrice(double newPrice)
243     {
244         price = newPrice;
245     }
246
247     /**
248      * Insert the method's description here.
249      * Creation date: (10.12.2000 14:40:04)
250      * @param newStock int
251      */

252     public void setStock(int newStock)
253     {
254         stock = newStock;
255     }
256
257     /**
258      * Insert the method's description here.
259      * Creation date: (10.12.2000 14:40:04)
260      * @param newSupplierId int
261      */

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

272     public void setUnit(java.lang.String JavaDoc newUnit)
273     {
274         unit = newUnit;
275     }
276 }
277
Popular Tags