001/*
002        $Id: Removable.java 3207 2009-04-09 06:48:11Z gregory $
003
004        Copyright (C) 2006 Gregory Vincic, Jari Hakkinen, 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;   BioArray Software Environment (Proteios) - http://base.thep.lu.se/
013        Copyright (C) 2002-2004 Lao Saal, Carl Troein,
014        Johan Vallon-Christersson, Jari H�kkinen, Nicklas Nordborg
015
016        This file is part of Proteios.
017
018        Proteios is free software; you can redistribute it and/or
019        modify it under the terms of the GNU General Public License
020        as published by the Free Software Foundation; either version 2
021        of the License, or (at your option) any later version.
022
023        Proteios is distributed in the hope that it will be useful,
024        but WITHOUT ANY WARRANTY; without even the implied warranty of
025        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
026        GNU General Public License for more details.
027
028        You should have received a copy of the GNU General Public License
029        along with this program; if not, write to the Free Software
030        Foundation, Inc., 59 Temple Place - Suite 330,
031        Boston, MA  02111-1307, USA.
032 either version 2 of the License, or
033        (at your option) any later version.
034
035        Proteios is distributed in the hope that it will be useful, but
036        WITHOUT ANY WARRANTY; without even the implied warranty of
037        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
038        General Public License for more details.
039
040        You should have received a copy of the GNU General Public License
041        along with this program; if not, write to the Free Software
042        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
043        02111-1307, USA.
044*/
045package org.proteios.core;
046
047/**
048        A <code>Removable</code> item is an item that can be flagged
049        as removed. This doesn't generally remove the information about the
050        item from the database, but can be used by client applications
051        to hide items that the user is not interested in.
052        <p>
053        For example, all methods generating lists of items, will by default
054        not include those that are flagged as removed.
055        <p>
056        At regular intervals, a cleanup application is checking the database for 
057        items that are flagged to be removed and deletes them permanently.
058        <p>
059        
060        <b>Reference implementation</b><br>
061        <pre class="code">
062public boolean isRemoved()
063{
064   return getData().isRemoved();
065}
066public void setRemoved(boolean removed)
067   throws PermissionDeniedException
068{
069   checkPermission(removed ? Permission.DELETE : Permission.WRITE);
070   getData().setRemoved(removed);
071}
072</pre>
073        @author Nicklas
074        @version 2.0
075        @base.modified $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $
076*/
077public interface Removable
078        extends Identifiable
079{
080
081        /**
082                Check if the removed flag is set for this item.
083                @return TRUE if the item is flagged as removed, FALSE otherwise
084        */
085        public boolean isRemoved();
086
087        /**
088                Set the removed flag for this item.
089                @param removed TRUE if the item should be flagged as removed,
090                        FALSE otherwise
091                @throws PermissionDeniedException If the logged in user doesn't 
092                        have {@link Permission#DELETE} permission for setting the flag 
093                        to TRUE or {@link Permission#WRITE} permission for setting the 
094                        flag to FALSE
095        */
096        public void setRemoved(boolean removed)
097                throws PermissionDeniedException;
098
099}