forked from romanb/JPA-NestedSet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Category.java
95 lines (79 loc) · 2.03 KB
/
Category.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/**
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file MIT.txt.
* It is also available through the world-wide-web at this URL:
* http://www.opensource.org/licenses/mit-license.html
*/
package org.pkaboo.jpa.nestedset.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.pkaboo.jpa.nestedset.NodeInfo;
import org.pkaboo.jpa.nestedset.annotations.LeftColumn;
import org.pkaboo.jpa.nestedset.annotations.LevelColumn;
import org.pkaboo.jpa.nestedset.annotations.RightColumn;
import org.pkaboo.jpa.nestedset.annotations.RootColumn;
@Entity
public class Category implements NodeInfo {
@Id @GeneratedValue
private int id;
private String name;
@Column(updatable=false)
@LeftColumn
private int lft;
@RightColumn
@Column(updatable=false)
private int rgt;
@LevelColumn
@Column(updatable=false)
private int level;
@RootColumn
private int rootId;
@Override public int getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@Override
public int getLeftValue() {
return this.lft;
}
@Override
public int getRightValue() {
return this.rgt;
}
@Override
public int getLevel() {
return this.level;
}
@Override
public void setLeftValue(int value) {
this.lft = value;
}
@Override
public void setRightValue(int value) {
this.rgt = value;
}
@Override
public void setLevel(int level) {
this.level = level;
}
@Override
public int getRootValue() {
return this.rootId;
}
@Override
public void setRootValue(int value) {
this.rootId = value;
}
@Override public String toString() {
return "[Category: id=" + this.id + ", name=" + this.name + "-" + super.toString() + "]";
}
}