Revision 10627 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/arcview/ArcJoinDataSource.java
ArcJoinDataSource.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.operations.arcview; |
2 | 2 |
|
3 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
3 | 4 |
import com.hardcode.gdbms.engine.data.DataSource; |
4 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
5 | 5 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
6 | 6 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
7 | 7 |
import com.hardcode.gdbms.engine.data.persistence.OperationLayerMemento; |
... | ... | |
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
/** |
41 |
* @throws ReadDriverException |
|
41 | 42 |
* @see com.hardcode.gdbms.engine.data.DataSource#start() |
42 | 43 |
*/ |
43 |
public void start() throws DriverException { |
|
44 |
public void start() throws ReadDriverException {
|
|
44 | 45 |
source.start(); |
45 | 46 |
linked.start(); |
46 | 47 |
} |
... | ... | |
48 | 49 |
/** |
49 | 50 |
* @see com.hardcode.gdbms.engine.data.DataSource#stop() |
50 | 51 |
*/ |
51 |
public void stop() throws DriverException { |
|
52 |
public void stop() throws ReadDriverException {
|
|
52 | 53 |
source.stop(); |
53 | 54 |
linked.stop(); |
54 | 55 |
} |
... | ... | |
56 | 57 |
/** |
57 | 58 |
* @see com.hardcode.gdbms.engine.data.FieldNameAccess#getFieldIndexByName(java.lang.String) |
58 | 59 |
*/ |
59 |
public int getFieldIndexByName(String fieldName) throws DriverException { |
|
60 |
public int getFieldIndexByName(String fieldName) throws ReadDriverException {
|
|
60 | 61 |
for (int i = 0; i < getFieldCount(); i++) { |
61 | 62 |
if (getFieldName(i).equals(fieldName)){ |
62 | 63 |
return i; |
63 | 64 |
} |
64 | 65 |
} |
65 |
|
|
66 |
|
|
66 | 67 |
return -1; |
67 | 68 |
} |
68 | 69 |
|
... | ... | |
70 | 71 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldValue(long, int) |
71 | 72 |
*/ |
72 | 73 |
public Value getFieldValue(long rowIndex, int fieldId) |
73 |
throws DriverException { |
|
74 |
throws ReadDriverException {
|
|
74 | 75 |
if (fieldId < source.getFieldCount()) { |
75 | 76 |
return source.getFieldValue(rowIndex, fieldId); |
76 |
} else {
|
|
77 |
fieldId = fieldId - source.getFieldCount();
|
|
77 |
} |
|
78 |
fieldId = fieldId - source.getFieldCount(); |
|
78 | 79 |
|
79 |
if (fieldId >= linkFieldindex) {
|
|
80 |
fieldId++;
|
|
81 |
}
|
|
80 |
if (fieldId >= linkFieldindex) { |
|
81 |
fieldId++; |
|
82 |
} |
|
82 | 83 |
|
83 |
int index = relation[(int) rowIndex];
|
|
84 |
int index = relation[(int) rowIndex]; |
|
84 | 85 |
|
85 |
if (index == -1) { |
|
86 |
return ValueFactory.createNullValue(); |
|
87 |
} |
|
88 |
|
|
89 |
return linked.getFieldValue(index, fieldId); |
|
86 |
if (index == -1) { |
|
87 |
return ValueFactory.createNullValue(); |
|
90 | 88 |
} |
89 |
|
|
90 |
return linked.getFieldValue(index, fieldId); |
|
91 | 91 |
} |
92 | 92 |
|
93 | 93 |
/** |
94 | 94 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldCount() |
95 | 95 |
*/ |
96 |
public int getFieldCount() throws DriverException { |
|
96 |
public int getFieldCount() throws ReadDriverException {
|
|
97 | 97 |
return (source.getFieldCount() + linked.getFieldCount()) - 1; |
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
/** |
101 | 101 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldName(int) |
102 | 102 |
*/ |
103 |
public String getFieldName(int fieldId) throws DriverException { |
|
103 |
public String getFieldName(int fieldId) throws ReadDriverException {
|
|
104 | 104 |
if (fieldId < source.getFieldCount()) { |
105 | 105 |
return source.getFieldName(fieldId); |
106 |
} else {
|
|
107 |
fieldId = fieldId - source.getFieldCount();
|
|
106 |
} |
|
107 |
fieldId = fieldId - source.getFieldCount(); |
|
108 | 108 |
|
109 |
if (fieldId >= linkFieldindex) { |
|
110 |
fieldId++; |
|
111 |
} |
|
112 |
|
|
113 |
return "link_"+linked.getFieldName(fieldId); |
|
109 |
if (fieldId >= linkFieldindex) { |
|
110 |
fieldId++; |
|
114 | 111 |
} |
112 |
|
|
113 |
return "link_"+linked.getFieldName(fieldId); |
|
115 | 114 |
} |
116 | 115 |
|
117 | 116 |
/** |
118 | 117 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getRowCount() |
119 | 118 |
*/ |
120 |
public long getRowCount() throws DriverException { |
|
119 |
public long getRowCount() throws ReadDriverException {
|
|
121 | 120 |
return source.getRowCount(); |
122 | 121 |
} |
123 | 122 |
|
124 | 123 |
/** |
125 | 124 |
* @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldType(int) |
126 | 125 |
*/ |
127 |
public int getFieldType(int i) throws DriverException { |
|
126 |
public int getFieldType(int i) throws ReadDriverException {
|
|
128 | 127 |
if (i < source.getFieldCount()) { |
129 | 128 |
return source.getFieldType(i); |
130 |
} else {
|
|
131 |
i = i - source.getFieldCount();
|
|
129 |
} |
|
130 |
i = i - source.getFieldCount(); |
|
132 | 131 |
|
133 |
if (i >= linkFieldindex) { |
|
134 |
i++; |
|
135 |
} |
|
136 |
|
|
137 |
return linked.getFieldType(i); |
|
132 |
if (i >= linkFieldindex) { |
|
133 |
i++; |
|
138 | 134 |
} |
135 |
|
|
136 |
return linked.getFieldType(i); |
|
139 | 137 |
} |
140 | 138 |
|
141 | 139 |
/** |
... | ... | |
146 | 144 |
new Memento[]{source.getMemento(), linked.getMemento()}, getSQL()); |
147 | 145 |
} |
148 | 146 |
|
149 |
public int getFieldWidth(int i) throws DriverException { |
|
147 |
public int getFieldWidth(int i) throws ReadDriverException {
|
|
150 | 148 |
if (i < source.getFieldCount()) { |
151 | 149 |
return source.getFieldWidth(i); |
152 |
} else {
|
|
153 |
i = i - source.getFieldCount();
|
|
150 |
} |
|
151 |
i = i - source.getFieldCount(); |
|
154 | 152 |
|
155 |
if (i >= linkFieldindex) { |
|
156 |
i++; |
|
157 |
} |
|
158 |
|
|
159 |
return linked.getFieldWidth(i); |
|
153 |
if (i >= linkFieldindex) { |
|
154 |
i++; |
|
160 | 155 |
} |
156 |
|
|
157 |
return linked.getFieldWidth(i); |
|
161 | 158 |
} |
162 |
|
|
163 |
public boolean isVirtualField(int fieldId) throws DriverException { |
|
159 |
|
|
160 |
public boolean isVirtualField(int fieldId) throws ReadDriverException {
|
|
164 | 161 |
if (fieldId < source.getFieldCount()) { |
165 | 162 |
return source.isVirtualField(fieldId); |
166 |
} else {
|
|
167 |
fieldId = fieldId - source.getFieldCount();
|
|
163 |
} |
|
164 |
fieldId = fieldId - source.getFieldCount(); |
|
168 | 165 |
|
169 |
if (fieldId >= linkFieldindex) { |
|
170 |
fieldId++; |
|
171 |
} |
|
172 |
|
|
173 |
return linked.isVirtualField(fieldId); |
|
166 |
if (fieldId >= linkFieldindex) { |
|
167 |
fieldId++; |
|
174 | 168 |
} |
175 |
} |
|
169 |
|
|
170 |
return linked.isVirtualField(fieldId); |
|
171 |
} |
|
176 | 172 |
} |
Also available in: Unified diff