001    /**
002     * 
003     * $Revision: 14437 $ $Date: 2008-11-18 15:39:31 +0100 (Di, 18 Nov 2008) $
004     *
005     * This file is part of ** M y C o R e **
006     * Visit our homepage at http://www.mycore.de/ for details.
007     *
008     * This program is free software; you can use it, redistribute it
009     * and / or modify it under the terms of the GNU General Public License
010     * (GPL) as published by the Free Software Foundation; either version 2
011     * of the License or (at your option) any later version.
012     *
013     * This program is distributed in the hope that it will be useful, but
014     * WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016     * GNU General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with this program, normally in the file license.txt.
020     * If not, write to the Free Software Foundation Inc.,
021     * 59 Temple Place - Suite 330, Boston, MA  02111-1307 USA
022     *
023     **/
024    package org.mycore.datamodel.classifications2;
025    
026    import java.net.URI;
027    import java.util.Collection;
028    import java.util.List;
029    
030    /**
031     * @author Thomas Scheffler (yagee)
032     * 
033     * @version $Revision: 14437 $ $Date: 2008-11-18 15:39:31 +0100 (Di, 18 Nov 2008) $
034     * @since 2.0
035     */
036    public interface MCRCategory {
037    
038        /**
039         * @return true if this is a root category
040         */
041        public abstract boolean isClassification();
042    
043        /**
044         * @return true if this is not a root category
045         * @see #isClassification()
046         */
047        public abstract boolean isCategory();
048    
049        /**
050         * Tells if this category has subcategories.
051         * 
052         * @return true if this category has subcategories
053         * @see #getChildren()
054         */
055        public abstract boolean hasChildren();
056    
057        /**
058         * Returns a list of subcategories.
059         * 
060         * Implementors must never return <code>null</code> if no children are
061         * present. As this method may need a new call the underlaying persistence
062         * layer use hasChildren() if you just want to know if subcategories are
063         * present. Changes to the list may not affect the underlaying persistence
064         * layer.
065         * 
066         * @return subcategories
067         * @see #hasChildren()
068         */
069        public abstract List<MCRCategory> getChildren();
070    
071        /**
072         * @return the id
073         */
074        public abstract MCRCategoryID getId();
075    
076        /**
077         * @param id
078         *            the id to set
079         */
080        public abstract void setId(MCRCategoryID id);
081    
082        /**
083         * @return the labels
084         */
085        public abstract Collection<MCRLabel> getLabels();
086    
087        /**
088         * @return the label in the current language (if available), default language (if available) or any other language  
089         */
090        public abstract MCRLabel getCurrentLabel();
091    
092        /**
093         * @return the label in the specified language (if available) or null
094         */
095        public abstract MCRLabel getLabel(String lang);
096    
097        /**
098         * Returns the hierarchie level of this category.
099         * 
100         * @return 0 if this is the root category
101         */
102        public abstract int getLevel();
103    
104        /**
105         * Returns root category (the classification).
106         * 
107         * @return the root category
108         */
109        public abstract MCRCategory getRoot();
110    
111        /**
112         * Returns the parent element
113         * 
114         * @return the categories parent or null if isClassification()==true or
115         *         category currently not attached
116         */
117        public abstract MCRCategory getParent();
118    
119        /**
120         * Returns the URI associated with this category.
121         * 
122         * @return the URI
123         */
124        public abstract URI getURI();
125    
126        /**
127         * @param uri
128         *            the URI to set
129         */
130        public abstract void setURI(URI uri);
131    
132    }