4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
DocClonerServer.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: DocClonerServer.java
5  * Description: Class representing approved document clone server
6  */
7 
8 /**
9  * @file DocClonerServer.java
10  *
11  * @brief Class representing approved document clone server
12  */
13 
14 package cz.vutbr.fit.knot.annotations.documentCloner;
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.NotNull;
27 import javax.validation.constraints.Size;
28 import javax.xml.bind.annotation.XmlRootElement;
29 
30 /**
31  * Class representing approved document clone server. Approved server can send
32  * request for cloning of document with all annotations.
33  *
34  * @brief Class representing approved document clone server
35  * @author Martin Petr (xpetrm05)
36  */
37 @Entity
38 @Table(name = "docClonerServer")
39 @XmlRootElement
40 @NamedQueries({
41  @NamedQuery(name = "DocClonerServer.findAll", query = "SELECT d FROM DocClonerServer d"),
42  @NamedQuery(name = "DocClonerServer.findById", query = "SELECT d FROM DocClonerServer d WHERE d.id = :id"),
43  @NamedQuery(name = "DocClonerServer.findByIpAddress", query = "SELECT d FROM DocClonerServer d WHERE d.ipAddress = :ipAddress")})
44 public class DocClonerServer implements Serializable {
45  private static final long serialVersionUID = 1L;
46  @Id
47  @GeneratedValue(strategy = GenerationType.IDENTITY)
48  @Basic(optional = false)
49  @Column(name = "id")
50  /** Id of approved document clone server */
51  private Integer id;
52  @Basic(optional = false)
53  @NotNull
54  @Size(min = 1, max = 255)
55  @Column(name = "ipAddress")
56  /** IP address of approved document clone server */
57  private String ipAddress;
58 
59  /**
60  * Constructor
61  */
62  public DocClonerServer() {
63  }
64 
65  /**
66  * Constructor
67  *
68  * @param id id of approved document clone server
69  */
70  public DocClonerServer(Integer id) {
71  this.id = id;
72  }
73 
74  /**
75  * Constructor
76  *
77  * @param id id of approved document clone server
78  * @param ipAddress IP address of approved document clone server
79  */
80  public DocClonerServer(Integer id, String ipAddress) {
81  this.id = id;
82  this.ipAddress = ipAddress;
83  }
84 
85  /**
86  * Gets id of approved document clone server.
87  *
88  * @return id of approved document clone server
89  */
90  public Integer getId() {
91  return id;
92  }
93 
94  /**
95  * Sets id of approved document clone server.
96  *
97  * @param id id of approved document clone server
98  */
99  public void setId(Integer id) {
100  this.id = id;
101  }
102 
103  /**
104  * Gets IP address of approved document clone server.
105  *
106  * @return IP address of approved document clone server
107  */
108  public String getIpAddress() {
109  return ipAddress;
110  }
111 
112  /**
113  * Sets IP address of approved document clone server.
114  *
115  * @param ipAddress IP address of approved document clone server
116  */
117  public void setIpAddress(String ipAddress) {
118  this.ipAddress = ipAddress;
119  }
120 
121  @Override
122  public int hashCode() {
123  int hash = 0;
124  hash += (id != null ? id.hashCode() : 0);
125  return hash;
126  }
127 
128  /**
129  * If objects are the same class instance and has the same id's then they are equal.
130  *
131  * @param object
132  * @return
133  */
134  @Override
135  public boolean equals(Object object) {
136  if (!(object instanceof DocClonerServer)) {
137  return false;
138  }
139  DocClonerServer other = (DocClonerServer) object;
140  if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
141  return false;
142  }
143  return true;
144  }
145 
146  @Override
147  public String toString() {
148  return "cz.vutbr.fit.knot.annotations.documentCloner.DocClonerServer[ id=" + id + " ]";
149  }
150 
151 } // public class DocClonerServer
Class representing approved document clone server.