001/*
002  $Id: FileAttachableData.java 3207 2009-04-09 06:48:11Z gregory $
003
004        Copyright (C) 2006 Gregory Vincic, Olle Mansson
005        Copyright (C) 2007 Gregory Vincic
006
007        This file is part of Proteios.
008        Available at http://www.proteios.org/
009
010        Proteios is free software; you can redistribute it and/or modify it
011        under the terms of the GNU General Public License as published by
012        the Free Software Foundation; either version 2 of the License, or
013        (at your option) any later version.
014
015        Proteios is distributed in the hope that it will be useful, but
016        WITHOUT ANY WARRANTY; without even the implied warranty of
017        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
018        General Public License for more details.
019
020        You should have received a copy of the GNU General Public License
021        along with this program; if not, write to the Free Software
022        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
023        02111-1307, USA.
024*/
025package org.proteios.core.data;
026
027/**
028        A fileattachable item is an item which can have a <code>File</code> 
029        attached to it.
030        <p>
031        <p>
032        This interface defines Hibernate database mapping for the
033        <code>file</code> property to the database column <code>file_id</code>.
034        If a subclass wants to map the property to another column, 
035        it should override the {@link #getFile()} method and add a 
036        Hibernate tag in the comment.
037        <p>
038        
039        <b>Reference implementation</b><br>
040        <pre class="code">
041private FileData file;
042public FileData getFile()
043{
044   return file;
045}
046public void setFile(FileData file)
047{
048   this.file = file;
049}
050</pre>
051
052        @author enell
053        @version 2.0
054        @see BasicData
055        @see <a href="../../../../../../../development/overview/data/files.html">File and directory overview</a>
056        @see <a href="../../../../../../../development/overview/data/basic.html">Basic classes and interfaces</a>
057*/
058public interface FileAttachableData
059        extends IdentifiableData
060{
061        /**
062                Get the file that is attached to the item.
063                @return A {@link FileData} object or null if no file is attached
064                @hibernate.many-to-one column="`file_id`" not-null="false" outer-join="false"
065        */
066        public FileData getFile();
067
068        /**
069                Attach a file to the item. Null is allowed.
070        */
071        public void setFile(FileData file);
072}