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