001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: FileDO.java,v $
031: * Revision 1.3 2005/10/11 18:51:38 colinmacleod
032: * Fixed some checkstyle and javadoc issues.
033: *
034: * Revision 1.2 2005/10/02 14:08:56 colinmacleod
035: * Added/improved log4j logging.
036: *
037: * Revision 1.1 2005/09/14 15:16:01 colinmacleod
038: * Moved from library to core as part of ivata cms restructuring.
039: *
040: * Revision 1.3 2005/04/10 20:10:07 colinmacleod
041: * Added new themes.
042: * Changed id type to String.
043: * Changed i tag to em and b tag to strong.
044: * Improved PicoContainerFactory with NanoContainer scripts.
045: *
046: * Revision 1.2 2005/04/09 17:20:00 colinmacleod
047: * Changed copyright text to GPL v2 explicitly.
048: *
049: * Revision 1.1.1.1 2005/03/10 17:51:13 colinmacleod
050: * Restructured ivata op around Hibernate/PicoContainer.
051: * Renamed ivata groupware.
052: *
053: * Revision 1.5 2004/07/13 20:00:13 colinmacleod
054: * Moved project to POJOs from EJBs.
055: * Applied PicoContainer to services layer (replacing session EJBs).
056: * Applied Hibernate to persistence layer (replacing entity EJBs).
057: *
058: * Revision 1.4 2004/03/21 21:16:26 colinmacleod
059: * Shortened name to ivata op.
060: *
061: * Revision 1.3 2004/02/10 19:57:23 colinmacleod
062: * Changed email address.
063: *
064: * Revision 1.2 2004/02/01 22:07:30 colinmacleod
065: * Added full names to author tags
066: *
067: * Revision 1.1.1.1 2004/01/27 20:58:27 colinmacleod
068: * Moved ivata op to sourceforge.
069: *
070: * Revision 1.2 2003/10/15 14:05:21 colin
071: * fixing for XDoclet
072: *
073: * Revision 1.8 2003/05/13 08:07:27 peter
074: * restructured hierarchy
075: *
076: * Revision 1.7 2003/02/24 19:03:09 colin
077: * restructured file paths
078: *
079: * Revision 1.6 2003/02/04 17:43:45 colin
080: * copyright notice
081: *
082: * Revision 1.5 2003/01/20 13:46:51 peter
083: * comment added
084: *
085: * Revision 1.2 2003/01/13 16:48:16 peter
086: * beans and DOs added to the model
087: *
088: * Revision 1.4 2003/01/09 17:14:12 peter
089: * added path field
090: *
091: * Revision 1.3 2002/12/30 16:03:52 peter
092: * added id field
093: *
094: * Revision 1.2 2002/12/23 13:36:16 peter
095: * completed and commented version
096: *
097: * Revision 1.1 2002/12/20 17:49:25 peter
098: * initial versions added to CVS
099: * -----------------------------------------------------------------------------
100: */
101: package com.ivata.groupware.business.drive.file;
102:
103: import org.apache.log4j.Logger;
104:
105: import com.ivata.groupware.container.persistence.BaseDO;
106:
107: /**
108: * <p>Encapsulates a single file, but doesn't
109: * contain its
110: * content. For content @link FileContentDO is used</p>
111: *
112: * @since 2002-12-20
113: * @author Peter Illes
114: * @version $Revision: 1.3 $
115: */
116: public class FileDO extends BaseDO {
117: /**
118: * Logger for this class.
119: */
120: private static final Logger logger = Logger.getLogger(FileDO.class);
121:
122: /**
123: * Serialization version (for <code>Serializable</code> interface).
124: */
125: private static final long serialVersionUID = 1L;
126:
127: /**
128: * <p>Comment used when working with new library attachments.</p>
129: */
130: private String comment;
131:
132: /**
133: * <p>Stores the mime-type text identifier of the content.</p>
134: */
135: private String mimeType;
136:
137: /**
138: * <p>The name of the file.</p>
139: */
140: private String name;
141:
142: /**
143: * <p>The size of this file in bytes.</p>
144: */
145: private Integer size;
146:
147: /**
148: * <p>Get the comment used when working with new library attachments.</p>
149: * @return comment used when working with new library attachments.
150: */
151: public final String getComment() {
152: if (logger.isDebugEnabled()) {
153: logger.debug("getComment() - start");
154: }
155:
156: if (logger.isDebugEnabled()) {
157: logger.debug("getComment() - end - return value = "
158: + comment);
159: }
160: return comment;
161: }
162:
163: /**
164: * <p>Get the mime type of the file content.</p>
165: * @return clear-text mime type of the file content.
166: *
167: * @roseuid 3E22C256019C
168: */
169: public final java.lang.String getMimeType() {
170: if (logger.isDebugEnabled()) {
171: logger.debug("getMimeType() - start");
172: }
173:
174: if (logger.isDebugEnabled()) {
175: logger.debug("getMimeType() - end - return value = "
176: + mimeType);
177: }
178: return mimeType;
179: }
180:
181: /**
182: * <p>Get the name of the file.</p>
183: * @return The name of the file.
184: */
185: public final String getName() {
186: if (logger.isDebugEnabled()) {
187: logger.debug("getName() - start");
188: }
189:
190: if (logger.isDebugEnabled()) {
191: logger.debug("getName() - end - return value = " + name);
192: }
193: return name;
194: }
195:
196: /**
197: * <p>Get the size of the file in bytes.</p>
198: * @return the size of the file in bytes.
199: */
200: public final Integer getSize() {
201: if (logger.isDebugEnabled()) {
202: logger.debug("getSize() - start");
203: }
204:
205: if (logger.isDebugEnabled()) {
206: logger.debug("getSize() - end - return value = " + size);
207: }
208: return size;
209: }
210:
211: /**
212: * <p>Get the comment used when working with new library attachments.</p>
213: * @param commentParam The comment used when working with new library
214: * attachments.
215: */
216: public final void setComment(final String commentParam) {
217: if (logger.isDebugEnabled()) {
218: logger.debug("setComment(String comment = " + commentParam
219: + ") - start");
220: }
221:
222: this .comment = commentParam;
223:
224: if (logger.isDebugEnabled()) {
225: logger.debug("setComment(String) - end");
226: }
227: }
228:
229: /**
230: * <p>sets the mime type of the file content.</p>
231: * @param mimeTypeParam clear-text mime type identifier of the file
232: * content.
233: *
234: * @roseuid 3E22C256019D
235: */
236: public final void setMimeType(final String mimeTypeParam) {
237: if (logger.isDebugEnabled()) {
238: logger.debug("setMimeType(String mimeType = "
239: + mimeTypeParam + ") - start");
240: }
241:
242: this .mimeType = mimeTypeParam;
243:
244: if (logger.isDebugEnabled()) {
245: logger.debug("setMimeType(String) - end");
246: }
247: }
248:
249: /**
250: * <p>Sets the file name field.</p>
251: * @param nameParam new file name.
252: *
253: * @roseuid 3E22C256015E
254: */
255: public final void setName(final String nameParam) {
256: if (logger.isDebugEnabled()) {
257: logger.debug("setName(String name = " + nameParam
258: + ") - start");
259: }
260:
261: this .name = nameParam;
262:
263: if (logger.isDebugEnabled()) {
264: logger.debug("setName(String) - end");
265: }
266: }
267:
268: /**
269: * <p>Set the size of the file in bytes.</p>
270: * @param sizeParam The size of the file in bytes.
271: *
272: * @roseuid 3E22C2560167
273: */
274: public final void setSize(final Integer sizeParam) {
275: if (logger.isDebugEnabled()) {
276: logger.debug("setSize(Integer size = " + sizeParam
277: + ") - start");
278: }
279:
280: this .size = sizeParam;
281:
282: if (logger.isDebugEnabled()) {
283: logger.debug("setSize(Integer) - end");
284: }
285: }
286: }
|