1 package org.apache.ojb.odmg.states; 2 3 17 18 import org.apache.ojb.odmg.ObjectEnvelope; 19 import org.apache.ojb.broker.PersistenceBrokerException; 20 21 24 public class StateNewDirty extends ModificationState 25 { 26 27 30 public ModificationState markClean() 31 { 32 return StateNewClean.getInstance(); 33 } 34 35 38 public ModificationState markDelete() 39 { 40 return StateNewDelete.getInstance(); 41 } 42 43 46 public ModificationState markDirty() 47 { 48 return this; 49 } 50 51 54 public ModificationState markNew() 55 { 56 return this; 57 } 58 59 62 public ModificationState markOld() 63 { 64 return StateOldDirty.getInstance(); 65 } 66 67 private static StateNewDirty _instance = new StateNewDirty(); 68 69 72 private StateNewDirty() 73 { 74 } 75 76 79 public static StateNewDirty getInstance() 80 { 81 return _instance; 82 } 83 84 87 public boolean needsInsert() 88 { 89 return true; 90 } 91 92 95 public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException 96 { 97 mod.doInsert(); 98 mod.setModificationState(StateOldClean.getInstance()); 99 } 100 101 104 public void commit(ObjectEnvelope mod) throws PersistenceBrokerException 105 { 106 mod.doInsert(); 107 mod.setModificationState(StateOldClean.getInstance()); 108 } 109 110 114 public void rollback(ObjectEnvelope mod) 115 { 116 mod.doEvictFromCache(); 117 } 118 119 } 120 | Popular Tags |