xdgnjobs/pom.xml
@@ -19,11 +19,11 @@ <src.output>${basedir}/target</src.output> <java5>1.6</java5> <xdgnio.version>2.1.1</xdgnio.version> <gt.version>10.3.x</gt.version> <gt.version>10.4.x</gt.version> <failIfNoTests>false</failIfNoTests> <stress.skip.pattern></stress.skip.pattern> <online.skip.pattern></online.skip.pattern> <java.awt.headless>false</java.awt.headless> <!--java.awt.headless>false</javaa.awt.headless--> <allow.test.failure.ignore>false</allow.test.failure.ignore> </properties> xdgnjobs/ximple-jobcarrier/.gitignore
@@ -1 +1,2 @@ /target/ /xjobcarrier.log xdgnjobs/ximple-jobcarrier/quartz.properties
@@ -23,8 +23,12 @@ org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin org.quartz.plugin.jobInitializer.class: org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_dmmsroadfee.xml org.quartz.plugin.jobInitializer.fileNames = quartz_jobs.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_inc.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_edb.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_colowner.xml org.quartz.plugin.jobInitializer.failOnFileNotFound = true org.quartz.plugin.jobInitializer.scanInterval = 10 org.quartz.plugin.jobInitializer.wrapInUserTransaction = false xdgnjobs/ximple-jobcarrier/quartz_jobs_colowner.xml
New file @@ -0,0 +1,168 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertPowerThemesIntoPostGISJob</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <job-class>com.ximple.eofms.jobs.OracleConvertThemes2PostGISJob</job-class> <!--volatility>false</volatility--> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/Users/ulysseskao/Projects/XGeoDMMS/xjobrun/tctpcjobs/jobdata</value> <!--value>/mnt/hdisk/home.data/private/projects/xdcad/xjobrun/nntpcjobs/jobdata</value--> </entry> <entry> <key>PGHOST</key> <value>10.10.1.17</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>simple000</value> </entry> <entry> <key>ORAHOST</key> <value>10.10.1.17</value> </entry> <entry> <key>ORAINST</key> <value>orcl</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>simple000</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>true</value> </entry> <entry> <key>CONVERTFILE</key> <value>true</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>false</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>false</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://192.168.11.99:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>true</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertPowerThemesIntoPostGISJob</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-jobcarrier/quartz_jobs_dmmsroadfee.xml
New file @@ -0,0 +1,173 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertDMMS2PostGisWithGeoserver</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <!--job-class>com.ximple.eofms.jobs.OracleConvertDgn2PostGISJob</job-class--> <!--<job-class>com.ximple.eofms.jobs.GeoserverIntegrateConfigJob</job-class>--> <job-class>com.ximple.eofms.jobs.DMMSRoadfeeCalculateJob</job-class> <!--job-class>com.ximple.eofms.jobs.OracleTransformColorOwnerJob</job-class--> <!--job-class>com.ximple.eofms.jobs.OracleTransformColorOwner2CSVJob</job-class--> <!--volatility>false</volatility--> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/Users/Shared/Public/Projects/XGeoDMMS/xjobrun/tctpcjobs/jobdata</value> </entry> <entry> <key>PGHOST</key> <value>10.10.1.7</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS2</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>simple000</value> </entry> <entry> <key>ORAHOST</key> <value>10.10.1.7</value> </entry> <entry> <key>ORAINST</key> <value>orcl</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>simple000</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>false</value> </entry> <entry> <key>CONVERTFILE</key> <value>false</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>false</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>true</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://10.10.1.7:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>false</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertDMMS2PostGisWithGeoserver</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-jobcarrier/quartz_jobs_inc.xml
New file @@ -0,0 +1,169 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertIncrementDMMS2PostGis</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <job-class>com.ximple.eofms.jobs.OracleIncrementDgn2PostGISJob</job-class> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <!--value>/home/ulysseskao/projects/xgeodmms/xjobrun/nstpcjobs/jobdata</value--> <value>/Users/ulysseskao/Projects/XGeoDMMS/xjobrun/nstpcjobs/jobdata</value> </entry> <entry> <key>PGHOST</key> <value>10.16.17.14</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>tpc000</value> </entry> <entry> <key>ORAHOST</key> <value>10.16.17.14</value> </entry> <entry> <key>ORAINST</key> <value>nntpc</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>manager</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>true</value> </entry> <entry> <key>CONVERTFILE</key> <value>false</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>true</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>true</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://10.10.1.7:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>false</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertIncrementDMMS2PostGis</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-jobcarrier/src/main/resources/quartz.properties
@@ -23,8 +23,12 @@ org.quartz.plugin.triggHistory.class = org.quartz.plugins.history.LoggingJobHistoryPlugin org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.XMLSchedulingDataProcessorPlugin org.quartz.plugin.jobInitializer.fileNames = quartz_jobs.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_inc.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_edb.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_colowner.xml #org.quartz.plugin.jobInitializer.fileNames = quartz_jobs_dmmsroadfee.xml org.quartz.plugin.jobInitializer.failOnFileNotFound = true org.quartz.plugin.jobInitializer.scanInterval = 10 xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs.xml
@@ -35,11 +35,11 @@ <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/Users/Shared/Public/Projects/XGeoDMMS/xjobrun/tctpcjobs/jobdata</value> <value>/home/ulysseskao/projects/xgeodmms/xjobrun/nntpcjobs/jobdata</value> </entry> <entry> <key>PGHOST</key> <value>10.10.1.17</value> <value>10.10.1.7</value> </entry> <entry> <key>PGDATBASE</key> @@ -63,7 +63,7 @@ </entry> <entry> <key>ORAHOST</key> <value>10.10.1.17</value> <value>10.10.1.7</value> </entry> <entry> <key>ORAINST</key> @@ -88,7 +88,7 @@ </entry> <entry> <key>CONVERTDB</key> <value>false</value> <value>true</value> </entry> <entry> <key>CONVERTFILE</key> @@ -96,7 +96,7 @@ </entry> <entry> <key>CONVERTELEMIN</key> <value>false</value> <value>true</value> </entry> <entry> <key>CONVERTPWTHEMES</key> @@ -136,7 +136,7 @@ </entry> <entry> <key>GEOSERVER_URL</key> <value>http://10.10.1.17:8080/geoserver</value> <value>http://10.10.1.7:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs_colowner.xml
New file @@ -0,0 +1,168 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertPowerThemesIntoPostGISJob</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <job-class>com.ximple.eofms.jobs.OracleConvertThemes2PostGISJob</job-class> <!--volatility>false</volatility--> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/Users/ulysseskao/Projects/XGeoDMMS/xjobrun/tctpcjobs/jobdata</value> <!--value>/mnt/hdisk/home.data/private/projects/xdcad/xjobrun/nntpcjobs/jobdata</value--> </entry> <entry> <key>PGHOST</key> <value>10.10.1.17</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>simple000</value> </entry> <entry> <key>ORAHOST</key> <value>10.10.1.17</value> </entry> <entry> <key>ORAINST</key> <value>orcl</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>simple000</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>true</value> </entry> <entry> <key>CONVERTFILE</key> <value>true</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>false</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>false</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://192.168.11.99:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>true</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertPowerThemesIntoPostGISJob</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs_dmmsroadfee.xml
New file @@ -0,0 +1,173 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertDMMS2PostGisWithGeoserver</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <!--job-class>com.ximple.eofms.jobs.OracleConvertDgn2PostGISJob</job-class--> <!--<job-class>com.ximple.eofms.jobs.GeoserverIntegrateConfigJob</job-class>--> <job-class>com.ximple.eofms.jobs.DMMSRoadfeeCalculateJob</job-class> <!--job-class>com.ximple.eofms.jobs.OracleTransformColorOwnerJob</job-class--> <!--job-class>com.ximple.eofms.jobs.OracleTransformColorOwner2CSVJob</job-class--> <!--volatility>false</volatility--> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/Users/Shared/Public/Projects/XGeoDMMS/xjobrun/tctpcjobs/jobdata</value> </entry> <entry> <key>PGHOST</key> <value>10.10.1.7</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS2</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>simple000</value> </entry> <entry> <key>ORAHOST</key> <value>10.10.1.7</value> </entry> <entry> <key>ORAINST</key> <value>orcl</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>simple000</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>false</value> </entry> <entry> <key>CONVERTFILE</key> <value>false</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>false</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>true</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://10.10.1.7:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>false</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertDMMS2PostGisWithGeoserver</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-jobcarrier/src/main/resources/quartz_jobs_inc.xml
New file @@ -0,0 +1,168 @@ <?xml version='1.0' encoding='utf-8'?> <job-scheduling-data xmlns="http://www.quartz-scheduler.org/xml/JobSchedulingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.quartz-scheduler.org/xml/JobSchedulingData http://www.quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd" version="1.8"> <pre-processing-commands> <delete-jobs-in-group>*</delete-jobs-in-group> <!-- clear all jobs in scheduler --> <delete-triggers-in-group>*</delete-triggers-in-group> <!-- clear all triggers in scheduler --> </pre-processing-commands> <processing-directives> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), overwrite them --> <overwrite-existing-data>true</overwrite-existing-data> <!-- if there are any jobs/trigger in scheduler of same name (as in this file), and over-write is false, ignore them rather then generating an error --> <ignore-duplicates>false</ignore-duplicates> </processing-directives> <schedule> <job> <name>ConvertIncrementDMMS2PostGis</name> <group>DEFAULT</group> <description>A job that convert dgn to postgis</description> <job-class>com.ximple.eofms.jobs.OracleIncrementDgn2PostGISJob</job-class> <durability>false</durability> <recover>false</recover> <!--job-data-map allows-transient-data="true"--> <job-data-map> <entry> <key>JOBDATA_DIR</key> <value>/home/ulysseskao/projects/xgeodmms/xjobrun/nstpcjobs/jobdata</value> </entry> <entry> <key>PGHOST</key> <value>10.10.1.9</value> </entry> <entry> <key>PGDATBASE</key> <value>pgDMMS</value> </entry> <entry> <key>PGPORT</key> <value>5432</value> </entry> <entry> <key>PGSCHEMA</key> <value>public</value> </entry> <entry> <key>PGUSER</key> <value>tpcdb</value> </entry> <entry> <key>PGPASS</key> <value>simple000</value> </entry> <entry> <key>ORAHOST</key> <value>10.10.1.9</value> </entry> <entry> <key>ORAINST</key> <value>orcl</value> </entry> <entry> <key>ORAPORT</key> <value>1521</value> </entry> <entry> <key>ORAUSER</key> <value>system</value> </entry> <entry> <key>ORAPASS</key> <value>SYSTEM000</value> </entry> <entry> <key>ORGSCHEMA</key> <!--value>SPATIALDB</value--> <value>SPATIALDB, CMMS_SPATIALDB</value> </entry> <entry> <key>CONVERTDB</key> <value>true</value> </entry> <entry> <key>CONVERTFILE</key> <value>false</value> </entry> <entry> <key>CONVERTELEMIN</key> <value>true</value> </entry> <entry> <key>CONVERTPWTHEMES</key> <value>true</value> </entry> <entry> <key>CREATEDUMMY</key> <value>false</value> </entry> <entry> <key>ELEMLOG</key> <value>true</value> </entry> <entry> <key>USEWKB</key> <value>true</value> </entry> <entry> <key>TESTMODE</key> <value>false</value> </entry> <entry> <key>TESTCOUNT</key> <value>2</value> </entry> <entry> <key>COPYCONNECTIVITYMODE</key> <value>true</value> </entry> <entry> <key>PROFILEMODE</key> <value>true</value> </entry> <entry> <key>USEZONE121</key> <value>true</value> </entry> <entry> <key>GEOSERVER_URL</key> <value>http://10.10.1.7:8080/geoserver</value> </entry> <entry> <key>GEOSERVER_USER</key> <value>admin</value> </entry> <entry> <key>GEOSERVER_PASS</key> <value>geoserver</value> </entry> <entry> <key>IGNORE_DBETL</key> <value>false</value> </entry> </job-data-map> </job> <trigger> <simple> <name>convertTrigger</name> <group>DEFAULT</group> <job-name>ConvertDMMS2PostGisWithGeoserver</job-name> <job-group>DEFAULT</job-group> <start-time>2013-03-01T18:00:00</start-time> <!-- repeat indefinitely every 10 seconds --> <repeat-count>0</repeat-count> <repeat-interval>500</repeat-interval> <!-- <repeat-interval>72000000</repeat-interval> --> </simple> </trigger> </schedule> </job-scheduling-data> xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateLineTextStrategy.java
@@ -85,7 +85,7 @@ Coordinate ptOrigin = txtElement.getUserOrigin(); Coordinate ptEnd = new Coordinate(); ptEnd.x = ptOrigin.x; ptEnd.y = ptOrigin.y + txtElement.getTextHeight(); ptEnd.y = ptOrigin.y - txtElement.getTextHeight(); Coordinate[] vect = new Coordinate[2]; if (useTransform) { vect[0] = (FeatureTypeBuilderUtil.getDefaultFeatureSRID() == 3826) ? xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateMultiSymbolStrategy.java
@@ -113,7 +113,7 @@ double angle = nodeElement.getRotationAngle(); angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); if (nodeElement.size() == 0) { logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + logger.info("CreateMultiSymbolStrategy cannot convert " + element.toString() + "to Feature - getText() is empty."); return null; } @@ -127,9 +127,10 @@ if (charArray.length == 0) { logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + logger.info("CreateMultiSymbolStrategy cannot convert " + element.toString() + "to Feature - getText() is empty."); return null; // return null; continue; } @@ -170,13 +171,19 @@ sb.toString() }, null); } break; } else if (txtElement instanceof TextNodeElement) { // logger.info("CreateMultiSymbolStrategy cannot convert " + element.toString() + "to Feature"); } else { logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + "to Feature"); return null; // TODO: Ximple // logger.info("CreateMultiSymbolStrategy cannot convert " + element.toString() + "to Feature"); continue; } txtElement.next(); } } else { logger.info("CreateMultiSymbolStrategy cannot conver " + element.toString() + "to Feature"); logger.info("CreateMultiSymbolStrategy cannot convert " + element.toString() + "to Feature"); return null; } return feature; xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateSymbolStrategy.java
@@ -118,7 +118,7 @@ (float) txtElement.getTextHeight(), (float) txtElement.getTextWidth(), (float) angle, sb.toString(), sb.toString().trim(), geomOrigin }, null); } else { xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/CreateTextStrategy.java
@@ -66,6 +66,7 @@ angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); String content = txtElement.getText(); content = content.replace('\u0000', ' '); content = content.trim(); Geometry gobj; if (useTransform) { GeometryConverterDecorator convertDecorator = FeatureTypeBuilderUtil.lookupDefaultGeometryConverter(); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DMMSRoadfeeCalculateJob.java
New file @@ -0,0 +1,1895 @@ package com.ximple.eofms.jobs; import com.ximple.eofms.jobs.context.AbstractOracleJobContext; import com.ximple.eofms.jobs.context.postgis.FeatureDgnConvertPostGISJobContext; 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.*; import com.ximple.io.dgn7.*; import com.ximple.util.PrintfFormat; import oracle.jdbc.OracleConnection; import oracle.jdbc.OracleResultSet; import oracle.sql.ARRAY; import oracle.sql.BLOB; import org.apache.commons.collections.OrderedMap; import org.apache.commons.collections.OrderedMapIterator; import org.apache.commons.collections.map.LinkedMap; import org.apache.commons.dbcp.DelegatingConnection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.data.DataStore; import org.geotools.data.Transaction; import org.geotools.data.jdbc.JDBCUtils; import org.geotools.data.postgis.PostgisNGDataStoreFactory; import org.geotools.feature.SchemaException; import org.geotools.jdbc.JDBCDataStore; import org.opengis.feature.IllegalAttributeException; import org.postgresql.PGConnection; import org.postgresql.copy.CopyManager; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.io.*; import java.math.BigDecimal; import java.nio.BufferOverflowException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.channels.FileChannel; import java.sql.*; import java.util.*; import java.util.Date; public class DMMSRoadfeeCalculateJob extends AbstractOracleDatabaseJob { final static Log logger = LogFactory.getLog(DMMSRoadfeeCalculateJob.class); private static final String PGHOST = "PGHOST"; private static final String PGDATBASE = "PGDATBASE"; private static final String PGPORT = "PGPORT"; private static final String PGSCHEMA = "PGSCHEMA"; private static final String PGUSER = "PGUSER"; private static final String PGPASS = "PGPASS"; private static final String USEWKB = "USEWKB"; private static final boolean useTpclidText = false; private static final int FETCHSIZE = 30; private static final int COMMITSIZE = 100; private static final String INDEXPATHNAME = "index"; private static final String OTHERPATHNAME = "other"; public static final String FORWARDFLOW_MARK = "shape://ccarrow"; public static final String BACKFLOW_MARK = "shape://rccarrow"; public static final String UNFLOW_MARK = "shape://backslash"; public static final String NONFLOW_MARK = "shape://slash"; 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)"; private static String CREATE_COLORTABLE = "CREATE TABLE s (tid smallint not null, oid int not null, dyncolor varchar(10) not null)"; public static final String FDYNCOLOR_SUFFIX = "_fdyncolor"; public static final String FOWNER_SUFFIX = "_fowner"; protected static class Pair { Object first; Object second; public Pair(Object first, Object second) { this.first = first; this.second = second; } } protected static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); protected String _pgHost; protected String _pgDatabase; protected String _pgPort; protected String _pgSchema; protected String _pgUsername; protected String _pgPassword; protected String _pgUseWKB; protected Map<String, String> pgProperties; protected JDBCDataStore targetDataStore; // protected OracleConvertEdbGeoJobContext oracleJobContext; private long queryTime = 0; private long queryTimeStart = 0; public Log getLogger() { return logger; } protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, boolean profileMode, boolean useTransform) { return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); } protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { super.extractJobConfiguration(jobDetail); JobDataMap dataMap = jobDetail.getJobDataMap(); _pgHost = dataMap.getString(PGHOST); _pgDatabase = dataMap.getString(PGDATBASE); _pgPort = dataMap.getString(PGPORT); _pgSchema = dataMap.getString(PGSCHEMA); _pgUsername = dataMap.getString(PGUSER); _pgPassword = dataMap.getString(PGPASS); _pgUseWKB = dataMap.getString(USEWKB); Log logger = getLogger(); /* logger.info("PGHOST=" + _myHost); logger.info("PGDATBASE=" + _myDatabase); logger.info("PGPORT=" + _myPort); logger.info("PGSCHEMA=" + _mySchema); logger.info("PGUSER=" + _myUsername); logger.info("PGPASS=" + _myPassword); logger.info("USEWKB=" + _myUseWKB); */ if (_pgHost == null) { logger.warn("PGHOST is null"); throw new JobExecutionException("Unknown PostGIS host."); } if (_pgDatabase == null) { logger.warn("PGDATABASE is null"); throw new JobExecutionException("Unknown PostGIS database."); } if (_pgPort == null) { logger.warn("PGPORT is null"); throw new JobExecutionException("Unknown PostGIS port."); } if (_pgSchema == null) { logger.warn("PGSCHEMA is null"); throw new JobExecutionException("Unknown PostGIS schema."); } if (_pgUsername == null) { logger.warn("PGUSERNAME is null"); throw new JobExecutionException("Unknown PostGIS username."); } if (_pgPassword == null) { logger.warn("PGPASSWORD is null"); throw new JobExecutionException("Unknown PostGIS password."); } Map<String, String> remote = new TreeMap<String, String>(); remote.put(PostgisNGDataStoreFactory.DBTYPE.key, "postgis"); // remote.put("charset", "UTF-8"); remote.put(PostgisNGDataStoreFactory.HOST.key, _pgHost); remote.put(PostgisNGDataStoreFactory.PORT.key, _pgPort); remote.put(PostgisNGDataStoreFactory.DATABASE.key, _pgDatabase); remote.put(PostgisNGDataStoreFactory.USER.key, _pgUsername); remote.put(PostgisNGDataStoreFactory.PASSWD.key, _pgPassword); // remote.put( "namespace", null); pgProperties = remote; } private List<String[]> sqlExecQuery(Connection connection,String strSQLIn,String[] params) throws SQLException { String strSQL=strSQLIn; for(int i=0;i<params.length;i++) { if(params[i]==null)params[i]=""; strSQL=strSQL.replace("%s"+String.valueOf(i+1),params[i]); } List<String[]> result=new ArrayList<String[]>(); List<String> temp = new ArrayList<String>(); String strTemp=""; // String result = null; Statement stmt = null; ResultSet rs = null; try { stmt = connection.createStatement(); rs = stmt.executeQuery(strSQL.toString()); // get first result // temp.clear(); ResultSetMetaData rsmd = rs.getMetaData(); int NumOfCol = rsmd.getColumnCount(); while (rs.next()) { for (int idx = 0; idx < NumOfCol; idx++) { strTemp = rs.getString(idx + 1); temp.add(strTemp); } result.add(temp.toArray(new String[0])); temp.clear(); } return result; } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void sqlExec(Connection connection,String strSQLIn,String[] params) throws SQLException { String strSQL=strSQLIn; for(int i=0;i<params.length;i++) { if(params[i]==null)params[i]=""; strSQL=strSQL.replace("%s"+String.valueOf(i+1),params[i]); } List<String[]> result=new ArrayList<String[]>(); List<String> temp = new ArrayList<String>(); String strTemp=""; // String result = null; Statement stmt = null; ResultSet rs = null; try { stmt = connection.createStatement(); stmt.execute( strSQL.toString()); // get first result // temp.clear(); } finally { // JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void doJob(Connection postsql,Connection orcl) throws SQLException { String strSQLGetTask="select proc_id,procname,datastore,name,step,src,dest,txtsql from roadfee_proc where rowstatus=1 and procname like 'STEP%' order by procname,step" ; List<String[]> joblist=null; Connection inConnection; int idOfJob=0; List<String[]> nodata= new ArrayList<String[]>(); List<String[]> lista= new ArrayList<String[]>(); List<String[]> list1= new ArrayList<String[]>(); List<String[]> listIn= new ArrayList<String[]>(); List<String[]> temp;//= new ArrayList<String[]>(); nodata.add(new String[]{""}); // proc_id[0],procname[1],datastore[2\,name[3],step[4], src[5],des[6]t,txtsql[7] try{ logger.info("getJoblist"); joblist=sqlExecQuery(postsql, strSQLGetTask, new String[]{}); for ( idOfJob=0;idOfJob<joblist.size();idOfJob++) { logger.info("begin "+joblist.get(idOfJob)[1]+"-"+joblist.get(idOfJob)[3]+"("+joblist.get(idOfJob)[0]+")"); if(joblist.get(idOfJob)[5].equals("nodata")) { listIn=nodata; } else if(joblist.get(idOfJob)[5].equals("list1")) { listIn=list1; } else if(joblist.get(idOfJob)[5].equals("lista")) { listIn=lista; } if(joblist.get(idOfJob)[2].equals("psql")) { inConnection= postsql; } else if(joblist.get(idOfJob)[2].equals("orcl")) { inConnection= orcl; } else return ; //connection failed if( joblist.get(idOfJob)[6].equals("list1")) list1.clear(); if( joblist.get(idOfJob)[6].equals("lista")) lista.clear(); //runsql logger.info("process data count: "+String.valueOf(listIn.size())); for( int idxOfListIn=0;idxOfListIn< listIn.size();idxOfListIn++) { if( joblist.get(idOfJob)[6].equals("nodata")) { sqlExec(inConnection, joblist.get(idOfJob)[7], listIn.get(idxOfListIn)); //logger.info("finish "+joblist.get(idOfJob)[1]+"-"+joblist.get(idOfJob)[3]+"("+joblist.get(idOfJob)[0]+")") continue; }else { temp=sqlExecQuery(inConnection, joblist.get(idOfJob)[7], listIn.get(idxOfListIn)); } for(int j=0;j<temp.size();j++) { if( joblist.get(idOfJob)[6].equals("list1")) { list1.add(temp.get(j)); } else if( joblist.get(idOfJob)[6].equals("lista")) { lista.add(temp.get(j)); } } } } }catch(SQLException sqlex) { logger.warn("ERROR@ID:"+String.valueOf( joblist.get(idOfJob)[0])); throw sqlex; } } public void execute(JobExecutionContext context) throws JobExecutionException { // Every job has its own job detail JobDetail jobDetail = context.getJobDetail(); // The name is defined in the job definition String jobName = jobDetail.getKey().getName(); // Log the time the job started logger.info(jobName + " fired at " + new Date()); extractJobConfiguration(jobDetail); if (isIgnoreDBETL()) { return; } createSourceDataStore(); createTargetDataStore(); if (getSourceDataStore() == null) { logger.warn("Cannot connect source oracle database."); throw new JobExecutionException("Cannot connect source oracle database."); } if (getTargetDataStore() == null) { logger.warn("Cannot connect source postgreSQL database."); throw new JobExecutionException("Cannot connect source postgreSQL database."); } if (isProfileMode()) { queryTime = 0; } long t1 = System.currentTimeMillis(); String targetSchemaName, targetThemeTable; try { //logger.info("-- step:clearOutputDatabase --"); doJob( targetDataStore.getConnection(Transaction.AUTO_COMMIT),sourceDataStore.getConnection(Transaction.AUTO_COMMIT) ); } catch (IOException ex) { disconnect(); logger.warn(ex.getMessage(), ex); throw new JobExecutionException("IO error. " + ex.getMessage(), ex); } catch (SQLException e) { disconnect(); logger.warn(e.getMessage(), e); throw new JobExecutionException("Database error. " + e.getMessage(), e); } finally { disconnect(); } logger.warn(jobName + " end at " + new Date()); } private void logTimeDiff(String message, long tBefore, long tCurrent) { logger.warn(message + ":use time = " + ((int) ((tCurrent - tBefore) / 60000.0)) + " min - " + (((int) ((tCurrent - tBefore) % 60000.0)) / 1000) + " sec"); } private void exetcuteConvert(OracleConvertPostGISJobContext jobContext, String querySchema, String targetSchemaName) throws SQLException { int order = 0; OrderedMap map = getBlobStorageList(jobContext.getOracleConnection(), querySchema, "SD$SPACENODES", null); logger.info("begin convert job:[" + map.size() + "]:testmode=" + _testMode); int total = map.size(); //spacenodes count int step = total / 100; int current = 0; if (total == 0) { logger.warn("SELECT COUNT FROM " + querySchema + ".SD$SPACENODES is zero."); return; } logger.warn("SELECT COUNT FROM " + querySchema + ".SD$SPACENODES is " + map.size()); //jobContext.startTransaction(); jobContext.setCurrentSchema(querySchema); jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 0); for (OrderedMapIterator it = map.orderedMapIterator(); it.hasNext(); ) { it.next(); Pair pair = (Pair) it.getValue(); String tableSrc = (String) pair.first; logger.info("begin convert:[" + order + "]-" + tableSrc); queryIgsetElement(jobContext, querySchema, tableSrc); order++; if (_testMode) { if ((_testCount < 0) || (order >= _testCount)) break; } if ((order % COMMITSIZE) == 0) { // OracleConnection connection = jobContext.getOracleConnection(); // connection.commitTransaction(); jobContext.commitTransaction(); //jobContext.startTransaction(); System.gc(); System.runFinalization(); } if (step != 0) { int now = order % step; if (now != current) { current = now; jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", current); } } else { jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", current); current++; } } jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 100); jobContext.commitTransaction(); jobContext.resetFeatureContext(); if (isProfileMode()) { } logger.info("end convert job:[" + order + "]"); System.gc(); System.runFinalization(); } protected OrderedMap getBlobStorageList(Connection connection, String schemaSrc, String tableSrc, OrderedMap orderedMap) throws SQLException { if (orderedMap == null) orderedMap = new LinkedMap(99); String fetchStmtFmt = "SELECT SNID, SPACETABLE FROM \"%s\".\"%s\""; PrintfFormat spf = new PrintfFormat(fetchStmtFmt); String fetchStmt = spf.sprintf(new Object[]{schemaSrc, tableSrc}); Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs = null; stmt.setFetchSize(FETCHSIZE); try { rs = stmt.executeQuery(fetchStmt); int size = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] values = new Object[size]; for (int i = 0; i < size; i++) { values[i] = rs.getObject(i + 1); } Integer key = ((BigDecimal) values[0]).intValue(); String name = (String) values[1]; Pair pair = (Pair) orderedMap.get(key); if (pair == null) orderedMap.put(key, new Pair(name, null)); else pair.first = name; } } catch (SQLException e) { logger.error(e.toString(), e); logger.error("stmt=" + fetchStmt); throw e; } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } return orderedMap; } protected OrderedMap getRawFormatStorageList(OracleConnection connection, String schemaSrc, String tableSrc, OrderedMap orderedMap) throws SQLException { if (orderedMap == null) orderedMap = new LinkedMap(99); String fetchStmtFmt = "SELECT RNID, SPACETABLE FROM \"%s\".\"%s\""; PrintfFormat spf = new PrintfFormat(fetchStmtFmt); String fetchStmt = spf.sprintf(new Object[]{schemaSrc, tableSrc}); Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(FETCHSIZE); ResultSet rs = stmt.executeQuery(fetchStmt); try { int size = rs.getMetaData().getColumnCount(); while (rs.next()) { Object[] values = new Object[size]; for (int i = 0; i < size; i++) { values[i] = rs.getObject(i + 1); } Integer key = ((BigDecimal) values[0]).intValue(); String name = (String) values[1]; Pair pair = (Pair) orderedMap.get(key); if (pair == null) orderedMap.put(key, new Pair(null, name)); else pair.second = name; } } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } return orderedMap; } protected void queryIgsetElement(OracleConvertPostGISJobContext jobContext, String srcschema, String srctable) throws SQLException { Connection connection = jobContext.getOracleConnection(); String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" ORDER BY ROWID"; //String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" WHERE TAG_SFSC = 423 AND TAG_LUFID = 21612065 ORDER BY ROWID"; PrintfFormat spf = new PrintfFormat(fetchSrcStmtFmt); String fetchSrcStmt = spf.sprintf(new Object[]{srcschema, srctable}); Statement stmtSrc = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmtSrc.setFetchSize(FETCHSIZE); ResultSet rsSrc = stmtSrc.executeQuery(fetchSrcStmt); int igdsMetaType = rsSrc.getMetaData().getColumnType(1); while (rsSrc.next()) { if (isProfileMode()) { markQueryTime(); } byte[] raw = null; if (igdsMetaType == Types.BLOB) { BLOB blob = (BLOB) rsSrc.getBlob(1); try { raw = getBytesFromBLOB(blob); } catch (BufferOverflowException e) { logger.warn("Wrong Element Structure-", e); } finally { // blob.close(); } } else { raw = rsSrc.getBytes(1); } try { if (raw != null) { Element element = fetchBinaryElement(raw); if (isProfileMode()) { accumulateQueryTime(); } jobContext.putFeatureCollection(element); } else { if (isProfileMode()) { accumulateQueryTime(); } } } catch (Dgn7fileException e) { logger.warn("Dgn7Exception", e); } } JDBCUtils.close(rsSrc); JDBCUtils.close(stmtSrc); } protected void queryRawElement(OracleConvertPostGISJobContext jobContext, String srcschema, String srctable) throws SQLException { Connection connection = jobContext.getOracleConnection(); String fetchDestStmtFmt = "SELECT ELEMENT FROM \"%s\".\"%s\" ORDER BY ROWID"; PrintfFormat spf = new PrintfFormat(fetchDestStmtFmt); String fetchDestStmt = spf.sprintf(new Object[]{srcschema, srctable}); Statement stmtDest = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmtDest.setFetchSize(FETCHSIZE); ResultSet rsDest = stmtDest.executeQuery(fetchDestStmt); try { while (rsDest.next()) { ARRAY rawsValue = ((OracleResultSet) rsDest).getARRAY(1); long[] rawData = rawsValue.getLongArray(); byte[] comparessedValue; /* if (dataMode == TransferTask.DataMode.Normal) { comparessedValue = BinConverter.unmarshalByteArray(rawData, true); } else { comparessedValue = BinConverter.unmarshalCompactByteArray(rawData); } */ comparessedValue = BinConverter.unmarshalByteArray(rawData, true); byte[] rawDest = ByteArrayCompressor.decompressByteArray(comparessedValue); try { Element element = fetchBinaryElement(rawDest); jobContext.putFeatureCollection(element); } catch (Dgn7fileException e) { logger.warn("Dgn7Exception:" + e.getMessage(), e); } } } finally { JDBCUtils.close(rsDest); JDBCUtils.close(stmtDest); } } // Binary to Element private Element fetchBinaryElement(byte[] raws) throws Dgn7fileException { ByteBuffer buffer = ByteBuffer.wrap(raws); buffer.order(ByteOrder.LITTLE_ENDIAN); short signature = buffer.getShort(); // byte type = (byte) (buffer.get() & 0x7f); byte type = (byte) ((signature >>> 8) & 0x007f); // silly Bentley say contentLength is in 2-byte words // and ByteByffer uses raws. // track the record location int elementLength = (buffer.getShort() * 2) + 4; ElementType recordType = ElementType.forID(type); IElementHandler handler; handler = recordType.getElementHandler(); Element dgnElement = (Element) handler.read(buffer, signature, elementLength); if (recordType.isComplexElement() && (elementLength < raws.length)) { int offset = elementLength; while (offset < (raws.length - 4)) { buffer.position(offset); signature = buffer.getShort(); type = (byte) ((signature >>> 8) & 0x007f); elementLength = (buffer.getShort() * 2) + 4; if (raws.length < (offset + elementLength)) { logger.debug("Length not match:" + offset + ":" + buffer.position() + ":" + buffer.limit()); break; } recordType = ElementType.forID(type); handler = recordType.getElementHandler(); if (handler != null) { Element subElement = (Element) handler.read(buffer, signature, elementLength); ((ComplexElement) dgnElement).add(subElement); offset += elementLength; } else { byte[] remain = new byte[buffer.remaining()]; System.arraycopy(raws, offset, remain, 0, buffer.remaining()); for (int i = 0; i < remain.length; i++) { if (remain[i] != 0) { logger.info("fetch element has some error. index=" + (offset + i) + ":value=" + remain[i]); } } break; } } } return dgnElement; } /** * �����ഫ�����ɪ��u�@ * * @param context �u�@�������� * @throws org.quartz.JobExecutionException * exception */ private void convertIndexDesignFile(JobExecutionContext context, String targetSchemaName) throws JobExecutionException { File indexDir = new File(getDataPath(), INDEXPATHNAME); if (!indexDir.exists()) { logger.info("index dir=" + indexDir + " not exist."); return; } if (!indexDir.isDirectory()) { logger.info("index dir=" + indexDir + " is not a directory."); } List<File> dgnFiles = FileUtils.recurseDir(indexDir, new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getName().toLowerCase().endsWith("dgn"); } }); for (File dgnFile : dgnFiles) { if (dgnFile.isDirectory()) continue; IndexDgnConvertPostGISJobContext convertContext = new IndexDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, isProfileMode(), isTransformed()); logger.info("--- start index dgnfile-" + dgnFile.toString() + " ---"); FileInputStream fs = null; FileChannel fc = null; Dgn7fileReader reader = null; try { convertContext.clearOutputDatabase(); convertContext.setExecutionContext(context); String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator); convertContext.setFilename(dgnPaths[dgnPaths.length - 1]); convertContext.startTransaction(); fs = new FileInputStream(dgnFile); fc = fs.getChannel(); reader = new Dgn7fileReader(fc, new Lock()); convertContext.setReader(reader); scanIndexDgnElement(convertContext); convertContext.commitTransaction(); convertContext.closeFeatureWriter(); System.gc(); System.runFinalization(); } catch (FileNotFoundException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (Dgn7fileException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IOException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IllegalAttributeException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (SchemaException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } finally { convertContext.closeFeatureWriter(); if (reader != null) { try { reader.close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } } if (fs != null) { try { fs.close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } } if (isProfileMode()) { logger.warn("Profile-Current convertContext Process Cost-" + ((int) ((convertContext.getProcessTime()) / 60000.0)) + " min - " + (((int) ((convertContext.getProcessTime()) % 60000.0)) / 1000) + " sec"); logger.warn("Profile-Current convertContext Update Cost-" + ((int) ((convertContext.getUpdateTime()) / 60000.0)) + " min - " + (((int) ((convertContext.getUpdateTime()) % 60000.0)) / 1000) + " sec"); } } } } protected void scanIndexDgnElement(IndexDgnConvertPostGISJobContext convertContext) throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException { Dgn7fileReader reader = convertContext.getReader(); int count = 0; Element lastComplex = null; while (reader.hasNext()) { if (isProfileMode()) markProcessTime(); Element.FileRecord record = reader.nextElement(); if (record.element() != null) { Element element = (Element) record.element(); ElementType type = element.getElementType(); if ((!type.isComplexElement()) && (!element.isComponentElement())) { if (lastComplex != null) { processIndexElement(lastComplex, convertContext); lastComplex = null; } processIndexElement(element, convertContext); } else if (element.isComponentElement()) { if (lastComplex != null) { ((ComplexElement) lastComplex).add(element); } } else if (type.isComplexElement()) { if (lastComplex != null) { processIndexElement(lastComplex, convertContext); } lastComplex = element; } } count++; } if (lastComplex != null) { processIndexElement(lastComplex, convertContext); } logger.debug("ElementRecord Count=" + count); } private void processIndexElement(Element element, IndexDgnConvertPostGISJobContext convertContext) throws IllegalAttributeException, SchemaException { //if (useTpclidText) { // if (element instanceof TextElement) { // convertContext.putFeatureCollection(element); // } //} else { // if (element instanceof ShapeElement) { convertContext.putFeatureCollection(element); // } //} } /** * �����ഫ��L�]�p���ɪ��u�@ * * @param context jobContext * @throws org.quartz.JobExecutionException * exception */ private void convertOtherDesignFile(JobExecutionContext context, String targetSchemaName) throws JobExecutionException { File otherDir = new File(getDataPath(), OTHERPATHNAME); if (!otherDir.exists()) { logger.info("other dir=" + otherDir + " not exist."); return; } if (!otherDir.isDirectory()) { logger.info("other dir=" + otherDir + " is not a directory."); } List<File> dgnFiles = FileUtils.recurseDir(otherDir, new FileFilter() { public boolean accept(File pathname) { return pathname.isDirectory() || pathname.getName().toLowerCase().endsWith("dgn"); } }); for (File dgnFile : dgnFiles) { if (dgnFile.isDirectory()) continue; GeneralDgnConvertPostGISJobContext convertContext = new GeneralDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, isProfileMode(), isTransformed()); logger.info("--- start other dgnfile-" + dgnFile.toString() + " ---"); FileInputStream fs = null; FileChannel fc; Dgn7fileReader reader = null; try { convertContext.setExecutionContext(context); String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator); convertContext.setFilename(dgnPaths[dgnPaths.length - 1]); convertContext.startTransaction(); fs = new FileInputStream(dgnFile); fc = fs.getChannel(); reader = new Dgn7fileReader(fc, new Lock()); convertContext.setReader(reader); scanOtherDgnElement(convertContext); convertContext.commitTransaction(); convertContext.closeFeatureWriter(); System.gc(); System.runFinalization(); } catch (FileNotFoundException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (Dgn7fileException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IOException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IllegalAttributeException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (SchemaException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } finally { convertContext.closeFeatureWriter(); if (reader != null) { try { reader.close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } } if (fs != null) { try { fs.close(); } catch (IOException e) { logger.warn(e.getMessage(), e); } } if (isProfileMode()) { logger.warn("Profile-Current convertContext Process Cost-" + ((int) ((convertContext.getProcessTime()) / 60000.0)) + " min - " + (((int) ((convertContext.getProcessTime()) % 60000.0)) / 1000) + " sec"); logger.warn("Profile-Current convertContext Update Cost-" + ((int) ((convertContext.getUpdateTime()) / 60000.0)) + " min - " + (((int) ((convertContext.getUpdateTime()) % 60000.0)) / 1000) + " sec"); } } } } public void scanOtherDgnElement(GeneralDgnConvertPostGISJobContext convertContext) throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException { Dgn7fileReader reader = convertContext.getReader(); int count = 0; Element lastComplex = null; while (reader.hasNext()) { Element.FileRecord record = reader.nextElement(); if (record.element() != null) { Element element = (Element) record.element(); ElementType type = element.getElementType(); if ((!type.isComplexElement()) && (!element.isComponentElement())) { if (lastComplex != null) { processOtherElement(lastComplex, convertContext); lastComplex = null; } processOtherElement(element, convertContext); } else if (element.isComponentElement()) { if (lastComplex != null) { ((ComplexElement) lastComplex).add(element); } } else if (type.isComplexElement()) { if (lastComplex != null) { processOtherElement(lastComplex, convertContext); } lastComplex = element; } } count++; } if (lastComplex != null) { processOtherElement(lastComplex, convertContext); } logger.debug("ElementRecord Count=" + count); } private void processOtherElement(Element element, GeneralDgnConvertPostGISJobContext convertContext) throws IllegalAttributeException, SchemaException { convertContext.putFeatureCollection(element); } private void clearOutputDatabase() { /* File outDataPath = new File(getDataPath(), OracleConvertEdbGeoJobContext.SHPOUTPATH); if (outDataPath.exists() && outDataPath.isDirectory()) { deleteFilesInPath(outDataPath); } outDataPath = new File(getDataPath(), IndexDgnConvertShpJobContext.SHPOUTPATH); if (outDataPath.exists() && outDataPath.isDirectory()) { deleteFilesInPath(outDataPath); } outDataPath = new File(getDataPath(), GeneralDgnConvertShpJobContext.SHPOUTPATH); if (outDataPath.exists() && outDataPath.isDirectory()) { deleteFilesInPath(outDataPath); } */ } private void deleteFilesInPath(File outDataPath) { deleteFilesInPath(outDataPath, true); } private void deleteFilesInPath(File outDataPath, boolean removeSubDir) { if (!outDataPath.isDirectory()) { return; } File[] files = outDataPath.listFiles(); for (File file : files) { if (file.isFile()) { if (!file.delete()) { logger.info("Cannot delete file-" + file.toString()); } } else if (file.isDirectory()) { deleteFilesInPath(file, removeSubDir); if (removeSubDir) { if (file.delete()) { logger.info("Cannot delete dir-" + file.toString()); } } } } } private void convertFeatureDesignFile(JobExecutionContext context, String targetSchemaName) throws JobExecutionException { File elminDir = new File(getDataPath(), "elmin"); if (!elminDir.exists()) { logger.info("elmin dir=" + elminDir + " not exist."); return; } if (!elminDir.isDirectory()) { logger.info("elmin dir=" + elminDir + " is not a directory."); } File[] dgnFiles = elminDir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".dgn"); } }); for (File dgnFile : dgnFiles) { FeatureDgnConvertPostGISJobContext convertContext = new FeatureDgnConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, _filterPath, isProfileMode(), isTransformed()); logger.info("--- start dgnfile-" + dgnFile.toString() + " ---"); try { convertContext.setExecutionContext(context); String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator); convertContext.setFilename(dgnPaths[dgnPaths.length - 1]); convertContext.startTransaction(); FileInputStream fs = new FileInputStream(dgnFile); FileChannel fc = fs.getChannel(); Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock()); convertContext.setReader(reader); scanFeatureDgnElement(convertContext); convertContext.commitTransaction(); convertContext.closeFeatureWriter(); System.gc(); System.runFinalization(); } catch (FileNotFoundException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (Dgn7fileException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IOException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (IllegalAttributeException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } catch (SchemaException e) { convertContext.rollbackTransaction(); logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } finally { convertContext.closeFeatureWriter(); } } } public void scanFeatureDgnElement(FeatureDgnConvertPostGISJobContext convertContext) throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException { Dgn7fileReader reader = convertContext.getReader(); int count = 0; Element lastComplex = null; while (reader.hasNext()) { Element.FileRecord record = reader.nextElement(); if (record.element() != null) { Element element = (Element) record.element(); ElementType type = element.getElementType(); if ((!type.isComplexElement()) && (!element.isComponentElement())) { if (lastComplex != null) { processFeatureElement(lastComplex, convertContext); lastComplex = null; } processFeatureElement(element, convertContext); } else if (element.isComponentElement()) { if (lastComplex != null) { ((ComplexElement) lastComplex).add(element); } } else if (type.isComplexElement()) { if (lastComplex != null) { processFeatureElement(lastComplex, convertContext); } lastComplex = element; } } count++; } if (lastComplex != null) { processFeatureElement(lastComplex, convertContext); } logger.debug("ElementRecord Count=" + count); } private void processFeatureElement(Element element, FeatureDgnConvertPostGISJobContext convertContext) throws IllegalAttributeException, SchemaException { convertContext.putFeatureCollection(element); } private void createDummyFeatureFile(JobExecutionContext context) throws JobExecutionException { /* DummyFeatureConvertShpJobContext convertContext = new DummyFeatureConvertShpJobContext(getDataPath(), _filterPath); try { convertContext.startTransaction(); convertContext.commitTransaction(); convertContext.closeFeatureWriter(); } catch (IOException e) { logger.warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } */ } public DataStore getTargetDataStore() { return targetDataStore; } protected void createTargetDataStore() throws JobExecutionException { if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } /* if (!isDriverFound()) { throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER); } */ if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MAXCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MAXCONN.key, "5"); } if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MINCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MINCONN.key, "1"); } /* if (!pgProperties.containsKey(PostgisNGDataStoreFactory.WKBENABLED.key)) { pgProperties.put(PostgisNGDataStoreFactory.WKBENABLED.key, "true"); } */ if (!dataStoreFactory.canProcess(pgProperties)) { getLogger().warn("cannot process properties-"); throw new JobExecutionException("cannot process properties-"); } try { targetDataStore = dataStoreFactory.createDataStore(pgProperties); } catch (IOException e) { getLogger().warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } } protected void disconnect() { super.disconnect(); if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } } private String determineTargetSchemaName() throws IOException { if (targetDataStore == null) return null; Connection connection = null; Statement stmt = null; ResultSet rs = null; String targetSchema = null; boolean needCreate = false; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); // Create XGVERSIONTABLE_NAME rs = connection.getMetaData().getTables(null, _pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME, new String[]{"TABLE"}); if (!rs.next()) needCreate = true; if (needCreate) createXGeosVersionTable(connection, _pgSchema); rs.close(); StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vsschema, vsstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)).append(' '); sbSQL.append("ORDER BY vsid"); stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); ArrayList<Object[]> tmpSchemas = new ArrayList<Object[]>(); int i = 0; int current = -1; while (rs.next()) { Object[] values = new Object[2]; values[0] = rs.getString("vsschema"); values[1] = rs.getShort("vsstatus"); tmpSchemas.add(values); if ((((Short) values[1]) & DataReposVersionManager.VSSTATUS_USING) != 0) { current = i; } i++; } if (current == -1) { Object[] values = tmpSchemas.get(0); targetSchema = (String) values[0]; } else if (current < (tmpSchemas.size() - 1)) { Object[] values = tmpSchemas.get(current + 1); targetSchema = (String) values[0]; } else { Object[] values = tmpSchemas.get(0); targetSchema = (String) values[0]; } sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vsstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_COVERT); sbSQL.append(" WHERE vsschema = '"); sbSQL.append(targetSchema).append("'"); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } return targetSchema; } private String determineTargetThemeTableName() throws IOException { if (targetDataStore == null) return null; Connection connection = null; Statement stmt = null; ResultSet rs = null; String targetTable = null; boolean needCreate = false; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); // Create XPTVERSIONTABLE_NAME needCreate = false; rs = connection.getMetaData().getTables(null, _pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME, new String[]{"TABLE"}); if (!rs.next()) needCreate = true; if (needCreate) createXPWThemeVersionTable(connection, _pgSchema); rs.close(); rs = null; StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vptname, vptstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append("ORDER BY vptid"); stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); ArrayList<Object[]> tmpTablenames = new ArrayList<Object[]>(); int i = 0; int current = -1; while (rs.next()) { Object[] values = new Object[2]; values[0] = rs.getString("vptname"); values[1] = rs.getShort("vptstatus"); tmpTablenames.add(values); if ((((Short) values[1]) & DataReposVersionManager.VSSTATUS_USING) != 0) { current = i; } i++; } if (current == -1) { Object[] values = tmpTablenames.get(0); targetTable = (String) values[0]; } else if (current < (tmpTablenames.size() - 1)) { Object[] values = tmpTablenames.get(current + 1); targetTable = (String) values[0]; } else { Object[] values = tmpTablenames.get(0); targetTable = (String) values[0]; } sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_COVERT); sbSQL.append(" WHERE vptname = '"); sbSQL.append(targetTable).append("'"); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetTable + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } return targetTable; } public String encodeSchemaTableName(String schemaName, String tableName) { if (schemaName == null) return "\"" + tableName + "\""; return "\"" + schemaName + "\".\"" + tableName + "\""; } private void createXGeosVersionTable(Connection connection, String pgSchema) throws SQLException { Statement stmt = null; StringBuilder sql = new StringBuilder("CREATE TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); sql.append(" ( vsid serial PRIMARY KEY, "); sql.append(" vsschema character varying(64) NOT NULL, "); sql.append(" vsstatus smallint NOT NULL, "); sql.append(" vstimestamp timestamp with time zone ) "); try { stmt = connection.createStatement(); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("ALTER TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); sql.append(" OWNER TO ").append(_pgUsername); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("GRANT ALL ON TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); sql.append(" TO public"); stmt.executeUpdate(sql.toString()); for (String schemaName : DataReposVersionManager.DEFAULTXGVERSIONSCHEMA_NAMES) { sql = new StringBuilder("INSERT INTO "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); sql.append(" (vsschema, vsstatus) VALUES ('"); sql.append(schemaName).append("', "); sql.append(DataReposVersionManager.VSSTATUS_AVAILABLE).append(" )"); stmt.executeUpdate(sql.toString()); createIfNotExistNewSchema(connection, schemaName); } } finally { if (stmt != null) stmt.close(); } } private void createXPWThemeVersionTable(Connection connection, String pgSchema) throws SQLException { Statement stmt = null; StringBuilder sql = new StringBuilder("CREATE TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" ( vptid serial PRIMARY KEY, "); sql.append(" vptname character varying(64) NOT NULL, "); sql.append(" vptstatus smallint NOT NULL, "); sql.append(" vpttimestamp timestamp with time zone ) "); try { stmt = connection.createStatement(); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("ALTER TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" OWNER TO ").append(_pgUsername); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("GRANT ALL ON TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" TO public"); stmt.executeUpdate(sql.toString()); for (String schemaName : DataReposVersionManager.DEFAULTXPTVERSIONTABLE_NAMES) { sql = new StringBuilder("INSERT INTO "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" (vptname, vptstatus) VALUES ('"); sql.append(schemaName).append("', "); sql.append(DataReposVersionManager.VSSTATUS_AVAILABLE).append(" )"); stmt.executeUpdate(sql.toString()); } } finally { if (stmt != null) stmt.close(); } } private void updateRepoStatusToReady(String targetSchema) { if (targetDataStore == null) return; Connection connection = null; Statement stmt = null; ResultSet rs = null; boolean needCreate = false; try { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vsstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_READY); sbSQL.append(" , vstimestamp = CURRENT_TIMESTAMP WHERE vsschema = '"); sbSQL.append(targetSchema).append("'"); connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); stmt = connection.createStatement(); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } catch (IOException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } } private void updatePWThemeStatusToReady(String targetSchema) { if (targetDataStore == null) return; Connection connection = null; Statement stmt = null; ResultSet rs = null; boolean needCreate = false; try { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_READY); sbSQL.append(" , vpttimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); sbSQL.append(targetSchema).append("'"); connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); stmt = connection.createStatement(); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } catch (IOException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } } private void createIfNotExistNewSchema(Connection connection, String s) throws SQLException { Statement stmt = null; ResultSet rs = null; try { /* rs = connection.getMetaData().getSchemas(null, s); if (rs.next()) return; rs.close(); rs = null; */ StringBuilder sbSQL = new StringBuilder("CREATE SCHEMA "); sbSQL.append(s).append(' '); sbSQL.append("AUTHORIZATION ").append(_pgUsername); stmt = connection.createStatement(); stmt.executeUpdate(sbSQL.toString()); sbSQL = new StringBuilder("GRANT ALL ON SCHEMA "); sbSQL.append(s).append(' '); sbSQL.append("TO public"); stmt.executeUpdate(sbSQL.toString()); } catch (SQLException e) { logger.info("create schema:" + s + " has exception."); logger.info(e.getMessage(), e); } finally { if (rs != null) rs.close(); if (stmt != null) stmt.close(); } } public final void accumulateQueryTime() { queryTime += System.currentTimeMillis() - queryTimeStart; } public long getQueryTime() { return queryTime; } public final void markQueryTime() { queryTimeStart = System.currentTimeMillis(); } public final void resetQueryTime() { queryTime = 0; } private void convertDynamicColorTheme(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertDynamicColorTheme"); return; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); boolean found = false; ResultSet rs = null; Statement stmt = null; PreparedStatement pstmt = null; try { DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); String targetTableName = targetTableBaseName + FDYNCOLOR_SUFFIX; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_COLORTAB); rs.setFetchSize(50); createOrClearTargetTable(connectionPG, targetTableName, "(tid smallint not null, oid int not null, dyncolor varchar(10) not null)"); pstmt = connectionPG.prepareStatement("INSERT INTO " + encodeSchemaTableName(_pgSchema, targetTableName) + " (tid, oid, dyncolor) VALUES (?, ?, ?)" ); final int MAX_BATCHSIZE = 50; int count = 0; while (rs.next()) { int cid = rs.getInt(1); long oid = rs.getLong(2); int colorId = rs.getInt(3); String colorText = colorTable.getColorCode(colorId); pstmt.setShort(1, (short) cid); pstmt.setInt(2, (int) oid); pstmt.setString(3, colorText); pstmt.addBatch(); if (count % MAX_BATCHSIZE == 0) { pstmt.executeBatch(); } ++count; } pstmt.executeBatch(); createTargetTableIndex(connectionPG, targetTableName); logger.info("Execute Update Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(pstmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } } private void convertPowerOwnerTheme(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertPowerOwnerTheme"); return; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); boolean found = false; ResultSet rs = null; Statement stmt = null; PreparedStatement pstmt = null; try { connectionPG.setAutoCommit(false); String targetTableName = targetTableBaseName + FOWNER_SUFFIX; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_CONNFDR); rs.setFetchSize(50); createOrClearTargetTable(connectionPG, targetTableName, "(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, flow) VALUES (?, ?, ?, ?)" ); final int MAX_BATCHSIZE = 50; int count = 0; while (rs.next()) { 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) { pstmt.executeBatch(); } ++count; } pstmt.executeBatch(); createTargetTableIndex(connectionPG, targetTableName); logger.info("Execute Update Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(pstmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } } private void createOrClearTargetTable(Connection connection, String tableName, String sql) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("DROP TABLE " + encodeSchemaTableName(_pgSchema, tableName) + "CASCADE"); } stmt.executeUpdate("CREATE TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " " + sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void createTargetTableIndex(Connection connection, String tableName) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("ALTER TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " ADD PRIMARY KEY (tid, oid)"); } } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private boolean convertDynamicColorThemeWithCopyAPI(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertDynamicColorThemeWithCopyAPI"); return false; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); while (connectionPG instanceof DelegatingConnection) { connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); } if (!(connectionPG instanceof PGConnection)) { return false; } final int MAX_BATCHSIZE = 250; ResultSet rs = null; Statement stmt = null; try { // connectionPG.setAutoCommit(false); DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); String targetTableName = targetTableBaseName + FDYNCOLOR_SUFFIX; String targetTempName = "tmp_" + targetTableName; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_COLORTAB); rs.setFetchSize(MAX_BATCHSIZE); createOrClearTempTargetTable(connectionPG, targetTempName, "(tid smallint not null, oid int not null, dyncolor varchar(10) not null)"); StringBuilder sb = new StringBuilder(); CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); PushbackReader reader = new PushbackReader(new StringReader(""), 10240); int count = 0; while (rs.next()) { int cid = rs.getInt(1); long oid = rs.getLong(2); int colorId = rs.getInt(3); String colorText = colorTable.getColorCode(colorId); sb.append(cid).append(','); sb.append(oid).append(','); sb.append(colorText).append("\n"); if (count % MAX_BATCHSIZE == 0) { reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); sb.delete(0, sb.length()); } ++count; } reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); createTargetTableIndexAndDropTemp(connectionPG, targetTableName, targetTempName); logger.info("Execute Copy Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } return true; } private boolean convertPowerOwnerThemeWithCopyAPI(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertPowerOwnerThemeWithCopyAPI"); return false; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); while (connectionPG instanceof DelegatingConnection) { connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); } if (!(connectionPG instanceof PGConnection)) { return false; } final int MAX_BATCHSIZE = 250; ResultSet rs = null; Statement stmt = null; try { // connectionPG.setAutoCommit(false); String targetTableName = targetTableBaseName + FOWNER_SUFFIX; String targetTempName = "tmp_" + targetTableName; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_CONNFDR); rs.setFetchSize(MAX_BATCHSIZE); createOrClearTempTargetTable(connectionPG, targetTempName, "(tid smallint not null, oid int not null, fowner smallint not null, flow varchar(20) not null)"); StringBuilder sb = new StringBuilder(); CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); PushbackReader reader = new PushbackReader(new StringReader(""), 10240); int count = 0; while (rs.next()) { 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 = FORWARDFLOW_MARK; } else if ((ConnectivityDirectionEnum.BackflowON == dir) || (ConnectivityDirectionEnum.BackFixflowON == dir)) { flowMark = BACKFLOW_MARK; } else if (ConnectivityDirectionEnum.Nondeterminate == dir) { flowMark = NONFLOW_MARK; } else { flowMark = UNFLOW_MARK; } sb.append(cid).append(','); sb.append(oid).append(','); sb.append(ownerId).append(','); sb.append(flowMark).append('\n'); if (count % MAX_BATCHSIZE == 0) { reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); sb.delete(0, sb.length()); } ++count; } reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); createTargetTableIndexAndDropTemp(connectionPG, targetTableName, targetTempName); logger.info("Execute Copy Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } return true; } private void createOrClearTempTargetTable(Connection connection, String tableName, String sql) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("DROP TABLE " + encodeSchemaTableName(null, tableName) + "CASCADE"); } stmt.executeUpdate("CREATE TEMP TABLE " + encodeSchemaTableName(null, tableName) + " " + sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void createTargetTableIndexAndDropTemp(Connection connection, String tableName, String tempTable) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { stmt.execute("CREATE TABLE " + tableName +" AS SELECT * FROM " + tempTable); rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("ALTER TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " ADD PRIMARY KEY (tid, oid)"); } stmt.execute("DROP TABLE " + tempTable); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java
@@ -108,7 +108,9 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|COMPID=" + linkage.getComponentID()))); (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size()); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java
@@ -245,6 +245,9 @@ String viewName = sbView.toString(); if (allViewNames.contains(viewName)) { resetThemesPostgisDataView(connection, ownerName, null, viewName); if (tid == 106) { resetFlowThemesPostgisDataView(connection, ownerName, null, viewName); } } } @@ -454,6 +457,45 @@ } } private void resetFlowThemesPostgisDataView(Connection connection, String ownerName, String currentSchema, String viewName) throws SQLException { String themeViewName = viewName + "-flow-oms"; ResultSet rs = null; Statement stmt = connection.createStatement(); try { StringBuilder sbSQL = new StringBuilder("CREATE OR REPLACE VIEW \""); sbSQL.append(themeViewName).append("\" AS SELECT "); rs = connection.getMetaData().getColumns(null, currentSchema, viewName, "%"); while (rs.next()) { String fieldName = rs.getString("COLUMN_NAME"); sbSQL.append("t." + fieldName).append(", "); } sbSQL.append("fc.dyncolor, fo.fowner, fo.flow FROM "); if (currentSchema != null) sbSQL.append("\"").append(currentSchema).append("\".\"").append(viewName).append("\" AS t,"); else sbSQL.append("\"").append(viewName).append("\" AS t,"); sbSQL.append("xpwtheme").append(FDYNCOLOR_SUFFIX).append(" AS fc,"); sbSQL.append("xpwtheme").append(FOWNER_SUFFIX).append(" AS fo WHERE "); sbSQL.append("t.tid = fc.tid AND t.oid = fc.oid AND "); sbSQL.append("t.tid = fo.tid AND t.oid = fo.oid"); // sbSQL.delete(sbSQL.length() - 2, sbSQL.length()); String sql = sbSQL.toString(); stmt.execute(sql); sbSQL.delete(0, sbSQL.length()); PrintfFormat pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(themeViewName); stmt.execute(sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private HashMap<String, String> retrieveViewDef(Connection connection, String schemaName, String tablePattern) throws SQLException { PreparedStatement stmt = connection.prepareStatement(QUERY_VIEWDEFSQL + "'" + tablePattern + "'"); stmt.setString(1, schemaName); @@ -563,7 +605,7 @@ private String retrieveCurrentSchemaName(Connection connection, short status) throws SQLException { StringBuilder sbSQL = new StringBuilder("SELECT vsschema, vstimestamp, vsstatus FROM "); sbSQL.append(DataReposVersionManager.XGVERSIONTABLE_NAME); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)); sbSQL.append(" WHERE vsstatus = "); sbSQL.append(status); sbSQL.append(" ORDER BY vsid"); @@ -586,14 +628,14 @@ } } private void updateCurrentThemeStatus(Connection connection, String schemaName, short newStatus) private void updateCurrentThemeStatus(Connection connection, String themeTableName, short newStatus) throws SQLException { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(DataReposVersionManager.XPTVERSIONTABLE_NAME).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(newStatus); sbSQL.append(", vpttimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); sbSQL.append(schemaName).append("'"); sbSQL.append(themeTableName).append("'"); Statement stmt = null; try { @@ -617,8 +659,10 @@ private String retrieveCurrentThemeName(Connection connection, short status) throws SQLException { StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vptname, vptstatus, vpttimestamp FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append("vptname, vpttimestamp, vptstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sbSQL.append(" WHERE vptstatus = "); sbSQL.append(status); sbSQL.append("ORDER BY vptid"); String result = null; @@ -661,6 +705,32 @@ } catch (SQLException e) { logger.warn(e.getMessage(), e); throw new JobExecutionException("Update " + DataReposVersionManager.XGVERSIONTABLE_NAME + " has error-", e); } } protected void transferThemesVersionStatus(Connection connection, short vsstatusBefore, short vsstatusAfter, boolean exclusive) throws JobExecutionException { try { String currentTargetTheme = retrieveCurrentThemeName(connection, vsstatusBefore); if (currentTargetTheme == null) { logger.info("Cannot found target schema in dataStore. status=" + vsstatusBefore); return; } String existTargetSchema = null; if (exclusive) existTargetSchema = retrieveCurrentThemeName(connection, vsstatusAfter); updateCurrentThemeStatus(connection, currentTargetTheme, vsstatusAfter); if ((exclusive) && (existTargetSchema != null)) { updateCurrentThemeStatus(connection, existTargetSchema, DataReposVersionManager.VSSTATUS_AVAILABLE); } } catch (SQLException e) { logger.warn(e.getMessage(), e); throw new JobExecutionException("Update " + DataReposVersionManager.XPTVERSIONTABLE_NAME + " has error-", e); } } @@ -827,6 +897,9 @@ connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); transferXGeosVersionStatus(connection, DataReposVersionManager.VSSTATUS_LINKVIEW, DataReposVersionManager.VSSTATUS_CONFIG, false); transferThemesVersionStatus(connection, DataReposVersionManager.VSSTATUS_LINKVIEW, DataReposVersionManager.VSSTATUS_CONFIG, false); URL geoServerURL = new URL(_geoServerURL); GeoServerRESTManager manager = new GeoServerRESTManager(geoServerURL, _geoServerUser, _geoServerPass); GeoServerRESTReader reader = manager.getReader(); @@ -865,6 +938,8 @@ transferXGeosVersionStatus(connection, DataReposVersionManager.VSSTATUS_CONFIG, DataReposVersionManager.VSSTATUS_USING, true); transferThemesVersionStatus(connection, DataReposVersionManager.VSSTATUS_CONFIG, DataReposVersionManager.VSSTATUS_USING, true); Date lastUpdate = Calendar.getInstance().getTime(); } catch (IOException e) { logger.warn(e.getMessage(), e); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleClearExchangeJob.java
New file @@ -0,0 +1,370 @@ package com.ximple.eofms.jobs; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Date; import java.util.Map; import java.util.TreeMap; import com.ximple.eofms.jobs.context.AbstractOracleJobContext; import com.ximple.eofms.jobs.context.postgis.OracleConvertPostGISJobContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.data.DataStore; import org.geotools.data.Transaction; import org.geotools.data.jdbc.JDBCUtils; import org.geotools.data.postgis.PostgisNGDataStoreFactory; import org.geotools.jdbc.JDBCDataStore; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; public class OracleClearExchangeJob extends AbstractOracleDatabaseJob { final static Log logger = LogFactory.getLog(OracleClearExchangeJob.class); public static String FETCH_TPDATA = "SELECT TPID, TPNAME FROM BASEDB.TPDATA"; private static final String PGHOST = "PGHOST"; private static final String PGDATBASE = "PGDATBASE"; private static final String PGPORT = "PGPORT"; private static final String PGSCHEMA = "PGSCHEMA"; private static final String PGUSER = "PGUSER"; private static final String PGPASS = "PGPASS"; private static final String USEWKB = "USEWKB"; private static final boolean useTpclidText = false; private static final int FETCHSIZE = 100; private static final int COMMITSIZE = 100; protected static class Pair { Object first; Object second; public Pair(Object first, Object second) { this.first = first; this.second = second; } } protected static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); protected String _pgHost; protected String _pgDatabase; protected String _pgPort; protected String _pgSchema; protected String _pgUsername; protected String _pgPassword; protected String _pgUseWKB; protected Map<String, String> pgProperties; protected JDBCDataStore targetDataStore; private long queryTime = 0; private long queryTimeStart = 0; protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { super.extractJobConfiguration(jobDetail); JobDataMap dataMap = jobDetail.getJobDataMap(); _pgHost = dataMap.getString(PGHOST); _pgDatabase = dataMap.getString(PGDATBASE); _pgPort = dataMap.getString(PGPORT); _pgSchema = dataMap.getString(PGSCHEMA); _pgUsername = dataMap.getString(PGUSER); _pgPassword = dataMap.getString(PGPASS); _pgUseWKB = dataMap.getString(USEWKB); Log logger = getLogger(); /* logger.info("PGHOST=" + _myHost); logger.info("PGDATBASE=" + _myDatabase); logger.info("PGPORT=" + _myPort); logger.info("PGSCHEMA=" + _mySchema); logger.info("PGUSER=" + _myUsername); logger.info("PGPASS=" + _myPassword); logger.info("USEWKB=" + _myUseWKB); */ if (_pgHost == null) { logger.warn("PGHOST is null"); throw new JobExecutionException("Unknown PostGIS host."); } if (_pgDatabase == null) { logger.warn("PGDATABASE is null"); throw new JobExecutionException("Unknown PostGIS database."); } if (_pgPort == null) { logger.warn("PGPORT is null"); throw new JobExecutionException("Unknown PostGIS port."); } if (_pgSchema == null) { logger.warn("PGSCHEMA is null"); throw new JobExecutionException("Unknown PostGIS schema."); } if (_pgUsername == null) { logger.warn("PGUSERNAME is null"); throw new JobExecutionException("Unknown PostGIS username."); } if (_pgPassword == null) { logger.warn("PGPASSWORD is null"); throw new JobExecutionException("Unknown PostGIS password."); } Map<String, String> remote = new TreeMap<String, String>(); remote.put(PostgisNGDataStoreFactory.DBTYPE.key, "postgis"); // remote.put("charset", "UTF-8"); remote.put(PostgisNGDataStoreFactory.HOST.key, _pgHost); remote.put(PostgisNGDataStoreFactory.PORT.key, _pgPort); remote.put(PostgisNGDataStoreFactory.DATABASE.key, _pgDatabase); remote.put(PostgisNGDataStoreFactory.USER.key, _pgUsername); remote.put(PostgisNGDataStoreFactory.PASSWD.key, _pgPassword); // remote.put( "namespace", null); pgProperties = remote; } @Override public Log getLogger() { return logger; } @Override public void execute(JobExecutionContext context) throws JobExecutionException { // Every job has its own job detail JobDetail jobDetail = context.getJobDetail(); // The name is defined in the job definition String jobName = jobDetail.getKey().getName(); // Log the time the job started logger.info(jobName + " fired at " + new Date()); extractJobConfiguration(jobDetail); createSourceDataStore(); if (getSourceDataStore() == null) { logger.warn("Cannot connect source oracle database."); throw new JobExecutionException("Cannot connect source oracle database."); } if (isProfileMode()) { queryTime = 0; } long t1 = System.currentTimeMillis(); String targetSchemaName; try { logger.info("-- step:clearOutputDatabase --"); clearOutputDatabase(); logger.info("-- step:transformOracleDMMSDB --"); targetSchemaName = ""; OracleConvertPostGISJobContext jobContext = (OracleConvertPostGISJobContext) prepareJobContext(targetSchemaName, _filterPath, isProfileMode(), isTransformed()); jobContext.setSourceDataStore(getSourceDataStore()); jobContext.setExecutionContext(context); long tStep = System.currentTimeMillis(); fetchTPData(jobContext); logger.info("TPC DIST:" + jobContext.getDistId() + ":" + ((jobContext.getDistName() == null) ? "NULL" : jobContext.getDistName())); clearExchangeData(jobContext); if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-Merge Connectivity Owner", tStep, tStepEnd); } tStep = System.currentTimeMillis(); if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-Merge ColorTable", tStep, tStepEnd); } jobContext.closeOracleConnection(); long t2 = System.currentTimeMillis(); // public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; // SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); logTimeDiff("Total ", t1, t2); } catch (SQLException e) { disconnect(); logger.warn(e.getMessage(), e); throw new JobExecutionException("Database error. " + e.getMessage(), e); } catch (IOException ex) { disconnect(); logger.warn(ex.getMessage(), ex); throw new JobExecutionException("IO error. " + ex.getMessage(), ex); } finally { disconnect(); } logger.warn(jobName + " end at " + new Date()); } private void clearExchangeData(OracleConvertPostGISJobContext jobContext) throws SQLException, IOException { Connection connection = jobContext.getOracleConnection(); ResultSet rsMeta = connection.getMetaData().getTables(null, "CMMS_POSTDB", "GEO_EXCHANGE", new String[]{"TABLE"}); boolean found = false; try { while (rsMeta.next()) { found = true; break; } // } catch (SQLException e) } finally { if (rsMeta != null) { rsMeta.close(); rsMeta = null; } } if (!found) { logger.info("Cannot Found GEO_EXCHANGE in CMMS_POSTDB."); return; } Statement stmt = null; try { stmt = connection.createStatement(); int count = stmt.executeUpdate("DELETE FROM \"CMMS_POSTDB\".\"GEO_EXCHANGE\" WHERE ISEXCHANGE=1"); logger.info("DELETE GEO_EXCHANGE UPDATE SIZE=" + count); } finally { JDBCUtils.close(stmt); } } @Override protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, boolean profileMode, boolean useTransform) { return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); } private void logTimeDiff(String message, long tBefore, long tCurrent) { logger.warn(message + ":use time = " + ((int) ((tCurrent - tBefore) / 60000.0)) + " min - " + (((int) ((tCurrent - tBefore) % 60000.0)) / 1000) + " sec"); } public DataStore getTargetDataStore() { return targetDataStore; } protected void createTargetDataStore() throws JobExecutionException { if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MAXCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MAXCONN.key, "5"); } if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MINCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MINCONN.key, "1"); } if (!dataStoreFactory.canProcess(pgProperties)) { getLogger().warn("cannot process properties-"); throw new JobExecutionException("cannot process properties-"); } try { targetDataStore = dataStoreFactory.createDataStore(pgProperties); } catch (IOException e) { getLogger().warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } } protected void disconnect() { super.disconnect(); if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } } private String determineTargetSchemaName() throws IOException { if (targetDataStore == null) return null; Connection connection = null; Statement stmt = null; ResultSet rs = null; String targetSchema = null; boolean needCreate = false; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); rs = connection.getMetaData().getTables(null, _pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME, new String[]{"TABLE"}); if (!rs.next()) needCreate = true; if (needCreate) { throw new IOException("cannot found " + DataReposVersionManager.XGVERSIONTABLE_NAME); } rs.close(); rs = null; StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vsschema, vsstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XGVERSIONTABLE_NAME)).append(' '); sbSQL.append("ORDER BY vsid"); stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); ArrayList<Object[]> tmpSchemas = new ArrayList<Object[]>(); int i = 0; int current = -1; while (rs.next()) { Object[] values = new Object[2]; values[0] = rs.getString("vsschema"); values[1] = rs.getShort("vsstatus"); tmpSchemas.add(values); if ((((Short) values[1]) & DataReposVersionManager.VSSTATUS_USING) != 0) { current = i; } i++; } if (current != -1) { Object[] values = tmpSchemas.get(current); targetSchema = (String) values[0]; } } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } return targetSchema; } public String encodeSchemaTableName(String schemaName, String tableName) { return "\"" + schemaName + "\".\"" + tableName + "\""; } public final void accumulateQueryTime() { queryTime += System.currentTimeMillis() - queryTimeStart; } public long getQueryTime() { return queryTime; } public final void markQueryTime() { queryTimeStart = System.currentTimeMillis(); } public final void resetQueryTime() { queryTime = 0; } private void clearOutputDatabase() { } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
@@ -317,6 +317,7 @@ } } clearExchangeData(jobContext); jobContext.closeOracleConnection(); } @@ -386,6 +387,41 @@ private void logTimeDiff(String message, long tBefore, long tCurrent) { logger.warn(message + ":use time = " + ((int) ((tCurrent - tBefore) / 60000.0)) + " min - " + (((int) ((tCurrent - tBefore) % 60000.0)) / 1000) + " sec"); } private void clearExchangeData(OracleConvertPostGISJobContext jobContext) throws SQLException, IOException { Connection connection = jobContext.getOracleConnection(); ResultSet rsMeta = connection.getMetaData().getTables(null, "CMMS_POSTDB", "GEO_EXCHANGE", new String[]{"TABLE"}); boolean found = false; try { while (rsMeta.next()) { found = true; break; } // } catch (SQLException e) } finally { if (rsMeta != null) { rsMeta.close(); rsMeta = null; } } if (!found) { logger.info("Cannot Found GEO_EXCHANGE in CMMS_POSTDB."); return; } Statement stmt = null; try { stmt = connection.createStatement(); int count = stmt.executeUpdate("UPDATE \"CMMS_POSTDB\".\"GEO_EXCHANGE\" SET ISEXCHANGE=1 WHERE ISEXCHANGE=0"); logger.info("GEO_EXCHANGE UPDATE SIZE=" + count); } finally { JDBCUtils.close(stmt); } } private void exetcuteConvert(OracleConvertPostGISJobContext jobContext, @@ -1310,7 +1346,7 @@ values[0] = rs.getString("vptname"); values[1] = rs.getShort("vptstatus"); tmpTablenames.add(values); if ((((Short) values[1]) & DataReposVersionManager.VSSTATUS_USING) != 0) { if (((Short) values[1]) >= DataReposVersionManager.VSSTATUS_LINKVIEW) { current = i; } i++; @@ -1887,12 +1923,24 @@ Statement stmt = connection.createStatement(); ResultSet rs = null; try { boolean found = false; rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { found = true; } JDBCUtils.close(rs); if (!found) { stmt.execute("CREATE TABLE " + tableName +" AS SELECT * FROM " + tempTable); rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("ALTER TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " ADD PRIMARY KEY (tid, oid)"); } } else { stmt.execute("TRUNCATE "+ tableName + " CASCADE"); stmt.execute("SELECT * INTO " + tableName + " FROM " + tempTable); } stmt.execute("DROP TABLE " + tempTable); } finally { JDBCUtils.close(rs); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertThemes2PostGISJob.java
New file @@ -0,0 +1,1325 @@ package com.ximple.eofms.jobs; import java.io.IOException; import java.io.PushbackReader; import java.io.StringReader; import java.net.URL; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.TreeSet; import com.ximple.eofms.geoserver.config.XGeosDataConfig; import com.ximple.eofms.geoserver.config.XGeosDataConfigMapping; import com.ximple.eofms.jobs.context.AbstractOracleJobContext; import com.ximple.eofms.jobs.context.postgis.OracleConvertPostGISJobContext; import com.ximple.eofms.util.ConnectivityDirectionEnum; import com.ximple.eofms.util.DefaultColorTable; import com.ximple.eofms.util.PrintfFormat; import com.ximple.eofms.util.XGeosConfigDigesterUtils; import org.apache.commons.collections.MultiMap; import org.apache.commons.dbcp.DelegatingConnection; import org.apache.commons.digester3.Digester; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.geotools.data.DataStore; import org.geotools.data.Transaction; import org.geotools.data.jdbc.JDBCUtils; import org.geotools.data.postgis.PostgisNGDataStoreFactory; import org.geotools.jdbc.JDBCDataStore; import org.postgresql.PGConnection; import org.postgresql.copy.CopyManager; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.xml.sax.SAXException; public class OracleConvertThemes2PostGISJob extends AbstractOracleDatabaseJob { final static Log logger = LogFactory.getLog(GeoserverIntegrateConfigJob.class); private static final String SKIPCONFIGJOB = "SKIPCONFIGJOB"; private static final String MASTERMODE = "MASTERMODE"; private static final String EPSG = "EPSG:"; private static final String XGEOSDATACONFIG_PATH = "xgeosdataconfig.xml"; // private static final int MAGIC_BLOCKSIZE = (64 * 1024 * 1024) - (32 * 1024); private static final String QUERY_VIEWDEFSQL = "SELECT table_name, view_definition FROM information_schema.views " + "WHERE table_schema = ? AND table_name LIKE "; private static final String CREATE_VIEWSQL = "CREATE OR REPLACE VIEW \"%s\" AS SELECT * FROM \"%s\".\"%s\""; private static final String EXTRAWHERE_VIEWSQL = " WHERE \"%s\".level = %s AND \"%s\".symweight = %s"; private static final String ALTER_VIEWSQL = "ALTER TABLE \"%s\" OWNER TO "; // private static final String GRANT_VIEWSQL = "GRANT SELECT ON TABLE \"%s\" TO public"; private static final int SRSID_TWD97_ZONE119 = 3825; private static final int SRSID_TWD97_ZONE121 = 3826; public static final String DEFAULT_STORENAME = "pgDMMS"; public static final String DEFAULT_GEODMMS_NAMESPACE = "http://tpc.ximple.com.tw/geodmms"; private static final String PGHOST = "PGHOST"; private static final String PGDATBASE = "PGDATBASE"; private static final String PGPORT = "PGPORT"; private static final String PGSCHEMA = "PGSCHEMA"; private static final String PGUSER = "PGUSER"; private static final String PGPASS = "PGPASS"; private static final String USEWKB = "USEWKB"; private static final boolean useTpclidText = false; private static final int FETCHSIZE = 30; private static final int COMMITSIZE = 100; public static final String FORWARDFLOW_MARK = "shape://ccarrow"; public static final String BACKFLOW_MARK = "shape://rccarrow"; public static final String UNFLOW_MARK = "shape://backslash"; public static final String NONFLOW_MARK = "shape://slash"; 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 WHERE TAG_BCOMPID = 0 ORDER BY TAG_SFSC"; private static String CREATE_OWNERTABLE = "CREATE TABLE s (tid smallint not null, oid int not null, owner smallint not null)"; private static String CREATE_COLORTABLE = "CREATE TABLE s (tid smallint not null, oid int not null, dyncolor varchar(10) not null)"; public static final String FDYNCOLOR_SUFFIX = "_fdyncolor"; public static final String FOWNER_SUFFIX = "_fowner"; private static XGeosDataConfigMapping xgeosDataConfigMapping = null; protected JDBCDataStore targetDataStore; protected Map<String, String> pgProperties; protected static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); protected String _pgHost; protected String _pgDatabase; protected String _pgPort; protected String _pgSchema; protected String _pgUsername; protected String _pgPassword; protected String _pgUseWKB; private long queryTime = 0; private long queryTimeStart = 0; private String currentThemeTable = null; private Short currentThemeStatus = -1; public Log getLogger() { return logger; } protected AbstractOracleJobContext prepareJobContext(String targetSchemaName, String filterPath, boolean profileMode, boolean useTransform) { return new OracleConvertPostGISJobContext(getDataPath(), getTargetDataStore(), targetSchemaName, filterPath, profileMode, useTransform); } protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { super.extractJobConfiguration(jobDetail); JobDataMap dataMap = jobDetail.getJobDataMap(); _pgHost = dataMap.getString(PGHOST); _pgDatabase = dataMap.getString(PGDATBASE); _pgPort = dataMap.getString(PGPORT); _pgSchema = dataMap.getString(PGSCHEMA); _pgUsername = dataMap.getString(PGUSER); _pgPassword = dataMap.getString(PGPASS); _pgUseWKB = dataMap.getString(USEWKB); Log logger = getLogger(); if (_pgHost == null) { logger.warn("PGHOST is null"); throw new JobExecutionException("Unknown PostGIS host."); } if (_pgDatabase == null) { logger.warn("PGDATABASE is null"); throw new JobExecutionException("Unknown PostGIS database."); } if (_pgPort == null) { logger.warn("PGPORT is null"); throw new JobExecutionException("Unknown PostGIS port."); } if (_pgSchema == null) { logger.warn("PGSCHEMA is null"); throw new JobExecutionException("Unknown PostGIS schema."); } if (_pgUsername == null) { logger.warn("PGUSERNAME is null"); throw new JobExecutionException("Unknown PostGIS username."); } if (_pgPassword == null) { logger.warn("PGPASSWORD is null"); throw new JobExecutionException("Unknown PostGIS password."); } Map<String, String> remote = new TreeMap<String, String>(); remote.put(PostgisNGDataStoreFactory.DBTYPE.key, "postgis"); // remote.put("charset", "UTF-8"); remote.put(PostgisNGDataStoreFactory.HOST.key, _pgHost); remote.put(PostgisNGDataStoreFactory.PORT.key, _pgPort); remote.put(PostgisNGDataStoreFactory.DATABASE.key, _pgDatabase); remote.put(PostgisNGDataStoreFactory.USER.key, _pgUsername); remote.put(PostgisNGDataStoreFactory.PASSWD.key, _pgPassword); // remote.put( "namespace", null); pgProperties = remote; } protected XGeosDataConfigMapping getConfigMapping() { if (xgeosDataConfigMapping == null) { Digester digester = XGeosConfigDigesterUtils.getXGeosConfigDigester(); final URL configDataURL = XGeosDataConfigMapping.class.getResource(XGEOSDATACONFIG_PATH); try { xgeosDataConfigMapping = (XGeosDataConfigMapping) digester.parse(configDataURL); } catch (IOException e) { logger.warn(e.getMessage(), e); } catch (SAXException e) { logger.warn(e.getMessage(), e); } } return xgeosDataConfigMapping; } private void logTimeDiff(String message, long tBefore, long tCurrent) { logger.warn(message + ":use time = " + ((int) ((tCurrent - tBefore) / 60000.0)) + " min - " + (((int) ((tCurrent - tBefore) % 60000.0)) / 1000) + " sec"); } @Override public void execute(JobExecutionContext context) throws JobExecutionException { // Every job has its own job detail JobDetail jobDetail = context.getJobDetail(); // The name is defined in the job definition String jobName = jobDetail.getKey().getName(); // Log the time the job started logger.info(jobName + " fired at " + new Date()); extractJobConfiguration(jobDetail); createSourceDataStore(); createTargetDataStore(); if (getSourceDataStore() == null) { logger.warn("Cannot connect source oracle database."); throw new JobExecutionException("Cannot connect source oracle database."); } if (getTargetDataStore() == null) { logger.warn("Cannot connect source postgreSQL database."); throw new JobExecutionException("Cannot connect source postgreSQL database."); } if (isProfileMode()) { queryTime = 0; } long t1 = System.currentTimeMillis(); String targetThemeTable; try { logger.info("-- step:clearOutputDatabase --"); OracleConvertPostGISJobContext jobContext = null; if (checkConvertPWThemes()) { targetThemeTable = determineTargetThemeTableName(); jobContext = (OracleConvertPostGISJobContext) prepareJobContext("public", _filterPath, isProfileMode(), isTransformed()); jobContext.setSourceDataStore(getSourceDataStore()); jobContext.setElementLogging(checkElementLogging()); jobContext.setExecutionContext(context); long tStep = System.currentTimeMillis(); if (!convertPowerOwnerThemeWithCopyAPI(jobContext, targetThemeTable)) { convertPowerOwnerTheme(jobContext, targetThemeTable); } if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-convertFeatureDesignFile", tStep, tStepEnd); } tStep = System.currentTimeMillis(); if (!convertDynamicColorThemeWithCopyAPI(jobContext, targetThemeTable)) convertDynamicColorTheme(jobContext, targetThemeTable); if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-convertFeatureDesignFile", tStep, tStepEnd); } jobContext.closeOracleConnection(); updatePWThemeStatusToReady(targetThemeTable); } long t2 = System.currentTimeMillis(); // public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; // SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); logTimeDiff("Total ", t1, t2); } catch (IOException ex) { disconnect(); logger.warn(ex.getMessage(), ex); throw new JobExecutionException("IO error. " + ex.getMessage(), ex); } finally { disconnect(); } logger.warn(jobName + " end at " + new Date()); createTargetDataStore(); if (getTargetDataStore() == null) { logger.warn("Cannot connect source postgreSQL database."); throw new JobExecutionException("Cannot connect source postgreSQL database."); } try { logger.info("-- step:resetThemesViewMapping --"); long tStep = System.currentTimeMillis(); resetThemesViewMapping(context); if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-resetThemesViewMapping", tStep, tStepEnd); } logger.info("-- step:resetGeoServerConfig --"); tStep = System.currentTimeMillis(); // resetGeoServerConfig(jobExecutionContext); if (isProfileMode()) { long tStepEnd = System.currentTimeMillis(); logTimeDiff("Profile-resetGeoServerConfig", tStep, tStepEnd); } } finally { disconnect(); } } /** * 重新建立所有重新建立所有PostGIS中的資料庫視景 * * @param executionContext 批次執行的關係 */ private void resetThemesViewMapping(JobExecutionContext executionContext) throws JobExecutionException { assert executionContext != null; Connection connection = null; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); String ownerName = _pgUsername; String currentTargetThemesName = retrieveCurrentThemeName(connection, DataReposVersionManager.VSSTATUS_READY); if (currentTargetThemesName == null) { logger.info("Cannot found themes that status is VSSTATUS_READY[" + DataReposVersionManager.VSSTATUS_READY + "]"); return; } ArrayList<String> realTableNames = new ArrayList<String>(); retrieveAllRealTableName(connection, currentTargetThemesName, realTableNames); resetThemesBaseView(connection, ownerName, currentTargetThemesName); if (currentThemeTable == null) { transferThemesVersionStatus(DataReposVersionManager.VSSTATUS_READY, DataReposVersionManager.VSSTATUS_LINKVIEW, false); } else { transferThemesVersionStatus(DataReposVersionManager.VSSTATUS_READY, currentThemeStatus, true); } /* updateCurrentThemeStatus(connection, currentTargetThemesName, DataReposVersionManager.VSSTATUS_LINKVIEW); */ // String[] featureNames = dataStore.getTypeNames(); // logger.info("featureNames[] size = " + featureNames.length); } catch (IOException e) { logger.warn(e.getMessage(), e); } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { if (connection != null) JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); // if (dataStore != null) dataStore.dispose(); } } private void retrieveAllRealTableName(Connection connection, String targetSchema, ArrayList<String> realTableNames) throws SQLException { ResultSet rsMeta = null; try { rsMeta = connection.getMetaData().getTables("", targetSchema, "fsc%", new String[]{"TABLE"}); while (rsMeta.next()) { String tableName = rsMeta.getString(3); realTableNames.add(tableName); } rsMeta.close(); rsMeta = null; rsMeta = connection.getMetaData().getTables("", targetSchema, "index%", new String[]{"TABLE"}); while (rsMeta.next()) { String tableName = rsMeta.getString(3); realTableNames.add(tableName); } rsMeta.close(); rsMeta = null; rsMeta = connection.getMetaData().getTables("", targetSchema, "lndtpc%", new String[]{"TABLE"}); while (rsMeta.next()) { String tableName = rsMeta.getString(3); realTableNames.add(tableName); } } finally { if (rsMeta != null) rsMeta.close(); } } private void resetPostgisDataView(Connection connection, HashMap<String, String> viewDefs, String ownerName, String schemaName, String tableName) throws SQLException { String[] splits = tableName.split("-"); if (splits.length > 3) { // feature table StringBuilder viewBuilder = new StringBuilder(); viewBuilder.append(splits[0]); viewBuilder.append('-'); viewBuilder.append(splits[1]); viewBuilder.append('-'); viewBuilder.append(splits[2]); viewBuilder.append(splits[3]); String viewName = viewBuilder.toString(); if (viewDefs.containsKey(viewName)) { String viewDef = viewDefs.get(viewName); int pos = viewDef.indexOf("FROM"); String subView = viewDef.substring(pos + 4); // String[] viewSources = subView.split("\\."); String[] viewSources = subView.split("(\\.\"|\")"); if (!viewSources[0].equalsIgnoreCase(schemaName)) { createOrReplaceView(connection, schemaName, tableName, viewName, ownerName); } } else { createOrReplaceView(connection, schemaName, tableName, viewName, ownerName); } } else { splits = tableName.split("_"); if (splits.length > 0) { StringBuilder viewBuilder = new StringBuilder(); viewBuilder.append(splits[0]); if (splits.length > 1) viewBuilder.append(splits[1]); if (splits.length > 2) viewBuilder.append(splits[2]); String viewName = viewBuilder.toString(); if (viewDefs.containsKey(viewName)) { String viewDef = viewDefs.get(viewName); int pos = viewDef.indexOf("FROM"); String subView = viewDef.substring(pos + 4); String[] viewSources = subView.split("(\\.\"|\")"); if (!viewSources[0].equalsIgnoreCase(schemaName)) { createOrReplaceView(connection, schemaName, tableName, viewName, ownerName); } } else { createOrReplaceView(connection, schemaName, tableName, viewName, ownerName); } } } } private void resetThemesBaseView(Connection connection, String ownerName, String currentThemesName) throws SQLException { String viewName = "xpwtheme" + FDYNCOLOR_SUFFIX; String tableName = currentThemesName + FDYNCOLOR_SUFFIX; PrintfFormat pf = new PrintfFormat("CREATE OR REPLACE VIEW \"%s\" AS SELECT * FROM \"%s\""); String sql = pf.sprintf(new Object[]{viewName, tableName}); Statement stmt = connection.createStatement(); try { stmt.execute(sql); pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(viewName); stmt.execute(sql); viewName = "xpwtheme" + FOWNER_SUFFIX; tableName = currentThemesName + FOWNER_SUFFIX; pf = new PrintfFormat("CREATE OR REPLACE VIEW \"%s\" AS SELECT * FROM \"%s\""); sql = pf.sprintf(new Object[]{viewName, tableName}); stmt.execute(sql); pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(viewName); stmt.execute(sql); } catch (SQLException e) { // logger.warn(e.getMessage(), e); logger.info(sql == null ? "SQL=NULL" : "SQL=" + sql); throw e; } finally { stmt.close(); } } private void resetThemesPostgisDataView(Connection connection, String ownerName, String currentSchema, String viewName) throws SQLException { String themeViewName = viewName + "-oms"; // PrintfFormat pf = new PrintfFormat(CREATE_VIEWSQL); // String sql = pf.sprintf(new Object[]{viewName, schemaName, tableName}); ResultSet rs = null; Statement stmt = connection.createStatement(); try { StringBuilder sbSQL = new StringBuilder("CREATE OR REPLACE VIEW \""); sbSQL.append(themeViewName).append("\" AS SELECT "); rs = connection.getMetaData().getColumns(null, currentSchema, viewName, "%"); while (rs.next()) { String fieldName = rs.getString("COLUMN_NAME"); sbSQL.append("t." + fieldName).append(", "); } sbSQL.append("fc.dyncolor, fo.fowner FROM "); if (currentSchema != null) sbSQL.append("\"").append(currentSchema).append("\".\"").append(viewName).append("\" AS t,"); else sbSQL.append("\"").append(viewName).append("\" AS t,"); sbSQL.append("xpwtheme").append(FDYNCOLOR_SUFFIX).append(" AS fc,"); sbSQL.append("xpwtheme").append(FOWNER_SUFFIX).append(" AS fo WHERE "); sbSQL.append("t.tid = fc.tid AND t.oid = fc.oid AND "); sbSQL.append("t.tid = fo.tid AND t.oid = fo.oid"); // sbSQL.delete(sbSQL.length() - 2, sbSQL.length()); String sql = sbSQL.toString(); stmt.execute(sql); sbSQL.delete(0, sbSQL.length()); PrintfFormat pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(themeViewName); stmt.execute(sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void resetFlowThemesPostgisDataView(Connection connection, String ownerName, String currentSchema, String viewName) throws SQLException { String themeViewName = viewName + "-flow-oms"; ResultSet rs = null; Statement stmt = connection.createStatement(); try { StringBuilder sbSQL = new StringBuilder("CREATE OR REPLACE VIEW \""); sbSQL.append(themeViewName).append("\" AS SELECT "); rs = connection.getMetaData().getColumns(null, currentSchema, viewName, "%"); while (rs.next()) { String fieldName = rs.getString("COLUMN_NAME"); sbSQL.append("t." + fieldName).append(", "); } sbSQL.append("fc.dyncolor, fo.fowner, fo.flow FROM "); if (currentSchema != null) sbSQL.append("\"").append(currentSchema).append("\".\"").append(viewName).append("\" AS t,"); else sbSQL.append("\"").append(viewName).append("\" AS t,"); sbSQL.append("xpwtheme").append(FDYNCOLOR_SUFFIX).append(" AS fc,"); sbSQL.append("xpwtheme").append(FOWNER_SUFFIX).append(" AS fo WHERE "); sbSQL.append("t.tid = fc.tid AND t.oid = fc.oid AND "); sbSQL.append("t.tid = fo.tid AND t.oid = fo.oid"); // sbSQL.delete(sbSQL.length() - 2, sbSQL.length()); String sql = sbSQL.toString(); stmt.execute(sql); sbSQL.delete(0, sbSQL.length()); PrintfFormat pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(themeViewName); stmt.execute(sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private HashMap<String, String> retrieveViewDef(Connection connection, String schemaName, String tablePattern) throws SQLException { PreparedStatement stmt = connection.prepareStatement(QUERY_VIEWDEFSQL + "'" + tablePattern + "'"); stmt.setString(1, schemaName); // stmt.setString(2, tablePattern); HashMap<String, String> result = new HashMap<String, String>(); ResultSet rs = stmt.executeQuery(); while (rs.next()) { String tableName = rs.getString(1); String viewDef = rs.getString(2); result.put(tableName, viewDef); } rs.close(); stmt.close(); return result; } private void createOrReplaceView(Connection connection, String schemaName, String tableName, String viewName, String ownerName) throws SQLException { PrintfFormat pf = new PrintfFormat(CREATE_VIEWSQL); String sql = pf.sprintf(new Object[]{viewName, schemaName, tableName}); Statement stmt = connection.createStatement(); try { stmt.execute(sql); pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(viewName); stmt.execute(sql); } catch (SQLException e) { // logger.warn(e.getMessage(), e); logger.info(sql == null ? "SQL=NULL" : "SQL=" + sql); throw e; } finally { stmt.close(); } // connection.commit(); } private void createOrReplaceExtraView(Connection connection, String schemaName, String tableName, String viewName, String ownerName, XGeosDataConfig xgeosConfig) throws SQLException { PrintfFormat pf = new PrintfFormat(CREATE_VIEWSQL); String sql = pf.sprintf(new Object[]{viewName, schemaName, tableName}); PrintfFormat pfWhere = new PrintfFormat(EXTRAWHERE_VIEWSQL); sql += pfWhere.sprintf(new String[]{tableName, Short.toString(xgeosConfig.getLEV()), tableName, Short.toString(xgeosConfig.getWEIGHT())}); Statement stmt = connection.createStatement(); stmt.execute(sql); pf = new PrintfFormat(ALTER_VIEWSQL + ownerName); sql = pf.sprintf(viewName); stmt.execute(sql); stmt.close(); // connection.commit(); } private Timestamp retrieveCurrentThemeTimestamp(Connection connection, short status) throws SQLException { StringBuilder sbSQL = new StringBuilder("SELECT vpttimestamp, vptname, vptstatus FROM "); sbSQL.append(DataReposVersionManager.XPTVERSIONTABLE_NAME); sbSQL.append(" WHERE vptstatus = "); sbSQL.append(status); sbSQL.append(" ORDER BY vptid"); Timestamp result = null; Statement stmt = null; ResultSet rs = null; try { stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); // get first result if (rs.next()) { result = rs.getTimestamp(1); } return result; } finally { if (rs != null) rs.close(); if (stmt != null) stmt.close(); } } private void updateCurrentThemeStatus(Connection connection, String themeTableName, short newStatus) throws SQLException { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(DataReposVersionManager.XPTVERSIONTABLE_NAME).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(newStatus); sbSQL.append(", vpttimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); sbSQL.append(themeTableName).append("'"); Statement stmt = null; try { stmt = connection.createStatement(); stmt.executeUpdate(sbSQL.toString()); } finally { if (stmt != null) stmt.close(); } } private boolean checkCurrentThemeStatus(Connection connection, short status) { try { return (retrieveCurrentThemeName(connection, status) != null); } catch (SQLException e) { logger.warn(e.getMessage(), e); return false; } } private String retrieveCurrentThemeName(Connection connection, short status) throws SQLException { StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vptname, vpttimestamp, vptstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sbSQL.append(" WHERE vptstatus = "); sbSQL.append(status); sbSQL.append("ORDER BY vptid"); String result = null; Statement stmt = null; ResultSet rs = null; try { stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); // get first result if (rs.next()) { result = rs.getString(1); } return result; } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } protected String[] retrieveTargetStoreAllViewNames(Connection connection) { try { final int TABLE_NAME_COL = 3; List<String> list = new ArrayList<String>(); DatabaseMetaData meta = connection.getMetaData(); // String[] tableType = { "TABLE", "VIEW" }; String[] tableType = { "VIEW" }; ResultSet tables = meta.getTables(null, _pgSchema, "%", tableType); while (tables.next()) { String tableName = tables.getString(TABLE_NAME_COL); list.add(tableName); /* if (allowTable(tableName)) { list.add(tableName); } */ } tables.close(); return (String[]) list.toArray(new String[list.size()]); } catch (SQLException e) { logger.warn(e.getMessage(), e); } return null; } public DataStore getTargetDataStore() { return targetDataStore; } protected void createTargetDataStore() throws JobExecutionException { if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } /* if (!isDriverFound()) { throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER); } */ if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MAXCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MAXCONN.key, "5"); } if (!pgProperties.containsKey(PostgisNGDataStoreFactory.MINCONN.key)) { pgProperties.put(PostgisNGDataStoreFactory.MINCONN.key, "1"); } if (!dataStoreFactory.canProcess(pgProperties)) { getLogger().warn("cannot process properties-"); throw new JobExecutionException("cannot process properties-"); } try { targetDataStore = dataStoreFactory.createDataStore(pgProperties); } catch (IOException e) { getLogger().warn(e.getMessage(), e); throw new JobExecutionException(e.getMessage(), e); } } protected void disconnect() { super.disconnect(); if (targetDataStore != null) { targetDataStore.dispose(); targetDataStore = null; } } private String determineTargetThemeTableName() throws IOException { if (targetDataStore == null) return null; Connection connection = null; Statement stmt = null; ResultSet rs = null; String targetTable = null; boolean needCreate = false; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); // Create XPTVERSIONTABLE_NAME needCreate = false; rs = connection.getMetaData().getTables(null, _pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME, new String[]{"TABLE"}); if (!rs.next()) needCreate = true; if (needCreate) { createXPWThemeVersionTable(connection, _pgSchema); } rs.close(); rs = null; StringBuilder sbSQL = new StringBuilder("SELECT "); sbSQL.append("vptname, vptstatus FROM "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append("ORDER BY vptid"); stmt = connection.createStatement(); rs = stmt.executeQuery(sbSQL.toString()); ArrayList<Object[]> tmpTablenames = new ArrayList<Object[]>(); int i = 0; int current = -1; while (rs.next()) { Object[] values = new Object[2]; values[0] = rs.getString("vptname"); values[1] = rs.getShort("vptstatus"); tmpTablenames.add(values); if (((Short) values[1]) >= DataReposVersionManager.VSSTATUS_LINKVIEW) { current = i; currentThemeTable = (String) values[0]; currentThemeStatus = (Short) values[1]; } i++; } if (current == -1) { Object[] values = tmpTablenames.get(0); targetTable = (String) values[0]; } else if (current < (tmpTablenames.size() - 1)) { Object[] values = tmpTablenames.get(current + 1); targetTable = (String) values[0]; } else { Object[] values = tmpTablenames.get(0); targetTable = (String) values[0]; } sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_COVERT); sbSQL.append(" WHERE vptname = '"); sbSQL.append(targetTable).append("'"); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetTable + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } return targetTable; } public String encodeSchemaTableName(String schemaName, String tableName) { if (schemaName == null) return "\"" + tableName + "\""; return "\"" + schemaName + "\".\"" + tableName + "\""; } private boolean convertDynamicColorThemeWithCopyAPI(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertDynamicColorThemeWithCopyAPI"); return false; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); while (connectionPG instanceof DelegatingConnection) { connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); } if (!(connectionPG instanceof PGConnection)) { return false; } final int MAX_BATCHSIZE = 250; ResultSet rs = null; Statement stmt = null; try { // connectionPG.setAutoCommit(false); DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); String targetTableName = targetTableBaseName + FDYNCOLOR_SUFFIX; String targetTempName = "tmp_" + targetTableName; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_COLORTAB); rs.setFetchSize(MAX_BATCHSIZE); createOrClearTempTargetTable(connectionPG, targetTempName, "(tid smallint not null, oid int not null, dyncolor varchar(10) not null)"); StringBuilder sb = new StringBuilder(); CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); PushbackReader reader = new PushbackReader(new StringReader(""), 10240); int count = 0; while (rs.next()) { int cid = rs.getInt(1); long oid = rs.getLong(2); int colorId = rs.getInt(3); String colorText = colorTable.getColorCode(colorId); if (cid > Short.MAX_VALUE) { logger.info("Wrong Color Table:" + cid + "-" + oid); continue; } sb.append(cid).append(','); sb.append(oid).append(','); sb.append(colorText).append("\n"); if (count % MAX_BATCHSIZE == 0) { reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); sb.delete(0, sb.length()); } ++count; } reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); createTargetTableIndexAndDropTemp(connectionPG, targetTableName, targetTempName, "tid, oid, dyncolor"); logger.info("Execute Copy Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } return true; } private boolean convertPowerOwnerThemeWithCopyAPI(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertPowerOwnerThemeWithCopyAPI"); return false; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); while (connectionPG instanceof DelegatingConnection) { connectionPG = ((DelegatingConnection) connectionPG).getDelegate(); } if (!(connectionPG instanceof PGConnection)) { return false; } final int MAX_BATCHSIZE = 250; ResultSet rs = null; Statement stmt = null; try { // connectionPG.setAutoCommit(false); String targetTableName = targetTableBaseName + FOWNER_SUFFIX; String targetTempName = "tmp_" + targetTableName; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_CONNFDR); rs.setFetchSize(MAX_BATCHSIZE); createOrClearTempTargetTable(connectionPG, targetTempName, "(tid smallint not null, oid int not null, fowner smallint not null, flow varchar(20) not null)"); StringBuilder sb = new StringBuilder(); CopyManager cpMgr = ((PGConnection) connectionPG).getCopyAPI(); PushbackReader reader = new PushbackReader(new StringReader(""), 10240); int count = 0; while (rs.next()) { int cid = rs.getInt(1); long oid = rs.getLong(2); int ownerId = rs.getInt(3); short dirId = (short) rs.getInt(4); String flowMark; ConnectivityDirectionEnum dir = ConnectivityDirectionEnum.convertShort(dirId); if ((ConnectivityDirectionEnum.ForwardflowON == dir) || (ConnectivityDirectionEnum.ForwardFixflowON == dir)) { flowMark = FORWARDFLOW_MARK; } else if ((ConnectivityDirectionEnum.BackflowON == dir) || (ConnectivityDirectionEnum.BackFixflowON == dir)) { flowMark = BACKFLOW_MARK; } else if (ConnectivityDirectionEnum.Nondeterminate == dir) { flowMark = NONFLOW_MARK; } else { flowMark = UNFLOW_MARK; } if (cid > Short.MAX_VALUE) { logger.info("Wrong Connectivity Table:" + cid + "-" + oid); continue; } sb.append(cid).append(','); sb.append(oid).append(','); sb.append(ownerId).append(','); sb.append(flowMark).append('\n'); if (count % MAX_BATCHSIZE == 0) { reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); sb.delete(0, sb.length()); } ++count; } reader.unread(sb.toString().toCharArray()); cpMgr.copyIn("COPY " + targetTempName + " FROM STDIN WITH CSV", reader); createTargetTableIndexAndDropTemp(connectionPG, targetTableName, targetTempName, "tid, oid, fowner, flow"); logger.info("Execute Copy Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } return true; } private void convertPowerOwnerTheme(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertPowerOwnerTheme"); return; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); boolean found = false; ResultSet rs = null; Statement stmt = null; PreparedStatement pstmt = null; try { connectionPG.setAutoCommit(false); String targetTableName = targetTableBaseName + FOWNER_SUFFIX; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_CONNFDR); rs.setFetchSize(50); createOrClearTargetTable(connectionPG, targetTableName, "(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, flow) VALUES (?, ?, ?, ?)" ); final int MAX_BATCHSIZE = 50; int count = 0; while (rs.next()) { 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) { pstmt.executeBatch(); } ++count; } pstmt.executeBatch(); createTargetTableIndex(connectionPG, targetTableName); logger.info("Execute Update Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(pstmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } } private void createOrClearTargetTable(Connection connection, String tableName, String sql) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("DROP TABLE " + encodeSchemaTableName(_pgSchema, tableName) + "CASCADE"); } stmt.executeUpdate("CREATE TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " " + sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void createTargetTableIndex(Connection connection, String tableName) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("ALTER TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " ADD PRIMARY KEY (tid, oid)"); } } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void createTargetTableIndexAndDropTemp(Connection connection, String tableName, String tempTable, String fields) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { boolean found = false; rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { found = true; } JDBCUtils.close(rs); if (!found) { stmt.execute("CREATE TABLE " + tableName +" AS SELECT * FROM " + tempTable); rs = connection.getMetaData().getTables(null, _pgSchema, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("ALTER TABLE " + encodeSchemaTableName(_pgSchema, tableName) + " ADD PRIMARY KEY (tid, oid)"); } } else { stmt.execute("TRUNCATE "+ tableName + " CASCADE"); stmt.execute("INSERT INTO " + tableName + "(" + fields + ") SELECT " + fields + " FROM " + tempTable); /* --insert into xpwtheme1_fdyncolor (tid, oid, dyncolor) select tid, oid, dyncolor from xpwtheme2_fdyncolor; --reindex table xpwtheme1_fdyncolor; --alter table xpwtheme1_fdyncolor drop constraint xpwtheme1_fdyncolor_pkey; --alter table xpwtheme1_fdyncolor ADD PRIMARY KEY (tid, oid); */ } stmt.execute("DROP TABLE " + tempTable); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void createOrClearTempTargetTable(Connection connection, String tableName, String sql) throws SQLException { Statement stmt = connection.createStatement(); ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, new String[]{"TABLE"}); if (rs.next()) { stmt.execute("DROP TABLE " + encodeSchemaTableName(null, tableName) + "CASCADE"); } stmt.executeUpdate("CREATE TEMP TABLE " + encodeSchemaTableName(null, tableName) + " " + sql); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); } } private void convertDynamicColorTheme(AbstractOracleJobContext context, String targetTableBaseName) throws IOException { if (context == null) { getLogger().info("jobContext is null in convertDynamicColorTheme"); return; } Connection connection = context.getOracleConnection(); Connection connectionPG = targetDataStore.getConnection(Transaction.AUTO_COMMIT); boolean found = false; ResultSet rs = null; Statement stmt = null; PreparedStatement pstmt = null; try { DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance(); String targetTableName = targetTableBaseName + FDYNCOLOR_SUFFIX; logger.info("target table:" + targetTableName); stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(FETCH_COLORTAB); rs.setFetchSize(50); createOrClearTargetTable(connectionPG, targetTableName, "(tid smallint not null, oid int not null, dyncolor varchar(10) not null)"); pstmt = connectionPG.prepareStatement("INSERT INTO " + encodeSchemaTableName(_pgSchema, targetTableName) + " (tid, oid, dyncolor) VALUES (?, ?, ?)" ); final int MAX_BATCHSIZE = 50; int count = 0; while (rs.next()) { int cid = rs.getInt(1); long oid = rs.getLong(2); int colorId = rs.getInt(3); String colorText = colorTable.getColorCode(colorId); pstmt.setShort(1, (short) cid); pstmt.setInt(2, (int) oid); pstmt.setString(3, colorText); pstmt.addBatch(); if (count % MAX_BATCHSIZE == 0) { pstmt.executeBatch(); } ++count; } pstmt.executeBatch(); createTargetTableIndex(connectionPG, targetTableName); logger.info("Execute Update Count=" + count); } catch (SQLException e) { logger.info(e.getMessage(), e); throw new IOException(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(pstmt); JDBCUtils.close(connectionPG, Transaction.AUTO_COMMIT, null); } } private void updatePWThemeStatusToReady(String targetSchema) { if (targetDataStore == null) return; Connection connection = null; Statement stmt = null; ResultSet rs = null; boolean needCreate = false; try { StringBuilder sbSQL = new StringBuilder("UPDATE "); sbSQL.append(encodeSchemaTableName(_pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)).append(' '); sbSQL.append(" SET vptstatus = "); sbSQL.append(DataReposVersionManager.VSSTATUS_READY); sbSQL.append(" , vpttimestamp = CURRENT_TIMESTAMP WHERE vptname = '"); sbSQL.append(targetSchema).append("'"); connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); stmt = connection.createStatement(); int count = stmt.executeUpdate(sbSQL.toString()); if (count != 1) { logger.info("update status for " + targetSchema + " update result count=" + count); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } catch (IOException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(rs); JDBCUtils.close(stmt); JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } } private void createXPWThemeVersionTable(Connection connection, String pgSchema) throws SQLException { Statement stmt = null; StringBuilder sql = new StringBuilder("CREATE TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" ( vptid serial PRIMARY KEY, "); sql.append(" vptname character varying(64) NOT NULL, "); sql.append(" vptstatus smallint NOT NULL, "); sql.append(" vpttimestamp timestamp with time zone ) "); try { stmt = connection.createStatement(); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("ALTER TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" OWNER TO ").append(_pgUsername); stmt.executeUpdate(sql.toString()); sql = new StringBuilder("GRANT ALL ON TABLE "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" TO public"); stmt.executeUpdate(sql.toString()); for (String schemaName : DataReposVersionManager.DEFAULTXPTVERSIONTABLE_NAMES) { sql = new StringBuilder("INSERT INTO "); sql.append(encodeSchemaTableName(pgSchema, DataReposVersionManager.XPTVERSIONTABLE_NAME)); sql.append(" (vptname, vptstatus) VALUES ('"); sql.append(schemaName).append("', "); sql.append(DataReposVersionManager.VSSTATUS_AVAILABLE).append(" )"); stmt.executeUpdate(sql.toString()); } } finally { if (stmt != null) stmt.close(); } } protected void transferThemesVersionStatus(Connection connection, short vsstatusBefore, short vsstatusAfter, boolean exclusive) throws JobExecutionException { try { String currentTargetTheme = retrieveCurrentThemeName(connection, vsstatusBefore); if (currentTargetTheme == null) { logger.info("Cannot found target schema in dataStore. status=" + vsstatusBefore); return; } String existTargetSchema = null; if (exclusive) existTargetSchema = retrieveCurrentThemeName(connection, vsstatusAfter); updateCurrentThemeStatus(connection, currentTargetTheme, vsstatusAfter); if ((exclusive) && (existTargetSchema != null)) { updateCurrentThemeStatus(connection, existTargetSchema, DataReposVersionManager.VSSTATUS_AVAILABLE); } } catch (SQLException e) { logger.warn(e.getMessage(), e); throw new JobExecutionException("Update " + DataReposVersionManager.XPTVERSIONTABLE_NAME + " has error-", e); } } protected void transferThemesVersionStatus(short vsstatusBefore, short vsstatusAfter, boolean exclusive) throws JobExecutionException { if (targetDataStore == null) return; Connection connection = null; try { connection = targetDataStore.getConnection(Transaction.AUTO_COMMIT); transferThemesVersionStatus(connection, vsstatusBefore, vsstatusAfter, exclusive); } catch (IOException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(connection, Transaction.AUTO_COMMIT, null); } } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleIncrementDgn2PostGISJob.java
@@ -5,6 +5,7 @@ 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; @@ -51,7 +52,7 @@ private static final String USEWKB = "USEWKB"; private static final int FETCHSIZE = 30; private static final int COMMITSIZE = 100; private static final int COMMITSIZE = 10; protected static PostgisNGDataStoreFactory dataStoreFactory = new PostgisNGDataStoreFactory(); @@ -97,6 +98,7 @@ @Override protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException { super.extractJobConfiguration(jobDetail); JobDataMap dataMap = jobDetail.getJobDataMap(); _pgHost = dataMap.getString(PGHOST); _pgDatabase = dataMap.getString(PGDATBASE); @@ -213,6 +215,7 @@ // Log the time the job started logger.info(jobName + " fired at " + new Date()); extractJobConfiguration(jobDetail); createSourceDataStore(); createTargetDataStore(); @@ -397,11 +400,14 @@ return; } // SELECT COUNT(*) FROM CMMS_POSTDB.GEO_EXCHANGE WHERE ISEXCHANGE <> 0 // SELECT COUNT(*) FROM CMMS_POSTDB.GEO_EXCHANGE WHERE ISEXCHANGE = 0 int exchangeCount = fetchExchangeCount(connection); logger.info("exchangeCount=" + exchangeCount); try { processIncrementElement(jobContext); processIncrementElement(jobContext, exchangeCount); // jobContext.setCurrentSchema(querySchema); } finally { } @@ -412,7 +418,7 @@ Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); ResultSet rs = null; StringBuilder sbSQL = new StringBuilder(); sbSQL.append("SELECT COUNT(*) FROM \"CMMS_POSTDB\".\"GEO_EXCHANGE\" WHERE ISEXCHANGE <> 0"); sbSQL.append("SELECT COUNT(*) FROM \"CMMS_POSTDB\".\"GEO_EXCHANGE\" WHERE ISEXCHANGE = 0"); int size = -1; try { @@ -433,14 +439,20 @@ Element element; }; private void processIncrementElement(OracleIncrementPostGISJobContext jobContext) throws SQLException { private void processIncrementElement(OracleIncrementPostGISJobContext jobContext, int exchangeCount) throws SQLException { Connection connection = jobContext.getOracleConnection(); // SELECT TAG_LUFID, TAG_SFSC, TAG_BCOMPID, TAG_SOCCID, STATUS, IGDSELM if (exchangeCount == 0) { logger.info("GEO_EXCHANGE ELEMENT COUNT IS ZERO."); return; } // SELECT ID, TAG_LUFID, TAG_SFSC, TAG_BCOMPID, TAG_SOCCID, STATUS, TASKID, IGDSELM // FROM CMMS_POSTDB.GEO_EXCHANGE ORDER BY UPDATETIME WHERE ISEXCHANGE <> 0 String fetchSrcStmtFmt = "SELECT TAG_LUFID, TAG_SFSC, TAG_BCOMPID, TAG_SOCCID, STATUS, TASKID IGDSELM " + "FROM \"%s\".\"%s\" ORDER BY UPDATETIME WHERE ISEXCHANGE <> 0"; //String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" WHERE TAG_SFSC = 423 AND TAG_LUFID = 21612065 ORDER BY ROWID"; String fetchSrcStmtFmt = "SELECT ID, TAG_LUFID, TAG_SFSC, TAG_BCOMPID, TAG_SOCCID, STATUS, TASKID, IGDSELM " + "FROM \"%s\".\"%s\" WHERE ISEXCHANGE = 0 ORDER BY UPDATETIME"; // String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" // WHERE TAG_SFSC = 423 AND TAG_LUFID = 21612065 ORDER BY ROWID"; PrintfFormat spf = new PrintfFormat(fetchSrcStmtFmt); String fetchSrcStmt = spf.sprintf(new Object[]{"CMMS_POSTDB", "GEO_EXCHANGE"}); Statement stmtSrc = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); @@ -448,23 +460,31 @@ stmtSrc.setFetchSize(FETCHSIZE); ResultSet rsSrc = stmtSrc.executeQuery(fetchSrcStmt); int igdsMetaType = rsSrc.getMetaData().getColumnType(1); ArrayList<Integer> transIds = new ArrayList<Integer>(); int step = exchangeCount / 100; int order = 0; int current = 0; jobContext.getExecutionContext().put("IncrementDgn2PostGISJobProgress", 0); while (rsSrc.next()) { if (isProfileMode()) { markQueryTime(); } ElementTransactionContext xContext = new ElementTransactionContext(); xContext.oid = rsSrc.getInt(1); xContext.cid = (short) rsSrc.getInt(2); xContext.compid = (short) rsSrc.getInt(3); xContext.occid = (short) rsSrc.getInt(4); xContext.transcationType = rsSrc.getInt(5); xContext.taskid = rsSrc.getInt(6); xContext.transcationId = rsSrc.getInt(1); xContext.oid = rsSrc.getInt(2); xContext.cid = (short) rsSrc.getInt(3); xContext.compid = (short) rsSrc.getInt(4); xContext.occid = (short) rsSrc.getInt(5); xContext.transcationType = rsSrc.getInt(6); xContext.taskid = rsSrc.getInt(7); try { if (xContext.transcationType > 2) { if (xContext.transcationType <= 2) { byte[] raw = null; if (igdsMetaType == Types.BLOB) { BLOB blob = (BLOB) rsSrc.getBlob(7); BLOB blob = (BLOB) rsSrc.getBlob(8); try { raw = getBytesFromBLOB(blob); @@ -474,7 +494,7 @@ // blob.close(); } } else { raw = rsSrc.getBytes(7); raw = rsSrc.getBytes(8); } if (raw != null) { Element element = fetchBinaryElement(raw); @@ -487,15 +507,88 @@ accumulateQueryTime(); } } } else { xContext.element = null; } jobContext.putFeatureCollection(xContext); if (xContext.transcationType > 1) { // remove first } jobContext.processFeatureContext(xContext); transIds.add(xContext.transcationId); } catch (Dgn7fileException e) { logger.warn("Dgn7Exception", e); } if ((order % COMMITSIZE) == 0) { // OracleConnection connection = jobContext.getOracleConnection(); // connection.commitTransaction(); jobContext.commitTransaction(); //jobContext.startTransaction(); System.gc(); System.runFinalization(); } if (step != 0) { int now = order % step; if (now != current) { current = now; jobContext.getExecutionContext().put("IncrementDgn2PostGISJobProgress", current); } } else { jobContext.getExecutionContext().put("IncrementDgn2PostGISJobProgress", current); current++; } } jobContext.getExecutionContext().put("IncrementDgn2PostGISJobProgress", 100); jobContext.commitTransaction(); jobContext.resetFeatureContext(); JDBCUtils.close(rsSrc); JDBCUtils.close(stmtSrc); if (!transIds.isEmpty()) { completeTransactionAction(connection, transIds); } } private void completeTransactionAction(Connection connection, ArrayList<Integer> transIds) { if (transIds.isEmpty()) return; boolean autoCommit = true; PreparedStatement statement = null; try { autoCommit = connection.getAutoCommit(); connection.setAutoCommit(false); String sql = "UPDATE \"CMMS_POSTDB\".\"GEO_EXCHANGE\" SET ISEXCHANGE=? WHERE ID=?"; statement = connection.prepareStatement(sql); for (int id : transIds) { statement.setInt((int) 1, 1); statement.setInt((int) 2, id); statement.executeUpdate(); } connection.commit(); } catch (SQLException e) { logger.warn(e.getMessage(), e); try { connection.rollback(); } catch (SQLException e1) { logger.warn(e.getMessage(), e1); } } finally { JDBCUtils.close(statement); try { connection.setAutoCommit(autoCommit); } catch (SQLException e) { logger.warn(e.getMessage(), e); } } } // Binary to Element xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/edbgeo/GeneralDgnConvertEdbGeoJobContext.java
@@ -281,6 +281,7 @@ double angle = textElement.getRotationAngle(); String content = textElement.getText(); content = content.replace('\u0000', ' '); content = content.trim(); angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); if (geom != null) { return SimpleFeatureBuilder.build(featureType, new Object[]{ xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java
@@ -107,7 +107,9 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|COMPID=" + linkage.getComponentID()))); (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size()); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java
@@ -100,7 +100,9 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|COMPID=" + linkage.getComponentID()))); (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size()); xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java
@@ -282,6 +282,7 @@ double angle = textElement.getRotationAngle(); String content = textElement.getText(); content = content.replace('\u0000', ' '); content = content.trim(); angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue(); if (geom != null) { return SimpleFeatureBuilder.build(featureType, new Object[]{ xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
@@ -137,7 +137,8 @@ } else { Coordinate pt = polygon.getEnvelopeInternal().centre(); String id = TPCLIDConverter.CoordinateToTpclId(pt); logger.info("cannot craete feature. " + element.toString() + "'" + logger.info("cannot craete feature. type=" + element.getElementType() + "'" + id + "'- from pt=" + pt); } return; xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java
@@ -122,7 +122,8 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|COMPID=" + linkage.getComponentID()))); (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; @@ -144,7 +145,8 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Empty Geom Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID()))); (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getUfid() + "|" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleIncrementPostGISJobContext.java
@@ -9,11 +9,13 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.util.Assert; @@ -73,6 +75,7 @@ private int accumulate = 0; public static class ElementTransactionContext { public int transcationId; public int transcationType; public short cid; public int oid; @@ -82,6 +85,7 @@ public Element element; public int result; }; public OracleIncrementPostGISJobContext(String dataPath, DataStore pgDS, String targetSchema, String filterConfig, boolean profileMode, boolean useTransform) { @@ -126,26 +130,122 @@ /** * STATUS 欄位 :0:新增 2:編輯 3:刪除設備 4:刪除元件 * * @param context */ public void putFeatureCollection(ElementTransactionContext context) { public void processFeatureContext(ElementTransactionContext context) { assert elementDispatcher != null; if (context == null) { logger.warn("putFeatureCollection context is null"); return; } SimpleFeature simpleFeature = null; if (context.transcationType == 0) { // insert Element putFeatureCollection(context.element); if (context.element != null) { simpleFeature = generateFeature(context.element); if (simpleFeature == null) return; } if (simpleFeature != null) { SimpleFeatureType featureType = simpleFeature.getFeatureType(); String bindingStmt = makePrepareInsertSql(featureType); logger.trace("Execute SQL(0):" + bindingStmt); executePrepareSQL(bindingStmt, simpleFeature); } } else if (context.transcationType == 2) { // Update Element if (context.element != null) { simpleFeature = generateFeature(context.element); if (simpleFeature == null) return; } if (simpleFeature != null) { SimpleFeatureType featureType = simpleFeature.getFeatureType(); // String deleteStmt = makePrepareDeleteSql(featureType); String deleteStmt = makePrepareDeleteSql(context); logger.trace("Execute SQL(2):" + deleteStmt); executeSQL(deleteStmt); String bindingStmt = makePrepareInsertSql(featureType); logger.trace("Execute SQL(2):" + bindingStmt); executePrepareSQL(bindingStmt, simpleFeature); } } else if (context.transcationType == 3) { // Remove Whole Feature String deleteStmt = makePrepareDeleteSql(context); logger.trace("Execute SQL(3):" + deleteStmt); executeSQL(deleteStmt); } else if (context.transcationType == 4) { // Remove Feature Part try { List<String> tableList = fetchExistTableSchema(getTargetSchema(), context); for (String targetTable : tableList) { String deleteStmt = makePrepareDeleteSql(context, targetTable); logger.trace("Execute SQL(4):" + deleteStmt); executeSQL(deleteStmt); } } catch (SQLException e) { logger.warn(e.getMessage(), e); } } } private SimpleFeature generateFeature(Element element) { assert elementDispatcher != null; // 判斷是否符和條件 SimpleFeature feature = elementDispatcher.execute(element, getDistId(), isTransformed()); 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" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size() + ":" + (linkage == null ? "NULL" : (linkage.getUfid()))); if (complex.size() == 0) isEmptySize = true; } /* if (getElementLogging() && (!isEmptySize)) { getElementLogger().logElement(element, getCurrentSchema()); } */ return null; } if (((Geometry) feature.getDefaultGeometry()).isEmpty()) { boolean isEmptySize = false; FrammeAttributeData linkage = AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Empty Geom Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; logger.warn("----Complex Element size=" + complex.size() + ":" + (linkage == null ? "NULL" : (linkage.getUfid()))); if (complex.size() == 0) isEmptySize = true; } /* if (getElementLogging() && (!isEmptySize)) { getElementLogger().logElement(element, getCurrentSchema()); } */ return null; } return feature; } /* protected void putFeatureCollection(Element element) { assert elementDispatcher != null; // 判斷是否符和條件 @@ -156,7 +256,8 @@ AbstractFLinkageDispatchableFilter.getFeatureLinkage(element); logger.warn("Unknown Element:" + element.getElementType().toString() + ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" + (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|COMPID=" + linkage.getComponentID()))); (linkage == null ? "NULL" : "FSC=" + (linkage.getFsc() + "|UFID=" + linkage.getUfid() + "|COMPID=" + linkage.getComponentID()))); if (element instanceof ComplexElement) { ComplexElement complex = (ComplexElement) element; @@ -204,6 +305,7 @@ commitTransaction(); } } */ public void startTransaction() { } @@ -233,6 +335,8 @@ private void updateDataStore() { if (isProfileMode()) markUpdateTime(); if (txFeaturesContext.keySet().isEmpty()) return; Iterator<SimpleFeatureType> it = txFeaturesContext.keySet().iterator(); Connection conn = null; try { @@ -366,31 +470,7 @@ protected void createOrClearFeatureDataTable(SimpleFeatureType featureType) throws SchemaException { String featureName = featureType.getTypeName(); Connection conn = null; if (isExistFeature(featureType)) { try { conn = getConnection(); if (dropTableMode) { dropGeometryColumn(conn, getTargetSchema(), featureName, (featureType).getGeometryDescriptor().getName().getLocalPart()); dropTable(conn, getTargetSchema(), featureName); ArrayList<String> schemaTexts = createNewSchemaTexts(conn, featureType); for (String stmtText : schemaTexts) { Statement stmt = conn.createStatement(); stmt.execute(stmtText); JDBCUtils.close(stmt); } } else { deleteTable(conn, getTargetSchema(), featureName); } } catch (IOException e) { logger.warn(e.getMessage(), e); } catch (SQLException e) { logger.warn(e.getMessage(), e); } finally { JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null); } } else { if (!isExistFeature(featureType)) { String tempStmt = null; try { conn = getConnection(); @@ -399,7 +479,7 @@ Statement stmt = conn.createStatement(); tempStmt = stmtText; stmt.execute(stmtText); stmt.close(); JDBCUtils.close(stmt); } JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null); } catch (IOException e) { @@ -417,4 +497,157 @@ public boolean isSchemaChanged() { return schemaChanged; } protected String getFeatureTableName(ElementTransactionContext elmContext, boolean forLookup) { StringBuilder sb = new StringBuilder(); sb.append("fsc-"); sb.append(elmContext.cid); if (!forLookup) { sb.append("-c-"); sb.append(elmContext.compid); } return sb.toString(); } List<String> fetchExistTableSchema(String schemaName, ElementTransactionContext elmContext) throws SQLException { Connection connection = getConnection(); String tablePattern = getFeatureTableName(elmContext, true); ResultSet rsMeta = connection.getMetaData().getTables(null, schemaName, tablePattern + "%", new String[]{"TABLE"}); ArrayList<String> tables = new ArrayList<String>(); try { while (rsMeta.next()) { String tablename = rsMeta.getString(3); tables.add(tablename); } // } catch (SQLException e) } finally { if (rsMeta != null) { rsMeta.close(); rsMeta = null; } } return tables; } @Override protected String makeInsertSql(SimpleFeature feature, int srid) { return super.makeInsertSql(feature, srid); } @Override protected String makePrepareInsertSql(SimpleFeatureType featureType) { return super.makePrepareInsertSql(featureType); } protected String makePrepareDeleteSql(ElementTransactionContext context) { String tableName = getFeatureTableName(context, false); return makePrepareDeleteSql(context, tableName); } private String makePrepareDeleteSql(ElementTransactionContext context, String targetTable) { StringBuilder stmtBuilder = new StringBuilder(); stmtBuilder.append("DELETE FROM "); String tableName = getFeatureTableName(context, false); stmtBuilder.append(encodeSchemaTableName(targetTable)); stmtBuilder.append(" WHERE tid="); stmtBuilder.append(context.cid); stmtBuilder.append(" AND oid="); stmtBuilder.append(context.oid); if (context.compid != -1) { stmtBuilder.append(" AND cid="); stmtBuilder.append(context.compid); } return stmtBuilder.toString(); } private void executeSQL(String sqlStmt) { Connection conn = null; Statement stmt = null; try { conn = getConnection(); stmt = conn.createStatement(); stmt.execute(sqlStmt); JDBCUtils.close(stmt); JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null); } catch (SQLException e) { JDBCUtils.close(stmt); JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); logger.warn("RUN--" + sqlStmt); logger.warn(e.getMessage(), e); } } private void executePrepareSQL(String sqlStmt, SimpleFeature feature) { Connection conn = null; PreparedStatement pstmt = null; try { conn = getConnection(); boolean autoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); pstmt = conn.prepareStatement(sqlStmt); try { // stmt.execute(feature); bindFeatureParameters(pstmt, feature); // pstmt.executeUpdate(); pstmt.addBatch(); } catch (PSQLException e) { if (sqlStmt != null) { logger.error("Execute:" + sqlStmt); } logger.error(e.getServerErrorMessage()); logger.error(e.getMessage(), e); } catch (NullPointerException e) { if (sqlStmt != null) { logger.error("Execute:" + sqlStmt); } logger.error(feature.toString()); logger.error(e.getMessage(), e); } catch (ClassCastException e) { if (sqlStmt != null) { logger.error("Execute:" + sqlStmt); } for (int i = 0; i < feature.getAttributeCount(); i++) { logger.info("attr[" + i + "]-" + ((feature.getAttribute(i) == null) ? " NULL" : feature.getAttribute(i).toString())); } logger.error(e.getMessage(), e); } int[] numUpdates = pstmt.executeBatch(); for (int i = 0; i < numUpdates.length; i++) { if (numUpdates[i] == -2) logger.warn("Execution " + i + ": unknown number of rows updated"); } conn.commit(); JDBCUtils.close(pstmt); logger.debug("End Save into PostGIS:" + feature.getFeatureType().getTypeName()); conn.setAutoCommit(autoCommit); JDBCUtils.close(conn, Transaction.AUTO_COMMIT, null); accumulate = 0; } catch (BatchUpdateException e) { JDBCUtils.close(pstmt); JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); logger.error(e.getMessage(), e); SQLException ex; while ((ex = e.getNextException()) != null) { // logger.warn(ex.getMessage(), ex); logger.warn(ex.getMessage()); } } catch (SQLException e) { JDBCUtils.close(pstmt); JDBCUtils.close(conn, Transaction.AUTO_COMMIT, e); logger.error(e.getMessage(), e); } finally { if (isProfileMode()) accumulateUpdateTime(); } } } xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java
@@ -127,7 +127,7 @@ "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( "context", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 254, ""))); "context", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 512, ""))); /* attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( @@ -387,7 +387,7 @@ "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( "context", createAttributeType(attrBuilder, "StringType", String.class, allowNull, 254, ""))); "context", createAttributeType(attrBuilder, "StringType", String.class, allowNull, 512, ""))); /* attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( @@ -455,7 +455,7 @@ "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20))); "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20, ""))); /* attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( @@ -692,7 +692,7 @@ "angle", createAttributeType(attrBuilder, "FloatType", Float.class, notAllowNull, 1, (float) 0.0))); attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20))); "symbol", createAttributeType(attrBuilder, "StringType", String.class, notAllowNull, 20, ""))); /* attrBuilder = new AttributeTypeBuilder(); attrDescs.add(attrBuilder.buildDescriptor( xdgnjobs/ximple-spatialjob/src/main/resources/conf/DefaultConvertShpFilter.xmlold mode 100644 new mode 100755
@@ -1,10 +1,10 @@ <?xml version="1.0" encoding="big5" ?> <?xml version="1.0" encoding="utf-8" ?> <ElementDispatcherRules> <!-- High Voltage Features --> <TypeCompFilter name="FSC-106.C-0"> <tid>106</tid> <cid>0</cid> <description>¥D°ªÀ£½u</description> <description>主高壓線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -14,7 +14,7 @@ <TypeCompFilter name="FSC-106.C-1"> <tid>106</tid> <cid>1</cid> <description>°ªÀ£½u¤Þ½u</description> <description>高壓線引線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -24,7 +24,7 @@ <TypeCompFilter name="FSC-106.C-2"> <tid>106</tid> <cid>2</cid> <description>°ªÀ£½u¤Þ½uµù°O</description> <description>高壓線引線註記</description> <elementCriterion> <elementType>7</elementType> </elementCriterion> @@ -33,7 +33,7 @@ <TypeCompFilter name="FSC-106.C-4"> <tid>106</tid> <cid>4</cid> <description>°ªÀ£½uõX½u¥N¸¹¤Þ½uµù°O</description> <description>高壓線饋線代號引線註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -42,7 +42,7 @@ <TypeCompFilter name="FSC-106.C-5"> <tid>106</tid> <cid>5</cid> <description>½u¸ô¬Û§Ç</description> <description>線路相序</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -51,7 +51,7 @@ <TypeCompFilter name="FSC-402.C-0"> <tid>402</tid> <cid>0</cid> <description>Åܹq©Ò</description> <description>變電所</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -60,7 +60,7 @@ <TypeCompFilter name="FSC-402.C-1"> <tid>402</tid> <cid>1</cid> <description>Åܹq©Òµù°O</description> <description>變電所註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -70,7 +70,7 @@ <TypeCompFilter name="FSC-402.C-2"> <tid>402</tid> <cid>2</cid> <description>Åܹq©Ò¤¤¤åµù°O</description> <description>變電所中文註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -80,7 +80,7 @@ <TypeCompFilter name="FSC-411.C-0"> <tid>411</tid> <cid>0</cid> <description>°t¹q³õ</description> <description>配電場</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -89,7 +89,7 @@ <TypeCompFilter name="FSC-411.C-1"> <tid>411</tid> <cid>1</cid> <description>°t¹q³õµù°O</description> <description>配電場註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -99,7 +99,7 @@ <TypeCompFilter name="FSC-411.C-2"> <tid>411</tid> <cid>2</cid> <description>°t¹q³õ-1/600</description> <description>配電場-1/600</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -108,7 +108,7 @@ <TypeCompFilter name="FSC-411.C-3"> <tid>411</tid> <cid>3</cid> <description>°t¹q³õµù°O-1/600</description> <description>配電場註記-1/600</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -118,7 +118,7 @@ <TypeCompFilter name="FSC-411.C-4"> <tid>411</tid> <cid>3</cid> <description>§CÀ£¨t²Î¹Ï-°t¹q«Ç®y¼Ðµù°O</description> <description>低壓系統圖-配電室座標註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -128,7 +128,7 @@ <TypeCompFilter name="FSC-411.C-5"> <tid>411</tid> <cid>3</cid> <description>¸ô¿O¨t²Î¹Ï-°t¹q«Ç®y¼Ðµù°O</description> <description>路燈系統圖-配電室座標註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -138,7 +138,7 @@ <TypeCompFilter name="FSC-411.C-6"> <tid>411</tid> <cid>3</cid> <description>¥úÆl¨t²Î¹Ï-°t¹q«Ç®y¼Ðµù°O</description> <description>光纜系統圖-配電室座標註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -148,7 +148,7 @@ <TypeCompFilter name="FSC-411.C-7"> <tid>411</tid> <cid>7</cid> <description>°t¹q³õ1/600¤Þ¤W¤U²Å¸¹</description> <description>配電場1/600引上下符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -157,7 +157,7 @@ <TypeCompFilter name="FSC-411.C-8"> <tid>411</tid> <cid>8</cid> <description>°t¹q³õ1/1200¤Þ¤W¤U²Å¸¹</description> <description>配電場1/1200引上下符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -166,7 +166,7 @@ <TypeCompFilter name="FSC-417.C-0"> <tid>417</tid> <cid>0</cid> <description>¦@ºc§ë®Æ¤Õ</description> <description>共構投料孔</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -175,7 +175,7 @@ <TypeCompFilter name="FSC-417.C-1"> <tid>417</tid> <cid>1</cid> <description>¦@ºc§ë®Æ¤Õµù°O</description> <description>共構投料孔註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -184,7 +184,7 @@ <TypeCompFilter name="FSC-419.C-0"> <tid>419</tid> <cid>0</cid> <description>³s±µ¤Õ</description> <description>連接孔</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -193,7 +193,7 @@ <TypeCompFilter name="FSC-419.C-1"> <tid>419</tid> <cid>1</cid> <description>³s±µ¤Õ¹Ï¸¹®y¼Ð</description> <description>連接孔圖號座標</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -202,7 +202,7 @@ <TypeCompFilter name="FSC-420.C-0"> <tid>420</tid> <cid>0</cid> <description>ºÞ·¾</description> <description>管溝</description> <elementCriterion> <elementType>6</elementType> </elementCriterion> @@ -211,7 +211,7 @@ <TypeCompFilter name="FSC-420.C-1"> <tid>420</tid> <cid>1</cid> <description>ºÞ·¾µù°O</description> <description>管溝註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -220,7 +220,7 @@ <TypeCompFilter name="FSC-421.C-0"> <tid>421</tid> <cid>0</cid> <description>¦@¦PºÞ¹D</description> <description>共同管道</description> <elementCriterion> <elementType>6</elementType> </elementCriterion> @@ -229,66 +229,16 @@ <TypeCompFilter name="FSC-421.C-1"> <tid>421</tid> <cid>1</cid> <description>¦@¦PºÞ¹Dµù°O</description> <description>共同管道註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-0"> <tid>423</tid> <cid>0</cid> <description>ºÞ¸ôÂ_±</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <MultiSymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-1"> <tid>423</tid> <cid>1</cid> <description>ºÞ¸ôÂ_±¤Þ½u</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-2"> <tid>423</tid> <cid>2</cid> <description>ªø«×µù°O</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-3"> <tid>423</tid> <cid>3</cid> <description>¬ï½uµù°O</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-4"> <tid>423</tid> <cid>4</cid> <description>ºÞ¸ôÂ_±»²§U½u</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-424.C-0"> <tid>424</tid> <cid>0</cid> <description>¯S®í¤uªkºX¼Ð²Å¸¹</description> <description>特殊工法旗標符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -297,7 +247,7 @@ <TypeCompFilter name="FSC-501.C-0"> <tid>501</tid> <cid>0</cid> <description>»Ùê³òÆX</description> <description>障礙圍籬</description> <elementCriterion> <elementType>6</elementType> </elementCriterion> @@ -306,7 +256,7 @@ <TypeCompFilter name="FSC-501.C-1"> <tid>501</tid> <cid>1</cid> <description>»Ùê³òÆX¤å¦rµù°O</description> <description>障礙圍籬文字註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -315,7 +265,7 @@ <TypeCompFilter name="FSC-502.C-0"> <tid>502</tid> <cid>0</cid> <description>°ÝÃD³òÆX</description> <description>問題圍籬</description> <elementCriterion> <elementType>6</elementType> </elementCriterion> @@ -324,7 +274,7 @@ <TypeCompFilter name="FSC-502.C-1"> <tid>502</tid> <cid>1</cid> <description>°ÝÃD³òÆX¤å¦rµù°O</description> <description>問題圍籬文字註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -333,7 +283,7 @@ <TypeCompFilter name="FSC-405.C-0"> <tid>405</tid> <cid>0</cid> <description>±µ½u²°</description> <description>接線盒</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -342,7 +292,7 @@ <TypeCompFilter name="FSC-405.C-1"> <tid>405</tid> <cid>1</cid> <description>±µ½u²°¤å¦rµù°O</description> <description>接線盒文字註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -351,7 +301,7 @@ <TypeCompFilter name="FSC-418.C-0"> <tid>418</tid> <cid>0</cid> <description>¤Hû¥X¤J¤f</description> <description>人員出入口</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -360,7 +310,7 @@ <TypeCompFilter name="FSC-418.C-1"> <tid>418</tid> <cid>1</cid> <description>¤Hû¥X¤J¤f¤å¦rµù°O</description> <description>人員出入口文字註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -369,7 +319,7 @@ <TypeCompFilter name="FSC-503.C-0"> <tid>503</tid> <cid>0</cid> <description>¤å¦rµù°O</description> <description>文字註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -378,7 +328,7 @@ <TypeCompFilter name="FSC-407.C-0"> <tid>407</tid> <cid>0</cid> <description>¹q±ì</description> <description>電桿</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -387,7 +337,7 @@ <TypeCompFilter name="FSC-407.C-1"> <tid>407</tid> <cid>1</cid> <description>¹q±ìµù°O</description> <description>電桿註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -397,7 +347,7 @@ <TypeCompFilter name="FSC-407.C-2"> <tid>407</tid> <cid>2</cid> <description>¹q±ì-1/600</description> <description>電桿-1/600</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -406,7 +356,7 @@ <TypeCompFilter name="FSC-407.C-3"> <tid>407</tid> <cid>3</cid> <description>¹q±ì-1/600µù°O</description> <description>電桿-1/600註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -416,7 +366,7 @@ <TypeCompFilter name="FSC-407.C-5"> <tid>407</tid> <cid>5</cid> <description>®y¼Ðµù°O</description> <description>座標註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -425,7 +375,7 @@ <TypeCompFilter name="FSC-407.C-7"> <tid>407</tid> <cid>7</cid> <description>1/600¹q±ì¤Þ¤W¤U²Å¸¹</description> <description>1/600電桿引上下符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -434,7 +384,7 @@ <TypeCompFilter name="FSC-407.C-8"> <tid>407</tid> <cid>8</cid> <description>1/1200¹q±ì¤Þ¤W¤U²Å¸¹</description> <description>1/1200電桿引上下符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -443,7 +393,7 @@ <TypeCompFilter name="FSC-407.C-9"> <tid>407</tid> <cid>9</cid> <description>¹q±ì¤ô¥¤ä½u</description> <description>電桿水平支線</description> <elementCriterion> <elementType>4</elementType> <elementType>17</elementType> @@ -453,7 +403,7 @@ <TypeCompFilter name="FSC-407.C-10"> <tid>407</tid> <cid>10</cid> <description>¹q±ì¤ô¥¤ä½u³»»\</description> <description>電桿水平支線頂蓋</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -462,7 +412,7 @@ <TypeCompFilter name="FSC-407.C-11"> <tid>407</tid> <cid>11</cid> <description>¹q±ì¤ô¥¤ä½u³»»\</description> <description>電桿水平支線頂蓋</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -471,7 +421,16 @@ <TypeCompFilter name="FSC-407.C-12"> <tid>407</tid> <cid>12</cid> <description>¹q±ì±ì¸¹</description> <description>電桿桿號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-407.C-13"> <tid>407</tid> <cid>13</cid> <description>電桿桿高</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -480,7 +439,7 @@ <TypeCompFilter name="FSC-114.C-0"> <tid>114</tid> <cid>0</cid> <description>¶}Ãö</description> <description>開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -489,7 +448,7 @@ <TypeCompFilter name="FSC-114.C-1"> <tid>114</tid> <cid>1</cid> <description>¶}Ãö°j¸ôµù°O</description> <description>開關迴路註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -499,7 +458,7 @@ <TypeCompFilter name="FSC-114.C-2"> <tid>114</tid> <cid>2</cid> <description>¶}Ãö¤p¬P¸¹</description> <description>開關小星號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -508,7 +467,7 @@ <TypeCompFilter name="FSC-114.C-3"> <tid>114</tid> <cid>3</cid> <description>¶}Ãö¤j¬P¸¹</description> <description>開關大星號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -517,7 +476,7 @@ <TypeCompFilter name="FSC-122.C-0"> <tid>122</tid> <cid>0</cid> <description>ª½±µ³s±µ</description> <description>直接連接</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -528,7 +487,7 @@ <TypeCompFilter name="FSC-122.C-1"> <tid>122</tid> <cid>1</cid> <description>ª½±µ³s±µµù°O</description> <description>直接連接註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -538,7 +497,7 @@ <TypeCompFilter name="FSC-107.C-0"> <tid>107</tid> <cid>0</cid> <description>°ªÀ£¥Î¤á</description> <description>高壓用戶</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -547,7 +506,7 @@ <TypeCompFilter name="FSC-107.C-1"> <tid>107</tid> <cid>1</cid> <description>°ªÀ£¥Î¤áµù°O</description> <description>高壓用戶註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -557,7 +516,7 @@ <TypeCompFilter name="FSC-107.C-2"> <tid>107</tid> <cid>2</cid> <description>°ªÀ£¥Î¤á¤¤¤åµù°O</description> <description>高壓用戶中文註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -567,7 +526,7 @@ <TypeCompFilter name="FSC-117.C-0"> <tid>117</tid> <cid>0</cid> <description>TieÅÜÀ£¾¹</description> <description>Tie變壓器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -576,7 +535,7 @@ <TypeCompFilter name="FSC-105.C-0"> <tid>105</tid> <cid>0</cid> <description>ª½¸ô±µÀY</description> <description>直路接頭</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -585,7 +544,7 @@ <TypeCompFilter name="FSC-105.C-1"> <tid>105</tid> <cid>1</cid> <description>ª½¸ô±µÀYµù°O</description> <description>直路接頭註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -594,7 +553,7 @@ <TypeCompFilter name="FSC-101.C-0"> <tid>101</tid> <cid>0</cid> <description>¶×¬y±Æ</description> <description>匯流排</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -604,7 +563,7 @@ <TypeCompFilter name="FSC-120.C-0"> <tid>120</tid> <cid>0</cid> <description>¸`ÂI</description> <description>節點</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -613,7 +572,7 @@ <TypeCompFilter name="FSC-150.C-0"> <tid>150</tid> <cid>0</cid> <description>¨â¸ô¶}Ãö</description> <description>兩路開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -622,7 +581,7 @@ <TypeCompFilter name="FSC-130.C-0"> <tid>130</tid> <cid>0</cid> <description>¾É½u¥æ¤e</description> <description>導線交叉</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -631,7 +590,7 @@ <TypeCompFilter name="FSC-131.C-0"> <tid>131</tid> <cid>0</cid> <description>¾É½uÅܧó</description> <description>導線變更</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -640,7 +599,7 @@ <TypeCompFilter name="FSC-109.C-0"> <tid>109</tid> <cid>0</cid> <description>¸õ½u³s±µ</description> <description>跳線連接</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -649,7 +608,7 @@ <TypeCompFilter name="FSC-116.C-0"> <tid>116</tid> <cid>0</cid> <description>°ªÀ£²×ºÝ</description> <description>高壓終端</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -658,7 +617,7 @@ <TypeCompFilter name="FSC-108.C-0"> <tid>108</tid> <cid>0</cid> <description>Â_¸ô¾¹</description> <description>斷路器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -667,7 +626,7 @@ <TypeCompFilter name="FSC-108.C-1"> <tid>108</tid> <cid>1</cid> <description>Â_¸ô¾¹µù°O</description> <description>斷路器註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -677,7 +636,7 @@ <TypeCompFilter name="FSC-119.C-0"> <tid>119</tid> <cid>0</cid> <description>¹qÅæ</description> <description>電驛</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -686,7 +645,7 @@ <TypeCompFilter name="FSC-115.C-0"> <tid>115</tid> <cid>0</cid> <description>ÅÜÀ£¾¹</description> <description>變壓器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -695,7 +654,7 @@ <TypeCompFilter name="FSC-115.C-1"> <tid>115</tid> <cid>1</cid> <description>ÅÜÀ£¾¹µù°O</description> <description>變壓器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -705,7 +664,7 @@ <TypeCompFilter name="FSC-115.C-2"> <tid>115</tid> <cid>2</cid> <description>¸ô¿O¨t²Î¹ÏÅÜÀ£¾¹</description> <description>路燈系統圖變壓器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -714,7 +673,7 @@ <TypeCompFilter name="FSC-115.C-3"> <tid>115</tid> <cid>3</cid> <description>¸ô¿O¨t²Î¹ÏÅÜÀ£¾¹µù°O</description> <description>路燈系統圖變壓器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -724,7 +683,7 @@ <TypeCompFilter name="FSC-115.C-4"> <tid>115</tid> <cid>4</cid> <description>§CÀ£¨t²Î¹ÏÅÜÀ£¾¹</description> <description>低壓系統圖變壓器</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -734,7 +693,7 @@ <TypeCompFilter name="FSC-115.C-5"> <tid>115</tid> <cid>5</cid> <description>§CÀ£¨t²Î¹ÏÅÜÀ£¾¹µù°O</description> <description>低壓系統圖變壓器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -744,7 +703,7 @@ <TypeCompFilter name="FSC-115.C-6"> <tid>115</tid> <cid>6</cid> <description>§CÀ£¨t²Î¹Ï-°t¹q«Ç®y¼Ðµù°O</description> <description>低壓系統圖-配電室座標註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -754,7 +713,7 @@ <TypeCompFilter name="FSC-115.C-7"> <tid>115</tid> <cid>7</cid> <description>§CÀ£¨t²Î¹Ï-°t¹q«Ç®y¼Ðµù°O</description> <description>低壓系統圖-配電室座標註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -764,7 +723,7 @@ <TypeCompFilter name="FSC-115.C-8"> <tid>115</tid> <cid>8</cid> <description>¬[ªÅÅÜÀ£¾¹(¦a¤U§CÀ£¥Î)µù°O</description> <description>架空變壓器(地下低壓用)註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -774,7 +733,7 @@ <TypeCompFilter name="FSC-115.C-91"> <tid>115</tid> <cid>91</cid> <description>ÅÜÀ£¾¹©µ¦ù³s±µ½u</description> <description>變壓器延伸連接線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -784,7 +743,7 @@ <TypeCompFilter name="FSC-118.C-0"> <tid>118</tid> <cid>0</cid> <description>¥DÅÜÀ£¾¹</description> <description>主變壓器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -793,7 +752,7 @@ <TypeCompFilter name="FSC-102.C-0"> <tid>102</tid> <cid>0</cid> <description>¹q®e¾¹</description> <description>電容器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -802,7 +761,7 @@ <TypeCompFilter name="FSC-100.C-0"> <tid>100</tid> <cid>0</cid> <description>Á×¹p¾¹</description> <description>避雷器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -811,7 +770,7 @@ <TypeCompFilter name="FSC-140.C-0"> <tid>140</tid> <cid>0</cid> <description>°ªÀ£½u¸ô(½u¸ô¹Ï¥Î)</description> <description>高壓線路(線路圖用)</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -821,7 +780,7 @@ <TypeCompFilter name="FSC-140.C-1"> <tid>140</tid> <cid>1</cid> <description>¤Þ½u(½u¸ô¹Ï¥Î)</description> <description>引線(線路圖用)</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -831,7 +790,7 @@ <TypeCompFilter name="FSC-140.C-2"> <tid>140</tid> <cid>2</cid> <description>¾É½uµù°O(½u¸ô¹Ï¥Î)</description> <description>導線註記(線路圖用)</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -841,7 +800,7 @@ <TypeCompFilter name="FSC-140.C-3"> <tid>140</tid> <cid>3</cid> <description>õX½u¥N¸¹¤Þ½u(½u¸ô¹Ï¥Î)</description> <description>饋線代號引線(線路圖用)</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> @@ -851,7 +810,7 @@ <TypeCompFilter name="FSC-140.C-4"> <tid>140</tid> <cid>4</cid> <description>õX½u¥N¸¹µù°O(½u¸ô¹Ï¥Î)</description> <description>饋線代號註記(線路圖用)</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -861,7 +820,7 @@ <TypeCompFilter name="FSC-151.C-0"> <tid>150</tid> <cid>0</cid> <description>±`³¬¶}Ãö</description> <description>常閉開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -871,17 +830,17 @@ <TypeCompFilter name="FSC-200.C-0"> <tid>200</tid> <cid>0</cid> <description>§CÀ£¸`ÂI</description> <description>低壓節點</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <!-- *****§CÀ£****** --> <!-- *****低壓****** --> <TypeCompFilter name="FSC-201.C-0"> <tid>201</tid> <cid>0</cid> <description>±µ¤á½u</description> <description>接戶線</description> <elementCriterion> <elementType>12</elementType> <elementType>16</elementType> @@ -892,7 +851,7 @@ <TypeCompFilter name="FSC-201.C-1"> <tid>201</tid> <cid>1</cid> <description>±µ¤á½uµù°O</description> <description>接戶線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -902,7 +861,7 @@ <TypeCompFilter name="FSC-201.C-2"> <tid>201</tid> <cid>2</cid> <description>±µ¤á½uªø«×µù°O</description> <description>接戶線長度註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -912,7 +871,7 @@ <TypeCompFilter name="FSC-202.C-0"> <tid>202</tid> <cid>0</cid> <description>±µ¤áÂI</description> <description>接戶點</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -921,7 +880,7 @@ <TypeCompFilter name="FSC-202.C-1"> <tid>202</tid> <cid>1</cid> <description>±µ¤áÂIªùµPµù°O</description> <description>接戶點門牌註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -931,7 +890,7 @@ <TypeCompFilter name="FSC-203.C-0"> <tid>203</tid> <cid>0</cid> <description>¸ô¿O³d¥ô¤À¬ÉÂI</description> <description>路燈責任分界點</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -940,7 +899,7 @@ <TypeCompFilter name="FSC-203.C-1"> <tid>203</tid> <cid>1</cid> <description>¸ô¿O³d¥ô¤À¬ÉÂIµù°O</description> <description>路燈責任分界點註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -950,7 +909,7 @@ <TypeCompFilter name="FSC-204.C-0"> <tid>204</tid> <cid>0</cid> <description>§CÀ£¸õ½u</description> <description>低壓跳線</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -959,7 +918,7 @@ <TypeCompFilter name="FSC-205.C-0"> <tid>205</tid> <cid>0</cid> <description>§CÀ£¾É½u</description> <description>低壓導線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -969,7 +928,7 @@ <TypeCompFilter name="FSC-205.C-1"> <tid>205</tid> <cid>1</cid> <description>§CÀ£¾É½uµù°O</description> <description>低壓導線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -979,7 +938,7 @@ <TypeCompFilter name="FSC-205.C-2"> <tid>205</tid> <cid>2</cid> <description>§CÀ£¾É½uªø«×µù°O</description> <description>低壓導線長度註記</description> <elementCriterion> <elementType>7</elementType> </elementCriterion> @@ -988,7 +947,7 @@ <TypeCompFilter name="FSC-206.C-0"> <tid>206</tid> <cid>0</cid> <description>§CÀ£»»±±½c</description> <description>低壓遙控箱</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -997,7 +956,7 @@ <TypeCompFilter name="FSC-206.C-1"> <tid>206</tid> <cid>1</cid> <description>§CÀ£»»±±½cµù°O</description> <description>低壓遙控箱註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1007,7 +966,7 @@ <TypeCompFilter name="FSC-206.C-2"> <tid>206</tid> <cid>2</cid> <description>§CÀ£»»±±½cªùµPµù°O</description> <description>低壓遙控箱門牌註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1017,7 +976,7 @@ <TypeCompFilter name="FSC-207.C-0"> <tid>207</tid> <cid>0</cid> <description>§CÀ£Äµ³ø¾¹</description> <description>低壓警報器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1026,7 +985,7 @@ <TypeCompFilter name="FSC-207.C-1"> <tid>207</tid> <cid>1</cid> <description>§CÀ£Äµ³ø¾¹µù°O</description> <description>低壓警報器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1036,7 +995,7 @@ <TypeCompFilter name="FSC-207.C-2"> <tid>207</tid> <cid>2</cid> <description>§CÀ£Äµ³ø¾¹ªùµPµù°O</description> <description>低壓警報器門牌註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1046,7 +1005,7 @@ <TypeCompFilter name="FSC-208.C-0"> <tid>208</tid> <cid>0</cid> <description>§CÀ£²×ºÝ</description> <description>低壓終端</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1055,7 +1014,7 @@ <TypeCompFilter name="FSC-209.C-0"> <tid>209</tid> <cid>0</cid> <description>§CÀ£¥æ³q¸¹»x</description> <description>低壓交通號誌</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1064,7 +1023,7 @@ <TypeCompFilter name="FSC-209.C-1"> <tid>209</tid> <cid>1</cid> <description>§CÀ£¥æ³q¸¹»xµù°O</description> <description>低壓交通號誌註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1074,7 +1033,7 @@ <TypeCompFilter name="FSC-210.C-0"> <tid>210</tid> <cid>0</cid> <description>§CÀ£¦a¤U¾É½u</description> <description>低壓地下導線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1085,7 +1044,7 @@ <TypeCompFilter name="FSC-210.C-1"> <tid>210</tid> <cid>1</cid> <description>§CÀ£¦a¤U¾É½u¥´ÂI²Å¸¹</description> <description>低壓地下導線打點符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1094,7 +1053,7 @@ <TypeCompFilter name="FSC-210.C-2"> <tid>210</tid> <cid>2</cid> <description>§CÀ£¦a¤U¾É½uªø«×µù°O</description> <description>低壓地下導線長度註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1103,7 +1062,7 @@ <TypeCompFilter name="FSC-210.C-3"> <tid>210</tid> <cid>3</cid> <description>§CÀ£¦a¤U¾É½u²Å¸¹</description> <description>低壓地下導線符號</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1113,7 +1072,7 @@ <TypeCompFilter name="FSC-210.C-4"> <tid>210</tid> <cid>4</cid> <description>§CÀ£¦a¤U¾É½uµù°O</description> <description>低壓地下導線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1123,7 +1082,7 @@ <TypeCompFilter name="FSC-211.C-0"> <tid>211</tid> <cid>0</cid> <description>§CÀ£¬[ªÅ±µ¤á½u</description> <description>低壓架空接戶線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1133,7 +1092,7 @@ <TypeCompFilter name="FSC-211.C-1"> <tid>211</tid> <cid>1</cid> <description>§CÀ£¬[ªÅ±µ¤á½uµù°O</description> <description>低壓架空接戶線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1143,7 +1102,7 @@ <TypeCompFilter name="FSC-211.C-2"> <tid>211</tid> <cid>2</cid> <description>§CÀ£¬[ªÅ±µ¤á½uªø«×µù°O</description> <description>低壓架空接戶線長度註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1153,7 +1112,7 @@ <TypeCompFilter name="FSC-212.C-0"> <tid>212</tid> <cid>0</cid> <description>§CÀ£¬[ªÅ³s±µ±µ¤á½u</description> <description>低壓架空連接接戶線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1163,7 +1122,7 @@ <TypeCompFilter name="FSC-212.C-1"> <tid>212</tid> <cid>1</cid> <description>§CÀ£¬[ªÅ³s±µ±µ¤á½uµù°O</description> <description>低壓架空連接接戶線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1173,7 +1132,7 @@ <TypeCompFilter name="FSC-212.C-2"> <tid>212</tid> <cid>2</cid> <description>§CÀ£¬[ªÅ³s±µ±µ¤á½uªø«×µù°O</description> <description>低壓架空連接接戶線長度註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1183,7 +1142,7 @@ <TypeCompFilter name="FSC-213.C-0"> <tid>213</tid> <cid>0</cid> <description>§CÀ£¦a¤U³s±µ±µ¤á½u</description> <description>低壓地下連接接戶線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1194,7 +1153,7 @@ <TypeCompFilter name="FSC-213.C-1"> <tid>213</tid> <cid>1</cid> <description>§CÀ£¦a¤U³s±µ±µ¤á½uµù°O</description> <description>低壓地下連接接戶線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1204,7 +1163,7 @@ <TypeCompFilter name="FSC-213.C-2"> <tid>213</tid> <cid>2</cid> <description>§CÀ£¦a¤U³s±µ±µ¤á½uªø«×µù°O</description> <description>低壓地下連接接戶線長度註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1214,7 +1173,7 @@ <TypeCompFilter name="FSC-215.C-0"> <tid>215</tid> <cid>0</cid> <description>§CÀ£¦Û°Êt¸ü¤Á´«¶}Ãö</description> <description>低壓自動負載切換開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1223,7 +1182,7 @@ <TypeCompFilter name="FSC-216.C-0"> <tid>216</tid> <cid>0</cid> <description>¦a¤U§CÀ£ºÊµø¾¹</description> <description>地下低壓監視器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1232,7 +1191,7 @@ <TypeCompFilter name="FSC-216.C-1"> <tid>216</tid> <cid>1</cid> <description>§CÀ£ºÊµø¾¹µù°O</description> <description>低壓監視器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1242,7 +1201,7 @@ <TypeCompFilter name="FSC-216.C-2"> <tid>216</tid> <cid>2</cid> <description>§CÀ£ºÊµø¾¹ªùµPµù°O</description> <description>低壓監視器門牌註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1252,17 +1211,17 @@ <TypeCompFilter name="FSC-217.C-0"> <tid>217</tid> <cid>0</cid> <description>§CÀ£¦a¤U´å¥ð</description> <description>低壓地下游休</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <!-- ¥úÆl --> <!-- 光纜 --> <TypeCompFilter name="FSC-300.C-0"> <tid>300</tid> <cid>0</cid> <description>³q°T¥úÆl½u</description> <description>通訊光纜線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1272,7 +1231,7 @@ <TypeCompFilter name="FSC-300.C-1"> <tid>300</tid> <cid>1</cid> <description>¥úÅÖ¹qÆl«¬¦¡(ªø«×)µù°O</description> <description>光纖電纜型式(長度)註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1282,7 +1241,7 @@ <TypeCompFilter name="FSC-300.C-2"> <tid>300</tid> <cid>2</cid> <description>¥úÅÖ¹qÆl¤å¦r»¡©úµù°O</description> <description>光纖電纜文字說明註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1292,7 +1251,7 @@ <TypeCompFilter name="FSC-300.C-3"> <tid>300</tid> <cid>3</cid> <description>¥úÅÖ¹qÆl¤Þ½u²Å¸¹</description> <description>光纖電纜引線符號</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1302,7 +1261,7 @@ <TypeCompFilter name="FSC-300.C-4"> <tid>300</tid> <cid>4</cid> <description>¥úÅÖ¹qÆl¥´ÂI²Å¸¹</description> <description>光纖電纜打點符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1311,7 +1270,7 @@ <TypeCompFilter name="FSC-301.C-0"> <tid>301</tid> <cid>0</cid> <description>¸ô¿O±±¨î½u</description> <description>路燈控制線</description> <elementCriterion> <elementType>4</elementType> <elementType>12</elementType> @@ -1321,7 +1280,7 @@ <TypeCompFilter name="FSC-301.C-1"> <tid>301</tid> <cid>1</cid> <description>¸ô¿O±±¨î½u¤Þ½u²Å¸¹</description> <description>路燈控制線引線符號</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1330,7 +1289,7 @@ <TypeCompFilter name="FSC-301.C-3"> <tid>301</tid> <cid>3</cid> <description>¸ô¿O±±¨î½uµù°O</description> <description>路燈控制線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1340,7 +1299,7 @@ <TypeCompFilter name="FSC-999.C-0"> <tid>999</tid> <cid>0</cid> <description>µù°O</description> <description>註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1350,7 +1309,7 @@ <TypeCompFilter name="FSC-113.C-0"> <tid>113</tid> <cid>0</cid> <description>°ªÀ£¦a¤U´å¥ð</description> <description>高壓地下游休</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1359,7 +1318,7 @@ <TypeCompFilter name="FSC-403.C-0"> <tid>403</tid> <cid>0</cid> <description>°ª§CÀ£¤H¤â¤Õ</description> <description>高低壓人手孔</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1368,7 +1327,7 @@ <TypeCompFilter name="FSC-403.C-1"> <tid>403</tid> <cid>1</cid> <description>°ª§CÀ£¤H¤â¤Õ®y¼Ðµù°O</description> <description>高低壓人手孔座標註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1378,7 +1337,7 @@ <TypeCompFilter name="FSC-403.C-2"> <tid>403</tid> <cid>2</cid> <description>°ª§CÀ£¤H¤â¤Õ¶ê°é²Å¸¹</description> <description>高低壓人手孔圓圈符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1387,7 +1346,7 @@ <TypeCompFilter name="FSC-403.C-4"> <tid>403</tid> <cid>4</cid> <description>¸ô¿O¤Õ¶ê°é</description> <description>路燈孔圓圈</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1396,7 +1355,7 @@ <TypeCompFilter name="FSC-403.C-5"> <tid>403</tid> <cid>5</cid> <description>¸ô¿O¤Õ®y¼Ðµù°O</description> <description>路燈孔座標註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1406,7 +1365,7 @@ <TypeCompFilter name="FSC-403.C-6"> <tid>403</tid> <cid>6</cid> <description>¥úÅÖ¤Õ¶ê°é²Å¸¹</description> <description>光纖孔圓圈符號</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1415,7 +1374,7 @@ <TypeCompFilter name="FSC-403.C-7"> <tid>403</tid> <cid>7</cid> <description>¥úÆl¤Õ®y¼Ðµù°O(¥úÆl¹Ï¥Î)</description> <description>光纜孔座標註記(光纜圖用)</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1425,27 +1384,29 @@ <TypeCompFilter name="FSC-401.C-0"> <tid>401</tid> <cid>0</cid> <description>ºÞ¸ô</description> <description>管路</description> <elementCriterion> <elementType>12</elementType> <elementType>16</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-401.C-1"> <tid>401</tid> <cid>1</cid> <description>ºÞ¸ô¤Þ½u</description> <description>管路引線</description> <elementCriterion> <elementType>12</elementType> <elementType>16</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-401.C-2"> <tid>401</tid> <cid>2</cid> <description>ºÞ¸ôºÞ´U</description> <description>管路管帽</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1454,7 +1415,7 @@ <TypeCompFilter name="FSC-401.C-3"> <tid>401</tid> <cid>3</cid> <description>ºÞ¸ô¤å¦r»¡©úµù°O</description> <description>管路文字說明註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1464,7 +1425,7 @@ <TypeCompFilter name="FSC-401.C-5"> <tid>401</tid> <cid>5</cid> <description>ºÞ¸ôÂ_±°Ï¬q°Ï¹j</description> <description>管路斷面區段區隔</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1473,7 +1434,7 @@ <TypeCompFilter name="FSC-302.C-0"> <tid>302</tid> <cid>0</cid> <description>¸ô¿Ot¸ü½u</description> <description>路燈負載線</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1482,7 +1443,7 @@ <TypeCompFilter name="FSC-302.C-1"> <tid>302</tid> <cid>1</cid> <description>¸ô¿Ot¸ü½uµù°O</description> <description>路燈負載線註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> @@ -1492,7 +1453,7 @@ <TypeCompFilter name="FSC-303.C-0"> <tid>303</tid> <cid>0</cid> <description>¸ô¿O¾Þ§@½u</description> <description>路燈操作線</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1501,7 +1462,7 @@ <TypeCompFilter name="FSC-303.C-1"> <tid>303</tid> <cid>1</cid> <description>¸ô¿O¾Þ§@½u¤Þ½u</description> <description>路燈操作線引線</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1510,7 +1471,7 @@ <TypeCompFilter name="FSC-303.C-3"> <tid>303</tid> <cid>3</cid> <description>¸ô¿O¾Þ§@½uµù°O</description> <description>路燈操作線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1520,7 +1481,7 @@ <TypeCompFilter name="FSC-305.C-0"> <tid>305</tid> <cid>0</cid> <description>¸ô¿OÂI·À¾¹</description> <description>路燈點滅器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1529,7 +1490,7 @@ <TypeCompFilter name="FSC-306.C-0"> <tid>306</tid> <cid>0</cid> <description>¸ô¿O®É±±¶}Ãö</description> <description>路燈時控開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1538,7 +1499,7 @@ <TypeCompFilter name="FSC-307.C-0"> <tid>307</tid> <cid>0</cid> <description>¸ô¿O¤Àª[ÂI</description> <description>路燈分歧點</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1547,7 +1508,7 @@ <TypeCompFilter name="FSC-308.C-0"> <tid>308</tid> <cid>0</cid> <description>¸ô¿O²×ºÝ</description> <description>路燈終端</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1556,7 +1517,7 @@ <TypeCompFilter name="FSC-311.C-0"> <tid>311</tid> <cid>0</cid> <description>¸ô¿O¥x±b</description> <description>路燈台帳</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1565,7 +1526,7 @@ <TypeCompFilter name="FSC-311.C-1"> <tid>311</tid> <cid>1</cid> <description>¸ô¿O¥x±b¹Ï¸¹(®e¶q.·ø¼Æ)µù°O</description> <description>路燈台帳圖號(容量.盞數)註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1575,7 +1536,7 @@ <TypeCompFilter name="FSC-314.C-0"> <tid>314</tid> <cid>0</cid> <description>¬[ªÅ¸ô¿Ot¸ü½u</description> <description>架空路燈負載線</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1584,7 +1545,7 @@ <TypeCompFilter name="FSC-314.C-1"> <tid>314</tid> <cid>1</cid> <description>¬[ªÅ¸ô¿Ot¸ü½uµù°O</description> <description>架空路燈負載線註記</description> <elementCriterion> <elementType>7</elementType> </elementCriterion> @@ -1593,7 +1554,7 @@ <TypeCompFilter name="FSC-315.C-0"> <tid>315</tid> <cid>0</cid> <description>¬[ªÅ¸ô¿O±±¨î½u</description> <description>架空路燈控制線</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1602,7 +1563,7 @@ <TypeCompFilter name="FSC-315.C-1"> <tid>315</tid> <cid>1</cid> <description>¬[ªÅ¸ô¿O±±¨î½uµù°O</description> <description>架空路燈控制線註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1612,7 +1573,7 @@ <TypeCompFilter name="FSC-316.C-0"> <tid>316</tid> <cid>0</cid> <description>¸ô¿Oª½¸ô</description> <description>路燈直路</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1621,7 +1582,7 @@ <TypeCompFilter name="FSC-317.C-0"> <tid>317</tid> <cid>0</cid> <description>¸ô¿O±±¨î¶}Ãö</description> <description>路燈控制開關</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1630,7 +1591,7 @@ <TypeCompFilter name="FSC-317.C-1"> <tid>317</tid> <cid>1</cid> <description>¸ô¿O±±¨î¶}Ãöµù°O</description> <description>路燈控制開關註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> @@ -1640,7 +1601,7 @@ <TypeCompFilter name="FSC-318.C-0"> <tid>318</tid> <cid>0</cid> <description>¸ô¿O¶×¬y±Æ</description> <description>路燈匯流排</description> <elementCriterion> <elementType>12</elementType> </elementCriterion> @@ -1649,7 +1610,7 @@ <TypeCompFilter name="FSC-319.C-0"> <tid>319</tid> <cid>0</cid> <description>¥úÅÖ¦¬®e</description> <description>光纖收容</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1658,7 +1619,7 @@ <TypeCompFilter name="FSC-320.C-0"> <tid>320</tid> <cid>0</cid> <description>¥úÅÖ³q°T±µÀY</description> <description>光纖通訊接頭</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1667,7 +1628,7 @@ <TypeCompFilter name="FSC-325.C-0"> <tid>325</tid> <cid>0</cid> <description>¥úÅÖ¤À°t¸Ë¸m</description> <description>光纖分配裝置</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1676,7 +1637,7 @@ <TypeCompFilter name="FSC-325.C-1"> <tid>325</tid> <cid>1</cid> <description>¥úÅÖ¤À°t¸Ë¸mµù°O</description> <description>光纖分配裝置註記</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1686,7 +1647,7 @@ <TypeCompFilter name="FSC-323.C-0"> <tid>323</tid> <cid>0</cid> <description>¥ú¹qÂà´«¾¹</description> <description>光電轉換器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1695,7 +1656,7 @@ <TypeCompFilter name="FSC-324.C-0"> <tid>324</tid> <cid>0</cid> <description>¦Û°Ê¤Æ»»±±¾¹</description> <description>自動化遙控器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> @@ -1704,13 +1665,108 @@ <TypeCompFilter name="FSC-324.C-1"> <tid>324</tid> <cid>1</cid> <description>¦Û°Ê¤Æ»»±±¾¹µù°O</description> <description>自動化遙控器註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-103.C-0"> <tid>103</tid> <cid>0</cid> <description>電纜故障指示器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-110.C-0"> <tid>110</tid> <cid>0</cid> <description>分散式能源</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-110.C-2"> <tid>110</tid> <cid>2</cid> <description>分散式能源引線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-323.C-0"> <tid>323</tid> <cid>0</cid> <description>光電轉換器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-312.C-0"> <tid>312</tid> <cid>0</cid> <description>路燈台帳</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-312.C-1"> <tid>312</tid> <cid>1</cid> <description>路燈台帳註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-313.C-0"> <tid>313</tid> <cid>0</cid> <description>附架點數台帳</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-313.C-1"> <tid>313</tid> <cid>1</cid> <description>附架點數台帳註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-112.C-0"> <tid>112</tid> <cid>0</cid> <description>AMI</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-111.C-0"> <tid>111</tid> <cid>0</cid> <description>電壓調整器</description> <elementCriterion> <elementType>17</elementType> </elementCriterion> <SymbolCreateStrategy/> </TypeCompFilter> <!-- Dummy <TypeCompLevelFilter name="DemoFeature3"> <tid>999</tid> @@ -1719,5 +1775,57 @@ <description>DemoFilter for DemoFeature</description> <TextCreateStrategy-None/> </TypeCompLevelFilter> <TypeCompFilter name="FSC-423.C-0"> <tid>423</tid> <cid>0</cid> <description>管路斷面</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <MultiSymbolCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-1"> <tid>423</tid> <cid>1</cid> <description>管路斷面引線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-2"> <tid>423</tid> <cid>2</cid> <description>長度註記</description> <elementCriterion> <elementType>7</elementType> <elementType>17</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-3"> <tid>423</tid> <cid>3</cid> <description>穿線註記</description> <elementCriterion> <elementType>17</elementType> <elementType>7</elementType> </elementCriterion> <TextCreateStrategy/> </TypeCompFilter> <TypeCompFilter name="FSC-423.C-4"> <tid>423</tid> <cid>4</cid> <description>管路斷面輔助線</description> <elementCriterion> <elementType>12</elementType> <elementType>4</elementType> </elementCriterion> <LineCreateStrategy/> </TypeCompFilter> --> </ElementDispatcherRules>