forked from geodmms/xdgnjobs

?? ?
2008-08-25 5b68deeb9867ca8ec4e5c09719525f5b93061899
update for EOFM-153
1 files modified
74 ■■■■■ changed files
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java 74 ●●●●● patch | view | raw | blame | history
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
@@ -52,6 +52,7 @@
    private FeatureTypeBuilder typeBuilderPnt = null;
    private FeatureTypeBuilder typeBuilderRect = null;
    private FeatureTypeBuilder typeBuilderSmallRect = null;
    private FeatureType featureType = null;
    private FeatureType featureType2 = null;
@@ -357,6 +358,77 @@
        return typeBuilderPnt.getFeatureType();
    }
    public FeatureType createFeatureElement3(String featureName) throws SchemaException
    {
        if (typeBuilderSmallRect == null)
        {
            typeBuilderSmallRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName);
            if (isExistFeature(typeBuilderSmallRect.getFeatureType()))
            {
                try
                {
                    Connection conn = targetDataStore.getConnection(Transaction.AUTO_COMMIT);
                    if (dropTableMode)
                    {
                        try
                        {
                            dropGeometryColumn(conn, featureName,
                                    typeBuilderSmallRect.getFeatureType().getDefaultGeometry().getLocalName());
                        } catch (PSQLException e)
                        {
                            logger.debug(e.getMessage(), e);
                        }
                        try
                        {
                            dropTable(conn, featureName);
                        } catch (PSQLException e)
                        {
                            logger.debug(e.getMessage(), e);
                        }
                        ArrayList<String> schemaTexts = createNewSchemaTexts(typeBuilderSmallRect.getFeatureType());
                        for (String stmtText : schemaTexts)
                        {
                            Statement stmt = conn.createStatement();
                            stmt.execute(stmtText);
                            stmt.close();
                        }
                    } else
                    {
                        deleteTable(conn, featureName);
                    }
                    conn.close();
                } catch (IOException e)
                {
                    logger.warn(e.getMessage(), e);
                } catch (SQLException e)
                {
                    logger.warn(e.getMessage(), e);
                }
            } else
            {
                try
                {
                    Connection conn = targetDataStore.getConnection(Transaction.AUTO_COMMIT);
                    ArrayList<String> schemaTexts = createNewSchemaTexts(typeBuilderSmallRect.getFeatureType());
                    for (String stmtText : schemaTexts)
                    {
                        Statement stmt = conn.createStatement();
                        stmt.execute(stmtText);
                        stmt.close();
                    }
                    conn.close();
                } catch (IOException e)
                {
                    logger.warn(e.getMessage(), e);
                } catch (SQLException e)
                {
                    logger.warn(e.getMessage(), e);
                }
            }
        }
        return typeBuilderSmallRect.getFeatureType();
    }
    public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException
    {
        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
@@ -509,7 +581,7 @@
                dgnname = dgnname.substring(0, i);
            }
            dgnname = dgnname + "_s";
            featureType3 = createFeatureElement(dgnname.toLowerCase());
            featureType3 = createFeatureElement3(dgnname.toLowerCase());
        }
        return createFeature3(featureType3, element);
    }