4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
DrupAuthServer.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Author: Ing. Jaroslav Dytrych idytrych@fit.vutbr.cz
4  * File: DrupAuthServer.java
5  * Description: Class representing approved drupal authentization server
6  */
7 
8 /**
9  * @file DrupAuthServer.java
10  *
11  * @brief Class representing approved drupal authentization server
12  */
13 
14 package cz.vutbr.fit.knot.annotations.entity;
15 
16 import java.io.Serializable;
17 import javax.persistence.Basic;
18 import javax.persistence.Column;
19 import javax.persistence.Entity;
20 import javax.persistence.GeneratedValue;
21 import javax.persistence.GenerationType;
22 import javax.persistence.Id;
23 import javax.persistence.NamedQueries;
24 import javax.persistence.NamedQuery;
25 import javax.persistence.Table;
26 import javax.validation.constraints.Size;
27 import javax.xml.bind.annotation.XmlRootElement;
28 
29 /**
30  * Class representing approved drupal authentization server.
31  *
32  * @brief Class representing approved drupal authentization server
33  * @author Martin Petr (xpetrm05)
34  */
35 @Entity
36 @Table(name = "drupAuthServer")
37 @XmlRootElement
38 @NamedQueries({
39  @NamedQuery(name = "DrupAuthServer.findAll", query = "SELECT d FROM DrupAuthServer d"),
40  @NamedQuery(name = "DrupAuthServer.findById", query = "SELECT d FROM DrupAuthServer d WHERE d.id = :id"),
41  @NamedQuery(name = "DrupAuthServer.findByIpAddress", query = "SELECT d FROM DrupAuthServer d WHERE d.ipAddress = :ipAddress"),
42  @NamedQuery(name = "DrupAuthServer.findByHostName", query = "SELECT d FROM DrupAuthServer d WHERE d.hostName = :hostName")})
43 public class DrupAuthServer implements Serializable {
44  private static final long serialVersionUID = 1L;
45  @Id
46  @GeneratedValue(strategy = GenerationType.IDENTITY)
47  @Basic(optional = false)
48  @Column(name = "id")
49  /** Id of approved drupal authentization server */
50  private Integer id;
51 
52  @Basic(optional = false)
53  @Size(min = 1, max = 255)
54  @Column(name = "ipAddress")
55  /** IP Address of approved drupal authentization server */
56  private String ipAddress;
57 
58  @Size(max = 255)
59  @Column(name = "hostName")
60  /** Host name of approved drupal authentization server */
61  private String hostName;
62 
63  /**
64  * Constructor
65  */
66  public DrupAuthServer() {
67  }
68 
69  /**
70  * Constructor
71  *
72  * @param ipAddress IP Address of approved drupal authentization server
73  * @param hostName host name of approved drupal authentization server
74  */
75  public DrupAuthServer(String ipAddress, String hostName) {
76  this.ipAddress = ipAddress;
77  this.hostName = hostName;
78  }
79 
80  /**
81  * Constructor
82  *
83  * @param id Id of approved drupal authentization server
84  */
85  public DrupAuthServer(Integer id) {
86  this.id = id;
87  }
88 
89  /**
90  * Constructor
91  *
92  * @param id Id of approved drupal authentization server
93  * @param ipAddress IP Address of approved drupal authentization server
94  */
95  public DrupAuthServer(Integer id, String ipAddress) {
96  this.id = id;
97  this.ipAddress = ipAddress;
98  }
99 
100  /**
101  * Gets id of approved drupal authentization server.
102  *
103  * @return id of approved drupal authentization server
104  */
105  public Integer getId() {
106  return id;
107  }
108 
109  /**
110  * Sets id of approved drupal authentization server
111  *
112  * @param id id of approved drupal authentization server
113  */
114  public void setId(Integer id) {
115  this.id = id;
116  }
117 
118  /**
119  * Gets IP Address of approved drupal authentization server.
120  *
121  * @return IP Address of approved drupal authentization server
122  */
123  public String getIpAddress() {
124  return ipAddress;
125  }
126 
127  /**
128  * Sets IP Address of approved drupal authentization server.
129  *
130  * @param ipAddress IP Address of approved drupal authentization server
131  */
132  public void setIpAddress(String ipAddress) {
133  this.ipAddress = ipAddress;
134  }
135 
136  /**
137  * Gets host name of approved drupal authentization server.
138  *
139  * @return host name of approved drupal authentization server
140  */
141  public String getHostName() {
142  return hostName;
143  }
144 
145  /**
146  * Sets host name of approved drupal authentization server.
147  *
148  * @param hostName host name of approved drupal authentization server
149  */
150  public void setHostName(String hostName) {
151  this.hostName = hostName;
152  }
153 
154  @Override
155  public int hashCode() {
156  int hash = 0;
157  hash += (id != null ? id.hashCode() : 0);
158  return hash;
159  }
160 
161  /**
162  * Object equals if they are the same class instance and they have the same id.
163  *
164  * @param object
165  * @return
166  */
167  @Override
168  public boolean equals(Object object) {
169  if (!(object instanceof DrupAuthServer)) {
170  return false;
171  }
172  DrupAuthServer other = (DrupAuthServer) object;
173  if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
174  return false;
175  }
176  return true;
177  }
178 
179  @Override
180  public String toString() {
181  return "cz.vutbr.fit.knot.annotations.entity.DrupAuthServer[ id=" + id + " ]";
182  }
183 } // public class DrupAuthServer
Class representing approved drupal authentization server.
DrupAuthServer(String ipAddress, String hostName)