KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.ojb.broker;
2
3 public class ArticleWithNestedStockDetail implements java.io.Serializable JavaDoc
4 {
5     /** maps to db-column "Artikel-Nr";INT;PrimaryKey*/
6     protected int articleId;
7     /** maps to db-column Artikelname;CHAR*/
8     protected String JavaDoc articleName;
9  
10     /** this attribute is not filled through a reference lookup but with a RowReader !*/
11     protected StockDetail stockDetail;
12
13
14     /** maps to db-column Einzelpreis;DECIMAL*/
15     protected double price;
16     /** maps to db-column Kategorie-Nr;INT*/
17     protected int productGroupId;
18     /** maps to db-column Lieferanten-Nr;INT*/
19     protected int supplierId;
20
21     /** increase the amount of articles in stock by diff*/
22     public void addToStock(int diff)
23     {
24         stockDetail.stock += diff;
25     }
26
27     /**
28      * return an articles unique id.
29      * @return int the articles unique id
30      */

31     public int getArticleId()
32     {
33         return articleId;
34     }
35
36     /**
37      * return an articles name.
38      * @return java.lang.String
39      */

40     public String JavaDoc getArticleName()
41     {
42         return articleName;
43     }
44
45     /** return an articles ProductGroup*/
46
47     public double getStockValue()
48     {
49         return price * stockDetail.getStock();
50     }
51
52     /**
53      * set an articles unique id.
54      * @param newArticleId int
55      */

56     public void setArticleId(int newArticleId)
57     {
58         articleId = newArticleId;
59     }
60
61     /**
62      * set an articles name.
63      * @param newArticleName java.lang.String
64      */

65     public void setArticleName(String JavaDoc newArticleName)
66     {
67         articleName = newArticleName;
68     }
69
70     /**
71      * Insert the method's description here.
72      * Creation date: (05.01.2001 19:31:04)
73      */

74     public ArticleWithNestedStockDetail()
75     {
76     }
77
78     /**
79      * Insert the method's description here.
80      * Creation date: (10.12.2000 14:40:04)
81      * @return double
82      */

83     public double getPrice()
84     {
85         return price;
86     }
87
88
89     /**
90      * Insert the method's description here.
91      * Creation date: (10.12.2000 14:40:04)
92      * @return int
93      */

94     public int getProductGroupId()
95     {
96         return productGroupId;
97     }
98
99
100     /**
101      * Insert the method's description here.
102      * Creation date: (10.12.2000 14:40:04)
103      * @return int
104      */

105     public int getSupplierId()
106     {
107         return supplierId;
108     }
109
110
111     /**
112      * Insert the method's description here.
113      * Creation date: (10.12.2000 14:40:04)
114      * @param newPrice double
115      */

116     public void setPrice(double newPrice)
117     {
118         price = newPrice;
119     }
120
121
122     /**
123      * Insert the method's description here.
124      * Creation date: (10.12.2000 14:40:04)
125      * @param newProductGroupId int
126      */

127     public void setProductGroupId(int newProductGroupId)
128     {
129         productGroupId = newProductGroupId;
130     }
131
132
133     /**
134      * Insert the method's description here.
135      * Creation date: (10.12.2000 14:40:04)
136      * @param newSupplierId int
137      */

138     public void setSupplierId(int newSupplierId)
139     {
140         supplierId = newSupplierId;
141     }
142
143
144     public StockDetail getDetail()
145     {
146         return stockDetail;
147     }
148
149
150     /**
151      * Returns the stockDetail.
152      * @return StockDetail
153      */

154     public StockDetail getStockDetail()
155     {
156         return stockDetail;
157     }
158
159     /**
160      * Sets the stockDetail.
161      * @param stockDetail The stockDetail to set
162      */

163     public void setStockDetail(StockDetail stockDetail)
164     {
165         this.stockDetail = stockDetail;
166     }
167
168 }
169
Popular Tags