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.files.ejb;
034:
035: import org.libresource.LibresourceResourceBase;
036:
037: import org.libresource.files.util.FileResourceUtil;
038:
039: import java.util.Collection;
040: import java.util.Date;
041:
042: import javax.ejb.CreateException;
043:
044: /**
045: * A libresource File
046: *
047: * @libresource.resource name="File" service="LibresourceFiles"
048: */
049: public abstract class FileResourceBean extends LibresourceResourceBase {
050: /**
051: * @ejb.create-method
052: */
053: public String ejbCreate(String name, String description,
054: String author, String type, long size, boolean throwEvent,
055: Date date) throws CreateException {
056: setId(FileResourceUtil.generateGUID(this ));
057: setName(name);
058: setDisplayName(name);
059: setDescription(description);
060: setAuthor(author);
061: setSize(size);
062: setType(type);
063: setDate(date);
064: setNbOfDownloads(0);
065: setDownloadInfos(null);
066: setThrowEvent(throwEvent);
067:
068: return null;
069: }
070:
071: // persistents fields
072:
073: /**
074: * @ejb.persistent-field
075: * @ejb.interface-method
076: * @ejb.value-object match="libresource"
077: * @ejb.transaction type="Supports"
078: */
079: public abstract String getId();
080:
081: /**
082: * @ejb.persistent-field
083: * @ejb.interface-method
084: * @ejb.transaction type="Mandatory"
085: */
086: public abstract void setId(String id);
087:
088: /**
089: * @ejb.interface-method
090: * @ejb.value-object match="libresource"
091: * @ejb.transaction type="Supports"
092: */
093: public String getShortResourceName() {
094: return getName();
095: }
096:
097: /**
098: * @ejb.persistent-field
099: * @ejb.interface-method
100: * @ejb.value-object match="libresource"
101: * @ejb.transaction type="Supports"
102: */
103: public abstract String getName();
104:
105: /**
106: * @ejb.persistent-field
107: * @ejb.interface-method
108: * @ejb.transaction type="Mandatory"
109: */
110: public abstract void setName(String name);
111:
112: /**
113: * @ejb.persistent-field
114: * @ejb.interface-method
115: * @ejb.value-object match="libresource"
116: * @ejb.transaction type="Supports"
117: */
118: public abstract String getDisplayName();
119:
120: /**
121: * @ejb.persistent-field
122: * @ejb.interface-method
123: * @ejb.transaction type="Mandatory"
124: */
125: public abstract void setDisplayName(String displayName);
126:
127: /**
128: * @ejb.persistent-field
129: * @ejb.interface-method
130: * @ejb.value-object match="libresource"
131: * @ejb.transaction type="Supports"
132: */
133: public abstract String getDescription();
134:
135: /**
136: * @ejb.persistent-field
137: * @ejb.interface-method
138: * @ejb.transaction type="Mandatory"
139: */
140: public abstract void setDescription(String description);
141:
142: /**
143: * @ejb.persistent-field
144: * @ejb.interface-method
145: * @ejb.value-object match="libresource"
146: * @ejb.transaction type="Supports"
147: */
148: public abstract String getAuthor();
149:
150: /**
151: * @ejb.persistent-field
152: * @ejb.interface-method
153: * @ejb.transaction type="Mandatory"
154: */
155: public abstract void setAuthor(String author);
156:
157: /**
158: * @ejb.persistent-field
159: * @ejb.interface-method
160: * @ejb.value-object match="libresource"
161: * @ejb.transaction type="Supports"
162: */
163: public abstract String getType();
164:
165: /**
166: * @ejb.persistent-field
167: * @ejb.interface-method
168: * @ejb.transaction type="Mandatory"
169: */
170: public abstract void setType(String type);
171:
172: /**
173: * @ejb.persistent-field
174: * @ejb.interface-method
175: * @ejb.value-object match="libresource"
176: * @ejb.transaction type="Supports"
177: */
178: public abstract long getSize();
179:
180: /**
181: * @ejb.persistent-field
182: * @ejb.interface-method
183: * @ejb.transaction type="Mandatory"
184: */
185: public abstract void setSize(long size);
186:
187: /**
188: * @ejb.persistent-field
189: * @ejb.interface-method
190: * @ejb.value-object match="libresource"
191: * @ejb.transaction type="Supports"
192: */
193: public abstract Date getDate();
194:
195: /**
196: * @ejb.persistent-field
197: * @ejb.interface-method
198: * @ejb.transaction type="Mandatory"
199: */
200: public abstract void setDate(Date date);
201:
202: /**
203: * @ejb.persistent-field
204: * @ejb.interface-method
205: * @ejb.value-object match="libresource"
206: * @ejb.transaction type="Supports"
207: */
208: public abstract int getNbOfDownloads();
209:
210: /**
211: * @ejb.persistent-field
212: * @ejb.interface-method
213: * @ejb.transaction type="Required"
214: */
215: public abstract void setNbOfDownloads(int nb);
216:
217: /**
218: * @ejb.persistent-field
219: * @ejb.interface-method
220: * @ejb.value-object match="libresource"
221: * @ejb.transaction type="Supports"
222: */
223: public abstract Collection getDownloadInfos();
224:
225: /**
226: * @ejb.persistent-field
227: * @ejb.interface-method
228: * @ejb.transaction type="Required"
229: */
230: public abstract void setDownloadInfos(Collection downloadInfos);
231:
232: /**
233: * @ejb.persistent-field
234: * @ejb.interface-method
235: * @ejb.value-object match="libresource"
236: * @ejb.transaction type="Supports"
237: */
238: public abstract boolean getThrowEvent();
239:
240: /**
241: * @ejb.persistent-field
242: * @ejb.interface-method
243: * @ejb.transaction type="Required"
244: */
245: public abstract void setThrowEvent(boolean throwEvent);
246: }
|