001: /**
002: * LibreSource
003: * Copyright (C) 2004-2008 Artenum SARL / INRIA
004: * http://www.libresource.org - contact@artenum.com
005: *
006: * This file is part of the LibreSource software,
007: * which can be used and distributed under license conditions.
008: * The license conditions are provided in the LICENSE.TXT file
009: * at the root path of the packaging that enclose this file.
010: * More information can be found at
011: * - http://dev.libresource.org/home/license
012: *
013: * Initial authors :
014: *
015: * Guillaume Bort / INRIA
016: * Francois Charoy / Universite Nancy 2
017: * Julien Forest / Artenum
018: * Claude Godart / Universite Henry Poincare
019: * Florent Jouille / INRIA
020: * Sebastien Jourdain / INRIA / Artenum
021: * Yves Lerumeur / Artenum
022: * Pascal Molli / Universite Henry Poincare
023: * Gerald Oster / INRIA
024: * Mariarosa Penzi / Artenum
025: * Gerard Sookahet / Artenum
026: * Raphael Tani / INRIA
027: *
028: * Contributors :
029: *
030: * Stephane Bagnier / Artenum
031: * Amadou Dia / Artenum-IUP Blois
032: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033: */package org.libresource.forum.ejb;
034:
035: import org.libresource.LibresourceResourceBase;
036:
037: import org.libresource.forum.util.MessageResourceUtil;
038:
039: import java.util.Date;
040:
041: import javax.ejb.CreateException;
042:
043: /**
044: * A libresource Message
045: *
046: * @libresource.resource name="Message" service="LibresourceForum"
047: */
048: public abstract class MessageResourceBean extends
049: LibresourceResourceBase {
050: /**
051: * @ejb.create-method
052: */
053: public String ejbCreate(String title, String body)
054: throws CreateException {
055: setId(MessageResourceUtil.generateGUID(this ));
056: setTitle(title);
057: setBody(body);
058: setDate(new Date());
059:
060: return null;
061: }
062:
063: /**
064: * @ejb.create-method
065: */
066: public String ejbCreate(String id, String title, String body)
067: throws CreateException {
068: setId(id);
069: setTitle(title);
070: setBody(body);
071: setDate(new Date());
072:
073: return null;
074: }
075:
076: // persistents fields
077:
078: /**
079: * @ejb.persistent-field
080: * @ejb.interface-method
081: * @ejb.value-object match="libresource"
082: * @ejb.transaction type="Supports"
083: */
084: public abstract String getId();
085:
086: /**
087: * @ejb.persistent-field
088: * @ejb.interface-method
089: * @ejb.transaction type="Mandatory"
090: */
091: public abstract void setId(String id);
092:
093: /**
094: * @ejb.interface-method
095: * @ejb.value-object match="libresource"
096: * @ejb.transaction type="Supports"
097: */
098: public String getShortResourceName() {
099: return getTitle();
100: }
101:
102: /**
103: * @ejb.persistent-field
104: * @ejb.interface-method
105: * @ejb.value-object match="libresource"
106: * @ejb.transaction type="Supports"
107: */
108: public abstract String getTitle();
109:
110: /**
111: * @ejb.persistent-field
112: * @ejb.interface-method
113: * @ejb.transaction type="Mandatory"
114: */
115: public abstract void setTitle(String title);
116:
117: /**
118: * @ejb.persistent-field
119: * @ejb.interface-method
120: * @ejb.value-object match="libresource"
121: * @ejb.transaction type="Supports"
122: */
123: public abstract String getBody();
124:
125: /**
126: * @ejb.persistent-field
127: * @ejb.interface-method
128: * @ejb.transaction type="Mandatory"
129: */
130: public abstract void setBody(String body);
131:
132: /**
133: * @ejb.persistent-field
134: * @ejb.interface-method
135: * @ejb.value-object match="libresource"
136: * @ejb.transaction type="Supports"
137: */
138: public abstract String getAuthorName();
139:
140: /**
141: * @ejb.persistent-field
142: * @ejb.interface-method
143: * @ejb.transaction type="Mandatory"
144: */
145: public abstract void setAuthorName(String authorName);
146:
147: /**
148: * @ejb.persistent-field
149: * @ejb.interface-method
150: * @ejb.value-object match="libresource"
151: * @ejb.transaction type="Supports"
152: */
153: public abstract Date getDate();
154:
155: /**
156: * @ejb.persistent-field
157: * @ejb.interface-method
158: * @ejb.transaction type="Mandatory"
159: */
160: public abstract void setDate(Date date);
161: }
|