1 package com.netpotlet.nymph;
2
3 import java.util.Calendar;
4 import java.util.Date;
5
6 public class JdoGoods extends Goods {
7
8 private Date date;
9
10 public JdoGoods() {
11 super();
12 }
13
14 public JdoGoods(Goods goods) {
15 setId(goods.getId());
16 setSample(goods.getSample());
17 setCategory(goods.getCategory());
18 setPrice(goods.getPrice());
19 setName(goods.getName());
20 date = goods.getXmlDate().toDate();
21 setDescription(goods.getDescription());
22 }
23
24 public void setDate(Date date) {
25 this.date = date;
26 org.exolab.castor.types.Date
xmlDate =
27 new
org.exolab.castor.types.Date(date);
28 super.setXmlDate(xmlDate);
29 }
30
31 public void setDate(int year, int month, int date)
{
32 Calendar calendar = Calendar.getInstance();
33 calendar.set(year, month,
date);
34 this.date = calendar.getTime();
35 }
36
37 public Date getDate() {
38 if (date == null){
39 date
= super.getXmlDate().toDate();
40 }
41 return date;
42 }
43
44 public Goods getGoods() {
45 Goods goods = new Goods();
46 goods.setId(getId());
47 goods.setSample(getSample());
48 goods.setCategory(getCategory());
49 goods.setPrice(getPrice());
50 goods.setName(getName());
51 goods.setXmlDate(getXmlDate());
52 goods.setDescription(getDescription());
53 return goods;
54 }
55 }