forked from geodmms/xdgnjobs

yuanhung
2016-03-04 848e4c119f9ffea9d436eb3a8a7551debddb689f
xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleIncrementDgn2PostGISJob.java
@@ -1,29 +1,8 @@
package com.ximple.eofms.jobs;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;
import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
import com.ximple.eofms.jobs.context.postgis.OracleIncrementPostGISJobContext;
import com.ximple.io.dgn7.ComplexElement;
import com.ximple.io.dgn7.Dgn7fileException;
import com.ximple.io.dgn7.Element;
import com.ximple.io.dgn7.ElementType;
import com.ximple.io.dgn7.FrammeAttributeData;
import com.ximple.io.dgn7.IElementHandler;
import com.ximple.io.dgn7.*;
import com.ximple.util.PrintfFormat;
import oracle.sql.BLOB;
import org.apache.commons.logging.Log;
@@ -38,7 +17,17 @@
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import static com.ximple.eofms.jobs.context.postgis.OracleIncrementPostGISJobContext.*;
import java.io.IOException;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.sql.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
import static com.ximple.eofms.jobs.context.postgis.OracleIncrementPostGISJobContext.ElementTransactionContext;
public class OracleIncrementDgn2PostGISJob extends AbstractOracleDatabaseJob {
    final static Log logger = LogFactory.getLog(OracleIncrementDgn2PostGISJob.class);
@@ -394,21 +383,22 @@
     */
    private void exetcuteIncrementConvert(OracleIncrementPostGISJobContext jobContext, String targetSchemaName) throws SQLException {
        Connection connection = jobContext.getOracleConnection();
        if (connection == null) {
            logger.warn("Cannot Get Oracle Connection for DMMS.");
            return;
        }
        try {
        // SELECT COUNT(*) FROM CMMS_POSTDB.GEO_EXCHANGE WHERE ISEXCHANGE = 0
        int exchangeCount = fetchExchangeCount(connection);
        logger.info("exchangeCount=" + exchangeCount);
        try {
            processIncrementElement(jobContext, exchangeCount);
            // jobContext.setCurrentSchema(querySchema);
        } finally {
            JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null);
        }
    }