1 package org.apache.ojb.otm.states; 2 3 17 18 import org.apache.ojb.broker.util.ObjectModification; 19 20 23 public abstract class State implements ObjectModification 24 { 25 public static final State TRANSIENT = new Transient(); 26 27 public static final State PERSISTENT_CLEAN = new PersistentClean(); 28 29 public static final State PERSISTENT_DIRTY = new PersistentDirty(); 30 31 public static final State PERSISTENT_NEW = new PersistentNew(); 32 33 public static final State PERSISTENT_DELETED = new PersistentDeleted(); 34 35 public static final State PERSISTENT_NEW_DELETED = new PersistentNewDeleted(); 36 37 public static final State HOLLOW = new Hollow(); 38 39 41 45 public State getObject() 46 throws IllegalObjectStateException 47 { 48 throw new IllegalObjectStateException(this + " during getObject"); 49 } 50 51 54 public State markDirty() 55 throws IllegalObjectStateException 56 { 57 throw new IllegalObjectStateException(this + " during markDirty()"); 58 } 59 60 63 public State makePersistent() 64 throws IllegalObjectStateException 65 { 66 throw new IllegalObjectStateException(this + " during makePersistent()"); 67 } 68 69 72 public State deletePersistent() 73 throws IllegalObjectStateException 74 { 75 throw new IllegalObjectStateException(this + " during deletePersistent()"); 76 } 77 78 81 public State commit() 82 throws IllegalObjectStateException 83 { 84 throw new IllegalObjectStateException(this + " during commit()"); 85 } 86 87 90 public State rollback() 91 throws IllegalObjectStateException 92 { 93 throw new IllegalObjectStateException(this + " during rollback()"); 94 } 95 96 99 public State refresh() 100 throws IllegalObjectStateException 101 { 102 return this; 103 } 104 105 106 108 111 public boolean needsInsert() 112 { 113 return false; 114 } 115 116 119 public boolean needsUpdate() 120 { 121 return false; 122 } 123 124 127 public boolean needsDelete() 128 { 129 return false; 130 } 131 132 135 public boolean isDeleted() 136 { 137 return false; 138 } 139 140 } 141 | Popular Tags |