Revision 33281

View differences:

branches/v2_0_0_prep/extensions/extDalTransformJoin/src/org/gvsig/app/join/dal/feature/JoinTransform.java
372 372
		definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE,
373 373
				ABSTRACT_FEATURESTORE_DYNCLASS_NAME);
374 374

  
375
		definition.addDynField("store2").setType(DataTypes.OBJECT);
376
		definition.addDynField("keyAttr1").setType(DataTypes.STRING);
377
		definition.addDynField("keyAttr2").setType(DataTypes.STRING);
378
		definition.addDynField("prefix1").setType(DataTypes.STRING);
379
		definition.addDynField("prefix2").setType(DataTypes.STRING);
380
		definition.addDynField("attrs").setType(DataTypes.LIST);
375
		definition.addDynFieldObject("store2").setClassOfItems(FeatureStore.class).setMandatory(true);
376
		definition.addDynFieldString("keyAttr1").setMandatory(true);
377
		definition.addDynFieldString("keyAttr2").setMandatory(true);
378
		definition.addDynFieldString("prefix1").setMandatory(true);
379
		definition.addDynFieldString("prefix2").setMandatory(true);
380
		definition.addDynFieldList("attrs").setClassOfItems(String.class).setMandatory(true);
381 381
	}
382 382

  
383 383
	public void saveToState(PersistentState state) throws PersistenceException {
......
387 387
		state.set("keyAttr2", this.keyAttr2);
388 388
		state.set("prefix1", this.prefix1);
389 389
		state.set("prefix2", this.prefix2);		
390
		state.set("attrs", Arrays.asList(this.attrs));
390
		state.set("attrs", this.attrs);
391 391
	}
392 392

  
393 393
	@SuppressWarnings("unchecked")
......
396 396
		FeatureStore store2 = (FeatureStore) state.get("store2");
397 397
		String keyAttr1 = state.getString("keyAttr1");
398 398
		String keyAttr2 = state.getString("keyAttr2");
399
		String prefix2 =  state.getString("prefix2");		
400
		List attrList = (List) state.get("attrs");
401
		String[] attrs = null;
402
		if (attrList == null) {
403
			attrs = null;
404
		} else {
405
			attrs = (String[]) attrList
406
			.toArray(new String[attrList.size()]);
407
		}		
399
		String prefix2 =  state.getString("prefix2");
400
		String[] attrs = (String[]) state.getArray("attrs", String.class);
408 401
		try {
409 402
			initialize(getFeatureStore(), store2, keyAttr1, keyAttr2, prefix1, prefix2, attrs);
410 403
		} catch (DataException e) {
branches/v2_0_0_prep/extensions/extDalTransformEventTheme/src/org/gvsig/app/eventtheme/dal/feature/EventThemeTransform.java
41 41
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
42 42
import org.gvsig.fmap.dal.feature.FeatureStore;
43 43
import org.gvsig.fmap.dal.feature.FeatureType;
44
import org.gvsig.fmap.geom.GeometryLocator;
45
import org.gvsig.fmap.geom.GeometryManager;
46 44
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
47 45
import org.gvsig.fmap.geom.Geometry.TYPES;
46
import org.gvsig.fmap.geom.GeometryLocator;
47
import org.gvsig.fmap.geom.GeometryManager;
48 48
import org.gvsig.fmap.geom.exception.CreateGeometryException;
49 49
import org.gvsig.fmap.geom.primitive.Point;
50
import org.gvsig.fmap.mapcontext.layers.FLyrDefault;
51 50
import org.gvsig.tools.ToolsLocator;
52 51
import org.gvsig.tools.dynobject.DynStruct;
53 52
import org.gvsig.tools.persistence.PersistenceManager;
......
191 190
		definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE,
192 191
				ABSTRACT_FEATURESTORE_DYNCLASS_NAME);
193 192
		
194
		definition.addDynField("geometryFieldName").setType(DataTypes.STRING);
195
		definition.addDynField("xFieldName").setType(DataTypes.STRING);
196
		definition.addDynField("yFieldName").setType(DataTypes.STRING);
197
		definition.addDynField("projection").setType(DataTypes.CRS);
193
		definition.addDynFieldString("geometryFieldName").setMandatory(true);
194
		definition.addDynFieldString("xFieldName").setMandatory(true);
195
		definition.addDynFieldString("yFieldName").setMandatory(true);
196
		definition.addDynFieldObject("projection").setType(DataTypes.CRS);
198 197
	
199 198
	}
200 199
	
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/table/TableDocument.java
376 376
		
377 377
		definition.addDynFieldObject("store").setClassOfValue(FeatureStore.class).setMandatory(true);
378 378
		definition.addDynFieldString("featureTypeId").setMandatory(true);
379
		definition.addDynFieldArray("attributeNames").setClassOfValue(String.class).setMandatory(true);
379
		definition.addDynFieldArray("attributeNames").setClassOfItems(String.class).setMandatory(true);
380 380
		definition.addDynFieldString("associatedLayer").setMandatory(true);
381 381
		definition.addDynFieldString("query").setMandatory(true);
382 382
		definition.addDynFieldString("baseFilter").setMandatory(true);
383 383
		definition.addDynFieldObject("baseOrder").setClassOfValue(FeatureQueryOrder.class).setMandatory(true);
384
		definition.addDynFieldList("linkTable").setClassOfValue(TableLink.class).setMandatory(true);
384
		definition.addDynFieldList("linkTable").setClassOfItems(TableLink.class).setMandatory(true);
385 385
	}
386 386
	
