| 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;
|
| 22009 |
ashik.ali |
7 |
import javax.persistence.Convert;
|
| 21545 |
ashik.ali |
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 |
|
| 22009 |
ashik.ali |
17 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
|
| 21720 |
ashik.ali |
18 |
import com.spice.profitmandi.dao.enumuration.dtr.Method;
|
| 21545 |
ashik.ali |
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 |
|
| 22009 |
ashik.ali |
60 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
61 |
@Column(name="create_timestamp", updatable = false)
|
|
|
62 |
private LocalDateTime createTimestamp = LocalDateTime.now();
|
|
|
63 |
|
| 22009 |
ashik.ali |
64 |
@Convert(converter = LocalDateTimeAttributeConverter.class)
|
| 21545 |
ashik.ali |
65 |
@Column(name="update_timestamp")
|
|
|
66 |
private LocalDateTime updateTimestamp = LocalDateTime.now();
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
public int getId() {
|
|
|
70 |
return id;
|
|
|
71 |
}
|
|
|
72 |
public void setId(int id) {
|
|
|
73 |
this.id = id;
|
|
|
74 |
}
|
|
|
75 |
public void setName(String name) {
|
|
|
76 |
this.name = name;
|
|
|
77 |
}
|
|
|
78 |
public String getName() {
|
|
|
79 |
return name;
|
|
|
80 |
}
|
|
|
81 |
public void setMethod(Method method) {
|
|
|
82 |
this.method = method;
|
|
|
83 |
}
|
|
|
84 |
public Method getMethod() {
|
|
|
85 |
return method;
|
|
|
86 |
}
|
|
|
87 |
public String getUri() {
|
|
|
88 |
return uri;
|
|
|
89 |
}
|
|
|
90 |
public void setUri(String uri) {
|
|
|
91 |
this.uri = uri;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public void setCreateTimestamp(LocalDateTime createTimestamp) {
|
|
|
95 |
this.createTimestamp = createTimestamp;
|
|
|
96 |
}
|
|
|
97 |
public LocalDateTime getCreateTimestamp() {
|
|
|
98 |
return createTimestamp;
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
|
|
|
102 |
this.updateTimestamp = updateTimestamp;
|
|
|
103 |
}
|
|
|
104 |
public LocalDateTime getUpdateTimestamp() {
|
|
|
105 |
return updateTimestamp;
|
|
|
106 |
}
|
| 21924 |
ashik.ali |
107 |
|
| 22009 |
ashik.ali |
108 |
|
| 21545 |
ashik.ali |
109 |
@Override
|
| 21924 |
ashik.ali |
110 |
public int hashCode() {
|
|
|
111 |
final int prime = 31;
|
|
|
112 |
int result = 1;
|
|
|
113 |
result = prime * result + id;
|
|
|
114 |
return result;
|
|
|
115 |
}
|
|
|
116 |
@Override
|
|
|
117 |
public boolean equals(Object obj) {
|
|
|
118 |
if (this == obj)
|
|
|
119 |
return true;
|
|
|
120 |
if (obj == null)
|
|
|
121 |
return false;
|
|
|
122 |
if (getClass() != obj.getClass())
|
|
|
123 |
return false;
|
|
|
124 |
Api other = (Api) obj;
|
|
|
125 |
if (id != other.id)
|
|
|
126 |
return false;
|
|
|
127 |
return true;
|
|
|
128 |
}
|
|
|
129 |
@Override
|
| 21545 |
ashik.ali |
130 |
public String toString() {
|
|
|
131 |
return "Api [id=" + id + ", name=" + name + ", uri=" + uri + ", method=" + method + ", createTimestamp="
|
| 21695 |
amit.gupta |
132 |
+ createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
|
| 21924 |
ashik.ali |
133 |
}
|
| 21545 |
ashik.ali |
134 |
|
|
|
135 |
}
|