(empty log message)
@@ -1,116 +0,0 @@ | ||
1 | -package org.phosphoresce.webcore.hibernate4.model; | |
2 | - | |
3 | -import javax.persistence.Column; | |
4 | -import javax.persistence.Entity; | |
5 | -import javax.persistence.Table; | |
6 | -import javax.persistence.UniqueConstraint; | |
7 | - | |
8 | -import org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateEntity; | |
9 | - | |
10 | - | |
11 | -/** | |
12 | - * システムユーザーーエンティティクラス<br> | |
13 | - * | |
14 | - * @author Kitagawa<br> | |
15 | - * | |
16 | - *<!-- | |
17 | - * 更新日 更新者 更新内容 | |
18 | - * 2013/02/01 Kitagawa 新規作成 | |
19 | - *--> | |
20 | - */ | |
21 | -@Entity | |
22 | -@Table(name = "s_user", // | |
23 | -uniqueConstraints = { // | |
24 | -@UniqueConstraint(columnNames = { "delete_date", "code" }) // | |
25 | -}) | |
26 | -public class SUser extends AbstractHibernateEntity { | |
27 | - | |
28 | - /** ユーザーコード */ | |
29 | - @Column(name = "code", nullable = false, length = 32) | |
30 | - private String code; | |
31 | - | |
32 | - /** パスワード */ | |
33 | - @Column(name = "password", nullable = true, length = 32) | |
34 | - private String password; | |
35 | - | |
36 | - /** ユーザー名(名) */ | |
37 | - @Column(name = "first_name", nullable = false, length = 32) | |
38 | - private String firstName; | |
39 | - | |
40 | - /** ユーザー名(姓) */ | |
41 | - @Column(name = "last_name", nullable = false, length = 32) | |
42 | - private String lastName; | |
43 | - | |
44 | - /** | |
45 | - * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> | |
46 | - * 当処理はエンティティ毎に処理が異なります。<br> | |
47 | - * @see org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateEntity#validateEntity() | |
48 | - */ | |
49 | - @Override | |
50 | - protected void validateEntity() { | |
51 | - } | |
52 | - | |
53 | - /** | |
54 | - * ユーザーコードを取得します。<br> | |
55 | - * @return ユーザーコード | |
56 | - */ | |
57 | - public String getCode() { | |
58 | - return code; | |
59 | - } | |
60 | - | |
61 | - /** | |
62 | - * ユーザーコードを設定します。<br> | |
63 | - * @param code ユーザーコード | |
64 | - */ | |
65 | - public void setCode(String code) { | |
66 | - this.code = code; | |
67 | - } | |
68 | - | |
69 | - /** | |
70 | - * パスワードを取得します。<br> | |
71 | - * @return パスワード | |
72 | - */ | |
73 | - public String getPassword() { | |
74 | - return password; | |
75 | - } | |
76 | - | |
77 | - /** | |
78 | - * パスワードを設定します。<br> | |
79 | - * @param password パスワード | |
80 | - */ | |
81 | - public void setPassword(String password) { | |
82 | - this.password = password; | |
83 | - } | |
84 | - | |
85 | - /** | |
86 | - * ユーザー名(名)を取得します。<br> | |
87 | - * @return ユーザー名(名) | |
88 | - */ | |
89 | - public String getFirstName() { | |
90 | - return firstName; | |
91 | - } | |
92 | - | |
93 | - /** | |
94 | - * ユーザー名(名)を設定します。<br> | |
95 | - * @param firstName ユーザー名(名) | |
96 | - */ | |
97 | - public void setFirstName(String firstName) { | |
98 | - this.firstName = firstName; | |
99 | - } | |
100 | - | |
101 | - /** | |
102 | - * ユーザー名(姓)を取得します。<br> | |
103 | - * @return ユーザー名(姓) | |
104 | - */ | |
105 | - public String getLastName() { | |
106 | - return lastName; | |
107 | - } | |
108 | - | |
109 | - /** | |
110 | - * ユーザー名(姓)を設定します。<br> | |
111 | - * @param lastName ユーザー名(姓) | |
112 | - */ | |
113 | - public void setLastName(String lastName) { | |
114 | - this.lastName = lastName; | |
115 | - } | |
116 | -} |
@@ -0,0 +1,315 @@ | ||
1 | +package org.phosphoresce.webcore.hibernate4.model; | |
2 | + | |
3 | +import javax.persistence.Column; | |
4 | +import javax.persistence.Entity; | |
5 | +import javax.persistence.Table; | |
6 | +import javax.persistence.UniqueConstraint; | |
7 | + | |
8 | +import org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateExpirableEntity; | |
9 | + | |
10 | +/** | |
11 | + * システムコードマスタエンティティクラス<br> | |
12 | + * | |
13 | + * @author Kitagawa<br> | |
14 | + * | |
15 | + *<!-- | |
16 | + * 更新日 更新者 更新内容 | |
17 | + * 2013/02/01 Kitagawa 新規作成 | |
18 | + *--> | |
19 | + */ | |
20 | +@Entity | |
21 | +@Table(name = "sm_code", // | |
22 | +uniqueConstraints = { // | |
23 | +@UniqueConstraint(columnNames = { "delete_date", "category", "code" }) // | |
24 | +}) | |
25 | +public class SMCode extends AbstractHibernateExpirableEntity { | |
26 | + | |
27 | + /** カテゴリ */ | |
28 | + @Column(name = "category", nullable = false, length = 10) | |
29 | + private String category = null; | |
30 | + | |
31 | + /** コード */ | |
32 | + @Column(name = "code", nullable = false, length = 10) | |
33 | + private String code = null; | |
34 | + | |
35 | + /** ソート順 */ | |
36 | + @Column(name = "order_no", nullable = false) | |
37 | + private Integer orderNo = null; | |
38 | + | |
39 | + /** 名称 */ | |
40 | + @Column(name = "caption", nullable = false, length = 50) | |
41 | + private String caption = null; | |
42 | + | |
43 | + /** 略称 */ | |
44 | + @Column(name = "short_caption", nullable = false, length = 50) | |
45 | + private String shortCaption = null; | |
46 | + | |
47 | + /** 定義値1 */ | |
48 | + @Column(name = "definition_1", nullable = true, length = 50) | |
49 | + private String definition1 = null; | |
50 | + | |
51 | + /** 定義値2 */ | |
52 | + @Column(name = "definition_2", nullable = true, length = 50) | |
53 | + private String definition2 = null; | |
54 | + | |
55 | + /** 定義値3 */ | |
56 | + @Column(name = "definition_3", nullable = true, length = 50) | |
57 | + private String definition3 = null; | |
58 | + | |
59 | + /** 定義値4 */ | |
60 | + @Column(name = "definition_4", nullable = true, length = 50) | |
61 | + private String definition4 = null; | |
62 | + | |
63 | + /** 定義値5 */ | |
64 | + @Column(name = "definition_5", nullable = true, length = 50) | |
65 | + private String definition5 = null; | |
66 | + | |
67 | + /** 定義値6 */ | |
68 | + @Column(name = "definition_6", nullable = true, length = 50) | |
69 | + private String definition6 = null; | |
70 | + | |
71 | + /** 定義値7 */ | |
72 | + @Column(name = "definition_7", nullable = true, length = 50) | |
73 | + private String definition7 = null; | |
74 | + | |
75 | + /** 定義値8 */ | |
76 | + @Column(name = "definition_8", nullable = true, length = 50) | |
77 | + private String definition8 = null; | |
78 | + | |
79 | + /** 定義値9 */ | |
80 | + @Column(name = "definition_9", nullable = true, length = 50) | |
81 | + private String definition9 = null; | |
82 | + | |
83 | + /** | |
84 | + * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> | |
85 | + * 当処理はエンティティ毎に処理が異なります。<br> | |
86 | + * @see org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateEntity#validateEntity() | |
87 | + */ | |
88 | + @Override | |
89 | + protected void validateEntity() { | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * カテゴリを取得します。<br> | |
94 | + * @return カテゴリ | |
95 | + */ | |
96 | + public final String getCategory() { | |
97 | + return category; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * カテゴリを設定します。<br> | |
102 | + * @param category カテゴリ | |
103 | + */ | |
104 | + public final void setCategory(String category) { | |
105 | + this.category = category; | |
106 | + } | |
107 | + | |
108 | + /** | |
109 | + * コードを取得します。<br> | |
110 | + * @return コード | |
111 | + */ | |
112 | + public final String getCode() { | |
113 | + return code; | |
114 | + } | |
115 | + | |
116 | + /** | |
117 | + * コードを設定します。<br> | |
118 | + * @param code コード | |
119 | + */ | |
120 | + public final void setCode(String code) { | |
121 | + this.code = code; | |
122 | + } | |
123 | + | |
124 | + /** | |
125 | + * ソート順を取得します。<br> | |
126 | + * @return ソート順 | |
127 | + */ | |
128 | + public final Integer getOrderNo() { | |
129 | + return orderNo; | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * ソート順を設定します。<br> | |
134 | + * @param orderNo ソート順 | |
135 | + */ | |
136 | + public final void setOrderNo(Integer orderNo) { | |
137 | + this.orderNo = orderNo; | |
138 | + } | |
139 | + | |
140 | + /** | |
141 | + * 名称を取得します。<br> | |
142 | + * @return 名称 | |
143 | + */ | |
144 | + public final String getCaption() { | |
145 | + return caption; | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 名称を設定します。<br> | |
150 | + * @param caption 名称 | |
151 | + */ | |
152 | + public final void setCaption(String caption) { | |
153 | + this.caption = caption; | |
154 | + } | |
155 | + | |
156 | + /** | |
157 | + * 略称を取得します。<br> | |
158 | + * @return 略称 | |
159 | + */ | |
160 | + public final String getShortCaption() { | |
161 | + return shortCaption; | |
162 | + } | |
163 | + | |
164 | + /** | |
165 | + * 略称を設定します。<br> | |
166 | + * @param shortCaption 略称 | |
167 | + */ | |
168 | + public final void setShortCaption(String shortCaption) { | |
169 | + this.shortCaption = shortCaption; | |
170 | + } | |
171 | + | |
172 | + /** | |
173 | + * 定義値1を取得します。<br> | |
174 | + * @return 定義値1 | |
175 | + */ | |
176 | + public final String getDefinition1() { | |
177 | + return definition1; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * 定義値1を設定します。<br> | |
182 | + * @param definition1 定義値1 | |
183 | + */ | |
184 | + public final void setDefinition1(String definition1) { | |
185 | + this.definition1 = definition1; | |
186 | + } | |
187 | + | |
188 | + /** | |
189 | + * 定義値2を取得します。<br> | |
190 | + * @return 定義値2 | |
191 | + */ | |
192 | + public final String getDefinition2() { | |
193 | + return definition2; | |
194 | + } | |
195 | + | |
196 | + /** | |
197 | + * 定義値2を設定します。<br> | |
198 | + * @param definition2 定義値2 | |
199 | + */ | |
200 | + public final void setDefinition2(String definition2) { | |
201 | + this.definition2 = definition2; | |
202 | + } | |
203 | + | |
204 | + /** | |
205 | + * 定義値3を取得します。<br> | |
206 | + * @return 定義値3 | |
207 | + */ | |
208 | + public final String getDefinition3() { | |
209 | + return definition3; | |
210 | + } | |
211 | + | |
212 | + /** | |
213 | + * 定義値3を設定します。<br> | |
214 | + * @param definition3 定義値3 | |
215 | + */ | |
216 | + public final void setDefinition3(String definition3) { | |
217 | + this.definition3 = definition3; | |
218 | + } | |
219 | + | |
220 | + /** | |
221 | + * 定義値4を取得します。<br> | |
222 | + * @return 定義値4 | |
223 | + */ | |
224 | + public final String getDefinition4() { | |
225 | + return definition4; | |
226 | + } | |
227 | + | |
228 | + /** | |
229 | + * 定義値4を設定します。<br> | |
230 | + * @param definition4 定義値4 | |
231 | + */ | |
232 | + public final void setDefinition4(String definition4) { | |
233 | + this.definition4 = definition4; | |
234 | + } | |
235 | + | |
236 | + /** | |
237 | + * 定義値5を取得します。<br> | |
238 | + * @return 定義値5 | |
239 | + */ | |
240 | + public final String getDefinition5() { | |
241 | + return definition5; | |
242 | + } | |
243 | + | |
244 | + /** | |
245 | + * 定義値5を設定します。<br> | |
246 | + * @param definition5 定義値5 | |
247 | + */ | |
248 | + public final void setDefinition5(String definition5) { | |
249 | + this.definition5 = definition5; | |
250 | + } | |
251 | + | |
252 | + /** | |
253 | + * 定義値6を取得します。<br> | |
254 | + * @return 定義値6 | |
255 | + */ | |
256 | + public final String getDefinition6() { | |
257 | + return definition6; | |
258 | + } | |
259 | + | |
260 | + /** | |
261 | + * 定義値6を設定します。<br> | |
262 | + * @param definition6 定義値6 | |
263 | + */ | |
264 | + public final void setDefinition6(String definition6) { | |
265 | + this.definition6 = definition6; | |
266 | + } | |
267 | + | |
268 | + /** | |
269 | + * 定義値7を取得します。<br> | |
270 | + * @return 定義値7 | |
271 | + */ | |
272 | + public final String getDefinition7() { | |
273 | + return definition7; | |
274 | + } | |
275 | + | |
276 | + /** | |
277 | + * 定義値7を設定します。<br> | |
278 | + * @param definition7 定義値7 | |
279 | + */ | |
280 | + public final void setDefinition7(String definition7) { | |
281 | + this.definition7 = definition7; | |
282 | + } | |
283 | + | |
284 | + /** | |
285 | + * 定義値8を取得します。<br> | |
286 | + * @return 定義値8 | |
287 | + */ | |
288 | + public final String getDefinition8() { | |
289 | + return definition8; | |
290 | + } | |
291 | + | |
292 | + /** | |
293 | + * 定義値8を設定します。<br> | |
294 | + * @param definition8 定義値8 | |
295 | + */ | |
296 | + public final void setDefinition8(String definition8) { | |
297 | + this.definition8 = definition8; | |
298 | + } | |
299 | + | |
300 | + /** | |
301 | + * 定義値9を取得します。<br> | |
302 | + * @return 定義値9 | |
303 | + */ | |
304 | + public final String getDefinition9() { | |
305 | + return definition9; | |
306 | + } | |
307 | + | |
308 | + /** | |
309 | + * 定義値9を設定します。<br> | |
310 | + * @param definition9 定義値9 | |
311 | + */ | |
312 | + public final void setDefinition9(String definition9) { | |
313 | + this.definition9 = definition9; | |
314 | + } | |
315 | +} |
@@ -0,0 +1,115 @@ | ||
1 | +package org.phosphoresce.webcore.hibernate4.model; | |
2 | + | |
3 | +import javax.persistence.Column; | |
4 | +import javax.persistence.Entity; | |
5 | +import javax.persistence.Table; | |
6 | +import javax.persistence.UniqueConstraint; | |
7 | + | |
8 | +import org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateEntity; | |
9 | + | |
10 | +/** | |
11 | + * システムユーザーマスタエンティティクラス<br> | |
12 | + * | |
13 | + * @author Kitagawa<br> | |
14 | + * | |
15 | + *<!-- | |
16 | + * 更新日 更新者 更新内容 | |
17 | + * 2013/02/01 Kitagawa 新規作成 | |
18 | + *--> | |
19 | + */ | |
20 | +@Entity | |
21 | +@Table(name = "sm_user", // | |
22 | +uniqueConstraints = { // | |
23 | +@UniqueConstraint(columnNames = { "delete_date", "code" }) // | |
24 | +}) | |
25 | +public class SMUser extends AbstractHibernateEntity { | |
26 | + | |
27 | + /** ユーザーコード */ | |
28 | + @Column(name = "code", nullable = false, length = 32) | |
29 | + private String code = null; | |
30 | + | |
31 | + /** パスワード */ | |
32 | + @Column(name = "password", nullable = true, length = 32) | |
33 | + private String password = null; | |
34 | + | |
35 | + /** ユーザー名(名) */ | |
36 | + @Column(name = "first_name", nullable = false, length = 32) | |
37 | + private String firstName = null; | |
38 | + | |
39 | + /** ユーザー名(姓) */ | |
40 | + @Column(name = "last_name", nullable = false, length = 32) | |
41 | + private String lastName = null; | |
42 | + | |
43 | + /** | |
44 | + * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> | |
45 | + * 当処理はエンティティ毎に処理が異なります。<br> | |
46 | + * @see org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateEntity#validateEntity() | |
47 | + */ | |
48 | + @Override | |
49 | + protected void validateEntity() { | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * ユーザーコードを取得します。<br> | |
54 | + * @return ユーザーコード | |
55 | + */ | |
56 | + public final String getCode() { | |
57 | + return code; | |
58 | + } | |
59 | + | |
60 | + /** | |
61 | + * ユーザーコードを設定します。<br> | |
62 | + * @param code ユーザーコード | |
63 | + */ | |
64 | + public final void setCode(String code) { | |
65 | + this.code = code; | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * パスワードを取得します。<br> | |
70 | + * @return パスワード | |
71 | + */ | |
72 | + public final String getPassword() { | |
73 | + return password; | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * パスワードを設定します。<br> | |
78 | + * @param password パスワード | |
79 | + */ | |
80 | + public final void setPassword(String password) { | |
81 | + this.password = password; | |
82 | + } | |
83 | + | |
84 | + /** | |
85 | + * ユーザー名(名)を取得します。<br> | |
86 | + * @return ユーザー名(名) | |
87 | + */ | |
88 | + public final String getFirstName() { | |
89 | + return firstName; | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * ユーザー名(名)を設定します。<br> | |
94 | + * @param firstName ユーザー名(名) | |
95 | + */ | |
96 | + public final void setFirstName(String firstName) { | |
97 | + this.firstName = firstName; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * ユーザー名(姓)を取得します。<br> | |
102 | + * @return ユーザー名(姓) | |
103 | + */ | |
104 | + public final String getLastName() { | |
105 | + return lastName; | |
106 | + } | |
107 | + | |
108 | + /** | |
109 | + * ユーザー名(姓)を設定します。<br> | |
110 | + * @param lastName ユーザー名(姓) | |
111 | + */ | |
112 | + public final void setLastName(String lastName) { | |
113 | + this.lastName = lastName; | |
114 | + } | |
115 | +} |
@@ -2,7 +2,7 @@ | ||
2 | 2 | |
3 | 3 | import static org.hibernate.criterion.Restrictions.*; |
4 | 4 | |
5 | -import org.phosphoresce.webcore.hibernate4.model.SUser; | |
5 | +import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
6 | 6 | import org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateDAO; |
7 | 7 | import org.phosphoresce.webcore.hibernate4.transaction.GenericCriteria; |
8 | 8 | import org.phosphoresce.webcore.hibernate4.transaction.TransactionContainer; |
@@ -17,7 +17,7 @@ | ||
17 | 17 | * 2013/02/01 Kitagawa 新規作成 |
18 | 18 | *--> |
19 | 19 | */ |
20 | -public class SUserDAO extends AbstractHibernateDAO<SUser> { | |
20 | +public class SUserDAO extends AbstractHibernateDAO<SMUser> { | |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * コンストラクタ<br> |
@@ -33,8 +33,8 @@ | ||
33 | 33 | * @see org.phosphoresce.webcore.hibernate4.transaction.AbstractHibernateDAO#getTargetEntityClass() |
34 | 34 | */ |
35 | 35 | @Override |
36 | - public Class<SUser> getTargetEntityClass() { | |
37 | - return SUser.class; | |
36 | + public Class<SMUser> getTargetEntityClass() { | |
37 | + return SMUser.class; | |
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ | ||
42 | 42 | * @param code ユーザーコード |
43 | 43 | * @return エンティティオブジェクト |
44 | 44 | */ |
45 | - public SUser findByCode(String code) { | |
46 | - GenericCriteria<SUser> criteria = createCriteriaExcludeDeleted(); | |
45 | + public SMUser findByCode(String code) { | |
46 | + GenericCriteria<SMUser> criteria = createCriteriaExcludeDeleted(); | |
47 | 47 | |
48 | 48 | criteria.add(eq("code", code)); |
49 | 49 |
@@ -14,7 +14,7 @@ | ||
14 | 14 | import javax.persistence.OneToOne; |
15 | 15 | import javax.persistence.Version; |
16 | 16 | |
17 | -import org.phosphoresce.webcore.hibernate4.model.SUser; | |
17 | +import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
18 | 18 | import org.phosphoresce.webcore.hibernate4.model.enums.DeleteType; |
19 | 19 | |
20 | 20 | /** |
@@ -34,61 +34,49 @@ | ||
34 | 34 | @Id |
35 | 35 | @GeneratedValue(strategy = GenerationType.AUTO) |
36 | 36 | @Column(name = "id", unique = true, nullable = false) |
37 | - private Integer id; | |
37 | + private Integer id = null; | |
38 | 38 | |
39 | 39 | /** バージョン番号 */ |
40 | 40 | @Version |
41 | 41 | @Column(name = "version_lock", nullable = false) |
42 | - private Integer versionLocked; | |
42 | + private Integer versionLocked = null; | |
43 | 43 | |
44 | 44 | /** 登録日時 */ |
45 | 45 | @Column(name = "entry_date", nullable = false) |
46 | - private Date enrollDate; | |
46 | + private Date enrollDate = DAOUtil.getMinimumDate(); | |
47 | 47 | |
48 | 48 | /** 登録ユーザ */ |
49 | 49 | @OneToOne |
50 | 50 | @JoinColumn(name = "entry_user", nullable = true) |
51 | - private SUser enrollUser; | |
51 | + private SMUser enrollUser = null; | |
52 | 52 | |
53 | 53 | /** 更新日時 */ |
54 | 54 | @Column(name = "modify_date", nullable = false) |
55 | - private Date modifyDate; | |
55 | + private Date modifyDate = DAOUtil.getMinimumDate(); | |
56 | 56 | |
57 | 57 | /** 更新ユーザ */ |
58 | 58 | @OneToOne |
59 | 59 | @JoinColumn(name = "modify_user", nullable = true) |
60 | - private SUser modifyUser; | |
60 | + private SMUser modifyUser = null; | |
61 | 61 | |
62 | 62 | /** 削除日時 */ |
63 | 63 | @Column(name = "delete_date", nullable = false) |
64 | - private Date deleteDate; | |
64 | + private Date deleteDate = DAOUtil.getMinimumDate(); | |
65 | 65 | |
66 | 66 | /** 削除ユーザ */ |
67 | 67 | @OneToOne |
68 | 68 | @JoinColumn(name = "delete_user", nullable = true) |
69 | - private SUser deleteUser; | |
69 | + private SMUser deleteUser = null; | |
70 | 70 | |
71 | 71 | /** 削除状態 */ |
72 | 72 | @Column(name = "delete_type", nullable = false, length = 32) |
73 | 73 | @Enumerated(EnumType.STRING) |
74 | - private DeleteType deleteType; | |
74 | + private DeleteType deleteType = DeleteType.Validate; | |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> |
78 | 78 | */ |
79 | - final void validate() { | |
80 | - if (enrollDate == null) { | |
81 | - enrollDate = DAOUtil.getMinimumDate(); | |
82 | - } | |
83 | - if (modifyDate == null) { | |
84 | - modifyDate = DAOUtil.getMinimumDate(); | |
85 | - } | |
86 | - if (deleteDate == null) { | |
87 | - deleteDate = DAOUtil.getMinimumDate(); | |
88 | - } | |
89 | - if (deleteType == null) { | |
90 | - deleteType = DeleteType.Validate; | |
91 | - } | |
79 | + void validate() { | |
92 | 80 | validateEntity(); |
93 | 81 | } |
94 | 82 |
@@ -135,6 +123,9 @@ | ||
135 | 123 | * @return 登録日時 |
136 | 124 | */ |
137 | 125 | public final Date getEnrollDate() { |
126 | + if (enrollDate == null) { | |
127 | + enrollDate = DAOUtil.getMinimumDate(); | |
128 | + } | |
138 | 129 | return enrollDate; |
139 | 130 | } |
140 | 131 |
@@ -143,7 +134,11 @@ | ||
143 | 134 | * @param enrollDate 登録日時 |
144 | 135 | */ |
145 | 136 | final void setEnrollDate(Date enrollDate) { |
146 | - this.enrollDate = enrollDate; | |
137 | + if (enrollDate == null) { | |
138 | + this.enrollDate = DAOUtil.getMinimumDate(); | |
139 | + } else { | |
140 | + this.enrollDate = enrollDate; | |
141 | + } | |
147 | 142 | } |
148 | 143 | |
149 | 144 | /** |
@@ -150,7 +145,7 @@ | ||
150 | 145 | * 登録ユーザを取得します。<br> |
151 | 146 | * @return 登録ユーザ |
152 | 147 | */ |
153 | - public final SUser getEnrollUser() { | |
148 | + public final SMUser getEnrollUser() { | |
154 | 149 | return enrollUser; |
155 | 150 | } |
156 | 151 |
@@ -158,7 +153,7 @@ | ||
158 | 153 | * 登録ユーザを設定します。<br> |
159 | 154 | * @param enrollUser 登録ユーザ |
160 | 155 | */ |
161 | - final void setEnrollUser(SUser enrollUser) { | |
156 | + final void setEnrollUser(SMUser enrollUser) { | |
162 | 157 | this.enrollUser = enrollUser; |
163 | 158 | } |
164 | 159 |
@@ -167,6 +162,9 @@ | ||
167 | 162 | * @return 更新日時 |
168 | 163 | */ |
169 | 164 | public final Date getModifyDate() { |
165 | + if (modifyDate == null) { | |
166 | + modifyDate = DAOUtil.getMinimumDate(); | |
167 | + } | |
170 | 168 | return modifyDate; |
171 | 169 | } |
172 | 170 |
@@ -175,7 +173,11 @@ | ||
175 | 173 | * @param modifyDate 更新日時 |
176 | 174 | */ |
177 | 175 | final void setModifyDate(Date modifyDate) { |
178 | - this.modifyDate = modifyDate; | |
176 | + if (modifyDate == null) { | |
177 | + this.modifyDate = DAOUtil.getMinimumDate(); | |
178 | + } else { | |
179 | + this.modifyDate = modifyDate; | |
180 | + } | |
179 | 181 | } |
180 | 182 | |
181 | 183 | /** |
@@ -182,7 +184,7 @@ | ||
182 | 184 | * 更新ユーザを取得します。<br> |
183 | 185 | * @return 更新ユーザ |
184 | 186 | */ |
185 | - public final SUser getModifyUser() { | |
187 | + public final SMUser getModifyUser() { | |
186 | 188 | return modifyUser; |
187 | 189 | } |
188 | 190 |
@@ -190,7 +192,7 @@ | ||
190 | 192 | * 更新ユーザを設定します。<br> |
191 | 193 | * @param modifyUser 更新ユーザ |
192 | 194 | */ |
193 | - final void setModifyUser(SUser modifyUser) { | |
195 | + final void setModifyUser(SMUser modifyUser) { | |
194 | 196 | this.modifyUser = modifyUser; |
195 | 197 | } |
196 | 198 |
@@ -199,6 +201,9 @@ | ||
199 | 201 | * @return 削除日時 |
200 | 202 | */ |
201 | 203 | public final Date getDeleteDate() { |
204 | + if (deleteDate == null) { | |
205 | + deleteDate = DAOUtil.getMinimumDate(); | |
206 | + } | |
202 | 207 | return deleteDate; |
203 | 208 | } |
204 | 209 |
@@ -207,6 +212,11 @@ | ||
207 | 212 | * @param deleteDate 削除日時 |
208 | 213 | */ |
209 | 214 | final void setDeleteDate(Date deleteDate) { |
215 | + if (deleteDate == null) { | |
216 | + this.deleteDate = DAOUtil.getMinimumDate(); | |
217 | + } else { | |
218 | + this.deleteDate = deleteDate; | |
219 | + } | |
210 | 220 | this.deleteDate = deleteDate; |
211 | 221 | } |
212 | 222 |
@@ -214,7 +224,7 @@ | ||
214 | 224 | * 削除ユーザを取得します。<br> |
215 | 225 | * @return 削除ユーザ |
216 | 226 | */ |
217 | - public final SUser getDeleteUser() { | |
227 | + public final SMUser getDeleteUser() { | |
218 | 228 | return deleteUser; |
219 | 229 | } |
220 | 230 |
@@ -222,7 +232,30 @@ | ||
222 | 232 | * 削除ユーザを設定します。<br> |
223 | 233 | * @param deleteUser 削除ユーザ |
224 | 234 | */ |
225 | - final void setDeleteUser(SUser deleteUser) { | |
235 | + final void setDeleteUser(SMUser deleteUser) { | |
226 | 236 | this.deleteUser = deleteUser; |
227 | 237 | } |
238 | + | |
239 | + /** | |
240 | + * 削除状態を取得します。<br> | |
241 | + * @return 削除状態 | |
242 | + */ | |
243 | + public final DeleteType getDeleteType() { | |
244 | + if (deleteType == null) { | |
245 | + deleteType = DeleteType.Validate; | |
246 | + } | |
247 | + return deleteType; | |
248 | + } | |
249 | + | |
250 | + /** | |
251 | + * 削除状態を設定します。<br> | |
252 | + * @param deleteType 削除状態 | |
253 | + */ | |
254 | + final void setDeleteType(DeleteType deleteType) { | |
255 | + if (deleteType == null) { | |
256 | + this.deleteType = DeleteType.Validate; | |
257 | + } else { | |
258 | + this.deleteType = deleteType; | |
259 | + } | |
260 | + } | |
228 | 261 | } |
@@ -1,7 +1,7 @@ | ||
1 | 1 | package org.phosphoresce.webcore.hibernate4.transaction; |
2 | 2 | |
3 | 3 | import org.phosphoresce.commons.util.StringUtil; |
4 | -import org.phosphoresce.webcore.hibernate4.model.SUser; | |
4 | +import org.phosphoresce.webcore.hibernate4.model.SMUser; | |
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Hibernateトランザクション処理コンテナクラス<br> |
@@ -19,7 +19,7 @@ | ||
19 | 19 | private TransactionContainer transaction; |
20 | 20 | |
21 | 21 | /** 処理ユーザ */ |
22 | - private SUser processUser; | |
22 | + private SMUser processUser; | |
23 | 23 | |
24 | 24 | /** 処理時刻 */ |
25 | 25 | private long processTime; |
@@ -33,7 +33,7 @@ | ||
33 | 33 | * @param processTime 処理時刻 |
34 | 34 | * @param namespace トランザクション名前空間 |
35 | 35 | */ |
36 | - public TransactionProcess(SUser processUser, long processTime, String namespace) { | |
36 | + public TransactionProcess(SMUser processUser, long processTime, String namespace) { | |
37 | 37 | super(); |
38 | 38 | this.transaction = transaction; |
39 | 39 | this.processUser = processUser; |
@@ -46,7 +46,7 @@ | ||
46 | 46 | * @param processUser 処理ユーザ |
47 | 47 | * @param processTime 処理時刻 |
48 | 48 | */ |
49 | - public TransactionProcess(SUser processUser, long processTime) { | |
49 | + public TransactionProcess(SMUser processUser, long processTime) { | |
50 | 50 | this(processUser, processTime, null); |
51 | 51 | } |
52 | 52 |
@@ -69,7 +69,7 @@ | ||
69 | 69 | * 処理ユーザを取得します。<br> |
70 | 70 | * @return 処理ユーザ |
71 | 71 | */ |
72 | - public SUser getProcessUser() { | |
72 | + public SMUser getProcessUser() { | |
73 | 73 | return processUser; |
74 | 74 | } |
75 | 75 |
@@ -7,6 +7,7 @@ | ||
7 | 7 | import org.hibernate.LockMode; |
8 | 8 | import org.hibernate.LockOptions; |
9 | 9 | import org.phosphoresce.webcore.hibernate4.exception.HibernateTransactionException; |
10 | +import org.phosphoresce.webcore.hibernate4.model.enums.DeleteType; | |
10 | 11 | |
11 | 12 | /** |
12 | 13 | * サービス上位抽象クラス<br> |
@@ -118,6 +119,7 @@ | ||
118 | 119 | entity.setModifyDate(new Date(process.getProcessTime())); |
119 | 120 | entity.setDeleteUser(process.getProcessUser()); |
120 | 121 | entity.setDeleteDate(new Date(process.getProcessTime())); |
122 | + entity.setDeleteType(DeleteType.Deleted); | |
121 | 123 | entity.validate(); |
122 | 124 | process.getTransaction().getSession().saveOrUpdate(entity); |
123 | 125 | } |
@@ -0,0 +1,161 @@ | ||
1 | +package org.phosphoresce.webcore.hibernate4.transaction; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +import javax.persistence.Column; | |
6 | +import javax.persistence.MappedSuperclass; | |
7 | + | |
8 | +/** | |
9 | + * データベーステーブル有効期間条件保持エンティティ上位抽象クラス<br> | |
10 | + * <br> | |
11 | + * 当エンティティは有効期間情報を保持するエンティティクラスです。<br> | |
12 | + * 有効期間は必ず設定される前提のエンティティで明示的にnullを指定された場合でも、内部で常に値が設定されます。<br> | |
13 | + * | |
14 | + * @author Kitagawa<br> | |
15 | + * | |
16 | + *<!-- | |
17 | + * 更新日 更新者 更新内容 | |
18 | + * 2013/02/01 Kitagawa 新規作成 | |
19 | + *--> | |
20 | + */ | |
21 | +@MappedSuperclass | |
22 | +public abstract class AbstractHibernateExpirableEntity extends AbstractHibernateEntity { | |
23 | + | |
24 | + /** 有効期間開始 */ | |
25 | + @Column(name = "expiry_start", nullable = false) | |
26 | + private Date expiryStart = DAOUtil.getMinimumDate(); | |
27 | + | |
28 | + /** 有効期間終了 */ | |
29 | + @Column(name = "expiry_end", nullable = false) | |
30 | + private Date expiryEnd = DAOUtil.getMaximumDate(); | |
31 | + | |
32 | + /** | |
33 | + * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> | |
34 | + */ | |
35 | + void validate() { | |
36 | + validateEntity(); | |
37 | + } | |
38 | + | |
39 | + /** | |
40 | + * データベース登録処理前のエンティティ内容の整合処理を実施します。<br> | |
41 | + * 当処理はエンティティ毎に処理が異なります。<br> | |
42 | + */ | |
43 | + protected abstract void validateEntity(); | |
44 | + | |
45 | + /** | |
46 | + * 指定された日付がエンティティの有効期間内の日付であるか判定します。<br> | |
47 | + * エンティティ有効範囲が2000/01/01~2000/04/01の場合、2000/03/01はtrueが返却されます。<br> | |
48 | + * @param date 対象日付オブジェクト | |
49 | + * @return 有効期間内の日付である場合にtrueを返却 | |
50 | + */ | |
51 | + public boolean isValidityPeriod(Date date) { | |
52 | + Date target = date == null ? DAOUtil.getMinimumDate() : date; | |
53 | + return getExpiryEnd().compareTo(target) >= 0 && target.compareTo(getExpiryStart()) >= 0; | |
54 | + } | |
55 | + | |
56 | + /** | |
57 | + * 指定された日付範囲がエンティティの有効期間に一部でも含まれる期間であるか判定します。<br> | |
58 | + * エンティティ有効範囲が2000/01/01~2000/04/01の場合、1999/12/01~2000/03/01はtrueが返却されます。<br> | |
59 | + * @param date1 日付範囲開始 | |
60 | + * @param date2 日付範囲終了 | |
61 | + * @return 有効期間が一部でも含まれる期間である場合にtrueを返却 | |
62 | + */ | |
63 | + public boolean isOverlapPeriod(Date date1, Date date2) { | |
64 | + Date target1 = date1 == null ? DAOUtil.getMinimumDate() : date1; | |
65 | + Date target2 = date2 == null ? DAOUtil.getMaximumDate() : date2; | |
66 | + Date targetStart = target1.compareTo(target2) >= 0 ? target2 : target1; | |
67 | + Date targetEnd = target1.compareTo(target2) >= 0 ? target1 : target2; | |
68 | + return getExpiryEnd().compareTo(targetStart) >= 0 && targetEnd.compareTo(getExpiryStart()) >= 0; | |
69 | + } | |
70 | + | |
71 | + /** | |
72 | + * 指定された日付範囲がエンティティの有効期間を全て含む期間であるか判定します。<br> | |
73 | + * エンティティ有効範囲が2000/01/01~2000/04/01の場合、1999/12/01~2000/05/01はtrueが返却されます。<br> | |
74 | + * @param date1 日付範囲開始 | |
75 | + * @param date2 日付範囲終了 | |
76 | + * @return 有効期間が全て含む期間である場合にtrueを返却 | |
77 | + */ | |
78 | + public boolean isFullContainPeriod(Date date1, Date date2) { | |
79 | + Date target1 = date1 == null ? DAOUtil.getMinimumDate() : date1; | |
80 | + Date target2 = date2 == null ? DAOUtil.getMaximumDate() : date2; | |
81 | + Date targetStart = target1.compareTo(target2) >= 0 ? target2 : target1; | |
82 | + Date targetEnd = target1.compareTo(target2) >= 0 ? target1 : target2; | |
83 | + return getExpiryStart().compareTo(targetStart) >= 0 && targetEnd.compareTo(getExpiryEnd()) >= 0; | |
84 | + } | |
85 | + | |
86 | + /** | |
87 | + * 指定された日付範囲がエンティティの有効期間内の期間であるか判定します。<br> | |
88 | + * エンティティ有効範囲が2000/01/01~2000/04/01の場合、2000/02/01~2000/03/01はtrueが返却されます。<br> | |
89 | + * @param date1 日付範囲開始 | |
90 | + * @param date2 日付範囲終了 | |
91 | + * @return 有効期間が期間内である場合にtrueを返却 | |
92 | + */ | |
93 | + public boolean isInContainPeriod(Date date1, Date date2) { | |
94 | + Date target1 = date1 == null ? DAOUtil.getMinimumDate() : date1; | |
95 | + Date target2 = date2 == null ? DAOUtil.getMaximumDate() : date2; | |
96 | + Date targetStart = target1.compareTo(target2) >= 0 ? target2 : target1; | |
97 | + Date targetEnd = target1.compareTo(target2) >= 0 ? target1 : target2; | |
98 | + return getExpiryStart().compareTo(targetStart) >= 0 && targetEnd.compareTo(getExpiryEnd()) >= 0; | |
99 | + } | |
100 | + | |
101 | + /** | |
102 | + * 指定された日付範囲がエンティティの有効期間に完全一致する期間であるか判定します。<br> | |
103 | + * エンティティ有効範囲が2000/01/01~2000/04/01の場合、2000/01/01~2000/04/01はtrueが返却されます。<br> | |
104 | + * @param date1 日付範囲開始 | |
105 | + * @param date2 日付範囲終了 | |
106 | + * @return 有効期間が完全一致する期間である場合にtrueを返却 | |
107 | + */ | |
108 | + public boolean isEqualPeriod(Date date1, Date date2) { | |
109 | + Date target1 = date1 == null ? DAOUtil.getMinimumDate() : date1; | |
110 | + Date target2 = date2 == null ? DAOUtil.getMaximumDate() : date2; | |
111 | + Date targetStart = target1.compareTo(target2) >= 0 ? target2 : target1; | |
112 | + Date targetEnd = target1.compareTo(target2) >= 0 ? target1 : target2; | |
113 | + return getExpiryEnd().compareTo(targetStart) == 0 && targetEnd.compareTo(getExpiryStart()) == 0; | |
114 | + } | |
115 | + | |
116 | + /** | |
117 | + * 有効期間開始を取得します。<br> | |
118 | + * @return 有効期間開始 | |
119 | + */ | |
120 | + public final Date getExpiryStart() { | |
121 | + if (expiryStart == null) { | |
122 | + expiryStart = DAOUtil.getMinimumDate(); | |
123 | + } | |
124 | + return expiryStart; | |
125 | + } | |
126 | + | |
127 | + /** | |
128 | + * 有効期間開始を設定します。<br> | |
129 | + * @param expiryStart 有効期間開始 | |
130 | + */ | |
131 | + public final void setExpiryStart(Date expiryStart) { | |
132 | + if (expiryStart == null) { | |
133 | + this.expiryStart = DAOUtil.getMinimumDate(); | |
134 | + } else { | |
135 | + this.expiryStart = expiryStart; | |
136 | + } | |
137 | + } | |
138 | + | |
139 | + /** | |
140 | + * 有効期間終了を取得します。<br> | |
141 | + * @return 有効期間終了 | |
142 | + */ | |
143 | + public final Date getExpiryEnd() { | |
144 | + if (expiryEnd == null) { | |
145 | + expiryEnd = DAOUtil.getMaximumDate(); | |
146 | + } | |
147 | + return expiryEnd; | |
148 | + } | |
149 | + | |
150 | + /** | |
151 | + * 有効期間終了を設定します。<br> | |
152 | + * @param expiryEnd 有効期間終了 | |
153 | + */ | |
154 | + public final void setExpiryEnd(Date expiryEnd) { | |
155 | + if (expiryEnd == null) { | |
156 | + this.expiryEnd = DAOUtil.getMaximumDate(); | |
157 | + } else { | |
158 | + this.expiryEnd = expiryEnd; | |
159 | + } | |
160 | + } | |
161 | +} |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <faceted-project> |
3 | - <runtime name="Tomcat v6.0 サーバー (JDK1.6) @ localhost"/> | |
3 | + <runtime name="Apache Tomcat v6.0"/> | |
4 | 4 | <fixed facet="jst.web"/> |
5 | 5 | <fixed facet="wst.jsdt.web"/> |
6 | 6 | <fixed facet="java"/> |