forked from geodmms/xdgnjobs

?? ?
2008-05-26 0bd011e9dda3aabf6bbe3b9fad3f855a1ff2fae6
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertJobContext.java
@@ -37,6 +37,7 @@
import com.ximple.eofms.filter.ElementDispatcher;
import com.ximple.io.dgn7.Element;
import com.ximple.io.dgn7.FrammeAttributeData;
import com.ximple.io.dgn7.ComplexElement;
public class OracleConvertJobContext extends AbstractOracleJobContext
@@ -74,6 +75,7 @@
    private String _convertFile = null;
    private String currentSchema = null;
    private boolean schemaChanged = false;
    private String _convertElementIn = null;
    public OracleConvertJobContext(String filterConfig)
    {
@@ -133,14 +135,25 @@
        Feature feature = elementDispatcher.execute(element);
        if (feature == null)
        {
            boolean isEmptySize = false;
            FrammeAttributeData linkage =
                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
            logger.warn("Unknown Element:" + element.getElementType().toString() +
                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
            if (getElementLogging())
            if (element instanceof ComplexElement)
            {
                ComplexElement complex = (ComplexElement) element;
                logger.warn("----Complex Element size=" + complex.size() + ":" +
                        (linkage == null ? "NULL" : (linkage.getUfid())));
                isEmptySize = true;
            }
            if (getElementLogging() && (!isEmptySize))
            {
                getElementLogger().logElement(element, getCurrentSchema());
            }
            return;
        }
@@ -208,10 +221,19 @@
                    ShapefileDataStore shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL(),
                            true, Charset.forName("UTF-8"));
                    */
                    ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
                            null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
                    shapefileDataStore.createSchema(featureType);
                    writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
                    if (!sfile.exists())
                    {
                        ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
                                null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
                        shapefileDataStore.createSchema(featureType);
                        writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(),
                                Transaction.AUTO_COMMIT);
                    } else {
                        ShapefileDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
                                null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
                        writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(),
                                Transaction.AUTO_COMMIT);
                    }
                    featuresWriterContext.put(featureType.getTypeName(), writer);
                }
@@ -317,4 +339,9 @@
        this.currentSchema = querySchema;
        this.schemaChanged = true;
    }
    public void setConvertElementIn(String convertElementIn)
    {
        _convertElementIn = convertElementIn;
    }
}