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