1 10 11 package com.triactive.jdo.state; 12 13 import javax.jdo.JDOUserException; 14 import javax.jdo.Transaction; 15 16 17 class TransientDirty extends LifeCycleState 18 { 19 protected TransientDirty() 20 { 21 isPersistent = false; 22 isTransactional = true; 23 isDirty = true; 24 isNew = false; 25 isDeleted = false; 26 27 stateType = T_DIRTY; 28 } 29 30 public LifeCycleState transitionMakePersistent(StateManagerImpl sm, Transaction tx) 31 { 32 return changeState(sm, P_NEW); 33 } 34 35 public LifeCycleState transitionDeletePersistent(StateManagerImpl sm, Transaction tx) 36 { 37 throw new JDOUserException("Cannot delete, object is not persistent", sm.getObject()); 38 } 39 40 public LifeCycleState transitionMakeNontransactional(StateManagerImpl sm) 41 { 42 throw new JDOUserException("Cannot make object non-transactional: object is dirty", sm.getObject()); 43 } 44 45 public LifeCycleState transitionCommit(StateManagerImpl sm, Transaction tx) 46 { 47 sm.discardSavedFields(); 48 sm.evictFromTransaction(); 49 return changeState(sm, T_CLEAN); 50 } 51 52 public LifeCycleState transitionRollback(StateManagerImpl sm, Transaction tx) 53 { 54 sm.restoreFields(); 55 sm.replaceSCOFields(); 56 sm.evictFromTransaction(); 57 return changeState(sm, T_CLEAN); 58 } 59 60 public String toString() 61 { 62 return "T_DIRTY"; 63 } 64 } 65 | Popular Tags |