001: /*
002: * Created on 27 mai 2004
003: *
004: * To change the template for this generated file go to
005: * Window - Preferences - Java - Code Generation - Code and Comments
006: */
007: package org.objectweb.speedo.pobjects.inheritance.ejboo2;
008:
009: import java.util.Collection;
010: import java.util.Date;
011: import java.util.HashSet;
012: import java.util.Iterator;
013:
014: import javax.jdo.InstanceCallbacks;
015: import javax.jdo.JDOHelper;
016: import javax.jdo.PersistenceManager;
017:
018: /**
019: * Persistent Data
020: */
021:
022: public abstract class ArticlePersistantImpl implements
023: ArticlePersistant, InstanceCallbacks {
024:
025: private Long id;
026:
027: private String nom;
028:
029: private String description;
030:
031: /**
032: * S=Service, M=Materiel.
033: */
034: private String type;
035:
036: /**
037: * Date de commande.
038: */
039: private Date dateCom;
040:
041: /**
042: * one many relation, reverse = articles
043: */
044: //private CataloguePersistant catalogue;
045: private CataloguePersistantImpl catalogue;
046:
047: /**
048: * many many relation, reverse = articles
049: */
050: private Collection marches;
051:
052: public ArticlePersistantImpl() {
053: marches = new HashSet();
054: }
055:
056: public ArticlePersistantImpl(String _type) {
057: this ();
058: this .type = _type;
059: }
060:
061: public ArticlePersistantImpl(String _type, long idart) {
062: this (_type);
063: this .id = new Long(idart);
064: }
065:
066: /**
067: * @return Returns the catalogue.
068: */
069: public CataloguePersistant getCatalogue() {
070: return catalogue;
071: }
072:
073: /**
074: * @param catalogue The catalogue to set.
075: */
076: public void setCatalogue(CataloguePersistant catalogue) {
077: this .catalogue = (CataloguePersistantImpl) catalogue;
078: }
079:
080: /**
081: * @return Returns the dateCom.
082: */
083: public Date getDateCom() {
084: return dateCom;
085: }
086:
087: /**
088: * @param dateCom The dateCom to set.
089: */
090: public void setDateCom(Date dateCom) {
091: this .dateCom = dateCom;
092: }
093:
094: /**
095: * @return Returns the description.
096: */
097: public String getDescription() {
098: return description;
099: }
100:
101: /**
102: * @param description The description to set.
103: */
104: public void setDescription(String description) {
105: this .description = description;
106: }
107:
108: /**
109: * @return Returns the id.
110: */
111: public Long getId() {
112: return id;
113: }
114:
115: /**
116: * @param id The id to set.
117: */
118: public void setId(Long id) {
119: this .id = id;
120: }
121:
122: /**
123: * @return Returns the marches.
124: */
125: public Collection getMarches() {
126: return marches;
127: }
128:
129: /**
130: * @param marches The marches to set.
131: */
132: public void setMarches(Collection marches) {
133: this .marches = marches;
134: }
135:
136: /**
137: * @return Returns the nom.
138: */
139: public String getNom() {
140: return nom;
141: }
142:
143: /**
144: * @param nom The nom to set.
145: */
146: public void setNom(String nom) {
147: this .nom = nom;
148: }
149:
150: /**
151: * @return Returns the type.
152: */
153: public String getType() {
154: return type;
155: }
156:
157: /**
158: * @param type The type to set.
159: */
160: public void setType(String type) {
161: this .type = type;
162: }
163:
164: public void supprimer() {
165: System.out.println("ArticlePersistantImpl.supprimer");
166: PersistenceManager pm = JDOHelper.getPersistenceManager(this );
167:
168: System.out.println("pm.deletePersistent(this)");
169: pm.deletePersistent(this );
170: }
171:
172: public void jdoPreDelete() {
173: //System.out.println("ArticlePersistantImpl.jdoPreDelete");
174: PersistenceManager pm = JDOHelper.getPersistenceManager(this );
175:
176: // remove article-catalogue relation
177: catalogue = null;
178:
179: // remove marches-articles relations
180: for (Iterator i = marches.iterator(); i.hasNext();) {
181: ((MarchePersistant) i.next()).getArticles().remove(this );
182: }
183:
184: // remove articles-marches relations
185: marches.clear();
186: }
187:
188: public void jdoPreStore() {
189:
190: }
191:
192: public void jdoPreClear() {
193:
194: }
195:
196: public void jdoPostLoad() {
197:
198: }
199:
200: public String toString() {
201: String s = new String(this .getClass().getName());
202: s += " id=" + id;
203: s += " nom=" + nom;
204: s += " description=" + description;
205: s += " type=" + type;
206: return s;
207: }
208: }
|