Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/gazetteer/bo/Sequence.java @ 0:3e62083dbcbf
First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Thu, 23 Apr 2015 15:46:01 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3e62083dbcbf |
---|---|
1 package de.mpiwg.gazetteer.bo; | |
2 | |
3 import java.io.Serializable; | |
4 import javax.persistence.Column; | |
5 import javax.persistence.Entity; | |
6 import javax.persistence.GeneratedValue; | |
7 import javax.persistence.GenerationType; | |
8 import javax.persistence.Id; | |
9 import javax.persistence.Table; | |
10 | |
11 /** | |
12 * | |
13 * @author jurzua | |
14 */ | |
15 @Entity | |
16 @Table(name="row_sequence") | |
17 public class Sequence implements Serializable { | |
18 | |
19 private static final long serialVersionUID = 120128920808559599L; | |
20 | |
21 public Sequence(){} | |
22 | |
23 public Sequence(String name, Long value){ | |
24 this.lastValue = value; | |
25 this.name = name; | |
26 } | |
27 | |
28 @Id | |
29 @GeneratedValue(strategy = GenerationType.AUTO) | |
30 private Long id; | |
31 | |
32 public Long getId() { | |
33 return id; | |
34 } | |
35 | |
36 public void setId(Long id) { | |
37 this.id = id; | |
38 } | |
39 | |
40 @Column(name="name") | |
41 private String name; | |
42 | |
43 @Column(name="last_value") | |
44 private Long lastValue; | |
45 | |
46 public Long generateId(){ | |
47 return this.lastValue++; | |
48 } | |
49 | |
50 public Long getLastValue() { | |
51 return lastValue; | |
52 } | |
53 | |
54 public void setLastValue(Long lastValue) { | |
55 this.lastValue = lastValue; | |
56 } | |
57 | |
58 public String getName() { | |
59 return name; | |
60 } | |
61 | |
62 public void setName(String name) { | |
63 this.name = name; | |
64 } | |
65 | |
66 | |
67 | |
68 @Override | |
69 public int hashCode() { | |
70 int hash = 0; | |
71 hash += (id != null ? id.hashCode() : 0); | |
72 return hash; | |
73 } | |
74 | |
75 @Override | |
76 public boolean equals(Object object) { | |
77 // TODO: Warning - this method won't work in the case the id fields are not set | |
78 if (!(object instanceof Sequence)) { | |
79 return false; | |
80 } | |
81 Sequence other = (Sequence) object; | |
82 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { | |
83 return false; | |
84 } | |
85 return true; | |
86 } | |
87 | |
88 @Override | |
89 public String toString() { | |
90 return "org.mpi.openmind.ontology.joins.Sequence[id=" + id + "]"; | |
91 } | |
92 | |
93 } | |
94 |