1 | public class DocumentInterceptor implements Interceptor {↵ | | 1 | public class DocumentInterceptor implements Interceptor {↵
|
|
|
2 | public boolean onLoad(↵ | | 2 | public boolean onLoad(↵
|
3 | Object entity, Serializable id, Object[] state,↵ | | 3 | Object entity, Serializable id, Object[] state,↵
|
4 | String[] propertyNames, Type[] types↵ | | 4 | String[] propertyNames, Type[] types↵
|
5 | ) throws CallbackException {↵ | | 5 | ) throws CallbackException {↵
|
6 | return false;↵ | | 6 | return false;↵
|
7 | }↵ | | 7 | }↵
|
|
8 | public boolean onFlushDirty(↵ | | 8 | public boolean onFlushDirty(↵
|
9 | Object entity, Serializable id,↵ | | 9 | Object entity, Serializable id,↵
|
10 | Object[] currentState, Object[] previousState,↵ | | 10 | Object[] currentState, Object[] previousState,↵
|
11 | String[] propertyNames, Type[] types↵ | | 11 | String[] propertyNames, Type[] types↵
|
12 | ) throws CallbackException {↵ | | 12 | ) throws CallbackException {↵
|
13 | if ( entity instanceof Document ) {↵ | | 13 | if ( entity instanceof Document ) {↵
|
14 | currentState[2] = Calendar.getInstance();↵ | | 14 | currentState[3] = Calendar.getInstance();↵
|
15 | return true;↵ | | 15 | return true;↵
|
16 | }↵ | | 16 | }↵
|
17 | else {↵ | | 17 | else {↵
|
18 | return false;↵ | | 18 | return false;↵
|
19 | }↵ | | 19 | }↵
|
20 | }↵ | | 20 | }↵
|
|
21 | public boolean onSave(↵ | | 21 | public boolean onSave(↵
|
22 | Object entity, Serializable id, Object[] state,↵ | | 22 | Object entity, Serializable id, Object[] state,↵
|
23 | String[] propertyNames, Type[] types↵ | | 23 | String[] propertyNames, Type[] types↵
|
24 | ) throws CallbackException {↵ | | 24 | ) throws CallbackException {↵
|
25 | if ( entity instanceof Document ) {↵ | | 25 | if ( entity instanceof Document ) {↵
|
26 | state[3] = state[2] = Calendar.getInstance();↵ | | 26 | state[4] = state[3] = Calendar.getInstance();↵
|
27 | return true;↵ | | 27 | return true;↵
|
28 | }↵ | | 28 | }↵
|
29 | else {↵ | | 29 | else {↵
|
30 | return false;↵ | | 30 | return false;↵
|
31 | }↵ | | 31 | }↵
|
32 | }↵ | | 32 | }↵
|
|
33 | public void onDelete(↵ | | 33 | public void onDelete(↵
|
34 | Object entity, Serializable id, Object[] state,↵ | | 34 | Object entity, Serializable id, Object[] state,↵
|
35 | String[] propertyNames, Type[] types↵ | | 35 | String[] propertyNames, Type[] types↵
|
36 | ) throws CallbackException {↵ | | 36 | ) throws CallbackException {↵
|
|
37 | }↵ | | 37 | }↵
|
|
38 | public void preFlush(Iterator entities) throws CallbackException {↵ | | 38 | public void preFlush(Iterator entities) throws CallbackException {↵
|
|
39 | }↵ | | 39 | }↵
|
|
40 | public void postFlush(Iterator entities) throws CallbackException {↵ | | 40 | public void postFlush(Iterator entities) throws CallbackException {↵
|
|
41 | }↵ | | 41 | }↵
|
|
42 | public Boolean isTransient(Object entity) {↵ | | 42 | public Boolean isTransient(Object entity) {↵
|
43 | return null;↵ | | 43 | return null;↵
|
44 | }↵ | | 44 | }↵
|
|
45 | public int[] findDirty(↵ | | 45 | public int[] findDirty(↵
|
46 | Object entity, Serializable id,↵ | | 46 | Object entity, Serializable id,↵
|
47 | Object[] currentState, Object[] previousState,↵ | | 47 | Object[] currentState, Object[] previousState,↵
|
48 | String[] propertyNames, Type[] types↵ | | 48 | String[] propertyNames, Type[] types↵
|
49 | ) {↵ | | 49 | ) {↵
|
50 | return null;↵ | | 50 | return null;↵
|
51 | }↵ | | 51 | }↵
|
|
52 | public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {↵ | | 52 | public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {↵
|
53 | return null;↵ | | 53 | return null;↵
|
54 | }↵ | | 54 | }↵
|
|
55 | public String getEntityName(Object object) throws CallbackException {↵ | | 55 | public String getEntityName(Object object) throws CallbackException {↵
|
56 | return null;↵ | | 56 | return null;↵
|
57 | }↵ | | 57 | }↵
|
|
58 | public Object getEntity(String entityName, Serializable id)↵ | | 58 | public Object getEntity(String entityName, Serializable id)↵
|
59 | throws CallbackException {↵ | | 59 | throws CallbackException {↵
|
60 | return null;↵ | | 60 | return null;↵
|
61 | }↵ | | 61 | }↵
|
|
62 | public void afterTransactionBegin(Transaction tx) {}↵ | | 62 | public void afterTransactionBegin(Transaction tx) {↵
|
| | | 63 | }↵
|
|
63 | public void afterTransactionCompletion(Transaction tx) {}↵ | | 64 | public void afterTransactionCompletion(Transaction tx) {↵
|
| | | 65 | }↵
|
|
64 | public void beforeTransactionCompletion(Transaction tx) {↵ | | 66 | public void beforeTransactionCompletion(Transaction tx) {↵
|
65 | }↵ | | 67 | }↵
|
|
66 | public String onPrepareStatement(String sql) {↵ | | 68 | public String onPrepareStatement(String sql) {↵
|
67 | return sql;↵ | | 69 | return sql;↵
|
68 | }↵ | | 70 | }↵
|
|
69 | public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {↵ | | 71 | public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {↵
|
70 | }↵ | | 72 | }↵
|
|
71 | public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {↵ | | 73 | public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {↵
|
72 | }↵ | | 74 | }↵
|
|
73 | public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {} | | 75 | public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {↵
|
| | | 76 |
|