1 package org.apache.ojb.otm.states;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import org.apache.ojb.broker.util.ObjectModification;
19
20
21
22
23 public abstract class State implements ObjectModification
24 {
25 public static final State TRANSIENT = new Transient();
26
27 public static final State PERSISTENT_CLEAN = new PersistentClean();
28
29 public static final State PERSISTENT_DIRTY = new PersistentDirty();
30
31 public static final State PERSISTENT_NEW = new PersistentNew();
32
33 public static final State PERSISTENT_DELETED = new PersistentDeleted();
34
35 public static final State PERSISTENT_NEW_DELETED = new PersistentNewDeleted();
36
37 public static final State HOLLOW = new Hollow();
38
39
40
41
42
43
44
45 public State getObject()
46 throws IllegalObjectStateException
47 {
48 throw new IllegalObjectStateException(this + " during getObject");
49 }
50
51
52
53
54 public State markDirty()
55 throws IllegalObjectStateException
56 {
57 throw new IllegalObjectStateException(this + " during markDirty()");
58 }
59
60
61
62
63 public State makePersistent()
64 throws IllegalObjectStateException
65 {
66 throw new IllegalObjectStateException(this + " during makePersistent()");
67 }
68
69
70
71
72 public State deletePersistent()
73 throws IllegalObjectStateException
74 {
75 throw new IllegalObjectStateException(this + " during deletePersistent()");
76 }
77
78
79
80
81 public State commit()
82 throws IllegalObjectStateException
83 {
84 throw new IllegalObjectStateException(this + " during commit()");
85 }
86
87
88
89
90 public State rollback()
91 throws IllegalObjectStateException
92 {
93 throw new IllegalObjectStateException(this + " during rollback()");
94 }
95
96
97
98
99 public State refresh()
100 throws IllegalObjectStateException
101 {
102 return this;
103 }
104
105
106
107
108
109
110
111 public boolean needsInsert()
112 {
113 return false;
114 }
115
116
117
118
119 public boolean needsUpdate()
120 {
121 return false;
122 }
123
124
125
126
127 public boolean needsDelete()
128 {
129 return false;
130 }
131
132
133
134
135 public boolean isDeleted()
136 {
137 return false;
138 }
139
140 }