2 * Created on 2005-04-02 This file is created 2005-04-02 and
5 package drno
.server
.database
.persistence
;
7 import drno
.exception
.ConsistanceException
;
8 import drno
.exception
.ObjectLockException
;
9 import drno
.exception
.UnkErrException
;
10 import drno
.server
.database
.persistence
.repository
.MapperFacade
;
11 import drno
.support
.Logger
;
14 * Represents the situation when an object is new and still
15 * not committed to the database.
17 * When its new, the only meaningfull operation will be to
18 * commit the object to the database by using the commit
19 * operation. all other operations are ignored.
23 final class StateNew
extends AbstractState
{
24 /** singleton instance */
25 public final static AbstractState instance
= new StateNew();
28 * Singleton constructor.
30 * private forces use of instance.
37 // the object is actually not placed in any cache
43 * persists the object and changes state to
46 * @throws UnkErrException
49 void commit(LockObject lock
, PersistentObject obj
) throws ObjectLockException
,
55 MapperFacade
.instance().insert(obj
);
56 obj
.setState(StateOldClean
.instance
);
63 LockObject
delete(LockObject lock
, PersistentObject obj
)
65 obj
.setState(StateDeleted
.instance
);