1 package org.apache.ojb.odmg.states; 2 3 17 18 import org.apache.ojb.odmg.ObjectEnvelope; 19 20 23 public class StateNewDelete extends ModificationState 24 { 25 private static StateNewDelete _instance = new StateNewDelete(); 26 27 30 public ModificationState markClean() 31 { 32 return StateNewClean.getInstance(); 33 } 34 35 38 public ModificationState markDelete() 39 { 40 return this; 41 } 42 43 46 public ModificationState markDirty() 47 { 48 return this; 49 } 50 51 54 public ModificationState markNew() 55 { 56 return StateNewDirty.getInstance(); 57 } 58 59 62 public ModificationState markOld() 63 { 64 return StateOldDelete.getInstance(); 65 } 66 67 71 public boolean needsDelete() 72 { 73 return true; 74 } 75 76 79 private StateNewDelete() 80 { 81 } 82 83 86 public static StateNewDelete getInstance() 87 { 88 return _instance; 89 } 90 91 94 public void checkpoint(ObjectEnvelope mod) 95 { 96 } 97 98 101 public void commit(ObjectEnvelope mod) 102 { 103 mod.doEvictFromCache(); 104 mod.setModificationState(StateTransient.getInstance()); 105 } 106 107 110 public void rollback(ObjectEnvelope mod) 111 { 112 mod.doEvictFromCache(); 113 mod.setModificationState(StateTransient.getInstance()); 114 } 115 } 116 | Popular Tags |