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.HashSet;
011:
012: import javax.jdo.JDOHelper;
013: import javax.jdo.PersistenceManager;
014:
015: /**
016: * Persistent Data
017: */
018:
019: public class CataloguePersistantImpl implements CataloguePersistant {
020:
021: private Long id;
022:
023: private String nom;
024:
025: private String description;
026:
027: /**
028: * Constructor
029: * @param id
030: */
031: public CataloguePersistantImpl() {
032: this .articles = new HashSet();
033: }
034:
035: public CataloguePersistantImpl(long idcat) {
036: this ();
037: id = new Long(idcat);
038: }
039:
040: /**
041: * one many relation, reverse = catalogue
042: */
043: private Collection articles;
044:
045: /**
046: * @return Returns the articles.
047: */
048: public Collection getArticles() {
049: return articles;
050: }
051:
052: /**
053: * @param articles The articles to set.
054: */
055: public void setArticles(Collection articles) {
056: this .articles = articles;
057: }
058:
059: /**
060: * @return Returns the description.
061: */
062: public String getDescription() {
063: return description;
064: }
065:
066: /**
067: * @param description The description to set.
068: */
069: public void setDescription(String description) {
070: this .description = description;
071: }
072:
073: /**
074: * @return Returns the id.
075: */
076: public Long getId() {
077: return id;
078: }
079:
080: /**
081: * @param id The id to set.
082: */
083: public void setId(Long id) {
084: this .id = id;
085: }
086:
087: /**
088: * @return Returns the nom.
089: */
090: public String getNom() {
091: return nom;
092: }
093:
094: /**
095: * @param nom The nom to set.
096: */
097: public void setNom(String nom) {
098: this .nom = nom;
099: }
100:
101: public void supprimer() {
102: System.out.println("CataloguePersistantImpl.supprimer");
103: PersistenceManager pm = JDOHelper.getPersistenceManager(this );
104:
105: System.out.println("pm.deletePersistentAll(articles)");
106: // remove articles-catalogue relations
107: pm.deletePersistentAll(articles);
108:
109: // remove catalogue-articles relations
110: articles.clear();
111:
112: System.out.println("pm.deletePersistent(this)");
113: pm.deletePersistent(this );
114:
115: }
116:
117: public String toString() {
118: String s = new String(this .getClass().getName());
119: s += " id=" + id;
120: s += " nom=" + nom;
121: s += " description=" + description;
122: return s;
123: }
124: }
|