001: package org.apache.ojb.broker;
002:
003: public class ArticleWithNestedStockDetail implements
004: java.io.Serializable {
005: /** maps to db-column "Artikel-Nr";INT;PrimaryKey*/
006: protected int articleId;
007: /** maps to db-column Artikelname;CHAR*/
008: protected String articleName;
009:
010: /** this attribute is not filled through a reference lookup but with a RowReader !*/
011: protected StockDetail stockDetail;
012:
013: /** maps to db-column Einzelpreis;DECIMAL*/
014: protected double price;
015: /** maps to db-column Kategorie-Nr;INT*/
016: protected int productGroupId;
017: /** maps to db-column Lieferanten-Nr;INT*/
018: protected int supplierId;
019:
020: /** increase the amount of articles in stock by diff*/
021: public void addToStock(int diff) {
022: stockDetail.stock += diff;
023: }
024:
025: /**
026: * return an articles unique id.
027: * @return int the articles unique id
028: */
029: public int getArticleId() {
030: return articleId;
031: }
032:
033: /**
034: * return an articles name.
035: * @return java.lang.String
036: */
037: public String getArticleName() {
038: return articleName;
039: }
040:
041: /** return an articles ProductGroup*/
042:
043: public double getStockValue() {
044: return price * stockDetail.getStock();
045: }
046:
047: /**
048: * set an articles unique id.
049: * @param newArticleId int
050: */
051: public void setArticleId(int newArticleId) {
052: articleId = newArticleId;
053: }
054:
055: /**
056: * set an articles name.
057: * @param newArticleName java.lang.String
058: */
059: public void setArticleName(String newArticleName) {
060: articleName = newArticleName;
061: }
062:
063: /**
064: * Insert the method's description here.
065: * Creation date: (05.01.2001 19:31:04)
066: */
067: public ArticleWithNestedStockDetail() {
068: }
069:
070: /**
071: * Insert the method's description here.
072: * Creation date: (10.12.2000 14:40:04)
073: * @return double
074: */
075: public double getPrice() {
076: return price;
077: }
078:
079: /**
080: * Insert the method's description here.
081: * Creation date: (10.12.2000 14:40:04)
082: * @return int
083: */
084: public int getProductGroupId() {
085: return productGroupId;
086: }
087:
088: /**
089: * Insert the method's description here.
090: * Creation date: (10.12.2000 14:40:04)
091: * @return int
092: */
093: public int getSupplierId() {
094: return supplierId;
095: }
096:
097: /**
098: * Insert the method's description here.
099: * Creation date: (10.12.2000 14:40:04)
100: * @param newPrice double
101: */
102: public void setPrice(double newPrice) {
103: price = newPrice;
104: }
105:
106: /**
107: * Insert the method's description here.
108: * Creation date: (10.12.2000 14:40:04)
109: * @param newProductGroupId int
110: */
111: public void setProductGroupId(int newProductGroupId) {
112: productGroupId = newProductGroupId;
113: }
114:
115: /**
116: * Insert the method's description here.
117: * Creation date: (10.12.2000 14:40:04)
118: * @param newSupplierId int
119: */
120: public void setSupplierId(int newSupplierId) {
121: supplierId = newSupplierId;
122: }
123:
124: public StockDetail getDetail() {
125: return stockDetail;
126: }
127:
128: /**
129: * Returns the stockDetail.
130: * @return StockDetail
131: */
132: public StockDetail getStockDetail() {
133: return stockDetail;
134: }
135:
136: /**
137: * Sets the stockDetail.
138: * @param stockDetail The stockDetail to set
139: */
140: public void setStockDetail(StockDetail stockDetail) {
141: this.stockDetail = stockDetail;
142: }
143:
144: }
|