387 387
	public static class TableLink implements Observer, Persistent {
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/DefaultProject.java
651 651
		definition.addDynFieldObject("selectionColor").setClassOfValue(Color.class).setMandatory(true);
652 652
		definition.addDynFieldObject("projection").setClassOfValue(IProjection.class).setMandatory(true);
653 653

  
654
		definition.addDynFieldList("extents").setClassOfValue(ProjectExtent.class).setMandatory(true);
654
		definition.addDynFieldList("extents").setClassOfItems(ProjectExtent.class).setMandatory(true);
655 655

  
656
		definition.addDynFieldList("documents").setClassOfValue(Document.class).setMandatory(true);
656
		definition.addDynFieldList("documents").setClassOfItems(Document.class).setMandatory(true);
657 657
		
658 658
		AbstractDocument.registerPersistent();
659 659
		TableDocument.registerPersistent();
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/extension/ShowDevelInfoExtension.java
15 15
import java.util.Set;
16 16
import java.util.TreeSet;
17 17

  
18
import javax.help.Map;
19 18
import javax.swing.BorderFactory;
20
import javax.swing.Box;
21 19
import javax.swing.BoxLayout;
22 20
import javax.swing.JButton;
23 21
import javax.swing.JPanel;
......
298 296
			for( int i=0; i < fields.length ; i++ ) {
299 297
				DynField field = fields[i];
300 298
				if( dataTypesManager.isContainer(field.getType())) {
301
					if( field.getClassOfValue()==null ) {
299
					if( field.getClassOfItems()==null ) {
302 300
						classBuffer.append("Field <b>").append(field.getName()).append("</b>, container,  can't has class for value of items.<br>\n    ");
303 301
						warningsCounter++;
304 302
						warning = true;
305
					} else if( field.getClassOfValue().getName().equals(Map.class.getName()) ||
306
							   field.getClassOfValue().getName().equals(List.class.getName()) ||
307
							   field.getClassOfValue().getName().equals(Set.class.getName()) ) {
308
						classBuffer.append("Field <b>").append(field.getName()).append("</b>, container,  probably can't has class for value of items.<br>\n    ");
309
						warningsCounter++;
310
						warning = true;
311 303
					} else {
312 304
						referencedClasses.add(field.getClassOfValue());
313 305
					}
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ViewPort.java
53 53
import org.cresques.cts.IProjection;
54 54
import org.cresques.cts.UTM;
55 55
import org.gvsig.compat.CompatLocator;
56
import org.gvsig.fmap.crs.CRSFactory;
56
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
57 57
import org.gvsig.fmap.geom.GeometryLocator;
58 58
import org.gvsig.fmap.geom.GeometryManager;
59
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
60 59
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
61 60
import org.gvsig.fmap.geom.primitive.Envelope;
62 61
import org.gvsig.fmap.mapcontext.events.ColorEvent;
......
1592 1591
	 */
1593 1592
	public void saveToState(PersistentState state) throws PersistenceException {
1594 1593

  
1595
		// XMLEntity xml = new XMLEntity();
1596
		// xml.putProperty("className", this.getClass().getName());
1597 1594
		state.set("adjustedExtent", adjustedExtent);
1598
		
1599
		if (backColor != null) {
1600
			state.set("backColor", color2String(backColor));
1601
		} else {
1602
			throw new PersistenceException("Background color is null");
1603
		}
1604

  
1605
		if (cliprect != null) {
1606
			state.set("clip", cliprect);
1607
		}
1608
		
1595
		state.set("backColor", backColor);
1596
		state.set("clip", cliprect);
1609 1597
		state.set("dist1pixel", dist1pixel);
1610 1598
		state.set("dist3pixel", dist3pixel);
1611 1599
		state.set("distanceUnits", distanceUnits);
1612
		if (distanceArea != distanceUnits) {
1613
			state.set("distanceArea", distanceArea);
1614
		}
1600
		state.set("distanceArea", distanceArea);
1615 1601
		
1616 1602
		state.set("extent", extent);
1617 1603
		state.set("extents", extents);
1618 1604
		
1619 1605
		state.set("mapUnits", mapUnits);
1620
		state.set("offsetX", offset.getX());
1621
		state.set("offsetY", offset.getY());
1606
		state.set("offsetX", offset);
1622 1607

  
1623
		state.set("proj", proj.getFullCode());
1608
		state.set("proj", proj);
1624 1609

  
1625
		state.set("imageWidth", imageSize.width);
1626
		state.set("imageHeight", imageSize.height);
1610
		state.set("imageSize", imageSize);
1627 1611
	}
1628 1612
	
1629 1613
	
......
1646 1630
		
1647 1631
		
1648 1632
        definition.addDynFieldObject("adjustedExtent")
1633
        	.setClassOfValue(Rectangle2D.class)
1649 1634
        	.setMandatory(true);
1650 1635
        
1651 1636
        definition.addDynFieldString("backColor")
1637
        	.setClassOfValue(Color.class)
1652 1638
        	.setMandatory(true);
1653 1639
        
1654 1640
        definition.addDynFieldObject("clip")
1655
        	.setMandatory(false);
1641
        	.setClassOfValue(Rectangle2D.class)
1642
        	.setMandatory(true);
1656 1643
        
1657 1644
        definition.addDynFieldDouble("dist1pixel")
1658 1645
        	.setMandatory(true);
......
1667 1654
        	.setMandatory(false);
1668 1655
        
1669 1656
        definition.addDynFieldObject("extent")
1657
        	.setClassOfValue(Rectangle2D.class)
1670 1658
        	.setMandatory(true);
1671 1659
        
1672
        definition.addDynFieldList("extents")
1660
        definition.addDynFieldObject("extents")
1661
        	.setClassOfValue(ExtentHistory.class)
1673 1662
        	.setMandatory(true);
1674 1663
        
1675 1664
        definition.addDynFieldInt("mapUnits")
1676 1665
        	.setMandatory(true);
1677 1666
        
1678
        definition.addDynFieldDouble("offsetX")
1667
        definition.addDynFieldDouble("offset")
1668
        	.setClassOfValue(Point2D.class)
1679 1669
        	.setMandatory(true);
1680 1670

  
1681
        definition.addDynFieldDouble("offsetY")
1671
        definition.addDynFieldObject("proj")
1672
        	.setClassOfValue(IProjection.class)
1682 1673
        	.setMandatory(true);
1683 1674
        
1684
        definition.addDynFieldString("proj")
1675
        definition.addDynFieldInt("imageSize")
1676
        	.setClassOfValue(Dimension.class)
1685 1677
        	.setMandatory(true);
1686
        
1687
        definition.addDynFieldInt("imageWidth")
1688
        	.setMandatory(true);
1689
        
1690
        definition.addDynFieldInt("imageHeight")
1691
        	.setMandatory(true);
1692
        
1693 1678
	}	
1694 1679

  
1695 1680
	public void loadFromState(PersistentState state) throws PersistenceException {
1696 1681
		
1697
		// ViewPort vp = new ViewPort(null);
1698

  
1699 1682
		adjustedExtent = (Rectangle2D) state.get("adjustedExtent");
1700
		
1701
		String str = state.getString("backColor");
1702
		setBackColor(string2Color(str));
1683
		backColor = (Color) state.get("backColor");
1684
		cliprect = (Rectangle2D) state.get("clip");
1685
		dist1pixel = state.getDouble("dist1pixel");
1686
		dist3pixel = state.getDouble("dist3pixel");
1687
		distanceUnits = state.getInt("distanceUnits");
1688
		extents = (ExtentHistory) state.get("extents");
1689
		extent = (Rectangle2D) state.get("extent");
1690
		mapUnits = state.getInt("mapUnits");
1691
		offset =  (Point2D) state.get("offset");
1692
		proj = (IProjection) state.get("proj");
1693
		imageSize =  (Dimension) state.get("imageSize");
1703 1694

  
1704 1695
		try {
1705
			cliprect = (Rectangle2D) state.get("clip");
1706
		} catch (PersistenceException pex) {
1707
			// not mandatory
1708
			cliprect = null;
1709
		}
1710

  
1711
		setDist1pixel(state.getDouble("dist1pixel"));
1712
		setDist3pixel(state.getDouble("dist3pixel"));
1713
		setDistanceUnits(state.getInt("distanceUnits"));
1714

  
1715
		try {
1716
			setDistanceArea(state.getInt("distanceArea"));
1696
			distanceArea = state.getInt("distanceArea");
1717 1697
		} catch (Exception pvnf) {
1718 1698
			// not mandatory , use dist units
1719
			setDistanceArea(getDistanceUnits());
1699
			distanceArea = distanceUnits;
1720 1700
		}	
1721 1701
		
1722
		extents = (ExtentHistory) state.get("extents");
1723

  
1724
		extent = (Rectangle2D) state.get("extent");
1725

  
1726
		setMapUnits(state.getInt("mapUnits"));
1727

  
1728
		double x = state.getDouble("offsetX");
1729
		double y = state.getDouble("offsetY");
1730
		setOffset(new Point2D.Double(x, y));
1731

  
1732
		proj = CRSFactory.getCRS(state.getString("proj"));
1733
		
1734
		int w = state.getInt("imageWidth");
1735
		int h = state.getInt("imageHeight");
1736
		imageSize = new Dimension(w,h);
1737

  
1738 1702
		refreshExtent();
1739 1703
	}
1740 1704

  
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java
48 48
import java.util.Iterator;
49 49
import java.util.List;
50 50
import java.util.Map;
51
import java.util.regex.Pattern;
52 51

  
53 52
import org.cresques.cts.ICoordTrans;
54 53
import org.cresques.cts.IProjection;
55
import org.gvsig.fmap.crs.CRSFactory;
56 54
import org.gvsig.fmap.dal.exception.ReadException;
57 55
import org.gvsig.fmap.mapcontext.MapContext;
58 56
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
......
73 71
import org.gvsig.tools.persistence.PersistenceManager;
74 72
import org.gvsig.tools.persistence.PersistentState;
75 73
import org.gvsig.tools.persistence.exception.PersistenceException;
76
import org.gvsig.tools.persistence.impl.exception.PersistenceValueNotFoundException;
77 74
import org.slf4j.LoggerFactory;
78 75

  
79 76

  
......
104 101
	 * Useful for debug the problems during the implementation.
105 102
	 */
106 103
	final static private org.slf4j.Logger logger = LoggerFactory.getLogger(FLyrDefault.class);
104

  
105
	private static final String METADATA_CRS = "SRS";
106
	private static final String METADATA_NAME = "name";
107

  
107 108
	private LayerChangeSupport layerChangeSupport = new LayerChangeSupport();
108 109

  
109 110
	/**
......
166 167
	 * @see #setProperty(Object, Object)
167 168
	 * @see #getExtendedProperties()
168 169
	 */
169
	private Hashtable properties = new Hashtable();
170
	private Map properties = new Hashtable();
170 171

  
171 172
	//by default, all is active, visible and avalaible
172 173
	/**
......
266 267
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#setName(java.lang.String)
267 268
	 */
268 269
	public void setName(String name) {
269
		this.delegatedDynObject.setDynValue("name", name);
270
		this.delegatedDynObject.setDynValue(METADATA_NAME, name);
270 271
		callNameChanged(LayerEvent.createNameChangedEvent(this, "name"));
271 272
	}
272 273

  
......
275 276
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getName()
276 277
	 */
277 278
	public String getName() {
278
		return (String) this.delegatedDynObject.getDynValue("name");
279
		return (String) this.delegatedDynObject.getDynValue(METADATA_NAME);
279 280
	}
280 281

  
281 282
	/*
......
348 349
			return;
349 350
		}
350 351
		this.updateDrawVersion();
351
		this.delegatedDynObject.setDynValue("SRS", proj);
352
		this.delegatedDynObject.setDynValue(METADATA_CRS, proj);
352 353
		// Comprobar que la proyecci?n es la misma que la de FMap
353 354
		// Si no lo es, es una capa que est? reproyectada al vuelo
354 355
		if ((proj != null) && (getMapContext() != null)) {
......
367 368
	 * @see org.cresques.geo.Projected#getProjection()
368 369
	 */
369 370
	public IProjection getProjection() {
370
		if (!this.delegatedDynObject.hasDynValue("SRS")) {
371
		if (!this.delegatedDynObject.hasDynValue(METADATA_CRS)) {
371 372
			return null;
372 373
		}
373
		return (IProjection) this.delegatedDynObject.getDynValue("SRS");
374
		return (IProjection) this.delegatedDynObject.getDynValue(METADATA_CRS);
374 375
	}
375 376

  
376 377
	/**
......
934 935
	
935 936
	// ========================================================
936 937
	
937
//	/**
938
//	 * <p>Returns an entity that represents this layer.</p>
939
//	 *
940
//	 * <p>This XML entity has elements (properties) that represent and store information about this layer.</p>
941
//	 *
942
//	 * <p>There are two kinds of information: default properties of this layer, and extended properties (they added that weren't by default)</p>
943
//	 *
944
//	 * <p> <b>Default properties:</b>
945
//	 *  <ul>
946
//	 *   <li> className : name of this class
947
//	 *   <li> active : if this layer is active or not
948
//	 *   <li> name : name of this layer
949
//	 *   <li> minScale : minimum scale of this layer
950
//	 *   <li> maxScale : maximum scale of this layer
951
//	 *   <li> visible : if this layer is visible or not
952
//	 *   <li> proj : the projection of this layer (only if it's defined)
953
//	 *   <li> transparency : transparency level of this layer
954
//	 *   <li> isInTOC : if this layer is in the TOC or not
955
//	 *  </ul>
956
//	 * </p>
957
//	 *
958
//	 * <p> <b>Extended properties:</b> are stored as children of the tree-node returned. There are two kinds of information for a child,
959
//	 *  according if it's an instance of an <code>String</code> or of an object that implements the interface <code>IPersistance</code>.
960
//	 *
961
//	 *  <ul>
962
//	 *   <li> <i>Instance of <code>String</code>:</i>
963
//	 *   <ul>
964
//	 *    <li> className : name of the class of the object that it's the property
965
//	 *    <li> value : value of the property
966
//	 *    <li> layerPropertyName : name of the extended property of the layer
967
//	 *   </ul>
968
//	 *   <li> <i>Implements <code>IPersistance</code>:</i>
969
//	 *   <ul>
970
//	 *    <li> Information returned by the implementation of the method <code>getXMLEntity</code> of that object
971
//	 *    <li> className : name of the class of the object (this information could be with the information returned by
972
//	 *     the method <code>getXMLEntity</code> of that object
973
//	 *    <li> layerPropertyName : name of the extended property of the layer
974
//	 *   </ul>
975
//	 *  <ul>
976
//	 * </p>
977
//	 *
978
//	 * @return an XML entity with information to the current layer
979
//	 * @throws XMLException
980
//	 * @throws org.gvsig.fmap.mapcontext.layers.XMLException if there is an error obtaining the object.
981
//	 *
982
//	 * @see #setXMLEntity(XMLEntity)
983
//	 * @see #setXMLEntity03(XMLEntity)
984
//	 */
985
//	public XMLEntity getXMLEntity() throws XMLException {
986
//		XMLEntity xml = new XMLEntity();
987
//		xml.putProperty("className", this.getClass().getName());
988
//
989
//		xml.putProperty("active", status.active);
990
//		xml.putProperty("name", this.getName());
991
//		xml.putProperty("minScale", minScale);
992
//		xml.putProperty("maxScale", maxScale);
993
//
994
//		xml.putProperty("visible", status.visible);
995
//		IProjection projection = this.getProjection();
996
//		if (projection != null) {
997
//			xml.putProperty("proj", projection.getFullCode());
998
//		}
999
//		xml.putProperty("transparency", transparency);
1000
//		xml.putProperty("isInTOC", status.inTOC);
1001
//
1002
//		// persist Properties hashTable
1003
//		Set keyset = properties.keySet();
1004
//		Iterator keyitr = keyset.iterator();
1005
//		XMLEntity xmlProperties = new XMLEntity();
1006
//		xmlProperties.putProperty("tagName", "properties");
1007
//		while (keyitr.hasNext()) {
1008
//			String propName = (String)keyitr.next();
1009
//			Object obj = properties.get(propName);
1010
//			if (obj instanceof IPersistence)
1011
//			{
1012
//				IPersistence persistObj = (IPersistence)obj;
1013
//				XMLEntity xmlPropObj = persistObj.getXMLEntity();
1014
//				// make sure the node contains the class name
1015
//				if (!xmlPropObj.contains("className")) {
1016
//					try {
1017
//						String propClassName = persistObj.getClassName();
1018
//						System.out.println("PROP CLASS NAME "+propClassName);
1019
//						xmlPropObj.putProperty("className", propClassName);
1020
//					} catch (Exception e) {
1021
//						e.printStackTrace();
1022
//					}
1023
//				}
1024
//				xmlPropObj.putProperty("layerPropertyName", propName);
1025
//				xmlProperties.addChild(xmlPropObj);
1026
//			} else if (obj instanceof String) {
1027
//				XMLEntity xmlPropObj = new XMLEntity();
1028
//				xmlPropObj.putProperty("className", String.class.getName());
1029
//				xmlPropObj.putProperty("value",(String)obj);
1030
//				xmlPropObj.putProperty("layerPropertyName", propName);
1031
//				xmlProperties.addChild(xmlPropObj);
1032
//			}
1033
//		}
1034
//		if (xmlProperties.getChildrenCount() > 0) {
1035
//			xml.addChild(xmlProperties);
1036
//		}
1037
//		return xml;
1038
//	}
1039

  
1040
//	/**
1041
//	 * <p>Inserts information to this layer.</p>
1042
//	 *
1043
//	 * <p>This XML entity has elements that represent and store information about this layer.</p>
1044
//	 *
1045
//	 * <p>The properties are the same as the described in <code>getXMLEntity()</code>. And the properties
1046
//	 *  <i>proj</i>,  <i>transparency</i>, <i>isInTOC</i> are optional.</p>
1047
//	 *
1048
//	 * <p>The property <i>numProperties</i> is optional, and only used in old projects.</p>
1049
//	 *
1050
//	 * @see FLyrDefault#getXMLEntity()
1051
//	 *
1052
//	 * @param xml an <code>XMLEntity</code> with the information
1053
//	 *
1054
//	 * @throws org.gvsig.fmap.mapcontext.layers.XMLException if there is an error setting the object.
1055
//	 *
1056
//	 * @see #getXMLEntity()
1057
//	 */
1058
//	public void setXMLEntity(XMLEntity xml) throws XMLException {
1059
//		status.active = xml.getBooleanProperty("active");
1060
//		this.setName(xml.getStringProperty("name"));
1061
//		minScale = xml.getDoubleProperty("minScale");
1062
//		maxScale = xml.getDoubleProperty("maxScale");
1063
//		status.visible = xml.getBooleanProperty("visible");
1064
//		if (xml.contains("proj")) {
1065
//			setProjection(CRSFactory.getCRS(xml.getStringProperty("proj")));
1066
//		}
1067
//		if (xml.contains("transparency")) {
1068
//			transparency = xml.getIntProperty("transparency");
1069
//		}
1070
//		if (xml.contains("isInTOC")) {
1071
//			status.inTOC = xml.getBooleanProperty("isInTOC");
1072
//		}
1073
//
1074
//		// recreate Properties hashTable
1075
//		int xmlPropertiesPos = xml.firstIndexOfChild("childName", "properties");
1076
//		XMLEntity xmlProperties = null;
1077
//		if (xmlPropertiesPos > -1) {
1078
//			xmlProperties = xml.getChild(xmlPropertiesPos);
1079
//		}
1080
//
1081
//		if (xmlProperties != null) {
1082
//
1083
//			int numProps = xmlProperties.getChildrenCount();
1084
//			Object obj;
1085
//			String className;
1086
//			Class classProp;
1087
//			IPersistence objPersist;
1088
//			for (int iProp=0; iProp<numProps; iProp++) {
1089
//				XMLEntity xmlProp = xmlProperties.getChild(iProp);
1090
//				try {
1091
//					className = xmlProp.getStringProperty("className");
1092
//					if (className.equals(String.class.getName())) {
1093
//						obj = xmlProp.getStringProperty("value");
1094
//					} else {
1095
//						classProp = Class.forName(className);
1096
//						obj = classProp.newInstance();
1097
//						objPersist = (IPersistence)obj;
1098
//						objPersist.setXMLEntity(xmlProp);
1099
//
1100
//					}
1101
//					String propName = xmlProp.getStringProperty("layerPropertyName");
1102
//					properties.put(propName, obj);
1103
//				} catch (Exception e) {
1104
//					logger.error("Layer:" + this.getName()
1105
//							+ ": Error loading properties", e);
1106
//					continue;
1107
//				}
1108
//			}
1109
//		}
1110
//		this.updateDrawVersion();
1111
//	}
1112
	
1113
	
1114
	
1115
	
1116
	
1117 938
	public void saveToState(PersistentState state) throws PersistenceException {
1118

  
1119 939
		state.set("parentLayer", parentLayer);
1120
		state.set("active", status.active);
1121
		state.set("name", this.getName());
940
		state.set("status",status);
1122 941
		state.set("minScale", minScale);
1123 942
		state.set("maxScale", maxScale);
1124
		
1125
		state.set("visible", status.visible);
1126
		IProjection projection = getProjection();
1127
		
1128
		if (projection != null) {
1129
			state.set("proj", projection.getFullCode());
1130
		}
1131
		
1132
		state.set("transparency", transparency);
1133
		state.set("isInTOC", status.inTOC);
1134
		
1135
		// persist Properties hashTable
1136
		Iterator valueitr = properties.entrySet().iterator();
1137
		Iterator keyitr = properties.keySet().iterator();
1138
		state.set("propertiesvalues", valueitr);
1139
		state.set("propertieskeys", keyitr);
943
		state.set("transparency",transparency);
944
		state.set("coordTrans",ct);
945
		state.set("name", getName());
946
		state.set("crs", getProjection());
947
		state.set("properties",properties);
1140 948
	}
1141 949

  
1142 950
	public void loadFromState(PersistentState state) throws PersistenceException {
951
		this.parentLayer = (FLayers) state.get("parentlayer");
952
		this.status = (FLayerStatus) state.get("status");
953
		this.minScale = state.getDouble("minScale");
954
		this.minScale = state.getDouble("maxScale");
955
		this.transparency = state.getInt("transparency");
956
		this.ct = (ICoordTrans) state.get("coordTrans");
1143 957

  
1144
		Object pare = state.get("parentLayer");
1145
		this.setParentLayer((FLayers) pare);
1146
		status.active = state.getBoolean("active");
958
		this.setDynValue(METADATA_NAME, state.getString("name"));
959
		this.setDynValue(METADATA_CRS, state.get("crs"));
1147 960
		
1148
		this.setName(state.getString("name"));
1149
		this.setMinScale(state.getDouble("minScale"));
1150
		this.setMinScale(state.getDouble("maxScale"));
1151
		
1152
		status.visible = state.getBoolean("visible");
1153
		
1154
		String auxproj = null;
1155
		
1156
		try {
1157
			auxproj = state.getString("proj");
1158
			String[] colonparts = splitString(auxproj, ":");
1159

  
1160
			if (colonparts.length > 2) {
1161
				auxproj = colonparts[0] + ":" + colonparts[1];
1162
			}
1163
			
1164
		} catch (PersistenceValueNotFoundException pe) {
1165
			logger.warn("Projection not found, assumed EPSG:4326");
1166
			auxproj = "EPSG:4326";
1167
		}
1168
		// TODO: manage parameters ??
1169
		// this comes from: state.set("proj", projection.getFullCode());
1170
		
1171
		this.setProjection(CRSFactory.getCRS(auxproj));
1172
		
1173
		this.setTransparency(state.getInt("transparency"));
1174
		
1175
		status.inTOC = state.getBoolean("isInTOC");
1176

  
1177
		Iterator viter = state.getIterator("propertiesvalues");
1178
		Iterator kiter = state.getIterator("propertieskeys");
1179
		while (kiter.hasNext() && viter.hasNext()) {
1180
			properties.put(kiter.next(), viter.next());
1181
		}
961
		this.properties = new Hashtable((Map)state.get("properties"));
1182 962
	}
1183
	
1184
	
1185
	
1186
	/**
1187
	 * Splits string into an array of strings
1188
	 * @param input input string
1189
	 * @param sep separator string
1190
	 * @return an array of strings
1191
	 */
1192
	public static String[] splitString(String input, String sep) {
1193
		return Pattern.compile(sep).split(input, 0);
1194
	}
1195
	
963

  
1196 964
	public static void registerPersistent() {
1197 965
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
1198 966
		DynStruct definition = manager.addDefinition(
......
1202 970
				null, 
1203 971
				null
1204 972
		);
1205
		definition.addDynFieldObject("parentLayer").setMandatory(true);
973
		definition.addDynFieldString("name").setMandatory(true);
1206 974
		definition.addDynFieldInt("transparency").setMandatory(true);
1207
		definition.addDynFieldObject("coordTrans").setMandatory(true);
1208 975
		definition.addDynFieldDouble("minScale").setMandatory(true);
1209 976
		definition.addDynFieldDouble("maxScale").setMandatory(true);
1210
		definition.addDynFieldObject("status").setMandatory(true);
1211
		definition.addDynFieldLong("drawVersion").setMandatory(true);
1212
		definition.addDynFieldList("propertiesvalues").setMandatory(true);
1213
		definition.addDynFieldList("propertieskeys").setMandatory(true);
977
		definition.addDynFieldObject("crs").setClassOfValue(IProjection.class).setMandatory(true);
978
		definition.addDynFieldObject("parentLayer").setClassOfValue(FLayers.class).setMandatory(true);
979
		definition.addDynFieldObject("coordTrans").setClassOfValue(ICoordTrans.class).setMandatory(true);
980
		definition.addDynFieldObject("status").setClassOfValue(FLayerStatus.class).setMandatory(true);
981
		definition.addDynFieldList("properties").setClassOfValue(Object.class).setMandatory(true);
1214 982
	}
1215 983

  
1216

  
984
	
985
//	/**
986
//	 * Splits string into an array of strings
987
//	 * @param input input string
988
//	 * @param sep separator string
989
//	 * @return an array of strings
990
//	 */
991
//	public static String[] splitString(String input, String sep) {
992
//		return Pattern.compile(sep).split(input, 0);
993
//	}
994
	
1217 995
	public void clear() {
1218 996
		if (delegatedDynObject != null) {
1219 997
			delegatedDynObject.clear();
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/FLayers.java
742 742
		super.saveToState(state);
743 743
		
744 744
		state.set("mapContext", fmap);
745
		state.set("numLayers", layers.size());
746 745
		state.set("layers", layers);
747 746
	}
748 747

  
......
750 749

  
751 750
		super.loadFromState(state);
752 751

  
753
		Object obj = state.get("mapContext");
754
		setMapContext((MapContext) obj);
752
		setMapContext((MapContext) state.get("mapContext"));
755 753
		Iterator iter = state.getIterator("layers");
756
		
757 754
		while (iter.hasNext()) {
758

  
759
			Object ite = iter.next();
760
			FLayer item = (FLayer) ite;
755
			FLayer item = (FLayer) iter.next();
761 756
			layers.add(item); 
762 757
		}
763 758
	}
......
1327 1322
		);
1328 1323
		definition.extend(PersistenceManager.PERSISTENCE_NAMESPACE, "FLyrDefault");
1329 1324
		
1330
		definition.addDynFieldInt("numLayers").setMandatory(true);
1331
		definition.addDynFieldList("layers").setMandatory(true);
1325
		definition.addDynFieldObject("mapContext").setClassOfValue(MapContext.class).setMandatory(true);
1326
		definition.addDynFieldList("layers").setClassOfItems(FLayer.class).setMandatory(true);
1332 1327
	}
1333 1328

  
1334 1329
	protected void doDispose() throws BaseException {
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/layers/vectorial/ReprojectDefaultGeometry.java
170 170
	 * @see org.gvsig.tools.persistence.Persistent#loadState(org.gvsig.tools.persistence.PersistentState)
171 171
	 */
172 172
	public void saveToState(PersistentState state) throws PersistenceException {
173
		super.saveToState(state);
173 174
		
174
    	state.set("mainStore", getFeatureStore());
175
    	Iterator iter = null;
176
    	try {
177
			state.set("defaultFeatureTypeId", getDefaultFeatureType().getId());
178
	    	iter = getFeatureTypesIds(getFeatureTypes());
179
		} catch (DataException e) {
180
			// TODO Auto-generated catch block
181
			e.printStackTrace();
182
		}
183
    	
184
    	
185
    	state.set("featureTypesIds", iter);
186

  
187
    	iter = getFeatureTypesIds(orgFeatureTypes);
188
    	state.set("orgFeatureTypesIds", iter);
189
    	state.set("orgDefFeatureTypeId", orgDefFeatureType.getId());
190
    	
191
    	state.set("sourceSRS", sourceSRS.getFullCode());
192
    	state.set("targetSRS", targetSRS.getFullCode());
175
		state.set("source_crs", this.sourceSRS);
176
		state.set("source_defaultFeatureType", this.orgDefFeatureType);
177
		state.set("source_featureTypes", this.orgFeatureTypes);
178
		state.set("target_crs", this.targetSRS);
179
		state.set("coordtrans", this.ct);
193 180
	}
194 181

  
195 182
	/* (non-Javadoc)
196 183
	 * @see org.gvsig.tools.persistence.Persistent#loadFromState(org.gvsig.tools.persistence.PersistentState)
197 184
	 */
198 185
	public void loadFromState(PersistentState state) throws PersistenceException {
199

  
200
    	setFeatureStore((FeatureStore) state.get("mainStore"));
201
    	String aux = (String) state.get("defaultFeatureTypeId");
202
    	FeatureType auxft = null;
203
    	
204
    	try {
205
    		auxft = getFeatureStore().getFeatureType(aux);
206
		} catch (DataException e) {
207
			throw new PersistenceException(e);
208
		}
209
		
210
		Iterator ftids = state.getIterator("featureTypesIds");
211
		
212
    	List auxFeatureTypes = new ArrayList();
213
    	FeatureType item = null;
214
    	while (ftids.hasNext()) {
215
    		try {
216
				item = getFeatureStore().getFeatureType((String) ftids.next());
217
			} catch (DataException e) {
218
				throw new PersistenceException(e);
219
			}
220
			auxFeatureTypes.add(item);
221
    	}
222
    	this.setFeatureTypes(auxFeatureTypes, auxft);
223
		
224
		ftids = state.getIterator("orgFeatureTypesIds");
225
		orgFeatureTypes = new ArrayList();
226
    	item = null;
227
    	while (ftids.hasNext()) {
228
    		try {
229
				item = getFeatureStore().getFeatureType((String) ftids.next());
230
			} catch (DataException e) {
231
				throw new PersistenceException(e);
232
			}
233
			orgFeatureTypes.add(item);
234
    	}
235
		
236
    	aux = state.getString("orgDefFeatureTypeId");
237
    	try {
238
			orgDefFeatureType = getFeatureStore().getFeatureType(aux);
239
		} catch (DataException e) {
240
			throw new PersistenceException(e);
241
		}
242

  
243
		String srsaux = state.getString("sourceSRS");
244
		sourceSRS = CRSFactory.getCRS(srsaux);
245
		srsaux = state.getString("targetSRS");
246
		targetSRS = CRSFactory.getCRS(srsaux);
247
		ct = sourceSRS.getCT(targetSRS);
186
		super.loadFromState(state);
187
		this.sourceSRS = (IProjection) state.get("source_crs");
188
		this.orgDefFeatureType = (FeatureType) state.get("source_defaultFeatureType");
189
		this.orgFeatureTypes = new ArrayList( (List) state.get("source_featureTypes"));
190
		this.targetSRS = (IProjection) state.get("target_crs");
191
		this.ct = (ICoordTrans) state.get("coordtrans");
248 192
	}
249 193

  
250 194
	public static void registerPersistent() {
......
256 200
				null, 
257 201
				null
258 202
		);
259
		definition.addDynFieldObject("mainStore").setMandatory(true);
260
		definition.addDynFieldString("defaultFeatureTypeId").setMandatory(true);
261
		definition.addDynFieldList("featureTypesIds").setMandatory(true);
262
		definition.addDynFieldString("orgDefFeatureTypeId").setMandatory(true);
263
		definition.addDynFieldList("name").setMandatory(true);
264
		definition.addDynFieldString("targetSRS").setMandatory(true);
265
		definition.addDynFieldString("sourceSRS").setMandatory(true);
266
	}
267
	
268
	
269
    private Iterator getFeatureTypesIds(List ftl) {
270
    	
271
    	ArrayList resp = new ArrayList();
272
    	int sz = ftl.size();
273
    	for (int i=0; i<sz; i++) {
274
    		resp.add( ((FeatureType) ftl.get(i)).getId() );
275
    	}
276
		return resp.iterator();
277
	}
203
		definition.extend( manager.getDefinition(AbstractFeatureStoreTransform.class));
204
		
205
		definition.addDynFieldObject("source_crs")
206
			.setClassOfValue(IProjection.class)
207
			.setMandatory(true);
208
		definition.addDynFieldObject("source_defaultFeatureType")
209
			.setClassOfValue(FeatureType.class)
210
			.setMandatory(true);
211
		definition.addDynFieldObject("source_featureTypes")
212
			.setClassOfItems(FeatureType.class)
213
			.setMandatory(true);
214
		definition.addDynFieldObject("target_crs")
215
			.setClassOfValue(IProjection.class)
216
			.setMandatory(true);
217
		definition.addDynFieldObject("coordtrans")
218
			.setClassOfValue(ICoordTrans.class)
219
			.setMandatory(true);
278 220

  
221
	}
279 222
}
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java
55 55
import org.gvsig.compat.print.PrintAttributes;
56 56
import org.gvsig.fmap.dal.exception.ReadException;
57 57
import org.gvsig.fmap.dal.feature.FeatureStoreNotification;
58
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
58 59
import org.gvsig.fmap.geom.GeometryLocator;
59 60
import org.gvsig.fmap.geom.GeometryManager;
60
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
61 61
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
62 62
import org.gvsig.fmap.geom.primitive.Envelope;
63
import org.gvsig.fmap.mapcontext.MapContext.LayerEventListener;
63 64
import org.gvsig.fmap.mapcontext.events.ErrorEvent;
64 65
import org.gvsig.fmap.mapcontext.events.listeners.AtomicEventListener;
65 66
import org.gvsig.fmap.mapcontext.events.listeners.ErrorListener;
......
1624 1625
				null
