001/*
002        $Id: ShareableData.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 shareable item is an item which can be shared to other users, 
029        groups or projects. To be able to share an item, it must have an
030        owner, thus this interface extends the {@link OwnableData}
031        interface. 
032        <p>
033        Access permissions are held in a {@link ItemKeyData} object
034        for users and groups and a {@link ProjectKeyData} object for
035        projects.
036        <p>
037        The {@link SharedData} class provides an implementation
038        for this interface and it is recommended that shareable classes inherit
039        from that class.
040        <p>
041        This interface defines Hibernate database mappings for the
042        <code>itemKey</code> and <code>projectKey</code> properties to default 
043        database columns. If a subclass wants to map these properties to other columns,
044        it should override the {@link #getItemKey()} and {@link #getProjectKey()} methods
045        and add a Hibernate tag in the comment.
046        <p>
047        
048        <b>Reference implementation</b><br>
049        <pre class="code">
050private ItemKeyData itemKey;
051public ItemKeyData getItemKey()
052{
053   return itemKey;
054}
055public void setItemKey(ItemKeyData itemKey)
056{
057   this.itemKey = itemKey;
058}
059private ProjectKeyData projectKey;
060public ProjectKeyData getProjectKey()
061{
062   return projectKey;
063}
064public void setProjectKey(ProjectKeyData projectKey)
065{
066   this.projectKey = projectKey;
067}
068</pre>
069
070        @author Nicklas
071        @version 2.0
072        @see SharedData
073        @see org.proteios.core.Shareable
074        @see <a href="../../../../../../../development/overview/data/authentication.html">Authentication overview</a>
075        @see <a href="../../../../../../../development/overview/data/basic.html">Basic classes and interfaces</a>
076*/
077public interface ShareableData
078        extends OwnableData
079{
080
081        /**
082                Get the {@link ItemKeyData} for the item. An item key is used
083                to share an item to individual users and/or groups.
084                @hibernate.many-to-one column="`itemkey_id`" not-null="false" outer-join="false"
085        */
086        public ItemKeyData getItemKey();
087
088        /**
089                Set the {@link ItemKeyData} for the item. An item key is used
090                to share an item to individual users and or groups. Use null to
091                disable sharing.
092        */
093        public void setItemKey(ItemKeyData key);
094
095
096        /**
097                Get the {@link ProjectKeyData} for the item. A project key is used
098                to share an item to projects.
099                @hibernate.many-to-one column="`projectkey_id`" not-null="false" outer-join="false"
100        */
101        public ProjectKeyData getProjectKey();
102
103        /**
104                Set the {@link ProjectKeyData} for the item. A project key is used
105                to share an item to projects. Use null to disable sharing.
106        */
107        public void setProjectKey(ProjectKeyData key);
108
109}