Rev 945 | Rev 1010 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
924 | dev | 1 | package ak.hostadmiral.core.model; |
919 | dev | 2 | |
3 | import java.util.Date; |
||
924 | dev | 4 | import ak.hostadmiral.util.ModelException; |
5 | import ak.hostadmiral.util.ModelSecurityException; |
||
919 | dev | 6 | |
7 | public abstract class GeneralModelObject |
||
8 | implements ModelObject |
||
9 | { |
||
945 | dev | 10 | private Long id; |
919 | dev | 11 | private Boolean enabled; |
12 | private String comment; |
||
13 | private Date modStamp; |
||
918 | dev | 14 | private User modUser; |
919 | dev | 15 | |
918 | dev | 16 | /** |
17 | * |
||
945 | dev | 18 | * @hibernate.id generator-class="native" |
19 | */ |
||
20 | public Long getId() |
||
21 | { |
||
22 | return id; |
||
23 | } |
||
24 | |||
25 | protected void setId(Long id) |
||
26 | { |
||
27 | this.id = id; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * |
||
919 | dev | 32 | * @hibernate.property |
33 | */ |
||
34 | public Boolean getEnabled() |
||
35 | { |
||
36 | return enabled; |
||
37 | } |
||
38 | |||
921 | dev | 39 | protected void setEnabled(Boolean enabled) |
919 | dev | 40 | { |
41 | this.enabled = enabled; |
||
42 | } |
||
43 | |||
44 | public void setEnabled(User editor, Boolean enabled) |
||
45 | throws ModelException |
||
46 | { |
||
47 | if(!editableBy(editor)) |
||
48 | throw new ModelSecurityException(); |
||
49 | |||
50 | this.enabled = enabled; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * |
||
55 | * @hibernate.property |
||
56 | */ |
||
57 | public String getComment() |
||
58 | { |
||
59 | return comment; |
||
60 | } |
||
61 | |||
921 | dev | 62 | protected void setComment(String comment) |
919 | dev | 63 | { |
64 | this.comment = comment; |
||
65 | } |
||
66 | |||
67 | public void setComment(User editor, String comment) |
||
68 | throws ModelException |
||
69 | { |
||
70 | if(!editableBy(editor)) |
||
71 | throw new ModelSecurityException(); |
||
72 | |||
73 | this.comment = comment; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * |
||
78 | * @hibernate.timestamp column="mod_stamp" |
||
79 | */ |
||
80 | public Date getModStamp() |
||
81 | { |
||
82 | return modStamp; |
||
83 | } |
||
84 | |||
85 | protected void setModStamp(Date modStamp) |
||
86 | { |
||
87 | this.modStamp = modStamp; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * |
||
918 | dev | 92 | * @hibernate.many-to-one column="mod_user" |
93 | */ |
||
94 | public User getModUser() |
||
95 | { |
||
96 | return modUser; |
||
97 | } |
||
98 | |||
99 | protected void setModUser(User modUser) |
||
100 | { |
||
101 | this.modUser = modUser; |
||
102 | } |
||
919 | dev | 103 | } |