Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
21545 ashik.ali 1
package com.spice.profitmandi.dao.entity;
2
 
3
import java.io.Serializable;
4
import java.time.LocalDateTime;
5
 
6
import javax.persistence.Basic;
7
import javax.persistence.Column;
8
import javax.persistence.Entity;
9
import javax.persistence.GeneratedValue;
10
import javax.persistence.GenerationType;
11
import javax.persistence.Id;
12
import javax.persistence.NamedQueries;
13
import javax.persistence.NamedQuery;
14
import javax.persistence.Table;
15
import javax.persistence.UniqueConstraint;
16
import javax.persistence.Version;
17
 
18
import com.spice.profitmandi.dao.enumuration.Method;
19
 
20
/**
21
 * This class basically contains api details
22
 * 
23
 * @author ashikali
24
 *
25
 */
26
@Entity
21596 ashik.ali 27
@Table(name="dtr.api", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"uri","method"})})
21545 ashik.ali 28
@NamedQueries({
29
	@NamedQuery(name = "Api.selectCount", query = "select count(a) from Api a"),
30
	@NamedQuery(name="Api.selectAll",query="select a from Api a"),
31
	@NamedQuery(name="Api.selectById",query="select a from Api a where a.id= :id"),
32
	@NamedQuery(name="Api.selectByName",query="select a from Api a where a.name= :name"),
33
	@NamedQuery(name="Api.selectByUri",query="select a from Api a where a.uri= :uri"),
34
	@NamedQuery(name="Api.selectUniqueCount",query="select count(a) from Api a where a.uri = :uri and a.method = :method"),
35
	@NamedQuery(name="Api.selectNameCount",query="select count(a) from Api a where a.name = :name"),
36
	@NamedQuery(name="Api.deleteById",query="delete from Api a where a.id= :id"),
37
	@NamedQuery(name = "Api.updateById", query = "update Api a set a.name = :name, a.uri = :uri, a.method = :method, a.updateTimestamp = :updateTimestamp where a.id = :id"),
38
})
39
public class Api implements Serializable{
40
 
41
	private static final long serialVersionUID = 1L;
42
 
43
	public Api() {
44
	}
45
 
46
	@Id
47
	@Column(name="id", unique=true, updatable=false)
48
	@GeneratedValue(strategy = GenerationType.IDENTITY)
49
	private int id;
50
 
51
	@Column(name="name", unique = true)
52
	private String name;
53
 
54
	@Column(name = "uri")
55
	private String uri;
56
 
57
	@Column(name = "method")
58
	private Method method;
59
 
60
	@Column(name="create_timestamp", updatable = false)
61
	private LocalDateTime createTimestamp = LocalDateTime.now();
62
 
63
	@Column(name="update_timestamp")
64
	private LocalDateTime updateTimestamp = LocalDateTime.now();
65
 
66
 
67
	public int getId() {
68
		return id;
69
	}
70
	public void setId(int id) {
71
		this.id = id;
72
	}
73
	public void setName(String name) {
74
        this.name = name;
75
    }
76
    public String getName() {
77
        return name;
78
    }
79
    public void setMethod(Method method) {
80
		this.method = method;
81
	}
82
    public Method getMethod() {
83
		return method;
84
	}
85
    public String getUri() {
86
		return uri;
87
	}
88
    public void setUri(String uri) {
89
		this.uri = uri;
90
	}
91
 
92
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
93
		this.createTimestamp = createTimestamp;
94
	}
95
    public LocalDateTime getCreateTimestamp() {
96
		return createTimestamp;
97
	}
98
 
99
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
100
		this.updateTimestamp = updateTimestamp;
101
	}
102
    public LocalDateTime getUpdateTimestamp() {
103
		return updateTimestamp;
104
	}
105
 
21693 ashik.ali 106
 
21545 ashik.ali 107
	@Override
108
	public String toString() {
109
		return "Api [id=" + id + ", name=" + name + ", uri=" + uri + ", method=" + method + ", createTimestamp="
110
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", version=" + version + "]";
111
	}
112
 
113
 
114
 
115
 
116
}