1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package net.wotonomy.access;
19
20 import net.wotonomy.control.EOQualifier;
21 import net.wotonomy.foundation.NSArray;
22 import net.wotonomy.foundation.NSDictionary;
23
24 /***
25 * Represents a single primitive operation in a database server.
26 * Can be insert, update, delete, lock a row, or execute a
27 * stored procedure.
28 *
29 * @author ezamudio@nasoft.com
30 * @author $Author: cgruber $
31 * @version $Revision: 894 $
32 */
33 public class EOAdaptorOperation {
34
35 protected EOEntity _entity;
36 protected NSArray _attributes;
37 protected NSDictionary _changedValues;
38 protected Throwable _exception;
39 protected EOQualifier _qualifier;
40 protected EOStoredProcedure _proc;
41 protected int _adaptorOp;
42
43 public EOAdaptorOperation(EOEntity entity) {
44 super();
45 _entity = entity;
46 }
47
48 public void setAdaptorOperator(int adOp) {
49 _adaptorOp = adOp;
50 }
51 public int adaptorOperator() {
52 return _adaptorOp;
53 }
54
55 public void setAttributes(NSArray atts) {
56 _attributes = atts;
57 }
58 public NSArray attributes() {
59 return _attributes;
60 }
61
62 public void setChangedValues(NSDictionary values) {
63 _changedValues = values;
64 }
65 public NSDictionary changedValues() {
66 return _changedValues;
67 }
68
69 public int compareAdaptorOperation(EOAdaptorOperation op) {
70 if (op.entity() != null && entity() != null) {
71 if (!op.entity().name().equals(entity().name()))
72 op.entity().name().compareTo(entity().name());
73 }
74 if (adaptorOperator() < op.adaptorOperator())
75 return -1;
76 if (adaptorOperator() > op.adaptorOperator())
77 return 1;
78 return 0;
79 }
80
81 public EOEntity entity() {
82 return _entity;
83 }
84
85 public void setException(Throwable t) {
86 _exception = t;
87 }
88 public Throwable exception() {
89 return _exception;
90 }
91
92 public void setQualifier(EOQualifier q) {
93 _qualifier = q;
94 }
95 public EOQualifier qualifier() {
96 return _qualifier;
97 }
98
99 public void setStoredProcedure(EOStoredProcedure sp) {
100 _proc = sp;
101 }
102 public EOStoredProcedure storedProcedure() {
103 return _proc;
104 }
105
106 }
107
108
109
110
111
112
113
114
115
116
117
118
119
120