KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > golfShop > business > item > Item


1 /*
2  * Enhydra Java Application Server
3  * The Initial Developer of the Original Code is Lutris Technologies Inc.
4  * Portions created by Lutris are Copyright (C) 1997-2000 Lutris Technologies
5  * Inc.
6  * All Rights Reserved.
7  *
8  * The contents of this file are subject to the Enhydra Public License Version
9  * 1.0 (the "License"); you may not use this file except in compliance with the
10  * License. You may obtain a copy of the License at
11  * http://www.enhydra.org/software/license/epl.html
12  *
13  * Software distributed under the License is distributed on an "AS IS" basis,
14  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
15  * License for the specific language governing rights and limitations under the
16  * License.
17  *
18  *
19  */

20
21 package golfShop.business.item;
22
23
24 import golfShop.data.item.ItemDO;
25 import golfShop.spec.cart.CartItem;
26 /**
27  */

28 public class Item implements CartItem, java.io.Serializable JavaDoc {
29     private ItemDO itemDO;
30    
31     static public Item getItem(long ObjectId) {
32     return new Item(ItemDO.getItemByObjectId(ObjectId));
33     }
34  
35     /**
36      * Constructor
37      *
38      * @param itemDO An ItemDO data object.
39      */

40     public Item(ItemDO itemDO) {
41     this.itemDO = itemDO;
42     }
43
44     public String JavaDoc getName() {
45     return itemDO.getName();
46     }
47
48     // needs error-checking
49
public void setName(String JavaDoc name) {
50     itemDO.setName(name);
51     }
52
53     public String JavaDoc getDescription() {
54     return itemDO.getDescription();
55     }
56
57     // needs error-checking
58
public void setDescription(String JavaDoc description) {
59     itemDO.setDescription(description);
60     }
61
62     public long getObjectId()
63     {
64     return itemDO.getObjectId();
65     }
66
67     public double getPrice()
68     {
69     return itemDO.getPrice();
70     }
71
72     // needs error-checking
73
public void setPrice(double price)
74     {
75     itemDO.setPrice(price);
76     }
77
78     /*
79      * Generate info for debugging.
80      */

81     public String JavaDoc toString() {
82         return getName() + "|"
83             + getDescription() + "|"
84             + getObjectId() + "|"
85             + getPrice();
86     }
87 }
88
Popular Tags