4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
ServerSetting.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: ServerSettings.java
5  * Description: Class representing parameter of server settings
6  */
7 
8 /**
9  * @file ServerSettings.java
10  *
11  * @brief Class representing parameter of server settings
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.Lob;
24 import javax.persistence.NamedQueries;
25 import javax.persistence.NamedQuery;
26 import javax.persistence.Table;
27 import javax.validation.constraints.NotNull;
28 import javax.validation.constraints.Size;
29 import javax.xml.bind.annotation.XmlRootElement;
30 
31 /**
32  * Class representing parameter of server settings
33  *
34  * @brief Class representing parameter of server settings
35  * @author Martin Petr (xpetrm05)
36  */
37 @Entity
38 @Table(name = "serverSetting")
39 @XmlRootElement
40 @NamedQueries({
41  @NamedQuery(name = "ServerSetting.findAll", query = "SELECT s FROM ServerSetting s"),
42  @NamedQuery(name = "ServerSetting.findByName", query = "SELECT s FROM ServerSetting s WHERE s.settingName = :name"),
43  @NamedQuery(name = "ServerSetting.findById", query = "SELECT s FROM ServerSetting s WHERE s.id = :id")})
44 public class ServerSetting implements Serializable {
45  private static final long serialVersionUID = 1L;
46  /** Id of parameter of server settings */
47  @Id
48  @GeneratedValue(strategy = GenerationType.IDENTITY)
49  @Basic(optional = false)
50  @Column(name = "id")
51  private Integer id;
52 
53  /** Name of parameter of server settings */
54  @Basic(optional = false)
55  @NotNull
56  @Lob
57  @Size(min = 1, max = 65535)
58  @Column(name = "settingName")
59  private String settingName;
60 
61  /** Value of parameter of server settings */
62  @Basic(optional = false)
63  @NotNull
64  @Lob
65  @Size(min = 1, max = 65535)
66  @Column(name = "settingValue")
67  private String settingValue;
68 
69  /**
70  * Constructor
71  */
72  public ServerSetting() {
73  }
74 
75  /**
76  * Constructor
77  *
78  * @param id id of parameter of server settings
79  */
80  public ServerSetting(Integer id) {
81  this.id = id;
82  }
83 
84  /**
85  * Constructor
86  *
87  * @param settingName Name of parameter of server settings
88  * @param settingValue Value of parameter of server settings
89  */
90  public ServerSetting(String settingName, String settingValue) {
91  this.settingName = settingName;
92  this.settingValue = settingValue;
93  }
94 
95  /**
96  * Constructor
97  *
98  * @param id id of parameter of server settings
99  * @param settingName Name of parameter of server settings
100  * @param settingValue Value of parameter of server settings
101  */
102  public ServerSetting(Integer id, String settingName, String settingValue) {
103  this.id = id;
104  this.settingName = settingName;
105  this.settingValue = settingValue;
106  }
107 
108  /**
109  * Gets id of parameter of server settings
110  *
111  * @return id of parameter of server settings
112  */
113  public Integer getId() {
114  return id;
115  }
116 
117  /**
118  * Sets id of parameter of server settings
119  *
120  * @param id id of parameter of server settings
121  */
122  public void setId(Integer id) {
123  this.id = id;
124  }
125 
126  /**
127  * Gets name of parameter of server settings
128  *
129  * @return Returns name of parameter of server settings
130  */
131  public String getSettingName() {
132  return settingName;
133  }
134 
135  /**
136  * Sets name of parameter of server settings
137  *
138  * @param settingName Name of parameter of server settings
139  */
140  public void setSettingName(String settingName) {
141  this.settingName = settingName;
142  }
143 
144  /**
145  * Gets value of parameter of server settings
146  *
147  * @return Returns value of parameter of server settings
148  */
149  public String getSettingValue() {
150  return settingValue;
151  }
152 
153  /**
154  * Sets value oof parameter of server settings
155  *
156  * @param settingValue Value of parameter of server settings
157  */
158  public void setSettingValue(String settingValue) {
159  this.settingValue = settingValue;
160  }
161 
162  @Override
163  public int hashCode() {
164  int hash = 0;
165  hash += (id != null ? id.hashCode() : 0);
166  return hash;
167  }
168 
169  /**
170  * Compares this with other object and returns, whether objects are same type
171  * and have the same id.
172  * @param object
173  * @return
174  */
175  @Override
176  public boolean equals(Object object) {
177  if (!(object instanceof ServerSetting)) {
178  return false;
179  }
180  ServerSetting other = (ServerSetting) object;
181  if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
182  return false;
183  }
184  return true;
185  }
186 
187  @Override
188  public String toString() {
189  return "cz.vutbr.fit.knot.annotations.entity.ServerSetting[ id=" + id + " ]";
190  }
191 
192 } // public class ServerSetting
Class representing parameter of server settings.
ServerSetting(Integer id, String settingName, String settingValue)
ServerSetting(String settingName, String settingValue)