1 package mobisnap.common.reservation;
2
3 /***
4 * Used to represent the usage of a value-change reservation
5 *
6 * @version 5-Apr-2001
7 * @author
8 */
9 public class ValueChangeReservationUse
10 extends ReservationUseBase
11 implements java.io.Serializable
12 {
13 public ValueChangeReservationUse( ValueChangeReservation rsrv) {
14 super( rsrv);
15 }
16
17 /***
18 * The associated transaction has been committed. Updates the associated
19 * reservation accordingly.
20 * Returns true if the reservation has been completely used
21 */
22 public boolean commitCltRsrv() throws Exception {
23 return false;
24 }
25
26 /***
27 * The associated transaction has been rollbacked. Updates the associated
28 * reservation accordingly.
29 */
30 public void rollbackCltRsrv(){
31 // do nothing
32 }
33
34
35 /***
36 * Updates the reservation and database according to the current usage - processed
37 * BEFORE the transaction execution.
38 * Returns false if the current usage is not compatoble with the associated
39 * reservation.
40 */
41 public boolean preSrvTrxExeUpdate( ReservationBase rsrv0, nmp.dbms.JDBC.Jdbc_Sql database) throws Exception {
42 if( ! ( rsrv0 instanceof ValueChangeReservation))
43 throw new mobisnap.MobisnapException( "Value-change reservation expected in preSrvTrxExeUpdate");
44 ValueChangeReservation rsrv = (ValueChangeReservation)rsrv0;
45
46 StringBuffer buffer = new StringBuffer();
47 buffer.append( "alter trigger mobi_vc_");
48 buffer.append( rsrv.column);
49 buffer.append( "_");
50 buffer.append( rsrv.table);
51 buffer.append( "_");
52 buffer.append( rsrv.getTriggerCode());
53 buffer.append(" disable;");
54 if( database.executeUpdate( buffer.toString()) != 1)
55 return false;
56 return true;
57 }
58
59 /***
60 * Updates the reservation and database according to the current usage - processed
61 * AFTER the transaction execution.
62 * Returns true if the transaction has been completely used.
63 */
64 public boolean postSrvTrxExeUpdate( ReservationBase rsrv0, nmp.dbms.JDBC.Jdbc_Sql database) throws Exception {
65 if( ! ( rsrv0 instanceof ValueChangeReservation))
66 throw new mobisnap.MobisnapException( "Escrow reservation expected in preSrvTrxExeUpdate");
67 ValueChangeReservation rsrv = (ValueChangeReservation)rsrv0;
68
69 StringBuffer buffer = new StringBuffer();
70 buffer.append( "alter trigger mobi_vc_");
71 buffer.append( rsrv.table);
72 buffer.append( "_");
73 buffer.append( rsrv.getTriggerCode());
74 buffer.append(" enable;");
75 database.executeUpdate( buffer.toString());
76 return false;
77 }
78
79
80 }
This page was automatically generated by Maven