forked from geodmms/xdgnjobs

?? ?
2008-08-21 4ead6c8bc67563dc640ec9131059b44cd36b12bf
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateArcLineStringStrategy.java
@@ -81,7 +81,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateComplexChainStrategy.java
@@ -89,7 +89,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
@@ -110,7 +110,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) complexChain.getLevelIndex(),
                    colorTable.getColorCode(complexChain.getColorIndex()),
                    (short) complexChain.getWeight(),
@@ -131,7 +131,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineElement.getLevelIndex(),
                    colorTable.getColorCode(lineElement.getColorIndex()),
                    (short) lineElement.getWeight(),
@@ -153,7 +153,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateEllipseShapeStrategy.java
@@ -81,7 +81,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) shapeElement.getLevelIndex(),
                    colorTable.getColorCode(shapeElement.getColorIndex()),
                    (short) shapeElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineStringStrategy.java
@@ -88,7 +88,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
@@ -116,7 +116,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) complexChain.getLevelIndex(),
                    colorTable.getColorCode(complexChain.getColorIndex()),
                    (short) complexChain.getWeight(),
@@ -133,7 +133,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineElement.getLevelIndex(),
                    colorTable.getColorCode(lineElement.getColorIndex()),
                    (short) lineElement.getWeight(),
@@ -151,7 +151,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java
@@ -90,7 +90,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineStringElement.getLevelIndex(),
                    colorTable.getColorCode(lineStringElement.getColorIndex()),
                    (short) lineStringElement.getWeight(),
@@ -118,7 +118,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) txtElement.getLevelIndex(),
                    colorTable.getColorCode(txtElement.getColorIndex()),
                    (short) txtElement.getWeight(),
@@ -149,7 +149,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) complexChain.getLevelIndex(),
                    colorTable.getColorCode(complexChain.getColorIndex()),
                    (short) complexChain.getWeight(),
@@ -164,7 +164,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) lineElement.getLevelIndex(),
                    colorTable.getColorCode(lineElement.getColorIndex()),
                    (short) lineElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java
@@ -103,7 +103,7 @@
                        fLinkage.getFsc(),
                        (long) fLinkage.getUfid(),
                        (short) fLinkage.getComponentID(),
                        (short) 0,
                        fLinkage.getOccID(),
                        (short) txtElement.getLevelIndex(),
                        colorTable.getColorCode(txtElement.getColorIndex()),
                        (short) txtElement.getWeight(),
@@ -143,7 +143,7 @@
                        fLinkage.getFsc(),
                        (long) fLinkage.getUfid(),
                        (short) fLinkage.getComponentID(),
                        (short) 0,
                        fLinkage.getOccID(),
                        (short) nodeElement.getLevelIndex(),
                        colorTable.getColorCode(nodeElement.getColorIndex()),
                        (short) nodeElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateShapeStrategy.java
@@ -83,7 +83,7 @@
                        fLinkage.getFsc(),
                        (long) fLinkage.getUfid(),
                        (short) fLinkage.getComponentID(),
                        (short) 0,
                        fLinkage.getOccID(),
                        (short) shapeElement.getLevelIndex(),
                        colorTable.getColorCode(shapeElement.getColorIndex()),
                        (short) shapeElement.getWeight(),
@@ -100,7 +100,7 @@
                        fLinkage.getFsc(),
                        (long) fLinkage.getUfid(),
                        (short) fLinkage.getComponentID(),
                        (short) 0,
                        fLinkage.getOccID(),
                        (short) complexShape.getLevelIndex(),
                        colorTable.getColorCode(complexShape.getColorIndex()),
                        (short) complexShape.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java
@@ -99,7 +99,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) txtElement.getLevelIndex(),
                    colorTable.getColorCode(txtElement.getColorIndex()),
                    (short) txtElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java
@@ -88,7 +88,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) txtElement.getLevelIndex(),
                    colorTable.getColorCode(txtElement.getColorIndex()),
                    (short) txtElement.getWeight(),
@@ -122,7 +122,7 @@
                    fLinkage.getFsc(),
                    (long) fLinkage.getUfid(),
                    (short) fLinkage.getComponentID(),
                    (short) 0,
                    fLinkage.getOccID(),
                    (short) nodeElement.getLevelIndex(),
                    colorTable.getColorCode(nodeElement.getColorIndex()),
                    (short) nodeElement.getWeight(),
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java
@@ -340,30 +340,7 @@
            GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType;
            CoordinateReferenceSystem refSys = geomAttribute.getCoordinateSystem();
            int SRID;
            if (refSys != null)
            {
                try
                {
                    Set ident = refSys.getIdentifiers();
                    if ((ident == null || ident.isEmpty()) && refSys == DefaultGeographicCRS.WGS84)
                    {
                        SRID = 4326;
                    } else
                    {
                        String code = ((NamedIdentifier) ident.toArray()[0]).getCode();
                        SRID = Integer.parseInt(code);
                    }
                } catch (Exception e)
                {
                    getLogger().warn("SRID could not be determined");
                    SRID = -1;
                }
            } else
            {
                SRID = -1;
            }
            int SRID = getSRID(refSys);
            sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomAttribute, SRID);
            getLogger().debug(sqlStr);
