KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > pobjects > inheritance > ejboo2 > ArticlePersistantImpl


1 /*
2  * Created on 27 mai 2004
3  *
4  * To change the template for this generated file go to
5  * Window - Preferences - Java - Code Generation - Code and Comments
6  */

7 package org.objectweb.speedo.pobjects.inheritance.ejboo2;
8
9 import java.util.Collection JavaDoc;
10 import java.util.Date JavaDoc;
11 import java.util.HashSet JavaDoc;
12 import java.util.Iterator JavaDoc;
13
14 import javax.jdo.InstanceCallbacks;
15 import javax.jdo.JDOHelper;
16 import javax.jdo.PersistenceManager;
17
18
19 /**
20  * Persistent Data
21  */

22
23 public abstract class ArticlePersistantImpl
24         implements ArticlePersistant, InstanceCallbacks {
25
26     private Long JavaDoc id;
27
28     private String JavaDoc nom;
29
30     private String JavaDoc description;
31
32     /**
33      * S=Service, M=Materiel.
34      */

35     private String JavaDoc type;
36
37     /**
38      * Date de commande.
39      */

40     private Date JavaDoc dateCom;
41
42     /**
43     * one many relation, reverse = articles
44     */

45     //private CataloguePersistant catalogue;
46
private CataloguePersistantImpl catalogue;
47
48     /**
49     * many many relation, reverse = articles
50     */

51     private Collection JavaDoc marches;
52
53
54
55     public ArticlePersistantImpl() {
56         marches = new HashSet JavaDoc();
57     }
58
59     public ArticlePersistantImpl(String JavaDoc _type) {
60         this();
61         this.type = _type;
62     }
63
64     public ArticlePersistantImpl(String JavaDoc _type, long idart) {
65         this(_type);
66         this.id = new Long JavaDoc(idart);
67     }
68
69     /**
70      * @return Returns the catalogue.
71      */

72     public CataloguePersistant getCatalogue() {
73         return catalogue;
74     }
75     /**
76      * @param catalogue The catalogue to set.
77      */

78     public void setCatalogue(CataloguePersistant catalogue) {
79         this.catalogue = (CataloguePersistantImpl)catalogue;
80     }
81     /**
82      * @return Returns the dateCom.
83      */

84     public Date JavaDoc getDateCom() {
85         return dateCom;
86     }
87     /**
88      * @param dateCom The dateCom to set.
89      */

90     public void setDateCom(Date JavaDoc dateCom) {
91         this.dateCom = dateCom;
92     }
93     /**
94      * @return Returns the description.
95      */

96     public String JavaDoc getDescription() {
97         return description;
98     }
99     /**
100      * @param description The description to set.
101      */

102     public void setDescription(String JavaDoc description) {
103         this.description = description;
104     }
105     /**
106      * @return Returns the id.
107      */

108     public Long JavaDoc getId() {
109         return id;
110     }
111     /**
112      * @param id The id to set.
113      */

114     public void setId(Long JavaDoc id) {
115         this.id = id;
116     }
117     /**
118      * @return Returns the marches.
119      */

120     public Collection JavaDoc getMarches() {
121         return marches;
122     }
123     /**
124      * @param marches The marches to set.
125      */

126     public void setMarches(Collection JavaDoc marches) {
127         this.marches = marches;
128     }
129     /**
130      * @return Returns the nom.
131      */

132     public String JavaDoc getNom() {
133         return nom;
134     }
135     /**
136      * @param nom The nom to set.
137      */

138     public void setNom(String JavaDoc nom) {
139         this.nom = nom;
140     }
141     /**
142      * @return Returns the type.
143      */

144     public String JavaDoc getType() {
145         return type;
146     }
147     /**
148      * @param type The type to set.
149      */

150     public void setType(String JavaDoc type) {
151         this.type = type;
152     }
153
154     public void supprimer() {
155         System.out.println("ArticlePersistantImpl.supprimer");
156         PersistenceManager pm = JDOHelper.getPersistenceManager(this);
157
158         System.out.println("pm.deletePersistent(this)");
159         pm.deletePersistent(this);
160     }
161
162     public void jdoPreDelete() {
163         //System.out.println("ArticlePersistantImpl.jdoPreDelete");
164
PersistenceManager pm = JDOHelper.getPersistenceManager(this);
165
166         // remove article-catalogue relation
167
catalogue = null;
168
169         // remove marches-articles relations
170
for (Iterator JavaDoc i = marches.iterator(); i.hasNext();) {
171             ((MarchePersistant) i.next()).getArticles().remove(this);
172         }
173
174         // remove articles-marches relations
175
marches.clear();
176     }
177
178     public void jdoPreStore() {
179
180     }
181     public void jdoPreClear() {
182
183     }
184     public void jdoPostLoad() {
185
186     }
187
188     public String JavaDoc toString() {
189         String JavaDoc s = new String JavaDoc(this.getClass().getName());
190         s += " id="+id;
191         s += " nom="+nom;
192         s += " description="+description;
193         s += " type="+type;
194         return s;
195     }
196 }
197
Popular Tags