View Javadoc
1   /*
2    * This file is part of ***  M y C o R e  ***
3    * See http://www.mycore.de/ for details.
4    *
5    * MyCoRe is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    *
10   * MyCoRe is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with MyCoRe.  If not, see <http://www.gnu.org/licenses/>.
17   */
18  
19  package org.mycore.backend.jpa.access;
20  
21  import java.io.Serializable;
22  
23  import jakarta.persistence.Column;
24  import jakarta.persistence.Embeddable;
25  
26  @Embeddable
27  public class MCRACCESSPK implements Serializable {
28  
29      private static final long serialVersionUID = 1177905976922683366L;
30  
31      @Column(name = "ACPOOL")
32      private String acpool;
33  
34      @Column(name = "OBJID")
35      private String objid;
36  
37      public MCRACCESSPK() {
38      }
39  
40      public MCRACCESSPK(String acpool, String objid) {
41          this.acpool = acpool;
42          this.objid = objid;
43      }
44  
45      public String getAcpool() {
46          return acpool;
47      }
48  
49      public void setAcpool(String acpool) {
50          this.acpool = acpool;
51      }
52  
53      public String getObjid() {
54          return objid;
55      }
56  
57      public void setObjid(String objid) {
58          this.objid = objid;
59      }
60  
61      /* (non-Javadoc)
62       * @see java.lang.Object#hashCode()
63       */
64      @Override
65      public int hashCode() {
66          final int prime = 31;
67          int result = 1;
68          result = prime * result + (acpool == null ? 0 : acpool.hashCode());
69          result = prime * result + (objid == null ? 0 : objid.hashCode());
70          return result;
71      }
72  
73      /* (non-Javadoc)
74       * @see java.lang.Object#equals(java.lang.Object)
75       */
76      @Override
77      public boolean equals(Object obj) {
78          if (this == obj) {
79              return true;
80          }
81          if (obj == null) {
82              return false;
83          }
84          if (getClass() != obj.getClass()) {
85              return false;
86          }
87          final MCRACCESSPK other = (MCRACCESSPK) obj;
88          if (acpool == null) {
89              if (other.acpool != null) {
90                  return false;
91              }
92          } else if (!acpool.equals(other.acpool)) {
93              return false;
94          }
95          if (objid == null) {
96              return other.objid == null;
97          } else {
98              return objid.equals(other.objid);
99          }
100     }
101 
102 }