From cd99d57cccb88ea8a058eca530d62a81a665983c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 11 Apr 2013 10:13:44 +0200 Subject: o Initial import. --- src/main/java/io/trygvis/model/Article.java | 57 +++++++++++++++++++++++++++++ src/main/java/io/trygvis/model/Queue.java | 46 +++++++++++++++++++++++ src/main/java/io/trygvis/model/Task.java | 32 ++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100755 src/main/java/io/trygvis/model/Article.java create mode 100755 src/main/java/io/trygvis/model/Queue.java create mode 100755 src/main/java/io/trygvis/model/Task.java (limited to 'src/main/java/io/trygvis/model') diff --git a/src/main/java/io/trygvis/model/Article.java b/src/main/java/io/trygvis/model/Article.java new file mode 100755 index 0000000..6383e50 --- /dev/null +++ b/src/main/java/io/trygvis/model/Article.java @@ -0,0 +1,57 @@ +package io.trygvis.model; + +import java.util.Date; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +public class Article { + @Id + @SequenceGenerator(name="id_seq", sequenceName="id_seq") + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_seq") + private Integer id; + private Date created; + private Date updated; + private String title; + private String body; + + @SuppressWarnings("UnusedDeclaration") + private Article() { + } + + public Article(Date created, Date updated, String title, String body) { + this.created = created; + this.updated = updated; + this.title = title; + this.body = body; + } + + public Integer getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public Date getUpdated() { + return updated; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + public String getTitle() { + return title; + } + + public String getBody() { + return body; + } +} diff --git a/src/main/java/io/trygvis/model/Queue.java b/src/main/java/io/trygvis/model/Queue.java new file mode 100755 index 0000000..52c5c0f --- /dev/null +++ b/src/main/java/io/trygvis/model/Queue.java @@ -0,0 +1,46 @@ +package io.trygvis.model; + +import javax.persistence.*; + +@Entity +@Table( + uniqueConstraints = { + @UniqueConstraint(name = "uq_queue__name", columnNames = "name") + } +) +public class Queue { + + @Id + @SequenceGenerator(name = "queue_seq", sequenceName = "queue_seq") + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "queue_seq") + private Integer id; + + private String name; + + private long interval; + + public Queue(String name, long interval) { + this.name = name; + this.interval = interval; + } + + public Integer getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getInterval() { + return interval; + } + + public void setInterval(long interval) { + this.interval = interval; + } +} diff --git a/src/main/java/io/trygvis/model/Task.java b/src/main/java/io/trygvis/model/Task.java new file mode 100755 index 0000000..fa44e26 --- /dev/null +++ b/src/main/java/io/trygvis/model/Task.java @@ -0,0 +1,32 @@ +package io.trygvis.model; + +import javax.persistence.*; + +@Entity +public class Task { + @Id + @SequenceGenerator(name = "task_seq", sequenceName = "task_seq") + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "task_seq") + private Integer id; + + @ManyToOne + private Queue queue; + + private Long long1; + + public Task(Queue queue) { + this.queue = queue; + } + + public Integer getId() { + return id; + } + + public Long getLong1() { + return long1; + } + + public void setLong1(Long long1) { + this.long1 = long1; + } +} -- cgit v1.2.3