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 * 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.io.Serializable;
027
028 /**
029 * @author Thomas Scheffler (yagee)
030 *
031 * @version $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
032 * @since 2.0
033 */
034 public class MCRObjectReference implements Serializable {
035
036 private static final long serialVersionUID = -6457722746147666860L;
037
038 private String objectID;
039
040 private String type;
041
042 public MCRObjectReference() {
043 }
044
045 public MCRObjectReference(String objectID, String type) {
046 setObjectID(objectID);
047 setType(type);
048 }
049
050 public String getObjectID() {
051 return objectID;
052 }
053
054 public void setObjectID(String objectID) {
055 this.objectID = objectID;
056 }
057
058 public String getType() {
059 return type;
060 }
061
062 public void setType(String type) {
063 this.type = type;
064 }
065
066 @Override
067 public int hashCode() {
068 final int PRIME = 31;
069 int result = 1;
070 result = PRIME * result + ((objectID == null) ? 0 : objectID.hashCode());
071 result = PRIME * result + ((type == null) ? 0 : type.hashCode());
072 return result;
073 }
074
075 @Override
076 public boolean equals(Object obj) {
077 if (this == obj)
078 return true;
079 if (obj == null)
080 return false;
081 if (getClass() != obj.getClass())
082 return false;
083 final MCRObjectReference other = (MCRObjectReference) obj;
084 if (objectID == null) {
085 if (other.objectID != null)
086 return false;
087 } else if (!objectID.equals(other.objectID))
088 return false;
089 if (type == null) {
090 if (other.type != null)
091 return false;
092 } else if (!type.equals(other.type))
093 return false;
094 return true;
095 }
096
097 }