| | |
| | | import java.util.Map; |
| | | import java.util.TreeMap; |
| | | |
| | | import com.ximple.eofms.util.DefaultColorTable; |
| | | import com.ximple.eofms.util.*; |
| | | import org.apache.commons.collections.OrderedMap; |
| | | import org.apache.commons.collections.OrderedMapIterator; |
| | | import org.apache.commons.collections.map.LinkedMap; |
| | |
| | | import com.ximple.eofms.jobs.context.postgis.GeneralDgnConvertPostGISJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.IndexDgnConvertPostGISJobContext; |
| | | import com.ximple.eofms.jobs.context.postgis.OracleConvertPostGISJobContext; |
| | | import com.ximple.eofms.util.BinConverter; |
| | | import com.ximple.eofms.util.ByteArrayCompressor; |
| | | import com.ximple.eofms.util.FileUtils; |
| | | import com.ximple.eofms.util.StringUtils; |
| | | import com.ximple.io.dgn7.ComplexElement; |
| | | import com.ximple.io.dgn7.Dgn7fileException; |
| | | import com.ximple.io.dgn7.Dgn7fileReader; |
| | |
| | | private static final String INDEXPATHNAME = "index"; |
| | | private static final String OTHERPATHNAME = "other"; |
| | | |
| | | private static String FETCH_CONNFDR = "SELECT FSC, UFID, FDR1 FROM BASEDB.CONNECTIVITY ORDER BY FSC"; |
| | | private static String FETCH_CONNFDR = "SELECT FSC, UFID, FDR1, DIR FROM BASEDB.CONNECTIVITY ORDER BY FSC"; |
| | | private static String FETCH_COLORTAB = "SELECT TAG_SFSC, TAG_LUFID, COLOR FROM OCSDB.COLOR ORDER BY TAG_SFSC"; |
| | | |
| | | private static String CREATE_OWNERTABLE = "CREATE TABLE s (tid smallint not null, oid int not null, owner smallint not null)"; |
| | |
| | | rs.setFetchSize(50); |
| | | |
| | | createOrClearTargetTable(connectionPG, targetTableName, |
| | | "(tid smallint not null, oid int not null, fowner smallint not null)"); |
| | | "(tid smallint not null, oid int not null, fowner smallint not null, flow varchar(20) not null)"); |
| | | |
| | | pstmt = connectionPG.prepareStatement("INSERT INTO " + |
| | | encodeSchemaTableName(_pgSchema, targetTableName) + |
| | | " (tid, oid, fowner) VALUES (?, ?, ?)" ); |
| | | " (tid, oid, fowner, flow) VALUES (?, ?, ?, ?)" ); |
| | | |
| | | final int MAX_BATCHSIZE = 50; |
| | | int count = 0; |
| | |
| | | int cid = rs.getInt(1); |
| | | long oid = rs.getLong(2); |
| | | int ownerId = rs.getInt(3); |
| | | short dirId = (short) rs.getInt(4); |
| | | pstmt.setShort(1, (short) cid); |
| | | pstmt.setInt(2, (int) oid); |
| | | pstmt.setShort(3, (short) ownerId); |
| | | ConnectivityDirectionEnum dir = ConnectivityDirectionEnum.convertShort(dirId); |
| | | if ((ConnectivityDirectionEnum.ForwardflowON == dir) || |
| | | (ConnectivityDirectionEnum.ForwardFixflowON == dir)) { |
| | | pstmt.setString(4, "shape://ccarrow"); |
| | | |
| | | } else if ((ConnectivityDirectionEnum.BackflowON == dir) || |
| | | (ConnectivityDirectionEnum.BackFixflowON == dir)) { |
| | | pstmt.setString(4, "shape://rccarrow"); |
| | | } else { |
| | | pstmt.setString(4, "shape://backslash"); |
| | | } |
| | | pstmt.addBatch(); |
| | | |
| | | if (count % MAX_BATCHSIZE == 0) { |
| | |
| | | String colorText = colorTable.getColorCode(colorId); |
| | | |
| | | sb.append(cid).append(','); |
| | | sb.append(oid).append(","); |
| | | sb.append(oid).append(','); |
| | | sb.append(colorText).append("\n"); |
| | | |
| | | if (count % MAX_BATCHSIZE == 0) { |
| | |
| | | rs.setFetchSize(MAX_BATCHSIZE); |
| | | |
| | | createOrClearTempTargetTable(connectionPG, targetTempName, |
| | | "(tid smallint not null, oid int not null, fowner smallint not null)"); |
| | | "(tid smallint not null, oid int not null, fowner smallint not null, flow varchar(20) not null)"); |
| | | |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | |
| | | int cid = rs.getInt(1); |
| | | long oid = rs.getLong(2); |
| | | int ownerId = rs.getInt(3); |
| | | short dirId = (short) rs.getInt(4); |
| | | String flowMark = null; |
| | | ConnectivityDirectionEnum dir = ConnectivityDirectionEnum.convertShort(dirId); |
| | | if ((ConnectivityDirectionEnum.ForwardflowON == dir) || |
| | | (ConnectivityDirectionEnum.ForwardFixflowON == dir)) { |
| | | flowMark = "shape://ccarrow"; |
| | | |
| | | } else if ((ConnectivityDirectionEnum.BackflowON == dir) || |
| | | (ConnectivityDirectionEnum.BackFixflowON == dir)) { |
| | | flowMark = "shape://rccarrow"; |
| | | } else { |
| | | flowMark = "shape://backslash"; |
| | | } |
| | | |
| | | sb.append(cid).append(','); |
| | | sb.append(oid).append(','); |
| | | sb.append(ownerId).append('\n'); |
| | | sb.append(ownerId).append(','); |
| | | sb.append(flowMark).append('\n'); |
| | | |
| | | if (count % MAX_BATCHSIZE == 0) { |
| | | reader.unread(sb.toString().toCharArray()); |