1625 1626
		);
1626 1627
		definition.addDynFieldObject("ViewPort")
1627
		.setMandatory(true);
1628
			.setClassOfValue(ViewPort.class)
1629
			.setMandatory(true);
1628 1630
	
1629 1631
		definition.addDynFieldObject("layers")
1630
		.setMandatory(true);
1632
			.setClassOfValue(FLayers.class)
1633
			.setMandatory(true);
1631 1634
	}
1632 1635

  
1633 1636
	protected void doDispose() throws BaseException {
branches/v2_0_0_prep/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/ExtentHistory.java
213 213
		);
214 214
		definition.addDynFieldInt("num").setMandatory(true);
215 215
		definition.addDynFieldInt("numrec").setMandatory(true);
216
		definition.addDynFieldList("extents").setMandatory(true);
216
		definition.addDynFieldArray("extents").setClassOfItems(Rectangle2D.class).setMandatory(true);
217 217
	}
218 218
}
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
509 509
				.setPersistent(true);
510 510
			
511 511
			definition.addDynFieldObject("parameters")
512
				.setClassOfValue(DynObject.class)
512 513
				.setMandatory(true)
513 514
				.setPersistent(true);
514 515
	
515 516
			definition.addDynFieldObject("selection")
517
					.setClassOfValue(FeatureSelection.class)
