Revision 31228 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/SelectableDataSource.java
SelectableDataSource.java | ||
---|---|---|
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
mapping = new int[numExternalFields]; |
126 |
|
|
126 |
|
|
127 | 127 |
int j=0; |
128 | 128 |
for (int i=0; i < fieldCount; i++) |
129 | 129 |
{ |
... | ... | |
133 | 133 |
} |
134 | 134 |
|
135 | 135 |
} |
136 |
|
|
136 |
|
|
137 | 137 |
// this.dataSource.stop(); |
138 | 138 |
} |
139 | 139 |
|
... | ... | |
218 | 218 |
*/ |
219 | 219 |
public int getFieldIndexByName(String arg0) |
220 | 220 |
throws ReadDriverException { |
221 |
int internal = dataSource.getFieldIndexByName(arg0); |
|
222 |
for (int i=0; i < mapping.length; i++) |
|
223 |
{ |
|
224 |
if (mapping[i] == internal) |
|
221 |
// int internal = dataSource.getFieldIndexByName(arg0); |
|
222 |
// for (int i=0; i < mapping.length; i++) |
|
223 |
// { |
|
224 |
// if (mapping[i] == internal) |
|
225 |
// return i; |
|
226 |
// } |
|
227 |
// //OJO Parche para rodear poblema de gdbms + FileDriver |
|
228 |
// // Cuando en le fichero existe un campo de nombre 'PK' |
|
229 |
// if (arg0.equalsIgnoreCase("pk")){ |
|
230 |
// for (int i=0; i < mapping.length; i++) |
|
231 |
// { |
|
232 |
// if (dataSource.getFieldName(mapping[i]).equalsIgnoreCase(arg0)){ |
|
233 |
// return i; |
|
234 |
// } |
|
235 |
// } |
|
236 |
// |
|
237 |
// } |
|
238 |
for (int i=0; i < getFieldCount(); i++) { |
|
239 |
// Buscamos en los alias. Si no hay alias, cada alias es igual al fieldname |
|
240 |
if (getFieldAlias(i).compareTo(arg0) == 0) |
|
225 | 241 |
return i; |
226 | 242 |
} |
227 |
//OJO Parche para rodear poblema de gdbms + FileDriver |
|
228 |
// Cuando en le fichero existe un campo de nombre 'PK' |
|
229 |
if (arg0.equalsIgnoreCase("pk")){ |
|
230 |
for (int i=0; i < mapping.length; i++) |
|
231 |
{ |
|
232 |
if (dataSource.getFieldName(mapping[i]).equalsIgnoreCase(arg0)){ |
|
233 |
return i; |
|
234 |
} |
|
235 |
} |
|
236 |
|
|
243 |
for (int i=0; i < getFieldCount(); i++) { |
|
244 |
// Por compatibilidad con posibles leyendas guardadas |
|
245 |
if (getFieldName(i).compareTo(arg0) == 0) |
|
246 |
return i; |
|
237 | 247 |
} |
248 |
|
|
238 | 249 |
return -1; |
239 | 250 |
} |
240 | 251 |
|
... | ... | |
531 | 542 |
* @see com.hardcode.gdbms.engine.data.DataSource#getFieldNames() |
532 | 543 |
*/ |
533 | 544 |
public String[] getFieldNames() throws ReadDriverException { |
534 |
String[] fieldNames = new String[getFieldCount()]; |
|
535 |
int j=0; |
|
536 |
int fieldCount=dataSource.getFieldCount(); |
|
545 |
int fieldCount=getFieldCount(); |
|
546 |
String[] fieldNames = new String[fieldCount]; |
|
547 |
// int j=0; |
|
548 |
// int fieldCount=dataSource.getFieldCount(); |
|
549 |
// for (int i=0; i < fieldCount; i++) |
|
550 |
// { |
|
551 |
// if (!dataSource.isVirtualField(i)) |
|
552 |
// fieldNames[j++] = dataSource.getFieldName(i); |
|
553 |
// |
|
554 |
// } |
|
537 | 555 |
for (int i=0; i < fieldCount; i++) |
538 | 556 |
{ |
539 |
if (!dataSource.isVirtualField(i)) |
|
540 |
fieldNames[j++] = dataSource.getFieldName(i); |
|
557 |
fieldNames[i] = getFieldAlias(i); |
|
541 | 558 |
|
542 | 559 |
} |
543 |
// return dataSource.getFieldNames(); |
|
560 |
|
|
544 | 561 |
return fieldNames; |
545 | 562 |
} |
546 | 563 |
|
... | ... | |
587 | 604 |
fieldsDescrip[i].setFieldType(type); |
588 | 605 |
fieldsDescrip[i].setFieldName(getFieldName(i)); |
589 | 606 |
fieldsDescrip[i].setFieldLength(getFieldWidth(i)); |
590 |
try{ |
|
591 |
fieldsDescrip[i].setFieldAlias(getFieldAlias(i)); |
|
592 |
}catch (Exception e) { |
|
593 |
fieldsDescrip[i].setFieldAlias(getFieldName(i)); |
|
594 |
} |
|
607 |
fieldsDescrip[i].setFieldAlias(getFieldAlias(i)); |
|
595 | 608 |
if (NumberUtilities.isNumeric(type)) |
596 | 609 |
{ |
597 | 610 |
if (!NumberUtilities.isNumericInteger(type)) |
... | ... | |
612 | 625 |
public void setFieldAlias(int idField, String aliasName) { |
613 | 626 |
alias[idField] = aliasName; |
614 | 627 |
} |
628 |
|
|
615 | 629 |
|
616 |
|
|
617 | 630 |
public Driver getDriver() { |
618 | 631 |
return this.dataSource.getDriver(); |
619 | 632 |
} |
Also available in: Unified diff