Revision 47080
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/DALFile.java | ||
---|---|---|
209 | 209 |
store.setFeatureTypes(theTypes, ft); |
210 | 210 |
} |
211 | 211 |
|
212 |
public List<FeatureType> getFeatureTypes() throws DataException { |
|
213 |
List<FeatureType> theTypes = new ArrayList<>(); |
|
214 |
for (FeatureType type : this.featureTypes) { |
|
215 |
theTypes.add(type); |
|
216 |
} |
|
217 |
if( theTypes.isEmpty() ) { |
|
218 |
return null; |
|
219 |
} |
|
220 |
return theTypes; |
|
221 |
} |
|
222 |
|
|
212 | 223 |
@Override |
213 | 224 |
public void saveToState(PersistentState state) throws PersistenceException { |
214 | 225 |
state.set("defaultFeatureType", defaultFeatureTypeId); |
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/impl/DefaultDataManager.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.impl; |
2 | 2 |
|
3 |
import java.io.ByteArrayOutputStream; |
|
3 | 4 |
import java.io.File; |
4 | 5 |
import java.io.IOException; |
5 | 6 |
import java.io.InputStream; |
... | ... | |
50 | 51 |
import org.gvsig.fmap.dal.StoresRepository; |
51 | 52 |
import org.gvsig.fmap.dal.exception.CreateFileStoreException; |
52 | 53 |
import org.gvsig.fmap.dal.exception.DataException; |
54 |
import org.gvsig.fmap.dal.exception.DataRuntimeException; |
|
53 | 55 |
import org.gvsig.fmap.dal.exception.InitializeException; |
54 | 56 |
import org.gvsig.fmap.dal.exception.OpenException; |
55 | 57 |
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException; |
... | ... | |
113 | 115 |
import org.gvsig.tools.identitymanagement.SimpleIdentityManager; |
114 | 116 |
import org.gvsig.tools.identitymanagement.UnauthorizedException; |
115 | 117 |
import org.gvsig.tools.observer.Observer; |
118 |
import org.gvsig.tools.resourcesstorage.BytesResource; |
|
116 | 119 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
117 | 120 |
import org.gvsig.tools.script.Script; |
118 | 121 |
import org.gvsig.tools.script.ScriptManager; |
... | ... | |
1532 | 1535 |
LabelsCacheForFieldValuesImpl x = new LabelsCacheForFieldValuesImpl(labelFormulaProvider, status); |
1533 | 1536 |
return x; |
1534 | 1537 |
} |
1538 |
|
|
1539 |
public List<FeatureType> getFeatureTypesFromDAL(byte[] daldata) { |
|
1540 |
try { |
|
1541 |
BytesResource res = ResourcesStorage.createBytesResource(daldata); |
|
1542 |
DALFile dalfile = DALFile.getDALFile(res); |
|
1543 |
return dalfile.getFeatureTypes(); |
|
1544 |
} catch (DataException ex) { |
|
1545 |
return null; |
|
1546 |
} |
|
1547 |
} |
|
1548 |
|
|
1549 |
public byte[] getDALBytesFromFeatureType(FeatureType ftype) { |
|
1550 |
try { |
|
1551 |
DALFile dalfile = DALFile.getDALFile(); |
|
1552 |
dalfile.setFeatureType(ftype); |
|
1553 |
ByteArrayOutputStream bos = new ByteArrayOutputStream(); |
|
1554 |
dalfile.write(bos); |
|
1555 |
IOUtils.closeQuietly(bos); |
|
1556 |
return bos.toByteArray(); |
|
1557 |
} catch (DataException ex) { |
|
1558 |
return null; |
|
1559 |
} |
|
1560 |
} |
|
1535 | 1561 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/DataManager.java | ||
---|---|---|
23 | 23 |
package org.gvsig.fmap.dal; |
24 | 24 |
|
25 | 25 |
import java.io.File; |
26 |
import java.util.Collections; |
|
26 | 27 |
import java.util.List; |
27 | 28 |
import java.util.Map; |
28 | 29 |
import java.util.Set; |
... | ... | |
61 | 62 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
62 | 63 |
import org.gvsig.fmap.dal.feature.LabelsCacheForFieldValues; |
63 | 64 |
import org.gvsig.tools.observer.Observer; |
65 |
import org.gvsig.tools.resourcesstorage.BytesResource; |
|
64 | 66 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
65 | 67 |
import org.gvsig.tools.task.SimpleTaskStatus; |
66 | 68 |
import org.gvsig.tools.util.Factory; |
... | ... | |
646 | 648 |
public void clearAllCachedResources(); |
647 | 649 |
|
648 | 650 |
public LabelsCacheForFieldValues createLabelsCacheForFieldValues(Invocable labelFormulaProvider, SimpleTaskStatus status); |
651 |
|
|
652 |
public List<FeatureType> getFeatureTypesFromDAL(byte[] daldata); |
|
653 |
|
|
654 |
public byte[] getDALBytesFromFeatureType(FeatureType ftype); |
|
649 | 655 |
} |
Also available in: Unified diff