516 518
					.setMandatory(true)
517 519
					.setPersistent(true);
518 520
	
519 521
			definition.addDynFieldObject("transforms")
522
					.setClassOfValue(DefaultFeatureStoreTransforms.class)
520 523
					.setMandatory(true)
521 524
					.setPersistent(true);
522 525
	
523 526
			definition.addDynFieldMap("evaluatedAttributes")
527
					.setClassOfValue(List.class) // List<DefaultFeatureAttributeDescriptor>
524 528
					.setMandatory(true)
525 529
					.setPersistent(true);
526 530
	
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReference.java
7 7
import java.util.Iterator;
8 8
import java.util.List;
9 9

  
10
import org.gvsig.fmap.dal.DataTypes;
11 10
import org.gvsig.fmap.dal.exception.DataException;
12 11
import org.gvsig.fmap.dal.feature.Feature;
13 12
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
......
17 16
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
18 17
import org.gvsig.tools.ToolsLocator;
19 18
import org.gvsig.tools.dynobject.DynStruct;
20
import org.gvsig.tools.persistence.PersistenceManager;
21 19
import org.gvsig.tools.persistence.Persistent;
22 20
import org.gvsig.tools.persistence.PersistentState;
23 21
import org.gvsig.tools.persistence.exception.PersistenceException;
......
224 222
		state.set("store", (Persistent) storeRef.get());
