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
27
@Table(name="api", schema = "dtr", uniqueConstraints = {@UniqueConstraint(columnNames = {"uri","method"})})
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
	@Basic(optional = false)
67
    @Column(nullable = false)
68
	@Version
69
	private int version;
70
 
71
	public int getId() {
72
		return id;
73
	}
74
	public void setId(int id) {
75
		this.id = id;
76
	}
77
	public void setName(String name) {
78
        this.name = name;
79
    }
80
    public String getName() {
81
        return name;
82
    }
83
    public void setMethod(Method method) {
84
		this.method = method;
85
	}
86
    public Method getMethod() {
87
		return method;
88
	}
89
    public String getUri() {
90
		return uri;
91
	}
92
    public void setUri(String uri) {
93
		this.uri = uri;
94
	}
95
 
96
    public void setCreateTimestamp(LocalDateTime createTimestamp) {
97
		this.createTimestamp = createTimestamp;
98
	}
99
    public LocalDateTime getCreateTimestamp() {
100
		return createTimestamp;
101
	}
102
 
103
    public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
104
		this.updateTimestamp = updateTimestamp;
105
	}
106
    public LocalDateTime getUpdateTimestamp() {
107
		return updateTimestamp;
108
	}
109
 
110
    public void setVersion(int version) {
111
		this.version = version;
112
	}
113
    public int getVersion() {
114
		return version;
115
	}
116
	@Override
117
	public String toString() {
118
		return "Api [id=" + id + ", name=" + name + ", uri=" + uri + ", method=" + method + ", createTimestamp="
119
				+ createTimestamp + ", updateTimestamp=" + updateTimestamp + ", version=" + version + "]";
120
	}
121
 
122
 
123
 
124
 
125
}