01: package org.apache.ojb.broker.util;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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: /**
19: * Insert the type's description here.
20: *
21: * @deprecated Please use {@link ObjectModification#UPDATE} and {@link ObjectModification#INSERT}
22: * @author Thomas Mahler
23: * @version $Id: ObjectModificationDefaultImpl.java,v 1.5.2.2 2005/12/21 22:27:47 tomdz Exp $
24: */
25: public class ObjectModificationDefaultImpl implements
26: ObjectModification {
27: private boolean needsInsert = false;
28: private boolean needsUpdate = false;
29:
30: /**
31: * ObjectModificationImpl constructor comment.
32: */
33: public ObjectModificationDefaultImpl() {
34: super ();
35: }
36:
37: /**
38: * ObjectModificationImpl constructor comment.
39: */
40: public ObjectModificationDefaultImpl(boolean pNeedsInsert,
41: boolean pNeedsUpdate) {
42: needsInsert = pNeedsInsert;
43: needsUpdate = pNeedsUpdate;
44: }
45:
46: public static final ObjectModificationDefaultImpl INSERT = new ObjectModificationDefaultImpl(
47: true, false);
48: public static final ObjectModificationDefaultImpl UPDATE = new ObjectModificationDefaultImpl(
49: false, true);
50:
51: /**
52: * returns true if the underlying Object needs an INSERT statement. Returns false else.
53: */
54: public boolean needsInsert() {
55: return needsInsert;
56: }
57:
58: /**
59: * returns true if the underlying Object needs an UPDATE statement.
60: *
61: * Else Returns false.
62: */
63: public boolean needsUpdate() {
64: return needsUpdate;
65: }
66:
67: /**
68: * Method declaration
69: *
70: * @param newValue
71: */
72: public void setNeedsInsert(boolean newValue) {
73: needsInsert = newValue;
74: }
75:
76: /**
77: * Method declaration
78: *
79: * @param newValue
80: */
81: public void setNeedsUpdate(boolean newValue) {
82: needsUpdate = newValue;
83: }
84:
85: /**
86: * Method declaration
87: */
88: public void markModified() {
89: needsUpdate = true;
90: }
91: }
|