Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ModificationState |
|
| 1.0;1 |
1 | package org.apache.ojb.odmg.states; | |
2 | ||
3 | /* Copyright 2002-2005 The Apache Software Foundation | |
4 | * | |
5 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | ||
18 | import java.io.Serializable; | |
19 | ||
20 | import org.apache.ojb.broker.PersistenceBrokerException; | |
21 | import org.apache.ojb.odmg.ObjectEnvelope; | |
22 | ||
23 | /** | |
24 | * Describes an objects transactional state regarding commiting and rollbacking | |
25 | */ | |
26 | public abstract class ModificationState implements Serializable | |
27 | { | |
28 | static final long serialVersionUID = 4182870857709997816L; | |
29 | public ModificationState() | |
30 | { | |
31 | } | |
32 | ||
33 | /** | |
34 | * return resulting state after marking clean | |
35 | */ | |
36 | public abstract ModificationState markClean(); | |
37 | ||
38 | /** | |
39 | * return resulting state after marking delete | |
40 | */ | |
41 | public abstract ModificationState markDelete(); | |
42 | ||
43 | /** | |
44 | * return resulting state after marking dirty | |
45 | */ | |
46 | public abstract ModificationState markDirty(); | |
47 | ||
48 | /** | |
49 | * return resulting state after marking new | |
50 | */ | |
51 | public abstract ModificationState markNew(); | |
52 | ||
53 | /** | |
54 | * return resulting state after marking old | |
55 | */ | |
56 | public abstract ModificationState markOld(); | |
57 | ||
58 | /** | |
59 | * | |
60 | */ | |
61 | public abstract void checkpoint(ObjectEnvelope mod) | |
62 | throws PersistenceBrokerException; | |
63 | ||
64 | /** | |
65 | * | |
66 | */ | |
67 | public abstract void commit(ObjectEnvelope mod) | |
68 | throws PersistenceBrokerException; | |
69 | ||
70 | /** | |
71 | * | |
72 | */ | |
73 | public abstract void rollback(ObjectEnvelope mod); | |
74 | ||
75 | /** | |
76 | * return a String representation | |
77 | * @return java.lang.String | |
78 | */ | |
79 | public String toString() | |
80 | { | |
81 | return this.getClass().getName(); | |
82 | } | |
83 | ||
84 | ||
85 | /** | |
86 | * returns true is this state requires INSERT | |
87 | * @return boolean | |
88 | */ | |
89 | public boolean needsInsert() | |
90 | { | |
91 | return false; | |
92 | } | |
93 | ||
94 | /** | |
95 | * returns true is this state requires UPDATE | |
96 | * @return boolean | |
97 | */ | |
98 | public boolean needsUpdate() | |
99 | { | |
100 | return false; | |
101 | } | |
102 | ||
103 | /** | |
104 | * returns true is this state requires DELETE | |
105 | * @return boolean | |
106 | */ | |
107 | public boolean needsDelete() | |
108 | { | |
109 | return false; | |
110 | } | |
111 | ||
112 | public boolean isTransient() | |
113 | { | |
114 | return false; | |
115 | } | |
116 | } |