Coverage Report - org.apache.ojb.odmg.states.StateTransient
 
Classes in this File Line Coverage Branch Coverage Complexity
StateTransient
N/A
N/A
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 org.apache.ojb.odmg.ObjectEnvelope;
 19  
 import org.apache.ojb.broker.PersistenceBrokerException;
 20  
 
 21  
 /**
 22  
  * this state represents objects which are not persisted and no longer used.
 23  
  */
 24  
 public class StateTransient extends ModificationState
 25  
 {
 26  
     private static StateTransient _instance = new StateTransient();
 27  
 
 28  
     /**
 29  
      * private constructor: we use singleton instances
 30  
      */
 31  
     private StateTransient()
 32  
     {
 33  
     }
 34  
 
 35  
     /**
 36  
      * perform a checkpoint, i.e. perform updates on underlying db but keep locks on objects
 37  
      */
 38  
     public static StateTransient getInstance()
 39  
     {
 40  
         return _instance;
 41  
     }
 42  
 
 43  
     /**
 44  
      * return resulting state after marking clean
 45  
      */
 46  
     public ModificationState markClean()
 47  
     {
 48  
         return this;
 49  
     }
 50  
 
 51  
     /**
 52  
      * return resulting state after marking delete
 53  
      */
 54  
     public ModificationState markDelete()
 55  
     {
 56  
         return this;
 57  
     }
 58  
 
 59  
     /**
 60  
      * return resulting state after marking dirty
 61  
      */
 62  
     public ModificationState markDirty()
 63  
     {
 64  
         return this;
 65  
     }
 66  
 
 67  
     /**
 68  
      * return resulting state after marking new
 69  
      */
 70  
     public ModificationState markNew()
 71  
     {
 72  
         return StateNewClean.getInstance();
 73  
     }
 74  
 
 75  
     /**
 76  
      * return resulting state after marking old
 77  
      */
 78  
     public ModificationState markOld()
 79  
     {
 80  
         return this;
 81  
     }
 82  
 
 83  
     /**
 84  
      * object is new, thus we need an INSERT to store it
 85  
      */
 86  
     public boolean needsInsert()
 87  
     {
 88  
         return false;
 89  
     }
 90  
 
 91  
     /**
 92  
      * checkpoint the transaction
 93  
      */
 94  
     public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException
 95  
     {
 96  
     }
 97  
 
 98  
 
 99  
     /**
 100  
      * commit the associated transaction
 101  
      */
 102  
     public void commit(ObjectEnvelope mod) throws PersistenceBrokerException
 103  
     {
 104  
     }
 105  
 
 106  
     /**
 107  
      * rollback the transaction
 108  
      */
 109  
     public void rollback(ObjectEnvelope mod)
 110  
     {
 111  
     }
 112  
 
 113  
     public boolean isTransient()
 114  
     {
 115  
         return true;
 116  
     }
 117  
 }