001: package org.apache.ojb.broker;
002:
003: public class ArticleWithStockDetail implements java.io.Serializable {
004:
005: /** return a string representation of an article*/
006: public String toString() {
007: return "----\n" + "Article No: " + articleId + "\n"
008: + "Description: " + articleName + "\n"
009: + "stock: " + stock + "\n" + "price: "
010: + price + "\n" + "stock-value " + getStockValue()
011: + "\n";
012:
013: }
014:
015: /** maps to db-column "Artikel-Nr";INT;PrimaryKey*/
016: protected int articleId;
017: /** maps to db-column Artikelname;CHAR*/
018: protected String articleName;
019: /** maps to db-column Auslaufartikel;SMALL INT*/
020: boolean isSelloutArticle;
021: /** maps to db-column Mindestbestand;INT*/
022: int minimumStock;
023: /** maps to db-column BestellteEinheiten;INT*/
024: int orderedUnits;
025:
026: /** this attribute is not filled through a reference lookup but with a RowReader !*/
027: protected StockDetail stockDetail;
028:
029: /** maps to db-column Einzelpreis;DECIMAL*/
030: protected double price;
031: /** maps to db-column Kategorie-Nr;INT*/
032: protected int productGroupId;
033: /** maps to db-column Lagerbestand;INT*/
034: int stock;
035: /** maps to db-column Lieferanten-Nr;INT*/
036: protected int supplierId;
037: /** maps to db-column Liefereinheit;CHAR*/
038: String unit;
039:
040: /** increase the amount of articles in stock by diff*/
041: public void addToStock(int diff) {
042: stock += diff;
043: }
044:
045: /**
046: * return an articles unique id.
047: * @return int the articles unique id
048: */
049: public int getArticleId() {
050: return articleId;
051: }
052:
053: /**
054: * return an articles name.
055: * @return java.lang.String
056: */
057: public String getArticleName() {
058: return articleName;
059: }
060:
061: /** return an articles ProductGroup*/
062:
063: public double getStockValue() {
064: return price * stockDetail.getStock();
065: }
066:
067: /**
068: * set an articles unique id.
069: * @param newArticleId int
070: */
071: public void setArticleId(int newArticleId) {
072: articleId = newArticleId;
073: }
074:
075: /**
076: * set an articles name.
077: * @param newArticleName java.lang.String
078: */
079: public void setArticleName(String newArticleName) {
080: articleName = newArticleName;
081: }
082:
083: /**
084: * Insert the method's description here.
085: * Creation date: (05.01.2001 19:31:04)
086: */
087: public ArticleWithStockDetail() {
088: }
089:
090: /**
091: * Insert the method's description here.
092: * Creation date: (05.01.2001 19:21:38)
093: */
094: public ArticleWithStockDetail(int artId, String artName,
095: int suppId, int pgId, String uni, double pric, int sto,
096: int ordUnits, int minStock, boolean isSellout) {
097: articleId = artId;
098: articleName = artName;
099: supplierId = suppId;
100: productGroupId = pgId;
101: unit = uni;
102: price = pric;
103: stock = sto;
104: orderedUnits = ordUnits;
105: minimumStock = minStock;
106: isSelloutArticle = isSellout;
107: }
108:
109: /**
110: * Insert the method's description here.
111: * Creation date: (10.12.2000 14:40:04)
112: * @return boolean
113: */
114: public boolean getIsSelloutArticle() {
115: return isSelloutArticle;
116: }
117:
118: /**
119: * Insert the method's description here.
120: * Creation date: (10.12.2000 14:40:04)
121: * @return int
122: */
123: public int getMinimumStock() {
124: return minimumStock;
125: }
126:
127: /**
128: * Insert the method's description here.
129: * Creation date: (10.12.2000 14:40:04)
130: * @return int
131: */
132: public int getOrderedUnits() {
133: return orderedUnits;
134: }
135:
136: /**
137: * Insert the method's description here.
138: * Creation date: (10.12.2000 14:40:04)
139: * @return double
140: */
141: public double getPrice() {
142: return price;
143: }
144:
145: /**
146: * Insert the method's description here.
147: * Creation date: (10.12.2000 14:40:04)
148: * @return int
149: */
150: public int getProductGroupId() {
151: return productGroupId;
152: }
153:
154: /**
155: * Insert the method's description here.
156: * Creation date: (10.12.2000 14:40:04)
157: * @return int
158: */
159: public int getSupplierId() {
160: return supplierId;
161: }
162:
163: /**
164: * Insert the method's description here.
165: * Creation date: (10.12.2000 14:40:04)
166: * @return java.lang.String
167: */
168: public String getUnit() {
169: return unit;
170: }
171:
172: /**
173: * Insert the method's description here.
174: * Creation date: (10.12.2000 14:40:04)
175: * @param newIsSelloutArticle int
176: */
177: public void setIsSelloutArticle(boolean newIsSelloutArticle) {
178: isSelloutArticle = newIsSelloutArticle;
179: }
180:
181: /**
182: * Insert the method's description here.
183: * Creation date: (10.12.2000 14:40:04)
184: * @param newMinimumStock int
185: */
186: public void setMinimumStock(int newMinimumStock) {
187: minimumStock = newMinimumStock;
188: }
189:
190: /**
191: * Insert the method's description here.
192: * Creation date: (10.12.2000 14:40:04)
193: * @param newOrderedUnits int
194: */
195: public void setOrderedUnits(int newOrderedUnits) {
196: orderedUnits = newOrderedUnits;
197: }
198:
199: /**
200: * Insert the method's description here.
201: * Creation date: (10.12.2000 14:40:04)
202: * @param newPrice double
203: */
204: public void setPrice(double newPrice) {
205: price = newPrice;
206: }
207:
208: /**
209: * Insert the method's description here.
210: * Creation date: (10.12.2000 14:40:04)
211: * @param newProductGroupId int
212: */
213: public void setProductGroupId(int newProductGroupId) {
214: productGroupId = newProductGroupId;
215: }
216:
217: /**
218: * Insert the method's description here.
219: * Creation date: (10.12.2000 14:40:04)
220: * @param newSupplierId int
221: */
222: public void setSupplierId(int newSupplierId) {
223: supplierId = newSupplierId;
224: }
225:
226: /**
227: * Insert the method's description here.
228: * Creation date: (10.12.2000 14:40:04)
229: * @param newUnit java.lang.String
230: */
231: public void setUnit(String newUnit) {
232: unit = newUnit;
233: }
234:
235: public StockDetail getDetail() {
236: return stockDetail;
237: }
238:
239: /**
240: * Gets the stock.
241: * @return Returns a int
242: */
243: public int getStock() {
244: return stock;
245: }
246:
247: /**
248: * Sets the stock.
249: * @param stock The stock to set
250: */
251: public void setStock(int stock) {
252: this.stock = stock;
253: }
254:
255: }
|