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 import java.io.Serializable;
027
028 import org.apache.commons.lang.builder.EqualsBuilder;
029 import org.apache.commons.lang.builder.HashCodeBuilder;
030
031 /**
032 * This class hold all primary keys of MCRLINKHREF
033 *
034 * @author Heiko Helmbrecht
035 * @author Jens Kupferschmidt
036 * @version $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
037 */
038 public class MCRLINKHREFPK implements Serializable {
039
040 private static final long serialVersionUID = -5838803852559721772L;
041
042 private String mcrfrom;
043
044 private String mcrto;
045
046 private String mcrtype;
047
048 /**
049 * @param from
050 * the source ID of the link
051 * @param to
052 * the target ID of the link
053 * @param type
054 * the type of the link
055 */
056 public MCRLINKHREFPK(String from, String to, String type) {
057 this.mcrfrom = from;
058 this.mcrto = to;
059 this.mcrtype = type;
060 }
061
062 /**
063 * The constructor
064 */
065 public MCRLINKHREFPK() {
066 }
067
068 /**
069 * Get the data field from.
070 *
071 * @return Returns the mcrfrom.
072 */
073 public String getMcrfrom() {
074 return mcrfrom;
075 }
076
077 /**
078 * Set the data field from.
079 *
080 * @param mcrfrom
081 * The mcrfrom to set.
082 */
083 public void setMcrfrom(String mcrfrom) {
084 this.mcrfrom = mcrfrom;
085 }
086
087 /**
088 * Get the data filed to.
089 *
090 * @return Returns the mcrto.
091 */
092 public String getMcrto() {
093 return mcrto;
094 }
095
096 /**
097 * Set the data filed to.
098 *
099 * @param mcrto
100 * The mcrto to set.
101 */
102 public void setMcrto(String mcrto) {
103 this.mcrto = mcrto;
104 }
105
106 /**
107 * Get the data filed type.
108 *
109 * @return Returns the mcrtype.
110 */
111 public String getMcrtype() {
112 return mcrtype;
113 }
114
115 /**
116 * Set the data filed type.
117 *
118 * @param mcrtype
119 * The mcrtype to set.
120 */
121 public void setMcrtype(String mcrtype) {
122 this.mcrtype = mcrtype;
123 }
124
125 /**
126 * This method check the equalance of the given Object with this class. The
127 * Object must be an instance of the class MCRLINKHREFPK.
128 *
129 * @return Returns true if the object is equal.
130 */
131 public boolean equals(Object other) {
132 if (!(other instanceof MCRLINKHREFPK)) {
133 return false;
134 }
135
136 MCRLINKHREFPK castother = (MCRLINKHREFPK) other;
137
138 return new EqualsBuilder().append(this.getMcrfrom(), castother.getMcrfrom()).append(this.getMcrto(), castother.getMcrto()).append(this.getMcrtype(),
139 castother.getMcrtype()).isEquals();
140 }
141
142 /**
143 * This method return the hash code of this class as append of MCRFROM +
144 * MCRTO + MCRTYPE
145 *
146 * @return Returns the hash code.
147 */
148 public int hashCode() {
149 return new HashCodeBuilder().append(getMcrfrom()).append(getMcrto()).append(getMcrtype()).toHashCode();
150 }
151 }