001/*
002        $Id: Identifiable.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;
026
027/**
028        An <code>Identifiable</code> item is an item which has an
029        <code>id</code> a <code>type</code> and a <code>version</code>.
030        The id value is always greater than 0 for an existing item, and 0 for
031        a new item that has not yet been saved to the database.
032        <p>
033        The type is an value selected from the constants
034        defined by the {@link Item} enumeration.
035
036        @author Nicklas
037        @version 2.0
038        @see BasicItem
039        @see Item
040        @base.modified $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $
041*/
042public interface Identifiable
043        extends AccessControlled
044{
045
046        /**
047                Get the id for the item. If it hasn't yet been saved to the
048                database 0 is returned.
049                @return The id of the item or 0
050        */
051        public int getId();
052
053        /**
054                Get the type of item represented by the object. The returned
055                value is one of the values defined in the {@link Item} enumeration.
056                @return A value indicating the type of item
057        */
058        public Item getType();
059        
060        /**
061                Get the version number of the item. The version number is incremented each time
062                the item is updated and is used to prevent that the same item is updated at
063                the same time by two or more different threads or processes.
064        */
065        public int getVersion();
066
067}