225 223
		state.set("featureTypeId", featureTypeId);
226 224
		if (pk == null) {
227
			state.set("pk", (List) null);
228
			state.set("pkNames", (List) null);
225
			state.setNull("pk");
226
			state.setNull("pkNames");
229 227
		} else {
230
			state.set("pk", Arrays.asList(pk));
231
			state.set("pkNames", Arrays.asList(pkNames));
228
			state.set("pk", pk);
229
			state.set("pkNames", pkNames);
232 230
		}
233 231

  
234 232
	}
......
242 240
				null
243 241
			);
244 242

  
245
		definition.addDynField("oid")
246
			.setType(DataTypes.OBJECT)
243
		definition.addDynFieldObject("oid")
244
			.setClassOfValue(Object.class)
247 245
			.setMandatory(true)
248 246
			.setPersistent(true);
249 247
			
250
		definition.addDynField("isNewFeature")
251
			.setType(DataTypes.BOOLEAN)
248
		definition.addDynFieldBoolean("isNewFeature")
252 249
			.setMandatory(true)
253 250
			.setPersistent(true);
254 251
	
255
		definition.addDynField("store")
256
			.setType(DataTypes.OBJECT)
257
			.setSubtype("DataStore")
252
		definition.addDynFieldObject("store")
258 253
			.setClassOfValue(FeatureStore.class)
