Revision 28676

View differences:

branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dxf/DXFStoreProvider.java
1430 1430
		return false;
1431 1431
	}
1432 1432

  
1433
	public void append(org.gvsig.fmap.dal.feature.Feature feature) {
1433
	public void append(FeatureData featureData) {
1434 1434
		try {
1435
			writer.add(getFeatureDataFormFeature(feature));
1435
			writer.add(getFeatureDataFormFeature(featureData));
1436 1436
		} catch (WriteException e) {
1437 1437
			// TODO Auto-generated catch block
1438 1438
			e.printStackTrace();
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/SHPStoreProvider.java
530 530
		return super.getState();
531 531
	}
532 532

  
533
	public void append(Feature feature) throws DataException {
533
	public void append(FeatureData featureData) throws DataException {
534 534
		this.resourcesBegin();
535 535
		try {
536
			writer.append(feature);
536
			writer.append(store.createFeature(featureData));
537 537
		} finally {
538 538
			this.resourcesEnd();
539 539
		}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFStoreProvider.java
628 628
	}
629 629

  
630 630

  
631
	public void append(Feature feature) throws DataException {
631
	public void append(FeatureData featureData) throws DataException {
632 632
		this.resourcesBegin();
633 633
		try {
634
			writer.append(feature);
634
			writer.append(store.createFeature(featureData));
635 635
		} finally {
636 636
			this.resourcesEnd();
637 637
		}
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/dbf/DBFFeatureWriter.java
91 91
	}
92 92

  
93 93
	public void append(Feature feature) throws DataException {
94
		// TODO use FeatureData
94 95
		dbfWriter.append(feature);
95 96
	}
96 97

  
branches/v2_0_0_prep/libraries/libDielmoOpenLiDAR/src/org/gvsig/fmap/dal/store/lidar/LiDARStoreProvider.java
24 24
import org.gvsig.fmap.dal.exception.ReadException;
25 25
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor;
26 26
import org.gvsig.fmap.dal.feature.EditableFeatureType;
27
import org.gvsig.fmap.dal.feature.Feature;
28 27
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
29 28
import org.gvsig.fmap.dal.feature.FeatureQuery;
30 29
import org.gvsig.fmap.dal.feature.FeatureStore;
......
283 282
	/* (non-Javadoc)
284 283
	 * @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#append(org.gvsig.fmap.dal.feature.Feature)
285 284
	 */
286
	public void append(Feature feature) throws DataException {
285
	public void append(FeatureData featureData) throws DataException {
287 286
		// TODO Auto-generated method stub
288 287

  
289 288
	}
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
728 728
				this.featureCount = null;
729 729
				notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
730 730
				feature.validate(Feature.UPDATE);
731
				provider.append(feature);
731
				provider.append(((DefaultEditableFeature) feature).getData());
732 732
				hasStrongChanges = true;
733 733
				hasInserts = true;
734 734
				notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/spi/FeatureStoreProvider.java
5 5

  
6 6
import org.gvsig.fmap.dal.exception.DataException;
7 7
import org.gvsig.fmap.dal.exception.InitializeException;
8
import org.gvsig.fmap.dal.feature.Feature;
9 8
import org.gvsig.fmap.dal.feature.FeatureLocks;
10 9
import org.gvsig.fmap.dal.feature.FeatureQuery;
11 10
import org.gvsig.fmap.dal.feature.FeatureSelection;
......
92 91

  
93 92
	public void endAppend() throws DataException;
94 93

  
95
	public void append(Feature feature) throws DataException;
94
	public void append(FeatureData featureData) throws DataException;
96 95

  
97 96
	public boolean allowAutomaticValues();
98 97

  
branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/store/postgresql/PostgreSQLStoreProviderWriter.java
40 40
import org.gvsig.fmap.dal.DataTypes;
41 41
import org.gvsig.fmap.dal.exception.DataException;
42 42
import org.gvsig.fmap.dal.exception.InitializeException;
43
import org.gvsig.fmap.dal.exception.OpenException;
44 43
import org.gvsig.fmap.dal.feature.Feature;
45 44
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
46 45
import org.gvsig.fmap.dal.feature.FeatureType;
47 46
import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
48 47
import org.gvsig.fmap.dal.feature.spi.FeatureData;
49 48
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
50
import org.gvsig.fmap.dal.resource.exception.ResourceBeginException;
51 49
import org.gvsig.fmap.dal.store.jdbc.JDBCExecutePreparedSQLException;
52 50
import org.gvsig.fmap.dal.store.jdbc.JDBCExecuteSQLException;
53 51
import org.gvsig.fmap.dal.store.jdbc.JDBCPreparingSQLException;
......
62 60

  
63 61
	final static private Logger logger = LoggerFactory
64 62
			.getLogger(PostgreSQLStoreProvider.class);
63
	private String sqlForAppend;
64
	private List attrsForAppendMode;
65 65

  
66 66

  
67 67
	public PostgreSQLStoreProviderWriter() {
......
149 149

  
150 150
		boolean countChanged = deleteds.hasNext() || inserteds.hasNext();
151 151

  
152
		try {
153
			this.open();
154
		} catch (OpenException e2) {
155
			throw new PerformEditingException(this.getName(), e2);
156
		}
157
		try {
158
			this.resourceBegin();
159
		} catch (ResourceBeginException e2) {
160
			throw new PerformEditingException(this.getName(), e2);
161
		}
162 152

  
163 153
		TransactionalAction action = new TransactionalAction() {
164 154

  
......
208 198

  
209 199
		} catch (Exception e) {
210 200
			throw new PerformEditingException(this.getName(), e);
211
		} finally {
212
			this.resourceEnd();
213 201
		}
214 202
	}
215 203

  
......
797 785
		return strb.toString();
798 786
	}
799 787

  
788
	public boolean supportsAppendMode() {
789
		return true;
790
	}
791

  
792
	public void endAppend() throws DataException {
793
		this.loadMetadata();
794
	}
795

  
796
	public void append(final FeatureData featureData) throws DataException {
797
		TransactionalAction action = new TransactionalAction() {
798
			public Object action(Connection conn) throws DataException {
799

  
800
				PreparedStatement st;
801
				try {
802
					st = conn.prepareStatement(sqlForAppend);
803
				} catch (SQLException e) {
804
					throw new JDBCPreparingSQLException(sqlForAppend, e);
805
				}
806
				try {
807
//					perfomInsert(conn, st, sqlForAppend, featureData, attrsForAppendMode);
808
				} finally {
809
					try {st.close();} catch (SQLException e) {	};
810
				}
811
				return null;
812
			}
813

  
814
			public boolean continueTransactionAllowed() {
815
				return false;
816
			}
817
		};
818
		try {
819
			this.helper.doConnectionAction(action);
820

  
821
			resetCount();
822

  
823
		} catch (Exception e) {
824
			throw new PerformEditingException(this.getName(), e);
825
		}
826
	}
827

  
828
	public void beginAppend() throws DataException {
829
		StringBuilder sqlb = new StringBuilder();
830
		List attrs = new ArrayList();
831

  
832
		prepareSQLAndAttributeListForInser(sqlb, attrs);
833

  
834
		sqlForAppend = sqlb.toString();
835
		attrsForAppendMode = attrs;
836
	}
837

  
800 838
}
branches/v2_0_0_prep/libraries/libFMap_daldb/src/org/gvsig/fmap/dal/store/postgresql/PostgreSQLStoreProvider.java
51 51
import org.gvsig.fmap.dal.exception.ReadException;
52 52
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
53 53
import org.gvsig.fmap.dal.feature.EditableFeatureType;
54
import org.gvsig.fmap.dal.feature.Feature;
55 54
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
56 55
import org.gvsig.fmap.dal.feature.FeatureQuery;
57 56
import org.gvsig.fmap.dal.feature.FeatureStore;
......
590 589
		}
591 590
	}
592 591

  
593
	private void loadMetadata() throws DataException {
592
	protected void loadMetadata() throws DataException {
594 593
		IProjection srs = params.getSRS();
595 594

  
596 595
		if (srs == null) {
......
662 661
		totalCount = null;
663 662
	}
664 663

  
665
	// ************************************************************************************//
664
	public long getFeatureCount() throws DataException {
665
		return getCount(null);
666
	}
666 667

  
667

  
668
	// ************************************************************************************//
669

  
670

  
671 668
	public boolean supportsAppendMode() {
672
		// TODO Auto-generated method stub
673 669
		return false;
674 670
	}
675 671

  
676
	public PersistentState getState() throws PersistenceException {
677
		// TODO Auto-generated method stub
678
		return null;
679
	}
680 672

  
681
	public void loadState(PersistentState state) throws PersistenceException {
682
		// TODO Auto-generated method stub
673
	public void endAppend() throws DataException {
674
		// FIXME exception
675
		throw new UnsupportedOperationException();
683 676

  
684 677
	}
685 678

  
686
	public void loadFromState(PersistentState state) throws PersistenceException {
687
		// TODO Auto-generated method stub
679
	public void append(FeatureData featureData) throws DataException {
680
		// FIXME exception
681
		throw new UnsupportedOperationException();
688 682

  
689 683
	}
690 684

  
685
	public void beginAppend() throws DataException {
686
		// FIXME exception
687
		throw new UnsupportedOperationException();
688
	}
691 689

  
692
	public void endAppend() throws DataException {
693
		// TODO Auto-generated method stub
690
	// ************************************************************************************//
694 691

  
695
	}
696 692

  
693
	// ************************************************************************************//
697 694

  
698
	public void append(Feature feature) throws DataException {
695

  
696

  
697
	public PersistentState getState() throws PersistenceException {
699 698
		// TODO Auto-generated method stub
700

  
699
		return null;
701 700
	}
702 701

  
703
	public void beginAppend() throws DataException {
702
	public void loadState(PersistentState state) throws PersistenceException {
704 703
		// TODO Auto-generated method stub
705 704

  
706 705
	}
707 706

  
708
	public long getFeatureCount() throws DataException {
709
		return getCount(null);
707
	public void loadFromState(PersistentState state)
708
			throws PersistenceException {
709
		// TODO Auto-generated method stub
710

  
710 711
	}
711 712

  
712 713
	/* (non-Javadoc)

Also available in: Unified diff