1 package org.apache.ojb.odmg.states; 2 3 17 18 import org.apache.ojb.odmg.ObjectEnvelope; 19 20 23 public class StateNewClean extends ModificationState 24 { 25 private static StateNewClean _instance = new StateNewClean(); 26 27 30 private StateNewClean() 31 { 32 } 33 34 37 public static StateNewClean getInstance() 38 { 39 return _instance; 40 } 41 42 45 public ModificationState markClean() 46 { 47 return this; 48 } 49 50 53 public ModificationState markDelete() 54 { 55 return StateNewDelete.getInstance(); 56 } 57 58 61 public ModificationState markDirty() 62 { 63 return StateNewDirty.getInstance(); 64 } 65 66 69 public ModificationState markNew() 70 { 71 return this; 72 } 73 74 77 public ModificationState markOld() 78 { 79 return StateOldClean.getInstance(); 80 } 81 82 85 public boolean needsInsert() 86 { 87 return true; 88 } 89 90 93 public void checkpoint(ObjectEnvelope mod) 94 throws org.apache.ojb.broker.PersistenceBrokerException 95 { 96 mod.doInsert(); 97 mod.setModificationState(StateOldClean.getInstance()); 98 } 99 100 101 104 public void commit(ObjectEnvelope mod) throws org.apache.ojb.broker.PersistenceBrokerException 105 { 106 mod.doInsert(); 107 mod.setModificationState(StateOldClean.getInstance()); 108 } 109 110 113 public void rollback(ObjectEnvelope mod) 114 { 115 mod.doEvictFromCache(); 116 } 117 } 118 | Popular Tags |