259 254
			.setMandatory(true)
260 255
			.setPersistent(true);
261 256

  
262
		definition.addDynField("myHashCode")
263
			.setType(DataTypes.OBJECT)
264
			.setSubtype("Integer")
265
			.setClassOfValue(Integer.class)
257
		definition.addDynFieldInt("myHashCode")
266 258
			.setMandatory(true)
267 259
			.setPersistent(true);
268 260
	
269
		definition.addDynField("featureTypeId")
270
			.setType(DataTypes.STRING)
261
		definition.addDynFieldString("featureTypeId")
271 262
			.setMandatory(true)
272 263
			.setPersistent(true);
273 264

  
274
		definition.addDynField("ok")
275
			.setType(DataTypes.LIST)
265
		definition.addDynFieldArray("ok")
266
			.setClassOfItems(Object.class)
276 267
			.setMandatory(false)
277 268
			.setPersistent(true);
278 269

  
279
		definition.addDynField("pkNames")
280
			.setType(DataTypes.STRING)
270
		definition.addDynFieldArray("pkNames")
271
			.setClassOfItems(String.class)
281 272
			.setMandatory(true)
282 273
			.setPersistent(true);
283 274

  
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureAttributeDescriptor.java
514 514
	public DynField setReadOnly(boolean arg0) {
515 515
		throw new UnsupportedOperationException();
516 516
	}
