Revision 44767 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeature.java

View differences:

DefaultFeature.java
57 57
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
58 58
import org.gvsig.fmap.geom.Geometry;
59 59
import org.gvsig.fmap.geom.primitive.Envelope;
60
import org.gvsig.timesupport.Instant;
61
import org.gvsig.timesupport.Interval;
62
import org.gvsig.timesupport.Time;
63 60
import org.gvsig.tools.ToolsLocator;
64 61
import org.gvsig.tools.dataTypes.CoercionException;
65 62
import org.gvsig.tools.dataTypes.DataTypesManager;
......
562 559
        return geom;
563 560
    }
564 561

  
562
//    @Override
563
//    public Time getDefaultTime() {
564
//    	Time time = this.data.getDefaultTime();
565
//        if( time == null ) {
566
//            int i = this.data.getType().getDefaultTimeAttributeIndex();
567
//            Object x = this.get(i);
568
//            if( x instanceof Time ) {
569
//                time = (Time) x;
570
//            } else {
571
//                time = this.getTime(i);
572
//            }
573
//        }
574
//        return time;
575
//    }
576
//
565 577
    @Override
566
    public Time getDefaultTime() {
567
    	Time time = this.data.getDefaultTime();
568
        if( time == null ) {
569
            int i = this.data.getType().getDefaultTimeAttributeIndex();
570
            Object x = this.get(i);
571
            if( x instanceof Time ) {
572
                time = (Time) x;
573
            } else {
574
                time = this.getTime(i);
575
            }
576
        }
577
        return time;
578
    }
579

  
580
    @Override
581 578
    public IProjection getDefaultSRS() {
582 579
        IProjection srs = this.data.getType().getDefaultSRS();
583 580
        if( srs == null ) {
......
842 839

  
843 840
    @Override
844 841
    public Date getDate(int index) {
845
        Date value = ((Date) this.get(index,Date.class,DataTypes.DATE));
842
        Date value = ((Date) this.get(index,java.sql.Date.class,DataTypes.DATE));
843
        return value;
844
    }
846 845

  
846
    @Override
847
    public Date getTime(String name) {
848
        return this.getTime(this.data.getType().getIndex(name));
849
    }
850

  
851
    @Override
852
    public Date getTime(int index) {
853
        Date value = ((Date) this.get(index,java.sql.Time.class,DataTypes.TIME));
847 854
        return value;
848 855
    }
849 856

  
850 857
    @Override
858
    public Date getTimestamp(String name) {
859
        return this.getTimestamp(this.data.getType().getIndex(name));
860
    }
861

  
862
    @Override
863
    public Date getTimestamp(int index) {
864
        Date value = ((Date) this.get(index,java.sql.Timestamp.class,DataTypes.TIMESTAMP));
865
        return value;
866
    }
867

  
868
    @Override
851 869
    public double getDouble(String name) {
852 870
        return this.getDouble(this.data.getType().getIndex(name));
853 871
    }
......
1058 1076
        return this.data.getType().getIndex(name) >= 0;
1059 1077
    }
1060 1078

  
1079
//    @Override
1080
//    public Time getTime(int index) {
1081
//        return ((Time) this.get(index,Time.class,DataTypes.INSTANT));
1082
//    }
1083
//
1084
//    @Override
1085
//    public Time getTime(String name) {
1086
//        return this.getInstant(this.data.getType().getIndex(name));
1087
//    }
1088
//
1089
//    @Override
1090
//    public Instant getInstant(int index) {
1091
//        return ((Instant) this.get(index,Instant.class,DataTypes.INSTANT));
1092
//    }
1093
//
1094
//    @Override
1095
//    public Instant getInstant(String name) {
1096
//        return this.getInstant(this.data.getType().getIndex(name));
1097
//    }
1098
//
1099
//    @Override
1100
//    public Interval getInterval(int index) {
1101
//        return ((Interval) this.get(index,Interval.class,DataTypes.INTERVAL));
1102
//    }
1103
//
1104
//    @Override
1105
//    public Interval getInterval(String name) {
1106
//        return this.getInterval(this.data.getType().getIndex(name));
1107
//    }
1108
//
1061 1109
    @Override
1062
    public Time getTime(int index) {
1063
        return ((Time) this.get(index,Time.class,DataTypes.INSTANT));
1064
    }
1065

  
1066
    @Override
1067
    public Time getTime(String name) {
1068
        return this.getInstant(this.data.getType().getIndex(name));
1069
    }
1070

  
1071
    @Override
1072
    public Instant getInstant(int index) {
1073
        return ((Instant) this.get(index,Instant.class,DataTypes.INSTANT));
1074
    }
1075

  
1076
    @Override
1077
    public Instant getInstant(String name) {
1078
        return this.getInstant(this.data.getType().getIndex(name));
1079
    }
1080

  
1081
    @Override
1082
    public Interval getInterval(int index) {
1083
        return ((Interval) this.get(index,Interval.class,DataTypes.INTERVAL));
1084
    }
1085

  
1086
    @Override
1087
    public Interval getInterval(String name) {
1088
        return this.getInterval(this.data.getType().getIndex(name));
1089
    }
1090

  
1091
    @Override
1092 1110
    public DynObject getAsDynObject() {
1093 1111
        DynObjectFeatureFacade facade = new DynObjectFeatureFacade(this);
1094 1112
        return facade;

Also available in: Unified diff