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 file is part of ** M y C o R e ** Visit our homepage at
028     * http://www.mycore.de/ for details.
029     * 
030     * This program is free software; you can use it, redistribute it and / or
031     * modify it under the terms of the GNU General Public License (GPL) as
032     * published by the Free Software Foundation; either version 2 of the License or
033     * (at your option) any later version.
034     * 
035     * This program is distributed in the hope that it will be useful, but WITHOUT
036     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
037     * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
038     * details.
039     * 
040     * You should have received a copy of the GNU General Public License along with
041     * this program, normally in the file license.txt. If not, write to the Free
042     * Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307
043     * USA
044     */
045    import java.sql.Timestamp;
046    
047    public class MCRACCESSRULE {
048        private String rid;
049    
050        private String creator;
051    
052        private Timestamp creationdate;
053    
054        private String rule;
055    
056        private String description;
057    
058        public Timestamp getCreationdate() {
059            return creationdate;
060        }
061    
062        public void setCreationdate(Timestamp creationdate) {
063            this.creationdate = creationdate;
064        }
065    
066        public String getCreator() {
067            return creator;
068        }
069    
070        public void setCreator(String creator) {
071            this.creator = creator;
072        }
073    
074        public String getDescription() {
075            return description;
076        }
077    
078        public void setDescription(String description) {
079            this.description = description;
080        }
081    
082        public String getRid() {
083            return rid;
084        }
085    
086        public void setRid(String rid) {
087            this.rid = rid;
088        }
089    
090        public String getRule() {
091            return rule;
092        }
093    
094        public void setRule(String rule) {
095            this.rule = rule;
096        }
097    
098        @Override
099        public int hashCode() {
100            final int prime = 31;
101            int result = 1;
102            result = prime * result + ((creationdate == null) ? 0 : creationdate.hashCode());
103            result = prime * result + ((creator == null) ? 0 : creator.hashCode());
104            result = prime * result + ((description == null) ? 0 : description.hashCode());
105            result = prime * result + ((rid == null) ? 0 : rid.hashCode());
106            result = prime * result + ((rule == null) ? 0 : rule.hashCode());
107            return result;
108        }
109    
110        @Override
111        public boolean equals(Object obj) {
112            System.out.println("EQUALS");
113            if (this == obj)
114                return true;
115            if (obj == null)
116                return false;
117            if (!(obj instanceof MCRACCESSRULE))
118                return false;
119            final MCRACCESSRULE other = (MCRACCESSRULE) obj;
120            if (creationdate == null) {
121                if (other.getCreationdate() != null)
122                    return false;
123            } else {
124                if (other.getCreationdate() == null)
125                    return false;
126                // We will remove milliseconds as they don't need to be saved
127                long thisLong = (long) Math.floor(creationdate.getTime() / 1000);
128                long otherLong = (long) Math.floor(other.getCreationdate().getTime() / 1000);
129                if (thisLong != otherLong)
130                    return false;
131            }
132            if (creator == null) {
133                if (other.getCreator() != null)
134                    return false;
135            } else if (!creator.equals(other.getCreator()))
136                return false;
137            if (description == null) {
138                if (other.getDescription() != null)
139                    return false;
140            } else if (!description.equals(other.getDescription()))
141                return false;
142            if (rid == null) {
143                if (other.getRid() != null)
144                    return false;
145            } else if (!rid.equals(other.getRid()))
146                return false;
147            if (rule == null) {
148                if (other.getRule() != null)
149                    return false;
150            } else if (!rule.equals(other.getRule()))
151                return false;
152            return true;
153        }
154    }