@@ -391,18 +368,44 @@
        return result;
    }
    private int getSRID(CoordinateReferenceSystem refSys)
    {
        int SRID;
        if (refSys != null)
        {
            try
            {
                Set ident = refSys.getIdentifiers();
                if ((ident == null || ident.isEmpty()) && refSys == DefaultGeographicCRS.WGS84)
                {
                    SRID = 4326;
                } else
                {
                    String code = ((NamedIdentifier) ident.toArray()[0]).getCode();
                    SRID = Integer.parseInt(code);
                }
            } catch (Exception e)
            {
                getLogger().warn("SRID could not be determined");
                SRID = -1;
            }
        } else
        {
            SRID = -1;
        }
        return SRID;
    }
    private boolean tablePresent(String schema, String table, Connection conn) throws IOException
    {
        final int TABLE_NAME_COL = 3;
        ResultSet tables = null;
        try
        {
            conn = getConnection();
            DatabaseMetaData meta = conn.getMetaData();
            String[] tableType = {"TABLE"};
            ResultSet tables = meta.getTables(null,
                    schema, "%", tableType);
            tables = meta.getTables(null, schema, "%", tableType);
            while (tables.next())
            {
@@ -411,12 +414,10 @@
                if (allowTable(tableName) && (tableName != null)
                        && (tableName.equalsIgnoreCase(table)))
                {
                    tables.close();
                    return (true);
                }
            }
            tables.close();
            return false;
        } catch (SQLException sqlException)
        {
@@ -429,6 +430,7 @@
        } finally
        {
            // JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null);
            if (tables != null) try { tables.close(); } catch (SQLException e) {}
        }
    }
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java
@@ -341,30 +341,7 @@
            GeometryAttributeType geomAttribute = (GeometryAttributeType) anAttributeType;
            CoordinateReferenceSystem refSys = geomAttribute.getCoordinateSystem();
            int SRID;
            if (refSys != null)
            {
                try
                {
                    Set ident = refSys.getIdentifiers();
                    if ((ident == null || ident.isEmpty()) && refSys == DefaultGeographicCRS.WGS84)
                    {
                        SRID = 4326;
                    } else
                    {
                        String code = ((NamedIdentifier) ident.toArray()[0]).getCode();
                        SRID = Integer.parseInt(code);
                    }
                } catch (Exception e)
                {
                    getLogger().warn("SRID could not be determined");
                    SRID = -1;
                }
            } else
            {
                SRID = -1;
            }
            int SRID = getSRID(refSys);
            sqlStr = addGeometryColumn(getTargetSchema(), tableName, geomAttribute, SRID);
            getLogger().debug(sqlStr);
@@ -393,18 +370,44 @@
        return result;
    }
    private int getSRID(CoordinateReferenceSystem refSys)
    {
        int SRID;
        if (refSys != null)
        {
            try
            {
                Set ident = refSys.getIdentifiers();
                if ((ident == null || ident.isEmpty()) && refSys == DefaultGeographicCRS.WGS84)
                {
                    SRID = 4326;
                } else
                {
                    String code = ((NamedIdentifier) ident.toArray()[0]).getCode();
                    SRID = Integer.parseInt(code);
                }
            } catch (Exception e)
            {
                getLogger().warn("SRID could not be determined");
                SRID = -1;
            }
        } else
        {
            SRID = -1;
        }
        return SRID;
    }
    private boolean tablePresent(String schema, String table, Connection conn) throws IOException
    {
        final int TABLE_NAME_COL = 3;
        ResultSet tables = null;
        try
        {
            conn = getConnection();
            DatabaseMetaData meta = conn.getMetaData();
            String[] tableType = {"TABLE"};
            ResultSet tables = meta.getTables(null,
                    schema, "%", tableType);
            tables = meta.getTables(null, schema, "%", tableType);
            while (tables.next())
            {
@@ -413,23 +416,20 @@
                if (allowTable(tableName) && (tableName != null)
                        && (tableName.equalsIgnoreCase(table)))
                {
                    tables.close();
                    return true;
                }
            }
            tables.close();
            return false;
        } catch (SQLException sqlException)
        {
            // JDBCUtils.close(conn, Transaction.AUTO_COMMIT, sqlException);
            // conn = null;
            String message = "Error querying database for list of tables:"
                    + sqlException.getMessage();
            throw new DataSourceException(message, sqlException);
        } finally
        {
            if (tables != null) try { tables.close(); } catch (SQLException e) {}
            // JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null);
        }
    }
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java
@@ -31,8 +31,6 @@
import org.xml.sax.SAXException;
import com.vividsolutions.jts.util.Assert;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Geometry;
import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
import com.ximple.eofms.filter.CreateFeatureTypeEventListener;
@@ -42,7 +40,6 @@
import com.ximple.io.dgn7.ComplexElement;
import com.ximple.io.dgn7.Element;
import com.ximple.io.dgn7.FrammeAttributeData;
import com.ximple.io.dgn7.ComplexChainElement;
public class OracleConvertPostGISJobContext extends AbstractOracleToPostGISJobContext
        implements CreateFeatureTypeEventListener
@@ -349,14 +346,14 @@
    {
        try
        {
            clearFeatureData(evt.getFeatureType());
            createOrClearFeatureDataTable(evt.getFeatureType());
        } catch (SchemaException e)
        {
            logger.warn(e.getMessage(), e);
        }
    }
    protected void clearFeatureData(FeatureType featureType) throws SchemaException
    protected void createOrClearFeatureDataTable(FeatureType featureType) throws SchemaException
    {
        String featureName = featureType.getTypeName();
        if (isExistFeature(featureType))