Subversion Repositories SmartDukaan

Rev

Rev 22125 | Rev 25651 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
21720 ashik.ali 1
package com.spice.profitmandi.dao.entity.dtr;
21545 ashik.ali 2
 
3
import java.time.LocalDateTime;
4
 
5
import javax.persistence.Column;
6
import javax.persistence.Convert;
7
import javax.persistence.Entity;
8
import javax.persistence.EnumType;
9
import javax.persistence.Enumerated;
10
import javax.persistence.GeneratedValue;
11
import javax.persistence.GenerationType;
12
import javax.persistence.Id;
13
import javax.persistence.Table;
14
 
22216 ashik.ali 15
import org.hibernate.annotations.UpdateTimestamp;
16
 
22125 ashik.ali 17
import com.spice.profitmandi.common.enumuration.ContentType;
21545 ashik.ali 18
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
19
 
20
 
21
@Entity
21596 ashik.ali 22
@Table(name="dtr.document", schema = "dtr")
21545 ashik.ali 23
public class Document{
24
 
25
	@Id
26
	@Column(name="id", unique=true, updatable=false)
27
	@GeneratedValue(strategy = GenerationType.IDENTITY)
28
	private int id;
29
 
30
	@Column(name="name", unique = true)
31
	private String name;
32
 
33
	@Column(name = "path")
34
	private String path;
35
 
36
	@Column(name = "content_type")
37
	@Enumerated(EnumType.STRING)
38
	private ContentType contentType;
39
 
40
	private long size;
41
 
42
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22125 ashik.ali 43
	private LocalDateTime createTimestamp = LocalDateTime.now();
21545 ashik.ali 44
 
45
	@Convert(converter = LocalDateTimeAttributeConverter.class)
22216 ashik.ali 46
	@UpdateTimestamp
22125 ashik.ali 47
	private LocalDateTime updateTimestamp = LocalDateTime.now();
21545 ashik.ali 48
 
49
	@Column(columnDefinition="tinyint(1) default 0")
50
	private boolean persisted;
51
 
52
	public int getId() {
53
		return id;
54
	}
55
 
56
	public void setId(int id) {
57
		this.id = id;
58
	}
59
 
60
	public String getName() {
61
		return name;
62
	}
63
 
64
	public void setName(String name) {
65
		this.name = name;
66
	}
67
 
68
	public String getPath() {
69
		return path;
70
	}
71
 
72
	public void setPath(String path) {
73
		this.path = path;
74
	}
75
 
76
	public ContentType getContentType() {
77
		return contentType;
78
	}
79
 
80
	public void setContentType(ContentType contentType) {
81
		this.contentType = contentType;
82
	}
83
 
84
	public long getSize() {
85
		return size;
86
	}
87
 
88
	public void setSize(long size) {
89
		this.size = size;
90
	}
91
 
92
	public LocalDateTime getCreateTimestamp() {
93
		return createTimestamp;
94
	}
95
 
96
	public void setCreateTimestamp(LocalDateTime createTimestamp) {
97
		this.createTimestamp = createTimestamp;
98
	}
99
 
100
	public LocalDateTime getUpdateTimestamp() {
101
		return updateTimestamp;
102
	}
103
 
104
	public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
105
		this.updateTimestamp = updateTimestamp;
106
	}
107
 
108
 
109
	public boolean isPersisted() {
110
		return persisted;
111
	}
112
 
113
	public void setPersisted(boolean persisted) {
114
		this.persisted = persisted;
115
	}
116
 
21924 ashik.ali 117
 
22009 ashik.ali 118
 
21602 ashik.ali 119
	@Override
21924 ashik.ali 120
	public int hashCode() {
121
		final int prime = 31;
122
		int result = 1;
123
		result = prime * result + id;
124
		return result;
125
	}
126
 
127
	@Override
128
	public boolean equals(Object obj) {
129
		if (this == obj)
130
			return true;
131
		if (obj == null)
132
			return false;
133
		if (getClass() != obj.getClass())
134
			return false;
135
		Document other = (Document) obj;
136
		if (id != other.id)
137
			return false;
138
		return true;
139
	}
140
 
141
	@Override
21602 ashik.ali 142
	public String toString() {
143
		return "Document [id=" + id + ", name=" + name + ", path=" + path + ", contentType=" + contentType + ", size="
144
				+ size + ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp
145
				+ ", persisted=" + persisted + "]";
146
	}
147
 
148
 
149
 
21545 ashik.ali 150
}