001    /*
002     * 
003     * $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
004     *
005     * This file is part of ***  M y C o R e  ***
006     * See 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, in a file called gpl.txt or 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.backend.hibernate.tables;
025    
026    /**
027     * This class implement the data sructure of the MCRLinkHref table.
028     * 
029     * @author Heiko Helmbrecht
030     * @author Jens Kupferschmidt
031     * @version $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
032     */
033    public class MCRLINKHREF {
034        private MCRLINKHREFPK key;
035    
036        private String attr;
037    
038        /**
039         * The constructor of the class MCRLINKHREF
040         */
041        public MCRLINKHREF() {
042            this.key = new MCRLINKHREFPK();
043            this.attr = "";
044        }
045    
046        /**
047         * The constructor of the class MCRLINKHREF
048         * 
049         * @param from
050         *            The link source
051         * @param to
052         *            The link target
053         * @param type
054         *            The type of the link (defined by using of this class)
055         * @param attr
056         *            The optional attribute of the link (defined by using of this
057         *            class)
058         */
059        public MCRLINKHREF(String from, String to, String type, String attr) {
060            this.key = new MCRLINKHREFPK();
061            key.setMcrfrom(from);
062            key.setMcrto(to);
063            key.setMcrtype(type);
064            if (attr != null)
065                this.attr = attr;
066        }
067    
068        /**
069         * This method returns the primary key.
070         * 
071         * @return returns the primary key as class MCRLINKHREFPK.
072         * @hibernate.property column="Primary Key" not-null="true" update="true"
073         */
074        public MCRLINKHREFPK getKey() {
075            return key;
076        }
077    
078        /**
079         * This method set the primary key.
080         * 
081         * @param key
082         *            the primary key as instance of the class MCRLINKHREFPK
083         */
084        public void setKey(MCRLINKHREFPK key) {
085            this.key = key;
086        }
087    
088        /**
089         * Get the from value.
090         * 
091         * @return the from value as a String.
092         * @hibernate.property column="MCRFROM" not-null="true" update="true"
093         */
094        public String getMcrfrom() {
095            return key.getMcrfrom();
096        }
097    
098        /**
099         * Set the from value.
100         * 
101         * @param mcrfrom
102         *            the from value as a string
103         */
104        public void setMcrfrom(String mcrfrom) {
105            key.setMcrfrom(mcrfrom);
106        }
107    
108        /**
109         * Get the to value.
110         * 
111         * @return the to value as a String.
112         * @hibernate.property column="MCRTO" not-null="true" update="true"
113         */
114        public String getMcrto() {
115            return key.getMcrto();
116        }
117    
118        /**
119         * Set the to value.
120         * 
121         * @param mcrto
122         *            the to value as a string
123         */
124        public void setMcrto(String mcrto) {
125            key.setMcrto(mcrto);
126        }
127    
128        /**
129         * Get the type value.
130         * 
131         * @return the type value as a String.
132         * @hibernate.property column="MCRTYPE" not-null="true" update="true"
133         */
134        public String getMcrtype() {
135            return key.getMcrtype();
136        }
137    
138        /**
139         * Set the type value.
140         * 
141         * @param mcrtype
142         *            the type value as a string
143         */
144        public void setMcrtype(String mcrtype) {
145            key.setMcrtype(mcrtype);
146        }
147        /**
148         * Get the attribute value.
149         * 
150         * @return the attr value as a String.
151         * @hibernate.property column="MCRATTR" not-null="true" update="true"
152         */
153        public String getMcrattr() {
154            return this.attr;
155        }
156    
157        /**
158         * Set the attr value.
159         * 
160         * @param mcrattr
161         *            the attr value as a string
162         */
163        public void setMcrattr(String mcrattr) {
164            if (mcrattr == null) return;
165            this.attr = mcrattr;
166        }
167    }