| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ObjectModificationDefaultImpl |
|
| 1.0;1 |
| 1 | package org.apache.ojb.broker.util; | |
| 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 | ||
| 19 | /** | |
| 20 | * Insert the type's description here. | |
| 21 | * | |
| 22 | * @deprecated Please use {@link ObjectModification#UPDATE} and {@link ObjectModification#INSERT} | |
| 23 | * @author Thomas Mahler | |
| 24 | * @version $Id: ObjectModificationDefaultImpl.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $ | |
| 25 | */ | |
| 26 | public class ObjectModificationDefaultImpl implements ObjectModification | |
| 27 | { | |
| 28 | private boolean needsInsert = false; | |
| 29 | private boolean needsUpdate = false; | |
| 30 | ||
| 31 | /** | |
| 32 | * ObjectModificationImpl constructor comment. | |
| 33 | */ | |
| 34 | public ObjectModificationDefaultImpl() | |
| 35 | { | |
| 36 | super(); | |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * ObjectModificationImpl constructor comment. | |
| 41 | */ | |
| 42 | public ObjectModificationDefaultImpl(boolean pNeedsInsert, boolean pNeedsUpdate) | |
| 43 | { | |
| 44 | needsInsert = pNeedsInsert; | |
| 45 | needsUpdate = pNeedsUpdate; | |
| 46 | } | |
| 47 | ||
| 48 | ||
| 49 | public static final ObjectModificationDefaultImpl INSERT = new ObjectModificationDefaultImpl(true, false); | |
| 50 | public static final ObjectModificationDefaultImpl UPDATE = new ObjectModificationDefaultImpl(false, true); | |
| 51 | ||
| 52 | ||
| 53 | /** | |
| 54 | * returns true if the underlying Object needs an INSERT statement. Returns false else. | |
| 55 | */ | |
| 56 | public boolean needsInsert() | |
| 57 | { | |
| 58 | return needsInsert; | |
| 59 | } | |
| 60 | ||
| 61 | /** | |
| 62 | * returns true if the underlying Object needs an UPDATE statement. | |
| 63 | * | |
| 64 | * Else Returns false. | |
| 65 | */ | |
| 66 | public boolean needsUpdate() | |
| 67 | { | |
| 68 | return needsUpdate; | |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Method declaration | |
| 73 | * | |
| 74 | * @param newValue | |
| 75 | */ | |
| 76 | public void setNeedsInsert(boolean newValue) | |
| 77 | { | |
| 78 | needsInsert = newValue; | |
| 79 | } | |
| 80 | ||
| 81 | /** | |
| 82 | * Method declaration | |
| 83 | * | |
| 84 | * @param newValue | |
| 85 | */ | |
| 86 | public void setNeedsUpdate(boolean newValue) | |
| 87 | { | |
| 88 | needsUpdate = newValue; | |
| 89 | } | |
| 90 | ||
| 91 | /** | |
| 92 | * Method declaration | |
| 93 | */ | |
| 94 | public void markModified() | |
| 95 | { | |
| 96 | needsUpdate = true; | |
| 97 | } | |
| 98 | } |