Mercurial > hg > LGServices
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/gazetteer/bo/Sequence.java Thu Apr 23 15:46:01 2015 +0200 @@ -0,0 +1,94 @@ +package de.mpiwg.gazetteer.bo; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * + * @author jurzua + */ +@Entity +@Table(name="row_sequence") +public class Sequence implements Serializable { + + private static final long serialVersionUID = 120128920808559599L; + + public Sequence(){} + + public Sequence(String name, Long value){ + this.lastValue = value; + this.name = name; + } + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name="name") + private String name; + + @Column(name="last_value") + private Long lastValue; + + public Long generateId(){ + return this.lastValue++; + } + + public Long getLastValue() { + return lastValue; + } + + public void setLastValue(Long lastValue) { + this.lastValue = lastValue; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Sequence)) { + return false; + } + Sequence other = (Sequence) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "org.mpi.openmind.ontology.joins.Sequence[id=" + id + "]"; + } + +} +