517

  
518
	public boolean isContainer() {
519
		return false;
520
	}
521

  
522
	public Class getClassOfItems() {
523
		return null;
524
	}
525

  
526
	public DynField setDefaultFieldValue(Object defaultValue) {
527
		throw new UnsupportedOperationException();
528
	}
529

  
530
	public DynField setClassOfItems(Class theClass) {
531
		throw new UnsupportedOperationException();
532
	}
517 533
	
518 534
}
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureReferenceSelection.java
468 468
				null
469 469
			);
470 470

  
471
		definition.addDynFieldObject("store").setMandatory(true);
471
		definition.addDynFieldObject("store").setClassOfValue(FeatureStore.class).setMandatory(true);
472 472
		definition.addDynFieldBoolean("reversed").setMandatory(true);
473 473
		definition.addDynFieldLong("totalSize").setMandatory(true);
474
		definition.addDynFieldList("selected").setMandatory(true);
474
		definition.addDynFieldList("selected").setClassOfItems(DefaultFeatureReference.class).setMandatory(true);
475 475

  
476 476
	}
477 477

  
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureQuery.java
32 32
import java.util.List;
33 33
import java.util.Map;
34 34

  
35
import org.gvsig.fmap.dal.DataTypes;
36 35
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
37 36
import org.gvsig.fmap.dal.feature.FeatureQuery;
38 37
import org.gvsig.fmap.dal.feature.FeatureQueryOrder;
......
354 353
				null
355 354
			);
356 355
		
357
		definition.addDynField("queryParameters")
358
			.setType(DataTypes.MAP)
356
		definition.addDynFieldMap("queryParameters")
357
			.setClassOfItems(Object.class)
359 358
			.setMandatory(true);
360 359
		
361
		definition.addDynField("featureTypeId")
362
			.setType(DataTypes.STRING)
360
		definition.addDynFieldString("featureTypeId")
363 361
			.setMandatory(true);
364 362
		
365
		definition.addDynField("attributeNames")
366
			.setType(DataTypes.LIST)
363
		definition.addDynFieldList("attributeNames")
364
			.setClassOfItems(String.class)
367 365
			.setMandatory(true);
368 366
		
369
		definition.addDynField("filter")
370
			.setType(DataTypes.OBJECT)
367
		definition.addDynFieldObject("filter")
368
			.setClassOfValue(Evaluator.class)
371 369
			.setMandatory(true);
372 370

  
373 371
	}
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStoreTransforms.java
16 16
import org.gvsig.fmap.dal.feature.FeatureType;
17 17
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
18 18
import org.gvsig.tools.ToolsLocator;
19
import org.gvsig.tools.dynobject.DynClass;
20
import org.gvsig.tools.dynobject.DynObjectManager;
21 19
import org.gvsig.tools.dynobject.DynStruct;
22 20
import org.gvsig.tools.persistence.Persistent;
23 21
import org.gvsig.tools.persistence.PersistentState;
......
288 286
			);
289 287

  
290 288
		definition.addDynFieldBoolean("isTramsformValues").setMandatory(true);
291
		definition.addDynFieldList("transforms").setMandatory(true);
292
		definition.addDynFieldObject("store").setMandatory(true);
289
		definition.addDynFieldList("transforms").setClassOfItems(FeatureStoreTransform.class).setMandatory(true);
290
		definition.addDynFieldObject("store").setClassOfValue(FeatureStore.class).setMandatory(true);
293 291

  
294 292
	}
295 293

  
branches/v2_0_0_prep/libraries/libFMap_dal/src/org/gvsig/fmap/dal/feature/AbstractFeatureStoreTransform.java
1 1
package org.gvsig.fmap.dal.feature;
2 2

  
3 3
import java.util.ArrayList;
4
import java.util.Iterator;
5 4
import java.util.List;
6 5

  
7
import org.gvsig.fmap.dal.DataStore;
8
import org.gvsig.fmap.dal.DataTypes;
9 6
import org.gvsig.fmap.dal.exception.DataException;
10 7
import org.gvsig.tools.ToolsLocator;
11 8
import org.gvsig.tools.dynobject.DynStruct;
......
58 55
				null
59 56
			);
60 57
		
61
		definition.addDynField("store")
62
			.setType(DataTypes.OBJECT)
63
			.setSubtype("DataStore")
64
			.setClassOfValue(DataStore.class);
65
			
66
		
67
		definition.addDynField("defaultFeatureTypeId")
68
			.setType(DataTypes.STRING);
69
		
70
		definition.addDynField("featureTypesIds")
71
			.setType(DataTypes.LIST);	
58
		definition.addDynFieldObject("store")
59
			.setClassOfValue(FeatureStore.class)
60
			.setMandatory(true);
61
		definition.addDynFieldObject("defaultFeatureType")
62
			.setClassOfValue(FeatureType.class)
63
			.setMandatory(true);
64
		definition.addDynFieldList("featureTypes")
65
			.setClassOfItems(FeatureType.class)
66
			.setMandatory(true);
72 67

  
73 68
	}
74 69

  
75 70
	public void loadFromState(PersistentState state) throws PersistenceException {
76 71
		this.store = (FeatureStore) state.get("store");
77
		String defFTypeid = state.getString("defaultFeatureTypeId");
78

  
79
		try {
80
			this.defaultFeatureType = getFeatureStore().getFeatureType(defFTypeid);
81
		} catch (DataException e) {
82
			throw new PersistenceException(e);
83
		}
84

  
85
		Iterator ftids = state.getIterator("featureTypesIds");
86

  
87
		List auxFeatureTypes = new ArrayList();
88
		FeatureType item = null;
89
		while (ftids.hasNext()) {
90
			try {
91
				item = getFeatureStore().getFeatureType((String) ftids.next());
92
			} catch (DataException e) {
93
				throw new PersistenceException(e);
94
			}
95
			auxFeatureTypes.add(item);
96
		}
97
		this.setFeatureTypes(auxFeatureTypes, defaultFeatureType);
72
		this.defaultFeatureType = (FeatureType) state.get("defaultFeatureType");
73
		this.featureTypes = new ArrayList(state.getList("featureTypes"));
98 74
	}
99 75

  
100 76
	public void saveToState(PersistentState state) throws PersistenceException {
101 77
		state.set("store", store);
102
		state.set("defaultFeatureTypeId", defaultFeatureType.getId());
103

  
104
		Iterator iter = null;
105
		try {
106
			state.set("defaultFeatureTypeId", getDefaultFeatureType().getId());
107
			iter = getFeatureTypesIds(getFeatureTypes());
108
		} catch (DataException e) {
109
			// TODO Auto-generated catch block
110
			e.printStackTrace();
111
		}
112

  
113

  
114
		state.set("featureTypesIds", iter);
78
		state.set("defaultFeatureType", defaultFeatureType);
79
		state.set("featureTypes", featureTypes);
115 80
	}
116 81

  
117
	private Iterator getFeatureTypesIds(List ftl) {
118 82

  
119
		ArrayList resp = new ArrayList();
120
		int sz = ftl.size();
121
		for (int i=0; i<sz; i++) {
122
			resp.add( ((FeatureType) ftl.get(i)).getId() );
123
		}
124
		return resp.iterator();
125
	}
126

  
127

  
128

  
129 83
}
branches/v2_0_0_prep/libraries/libFMap_dal/resources/api/org/gvsig/fmap/dal/spi/ProviderParametersDefinition.xml
17 17
      </extends>
18 18
      <description>Parameters used for create a new store in the server</description>
19 19
      <fields>
20
        <field name="FeatureType" type="object" mandatory="true">
20
        <field name="FeatureType" type="object" mandatory="true" classOfvalue="org.gvsig.fmap.dal.feature.FeatureType">
21 21
          <description>Define the structure of the new store</description>
22 22
        </field>
23 23
      </fields>

Also available in: Unified diff