commit 060d78a68f6bfbb28b97d40509ffb4ff2f1b1b98 Author: lijh Date: Fri Mar 13 10:43:13 2026 +0800 20260313 diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..66d62cc --- /dev/null +++ b/.classpath @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..c413940 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + ZF_update_item + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..9cf58e4 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//src/com/zf/Main.java=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bin/com/zf/AppXCredentialManager.class b/bin/com/zf/AppXCredentialManager.class new file mode 100644 index 0000000..1440640 Binary files /dev/null and b/bin/com/zf/AppXCredentialManager.class differ diff --git a/bin/com/zf/AppXDeletedObjectListener.class b/bin/com/zf/AppXDeletedObjectListener.class new file mode 100644 index 0000000..610a141 Binary files /dev/null and b/bin/com/zf/AppXDeletedObjectListener.class differ diff --git a/bin/com/zf/AppXExceptionHandler.class b/bin/com/zf/AppXExceptionHandler.class new file mode 100644 index 0000000..e122581 Binary files /dev/null and b/bin/com/zf/AppXExceptionHandler.class differ diff --git a/bin/com/zf/AppXPartialErrorListener.class b/bin/com/zf/AppXPartialErrorListener.class new file mode 100644 index 0000000..431e8a3 Binary files /dev/null and b/bin/com/zf/AppXPartialErrorListener.class differ diff --git a/bin/com/zf/AppXRequestListener.class b/bin/com/zf/AppXRequestListener.class new file mode 100644 index 0000000..7037d9f Binary files /dev/null and b/bin/com/zf/AppXRequestListener.class differ diff --git a/bin/com/zf/AppXUpdateObjectListener.class b/bin/com/zf/AppXUpdateObjectListener.class new file mode 100644 index 0000000..fefbfa9 Binary files /dev/null and b/bin/com/zf/AppXUpdateObjectListener.class differ diff --git a/bin/com/zf/ICCTUserService.class b/bin/com/zf/ICCTUserService.class new file mode 100644 index 0000000..854f8fe Binary files /dev/null and b/bin/com/zf/ICCTUserService.class differ diff --git a/bin/com/zf/IntHolder.class b/bin/com/zf/IntHolder.class new file mode 100644 index 0000000..024c240 Binary files /dev/null and b/bin/com/zf/IntHolder.class differ diff --git a/bin/com/zf/LoginSoa.class b/bin/com/zf/LoginSoa.class new file mode 100644 index 0000000..ed5576a Binary files /dev/null and b/bin/com/zf/LoginSoa.class differ diff --git a/bin/com/zf/Main.class b/bin/com/zf/Main.class new file mode 100644 index 0000000..2b23a55 Binary files /dev/null and b/bin/com/zf/Main.class differ diff --git a/bin/com/zf/Session.class b/bin/com/zf/Session.class new file mode 100644 index 0000000..d25c432 Binary files /dev/null and b/bin/com/zf/Session.class differ diff --git a/bin/com/zf/StringHolder.class b/bin/com/zf/StringHolder.class new file mode 100644 index 0000000..3d98cd2 Binary files /dev/null and b/bin/com/zf/StringHolder.class differ diff --git a/bin/com/zf/TCSoaUserService.class b/bin/com/zf/TCSoaUserService.class new file mode 100644 index 0000000..b5bec79 Binary files /dev/null and b/bin/com/zf/TCSoaUserService.class differ diff --git a/bin/com/zf/TcUtility.class b/bin/com/zf/TcUtility.class new file mode 100644 index 0000000..73b4156 Binary files /dev/null and b/bin/com/zf/TcUtility.class differ diff --git a/bin/com/zf/TcUtils.class b/bin/com/zf/TcUtils.class new file mode 100644 index 0000000..f14874f Binary files /dev/null and b/bin/com/zf/TcUtils.class differ diff --git a/bin/com/zf/log4j.properties b/bin/com/zf/log4j.properties new file mode 100644 index 0000000..f2bd702 --- /dev/null +++ b/bin/com/zf/log4j.properties @@ -0,0 +1,39 @@ +log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n + +log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.infolog.Threshold = INFO +log4j.appender.infolog.File = soalog/item_id/zf_update_itemid_all.log +log4j.appender.infolog.layout = org.apache.log4j.PatternLayout +log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO +#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO + +log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.warnlog.Threshold = WARN +log4j.appender.warnlog.File = soalog/item_id/zf_update_itemid_warn.log +log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout +log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN +#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN + +log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.errorlog.Threshold = ERROR +log4j.appender.errorlog.File = soalog/item_id/zf_update_itemid_error.log +log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout +log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR +log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR + +log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.successlog.Threshold = FATAL +log4j.appender.successlog.File = soalog/item_id/zf_update_itemid_success.log +log4j.appender.successlog.layout = org.apache.log4j.PatternLayout +log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n \ No newline at end of file diff --git a/bin/com/zf/longSeqValue_u.class b/bin/com/zf/longSeqValue_u.class new file mode 100644 index 0000000..4bc4814 Binary files /dev/null and b/bin/com/zf/longSeqValue_u.class differ diff --git a/bin/com/zf/longSeqValue_uHolder.class b/bin/com/zf/longSeqValue_uHolder.class new file mode 100644 index 0000000..6e8b05e Binary files /dev/null and b/bin/com/zf/longSeqValue_uHolder.class differ diff --git a/bin/com/zf/param_zh_CN.properties b/bin/com/zf/param_zh_CN.properties new file mode 100644 index 0000000..54d6430 --- /dev/null +++ b/bin/com/zf/param_zh_CN.properties @@ -0,0 +1,15 @@ +#host=http://192.168.9.20:7001/tc +#username=admin +#password=admin +#host=http://10.19.245.251:58001/tc +#username=ojplm +#password=hand@123 +host=http://10.10.2.40:7001/tc +username=dcproxy +password=dcproxy +group=dba + + + + + diff --git a/bin/com/zf/stringSeqValue_u.class b/bin/com/zf/stringSeqValue_u.class new file mode 100644 index 0000000..aee8f2b Binary files /dev/null and b/bin/com/zf/stringSeqValue_u.class differ diff --git a/bin/log4j.properties b/bin/log4j.properties new file mode 100644 index 0000000..d209f36 --- /dev/null +++ b/bin/log4j.properties @@ -0,0 +1,39 @@ +log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n + +log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.infolog.Threshold = INFO +log4j.appender.infolog.File = soalog/item_id/Hisense_update_itemid_all.log +log4j.appender.infolog.layout = org.apache.log4j.PatternLayout +log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO +#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO + +log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.warnlog.Threshold = WARN +log4j.appender.warnlog.File = soalog/item_id/Hisense_update_itemid_warn.log +log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout +log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN +#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN + +log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.errorlog.Threshold = ERROR +log4j.appender.errorlog.File = soalog/item_id/Hisense_update_itemid_error.log +log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout +log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR +log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR + +log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.successlog.Threshold = FATAL +log4j.appender.successlog.File = soalog/item_id/Hisense_update_itemid_success.log +log4j.appender.successlog.layout = org.apache.log4j.PatternLayout +log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n \ No newline at end of file diff --git a/bin/param_zh_CN.properties b/bin/param_zh_CN.properties new file mode 100644 index 0000000..54d6430 --- /dev/null +++ b/bin/param_zh_CN.properties @@ -0,0 +1,15 @@ +#host=http://192.168.9.20:7001/tc +#username=admin +#password=admin +#host=http://10.19.245.251:58001/tc +#username=ojplm +#password=hand@123 +host=http://10.10.2.40:7001/tc +username=dcproxy +password=dcproxy +group=dba + + + + + diff --git a/lib/TcSoaAdministrationLoose_13000.1.0.jar b/lib/TcSoaAdministrationLoose_13000.1.0.jar new file mode 100644 index 0000000..3da16a5 Binary files /dev/null and b/lib/TcSoaAdministrationLoose_13000.1.0.jar differ diff --git a/lib/TcSoaCadStrong-12.3.0.jar b/lib/TcSoaCadStrong-12.3.0.jar new file mode 100644 index 0000000..3cbb1c6 Binary files /dev/null and b/lib/TcSoaCadStrong-12.3.0.jar differ diff --git a/lib/TcSoaClient-12.3.0.jar b/lib/TcSoaClient-12.3.0.jar new file mode 100644 index 0000000..d52ad78 Binary files /dev/null and b/lib/TcSoaClient-12.3.0.jar differ diff --git a/lib/TcSoaClient_11000.2.0.jar b/lib/TcSoaClient_11000.2.0.jar new file mode 100644 index 0000000..0989c41 Binary files /dev/null and b/lib/TcSoaClient_11000.2.0.jar differ diff --git a/lib/TcSoaClient_13000.1.0.jar b/lib/TcSoaClient_13000.1.0.jar new file mode 100644 index 0000000..9c4050e Binary files /dev/null and b/lib/TcSoaClient_13000.1.0.jar differ diff --git a/lib/TcSoaCommon-12.3.0.jar b/lib/TcSoaCommon-12.3.0.jar new file mode 100644 index 0000000..8737dfd Binary files /dev/null and b/lib/TcSoaCommon-12.3.0.jar differ diff --git a/lib/TcSoaCommon_13000.1.0.jar b/lib/TcSoaCommon_13000.1.0.jar new file mode 100644 index 0000000..2bf7a1e Binary files /dev/null and b/lib/TcSoaCommon_13000.1.0.jar differ diff --git a/lib/TcSoaCoreStrong-12.3.0.jar b/lib/TcSoaCoreStrong-12.3.0.jar new file mode 100644 index 0000000..3fe6149 Binary files /dev/null and b/lib/TcSoaCoreStrong-12.3.0.jar differ diff --git a/lib/TcSoaCoreStrong_13000.1.0.jar b/lib/TcSoaCoreStrong_13000.1.0.jar new file mode 100644 index 0000000..eebfeb3 Binary files /dev/null and b/lib/TcSoaCoreStrong_13000.1.0.jar differ diff --git a/lib/TcSoaCoreTypes_13000.1.0.jar b/lib/TcSoaCoreTypes_13000.1.0.jar new file mode 100644 index 0000000..1c32261 Binary files /dev/null and b/lib/TcSoaCoreTypes_13000.1.0.jar differ diff --git a/lib/TcSoaManufacturingStrong_13000.1.0.jar b/lib/TcSoaManufacturingStrong_13000.1.0.jar new file mode 100644 index 0000000..34f2ca4 Binary files /dev/null and b/lib/TcSoaManufacturingStrong_13000.1.0.jar differ diff --git a/lib/TcSoaQueryStrong-12.3.0.jar b/lib/TcSoaQueryStrong-12.3.0.jar new file mode 100644 index 0000000..fafa5aa Binary files /dev/null and b/lib/TcSoaQueryStrong-12.3.0.jar differ diff --git a/lib/TcSoaQueryStrong_13000.1.0.jar b/lib/TcSoaQueryStrong_13000.1.0.jar new file mode 100644 index 0000000..e4ebc3d Binary files /dev/null and b/lib/TcSoaQueryStrong_13000.1.0.jar differ diff --git a/lib/TcSoaReportsStrong_13000.1.0.jar b/lib/TcSoaReportsStrong_13000.1.0.jar new file mode 100644 index 0000000..7ab1928 Binary files /dev/null and b/lib/TcSoaReportsStrong_13000.1.0.jar differ diff --git a/lib/TcSoaStrongModel-12.3.0.jar b/lib/TcSoaStrongModel-12.3.0.jar new file mode 100644 index 0000000..cfe35c0 Binary files /dev/null and b/lib/TcSoaStrongModel-12.3.0.jar differ diff --git a/lib/TcSoaStrongModel_13000.1.0.jar b/lib/TcSoaStrongModel_13000.1.0.jar new file mode 100644 index 0000000..4d7263d Binary files /dev/null and b/lib/TcSoaStrongModel_13000.1.0.jar differ diff --git a/lib/TcSoaWorkflowStrong-12.3.0.jar b/lib/TcSoaWorkflowStrong-12.3.0.jar new file mode 100644 index 0000000..36d5387 Binary files /dev/null and b/lib/TcSoaWorkflowStrong-12.3.0.jar differ diff --git a/lib/TcSoaWorkflowStrong_13000.1.0.jar b/lib/TcSoaWorkflowStrong_13000.1.0.jar new file mode 100644 index 0000000..9c17a3b Binary files /dev/null and b/lib/TcSoaWorkflowStrong_13000.1.0.jar differ diff --git a/lib/bcprov-ext-jdk15on-1.54.jar b/lib/bcprov-ext-jdk15on-1.54.jar new file mode 100644 index 0000000..f31c1c1 Binary files /dev/null and b/lib/bcprov-ext-jdk15on-1.54.jar differ diff --git a/lib/bcprov-jdk15on-1.54.jar b/lib/bcprov-jdk15on-1.54.jar new file mode 100644 index 0000000..bd95185 Binary files /dev/null and b/lib/bcprov-jdk15on-1.54.jar differ diff --git a/lib/commons-beanutils-1.7.0.jar b/lib/commons-beanutils-1.7.0.jar new file mode 100644 index 0000000..b1b89c9 Binary files /dev/null and b/lib/commons-beanutils-1.7.0.jar differ diff --git a/lib/commons-codec.jar b/lib/commons-codec.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/lib/commons-codec.jar differ diff --git a/lib/commons-collections-3.1.jar b/lib/commons-collections-3.1.jar new file mode 100644 index 0000000..41e230f Binary files /dev/null and b/lib/commons-collections-3.1.jar differ diff --git a/lib/commons-httpclient-3.1.jar b/lib/commons-httpclient-3.1.jar new file mode 100644 index 0000000..7c59774 Binary files /dev/null and b/lib/commons-httpclient-3.1.jar differ diff --git a/lib/commons-lang-2.5.jar b/lib/commons-lang-2.5.jar new file mode 100644 index 0000000..ae491da Binary files /dev/null and b/lib/commons-lang-2.5.jar differ diff --git a/lib/commons-lang3-3.1.jar b/lib/commons-lang3-3.1.jar new file mode 100644 index 0000000..a85e539 Binary files /dev/null and b/lib/commons-lang3-3.1.jar differ diff --git a/lib/commons-logging.jar b/lib/commons-logging.jar new file mode 100644 index 0000000..b73a80f Binary files /dev/null and b/lib/commons-logging.jar differ diff --git a/lib/commons-net-3.6.jar b/lib/commons-net-3.6.jar new file mode 100644 index 0000000..4537623 Binary files /dev/null and b/lib/commons-net-3.6.jar differ diff --git a/lib/ezmorph-1.0.3.jar b/lib/ezmorph-1.0.3.jar new file mode 100644 index 0000000..179b8d6 Binary files /dev/null and b/lib/ezmorph-1.0.3.jar differ diff --git a/lib/fastjson-1.2.23.jar b/lib/fastjson-1.2.23.jar new file mode 100644 index 0000000..f63a7d5 Binary files /dev/null and b/lib/fastjson-1.2.23.jar differ diff --git a/lib/fccclient.jar b/lib/fccclient.jar new file mode 100644 index 0000000..0687251 Binary files /dev/null and b/lib/fccclient.jar differ diff --git a/lib/fccjavaclientproxy.jar b/lib/fccjavaclientproxy.jar new file mode 100644 index 0000000..639daf8 Binary files /dev/null and b/lib/fccjavaclientproxy.jar differ diff --git a/lib/fmsclientcache.jar b/lib/fmsclientcache.jar new file mode 100644 index 0000000..bc28570 Binary files /dev/null and b/lib/fmsclientcache.jar differ diff --git a/lib/fmsservercache.jar b/lib/fmsservercache.jar new file mode 100644 index 0000000..0cf8677 Binary files /dev/null and b/lib/fmsservercache.jar differ diff --git a/lib/fmsutil.jar b/lib/fmsutil.jar new file mode 100644 index 0000000..e64444d Binary files /dev/null and b/lib/fmsutil.jar differ diff --git a/lib/fscclient.jar b/lib/fscclient.jar new file mode 100644 index 0000000..f4183c1 Binary files /dev/null and b/lib/fscclient.jar differ diff --git a/lib/fscjavaclientproxy.jar b/lib/fscjavaclientproxy.jar new file mode 100644 index 0000000..c1870ea Binary files /dev/null and b/lib/fscjavaclientproxy.jar differ diff --git a/lib/gson-2.8.0.jar b/lib/gson-2.8.0.jar new file mode 100644 index 0000000..1235f63 Binary files /dev/null and b/lib/gson-2.8.0.jar differ diff --git a/lib/httpclient-4.5.jar b/lib/httpclient-4.5.jar new file mode 100644 index 0000000..970c989 Binary files /dev/null and b/lib/httpclient-4.5.jar differ diff --git a/lib/httpcore-4.4.1.jar b/lib/httpcore-4.4.1.jar new file mode 100644 index 0000000..99715b6 Binary files /dev/null and b/lib/httpcore-4.4.1.jar differ diff --git a/lib/iText-5.0.3.jar b/lib/iText-5.0.3.jar new file mode 100644 index 0000000..1d5effe Binary files /dev/null and b/lib/iText-5.0.3.jar differ diff --git a/lib/itextpdf-5.5.11.jar b/lib/itextpdf-5.5.11.jar new file mode 100644 index 0000000..cec5fe1 Binary files /dev/null and b/lib/itextpdf-5.5.11.jar differ diff --git a/lib/jacob.jar b/lib/jacob.jar new file mode 100644 index 0000000..177d44c Binary files /dev/null and b/lib/jacob.jar differ diff --git a/lib/javax.servlet-api-3.1.0.jar b/lib/javax.servlet-api-3.1.0.jar new file mode 100644 index 0000000..6b14c3d Binary files /dev/null and b/lib/javax.servlet-api-3.1.0.jar differ diff --git a/lib/json-lib-2.1-jdk15.jar b/lib/json-lib-2.1-jdk15.jar new file mode 100644 index 0000000..f78973e Binary files /dev/null and b/lib/json-lib-2.1-jdk15.jar differ diff --git a/lib/log4j-api-2.13.0.jar b/lib/log4j-api-2.13.0.jar new file mode 100644 index 0000000..4681b9c Binary files /dev/null and b/lib/log4j-api-2.13.0.jar differ diff --git a/lib/log4j-core-2.13.0.jar b/lib/log4j-core-2.13.0.jar new file mode 100644 index 0000000..0fc39c3 Binary files /dev/null and b/lib/log4j-core-2.13.0.jar differ diff --git a/lib/log4j-slf4j-impl-2.10.0.jar b/lib/log4j-slf4j-impl-2.10.0.jar new file mode 100644 index 0000000..2b7b392 Binary files /dev/null and b/lib/log4j-slf4j-impl-2.10.0.jar differ diff --git a/lib/log4j.jar b/lib/log4j.jar new file mode 100644 index 0000000..dde9972 Binary files /dev/null and b/lib/log4j.jar differ diff --git a/lib/org.apache.commons.httpclient_3.1.0.v201012070820.jar b/lib/org.apache.commons.httpclient_3.1.0.v201012070820.jar new file mode 100644 index 0000000..2ccaca5 Binary files /dev/null and b/lib/org.apache.commons.httpclient_3.1.0.v201012070820.jar differ diff --git a/lib/slf4j-api-1.7.26.jar b/lib/slf4j-api-1.7.26.jar new file mode 100644 index 0000000..d2f27ac Binary files /dev/null and b/lib/slf4j-api-1.7.26.jar differ diff --git a/lib/test.jar b/lib/test.jar new file mode 100644 index 0000000..eefd636 Binary files /dev/null and b/lib/test.jar differ diff --git a/lib/tika-core-1.16.jar b/lib/tika-core-1.16.jar new file mode 100644 index 0000000..89e587a Binary files /dev/null and b/lib/tika-core-1.16.jar differ diff --git a/lib/tika-parsers-1.16.jar b/lib/tika-parsers-1.16.jar new file mode 100644 index 0000000..a809eb1 Binary files /dev/null and b/lib/tika-parsers-1.16.jar differ diff --git a/lib/xercesImpl.jar b/lib/xercesImpl.jar new file mode 100644 index 0000000..33990e8 Binary files /dev/null and b/lib/xercesImpl.jar differ diff --git a/lib/xml-apis.jar b/lib/xml-apis.jar new file mode 100644 index 0000000..b338fb6 Binary files /dev/null and b/lib/xml-apis.jar differ diff --git a/poiLib/log4j-1.2.15.jar b/poiLib/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/poiLib/log4j-1.2.15.jar differ diff --git a/poiLib/poi-3.17.jar b/poiLib/poi-3.17.jar new file mode 100644 index 0000000..353ce76 Binary files /dev/null and b/poiLib/poi-3.17.jar differ diff --git a/poiLib/poi-examples-3.17.jar b/poiLib/poi-examples-3.17.jar new file mode 100644 index 0000000..a923b04 Binary files /dev/null and b/poiLib/poi-examples-3.17.jar differ diff --git a/poiLib/poi-excelant-3.17.jar b/poiLib/poi-excelant-3.17.jar new file mode 100644 index 0000000..da9f5ed Binary files /dev/null and b/poiLib/poi-excelant-3.17.jar differ diff --git a/poiLib/poi-ooxml-3.17.jar b/poiLib/poi-ooxml-3.17.jar new file mode 100644 index 0000000..68086e8 Binary files /dev/null and b/poiLib/poi-ooxml-3.17.jar differ diff --git a/poiLib/poi-ooxml-schemas-3.17.jar b/poiLib/poi-ooxml-schemas-3.17.jar new file mode 100644 index 0000000..2e9b3e7 Binary files /dev/null and b/poiLib/poi-ooxml-schemas-3.17.jar differ diff --git a/poiLib/poi-scratchpad-3.17.jar b/poiLib/poi-scratchpad-3.17.jar new file mode 100644 index 0000000..12ba1f1 Binary files /dev/null and b/poiLib/poi-scratchpad-3.17.jar differ diff --git a/poiLib/xmlbeans-2.6.0.jar b/poiLib/xmlbeans-2.6.0.jar new file mode 100644 index 0000000..d1b6627 Binary files /dev/null and b/poiLib/xmlbeans-2.6.0.jar differ diff --git a/soalog/item_id/Hisense_update_itemid_all.log b/soalog/item_id/Hisense_update_itemid_all.log new file mode 100644 index 0000000..e69de29 diff --git a/soalog/item_id/Hisense_update_itemid_error.log b/soalog/item_id/Hisense_update_itemid_error.log new file mode 100644 index 0000000..e69de29 diff --git a/soalog/item_id/Hisense_update_itemid_success.log b/soalog/item_id/Hisense_update_itemid_success.log new file mode 100644 index 0000000..e69de29 diff --git a/soalog/item_id/Hisense_update_itemid_warn.log b/soalog/item_id/Hisense_update_itemid_warn.log new file mode 100644 index 0000000..e69de29 diff --git a/src/com/zf/AppXCredentialManager.java b/src/com/zf/AppXCredentialManager.java new file mode 100644 index 0000000..72fd677 --- /dev/null +++ b/src/com/zf/AppXCredentialManager.java @@ -0,0 +1,143 @@ +//================================================== +// +// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +package com.zf; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.LineNumberReader; + +import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException; +import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException; +import com.teamcenter.soa.client.CredentialManager; +import com.teamcenter.soa.exceptions.CanceledOperationException; + +/** + * The CredentialManager is used by the Teamcenter Services framework to get the + * user's credentials when challanged by the server. This can occur after a period + * of inactivity and the server has timed-out the user's session, at which time + * the client application will need to re-authenitcate. The framework will + * call one of the getCredentials methods (depending on circumstances) and will + * send the SessionService.login service request. Upon successfull completion of + * the login service request. The last service request (one that cuased the challange) + * will be resent. + * + * The framework will also call the setUserPassword setGroupRole methods when ever + * these credentials change, thus allowing this implementation of the CredentialManager + * to cache these values so prompting of the user is not requried for re-authentication. + * + */ +public class AppXCredentialManager implements CredentialManager +{ + + private String name = null; + private String password = null; + private String group = ""; // default group + private String role = ""; // default role + private String discriminator = "SoaAppX"; // always connect same user + // to same instance of server + + /** + * Return the type of credentials this implementation provides, + * standard (user/password) or Single-Sign-On. In this case + * Standard credentials are returned. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentialType() + */ + public int getCredentialType() + { + return CredentialManager.CLIENT_CREDENTIAL_TYPE_STD; + } + + /** + * Prompt's the user for credentials. + * This method will only be called by the framework when a login attempt has + * failed. + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException) + */ + public String[] getCredentials(InvalidCredentialsException e) + throws CanceledOperationException + { + System.out.println(e.getMessage()); + return promptForCredentials(); + } + + /** + * Return the cached credentials. + * This method will be called when a service request is sent without a valid + * session ( session has expired on the server). + * + * @see com.teamcenter.soa.client.CredentialManager#getCredentials(com.teamcenter.schemas.soa._2006_03.exceptions.InvalidUserException) + */ + public String[] getCredentials(InvalidUserException e) + throws CanceledOperationException + { + // Have not logged in yet, shoult not happen but just in case + if (name == null) return promptForCredentials(); + + // Return cached credentials + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + + /** + * Cache the group and role + * This is called after the SessionService.setSessionGroupMember service + * operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setGroupRole(java.lang.String, + * java.lang.String) + */ + public void setGroupRole(String group, String role) + { + this.group = group; + this.role = role; + } + + /** + * Cache the User and Password + * This is called after the SessionService.login service operation is called. + * + * @see com.teamcenter.soa.client.CredentialManager#setUserPassword(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void setUserPassword(String user, String password, String discriminator) + { + this.name = user; + this.password = password; + this.discriminator = discriminator; + } + + + public String[] promptForCredentials() + throws CanceledOperationException + { + try + { + LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in)); + System.out.println("Please enter user credentials (return to quit):"); + System.out.print("User Name: "); + name = reader.readLine(); + + if (name.length() == 0) + throw new CanceledOperationException(""); + + System.out.print("Password: "); + password = reader.readLine(); + } + catch (IOException e) + { + String message = "Failed to get the name and password.\n" + e.getMessage(); + System.out.println(message); + throw new CanceledOperationException(message); + } + + String[] tokens = { name, password, group, role, discriminator }; + return tokens; + } + +} diff --git a/src/com/zf/AppXDeletedObjectListener.java b/src/com/zf/AppXDeletedObjectListener.java new file mode 100644 index 0000000..d7b64b3 --- /dev/null +++ b/src/com/zf/AppXDeletedObjectListener.java @@ -0,0 +1,35 @@ +//================================================== +// +// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + + +package com.zf; + +import com.teamcenter.soa.client.model.DeleteListener; + +/** + * Implementation of the DeleteListener, simply prints out list of all objects + * that are deleted. + * + */ +public class AppXDeletedObjectListener implements DeleteListener +{ + + public void modelObjectDelete(String[] uids) + { + if (uids.length == 0) + return; + + System.out.println(""); + System.out.println("Deleted Objects handled in com.teamcenter.clientx.AppXDeletedObjectListener.modelObjectDelete"); + System.out.println("The following objects have been deleted from the server and removed from the client data model:"); + for (int i = 0; i < uids.length; i++) + { + System.out.println(" " + uids[i]); + } + + } + +} diff --git a/src/com/zf/AppXExceptionHandler.java b/src/com/zf/AppXExceptionHandler.java new file mode 100644 index 0000000..21e7484 --- /dev/null +++ b/src/com/zf/AppXExceptionHandler.java @@ -0,0 +1,102 @@ +//================================================== +// +// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +package com.zf; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.LineNumberReader; + +import com.teamcenter.schemas.soa._2006_03.exceptions.ConnectionException; +import com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException; +import com.teamcenter.schemas.soa._2006_03.exceptions.ProtocolException; +import com.teamcenter.soa.client.ExceptionHandler; +import com.teamcenter.soa.exceptions.CanceledOperationException; + +/** + * Implementation of the ExceptionHandler. For ConnectionExceptions (server + * temporarily down .etc) prompts the user to retry the last request. For other + * exceptions convert to a RunTime exception. + */ +public class AppXExceptionHandler implements ExceptionHandler +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.schemas.soa._2006_03.exceptions.InternalServerException) + */ + public void handleException(InternalServerException ise) + { + System.out.println(""); + System.out.println("*****"); + System.out + .println("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(InternalServerException)."); + + LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in)); + + if (ise instanceof ConnectionException) + { + // ConnectionException are typically due to a network error (server + // down .etc) and can be recovered from (the last request can be sent again, + // after the problem is corrected). + System.out.print("\nThe server returned an connection error.\n" + ise.getMessage() + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + if (ise instanceof ProtocolException) + { + // ProtocolException are typically due to programming errors + // (content of HTTP + // request is incorrect). These are generally can not be + // recovered from. + System.out.print("\nThe server returned an protocol error.\n" + ise.getMessage() + + "\nThis is most likely the result of a programming error." + + "\nDo you wish to retry the last service request?[y/n]"); + } + else + { + System.out.println("\nThe server returned an internal server error.\n" + + ise.getMessage() + + "\nThis is most likely the result of a programming error." + + "\nA RuntimeException will be thrown."); + throw new RuntimeException(ise.getMessage()); + } + + try + { + String retry = reader.readLine(); + // If yes, return to the calling SOA client framework, where the + // last service request will be resent. + if (retry.equalsIgnoreCase("y") || retry.equalsIgnoreCase("yes")) return; + + throw new RuntimeException("The user has opted not to retry the last request"); + } + catch (IOException e) + { + System.err.println("Failed to read user response.\nA RuntimeException will be thrown."); + throw new RuntimeException(e.getMessage()); + } + } + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.ExceptionHandler#handleException(com.teamcenter.soa.exceptions.CanceledOperationException) + */ + public void handleException(CanceledOperationException coe) + { + System.out.println(""); + System.out.println("*****"); + System.out.println("Exception caught in com.teamcenter.clientx.AppXExceptionHandler.handleException(CanceledOperationException)."); + + // Expecting this from the login tests with bad credentials, and the + // AnyUserCredentials class not + // prompting for different credentials + throw new RuntimeException(coe); + } + +} diff --git a/src/com/zf/AppXPartialErrorListener.java b/src/com/zf/AppXPartialErrorListener.java new file mode 100644 index 0000000..a14b3db --- /dev/null +++ b/src/com/zf/AppXPartialErrorListener.java @@ -0,0 +1,65 @@ +//================================================== +// +// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + + +package com.zf; + +import com.teamcenter.soa.client.model.ErrorStack; +import com.teamcenter.soa.client.model.ErrorValue; +import com.teamcenter.soa.client.model.PartialErrorListener; + +/** + * Implementation of the PartialErrorListener. Print out any partial errors + * returned. + * + */ +public class AppXPartialErrorListener implements PartialErrorListener +{ + + /* + * (non-Javadoc) + * + * @see com.teamcenter.soa.client.model.PartialErrorListener#handlePartialError(com.teamcenter.soa.client.model.ErrorStack[]) + */ + public void handlePartialError(ErrorStack[] stacks) + { + if (stacks.length == 0) return; + + System.out.println(""); + System.out.println("*****"); + System.out.println("Partial Errors caught in com.teamcenter.clientx.AppXPartialErrorListener."); + + + for (int i = 0; i < stacks.length; i++) + { + ErrorValue[] errors = stacks[i].getErrorValues(); + System.out.print("Partial Error for "); + + // The different service implementation may optionally associate + // an ModelObject, client ID, or nothing, with each partial error + if (stacks[i].hasAssociatedObject()) + { + System.out.println( "object " + stacks[i].getAssociatedObject().getUid() ); + } + else if (stacks[i].hasClientId()) + { + System.out.println( "client id " + stacks[i].getClientId() ); + } + else if (stacks[i].hasClientIndex()) + System.out.println( "client index " + stacks[i].getClientIndex() ); + + + // Each Partial Error will have one or more contributing error messages + for (int j = 0; j < errors.length; j++) + { + System.out.println(" Code: " + errors[j].getCode() + "\tSeverity: " + + errors[j].getLevel() + "\t" + errors[j].getMessage()); + } + } + + } + +} diff --git a/src/com/zf/AppXRequestListener.java b/src/com/zf/AppXRequestListener.java new file mode 100644 index 0000000..c053a79 --- /dev/null +++ b/src/com/zf/AppXRequestListener.java @@ -0,0 +1,29 @@ +package com.zf; +import com.teamcenter.soa.client.RequestListener; + +/** + * This implemenation of the RequestListener, logs each service request + * to the console. + * + */ +public class AppXRequestListener implements RequestListener +{ + + /** + * Called before each request is sent to the server. + */ + public void serviceRequest ( final Info info ) + { + // will log the service name when done + } + + /** + * Called after each response from the server. + * Log the service operation to the console. + */ + public void serviceResponse( final Info info ) + { + System.out.println( info.id +": "+info.service+"."+info.operation); + } + +} diff --git a/src/com/zf/AppXUpdateObjectListener.java b/src/com/zf/AppXUpdateObjectListener.java new file mode 100644 index 0000000..8fd4d84 --- /dev/null +++ b/src/com/zf/AppXUpdateObjectListener.java @@ -0,0 +1,44 @@ +//================================================== +// +// Copyright 2010 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +package com.zf; + +import com.teamcenter.soa.client.model.ChangeListener; +import com.teamcenter.soa.client.model.ModelObject; +import com.teamcenter.soa.exceptions.NotLoadedException; + +/** + * Implementation of the ChangeListener. Print out all objects that have been updated. + * + */ +public class AppXUpdateObjectListener implements ChangeListener +{ + + public void modelObjectChange(ModelObject[] objects) + { +// if (objects.length == 0) return; +// System.out.println(""); +// System.out.println("Modified Objects handled in com.teamcenter.clientx.AppXUpdateObjectListener.modelObjectChange"); +// System.out.println("The following objects have been updated in the client data model:"); +// for (int i = 0; i < objects.length; i++) +// { +// String uid = objects[i].getUid(); +// String type = objects[i].getType().getName(); +// String name = ""; +// if (objects[i].getType().isInstanceOf("WorkspaceObject")) +// { +// ModelObject wo = objects[i]; +// try +// { +// name = wo.getProperty("object_string").getStringValue(); +// } +// catch (NotLoadedException e) {} // just ignore +// } +// System.out.println(" " + uid + " " + type + " " + name); +// } + } + +} diff --git a/src/com/zf/ICCTUserService.java b/src/com/zf/ICCTUserService.java new file mode 100644 index 0000000..c1bdb73 --- /dev/null +++ b/src/com/zf/ICCTUserService.java @@ -0,0 +1,59 @@ +package com.zf; + + +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; +import com.teamcenter.services.internal.loose.core.ICTService; +import com.teamcenter.services.internal.loose.core._2011_06.ICT.Arg; +import com.teamcenter.services.internal.loose.core._2011_06.ICT.InvokeICTMethodResponse; +import com.teamcenter.soa.client.Connection; + +public class ICCTUserService { + private ICTService m_service; +// public ICCTUserService() { +// m_service = ICTService.getService( AppXSession.getConnection() ); +// } + + public ICCTUserService(Connection connection) { + m_service = ICTService.getService( connection ); + } + public void getMethodParameters(String methodName, longSeqValue_uHolder argumentTypeList, IntHolder returnParameterType){ + Arg[] args_ = new Arg[1]; + + args_[0] = TcUtility.createArg(methodName); + InvokeICTMethodResponse response = null; + try { + response = m_service.invokeICTMethod("ICCTUserService", "getMethodParameters", args_); + } catch (ServiceException e) { + e.printStackTrace(); + //LogHelper.Error(ICCTUserService.class, "调用 ICCTUserService,getMethodParameters错误",e); + return; + } +// if( TCSoaUtil.checkServicedataHaveError(response.serviceData)) +// { +// return; +// } + argumentTypeList.value = TcUtility.queryArg(response.output[0], argumentTypeList.value); + returnParameterType.value = TcUtility.queryArg(response.output[1], returnParameterType.value); + } + + public void callMethod(String methodName, stringSeqValue_u marshalledArguments, StringHolder returnValue) { + Arg[] args_ = new Arg[2]; + args_[0] = TcUtility.createArg(methodName); + args_[1] = TcUtility.createArg(marshalledArguments); + InvokeICTMethodResponse response = null; + try { + response = m_service.invokeICTMethod("ICCTUserService", "callMethod", args_); + } catch (ServiceException e) { + //LogHelper.Error(ICCTUserService.class, "调用 ICCTUserService,callMethod错误",e); + e.printStackTrace(); + } + if( response.serviceData.sizeOfPartialErrors() > 0) + { + return; + } + returnValue.value = TcUtility.queryArgStringUnion(response.output[0], returnValue.value); + } + +} + + diff --git a/src/com/zf/IntHolder.java b/src/com/zf/IntHolder.java new file mode 100644 index 0000000..836fe0d --- /dev/null +++ b/src/com/zf/IntHolder.java @@ -0,0 +1,14 @@ +package com.zf; +public class IntHolder { + public int value = 0; + + + public IntHolder() { + } + + public IntHolder(int value) { + this.value = value; + } + +} + diff --git a/src/com/zf/LoginSoa.java b/src/com/zf/LoginSoa.java new file mode 100644 index 0000000..c308f70 --- /dev/null +++ b/src/com/zf/LoginSoa.java @@ -0,0 +1,54 @@ +package com.zf; + +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; +import com.teamcenter.services.strong.query.SavedQueryService; +import com.teamcenter.services.strong.query._2006_03.SavedQuery.ExecuteSavedQueryResponse; +import com.teamcenter.services.strong.query._2006_03.SavedQuery.GetSavedQueriesResponse; +import com.teamcenter.services.strong.query._2007_06.SavedQuery.SavedQueryInput; +import com.teamcenter.soa.client.Connection; +import com.teamcenter.soa.client.model.ModelObject; +import com.teamcenter.soa.client.model.strong.ImanQuery; +import com.teamcenter.soa.client.model.strong.User; +import org.apache.log4j.Logger; + + +import java.util.UUID; + + +public class LoginSoa { + + + private static final Logger logger = Logger.getLogger(LoginSoa.class); + + private Session session; + + public Connection loginSoa(String serverHost, String username, String password,String group) throws ServiceException { + session = new Session(serverHost); + User tcUser; + + try { + tcUser = session.login(username, password,group,"", UUID.randomUUID().toString()); + } catch (Exception e) { + logger.info("登录失败"); + logger.info("异常:",e); + session.logout(); + return null; + } + Connection connection = session.getConnection(); + if (tcUser == null || connection==null) { + logger.info("登录失败2"); + session.logout(); + System.exit(0); + return null; + } + + return connection; + } + + public void logout(){ + if (session != null) { + session.logout(); + } + } + +} diff --git a/src/com/zf/Main.java b/src/com/zf/Main.java new file mode 100644 index 0000000..fcc1ff3 --- /dev/null +++ b/src/com/zf/Main.java @@ -0,0 +1,319 @@ +package com.zf; + + + +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; +import com.teamcenter.services.strong.core.DataManagementService; +import com.teamcenter.services.strong.core.ReservationService; +import com.teamcenter.services.strong.core.SessionService; +import com.teamcenter.services.strong.core._2007_12.Session; +import com.teamcenter.services.strong.core._2008_06.DataManagement; +import com.teamcenter.services.strong.query.SavedQueryService; +import com.teamcenter.soa.client.Connection; +import com.teamcenter.soa.client.model.ModelObject; +import com.teamcenter.soa.client.model.ServiceData; +import com.teamcenter.soa.client.model.strong.*; +import com.teamcenter.soa.exceptions.NotLoadedException; +import org.apache.log4j.Logger; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; + +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.ResourceBundle; + + +public class Main { + private static final Logger log = Logger.getLogger(Main.class); + static final String object_name = "object_name"; + public static final String[] ENTRIES = {"Item ID"}; + public static void main(String[] args) { + String filePath = args[0]; + String username = null; + String password = null; + String group = null; + log.warn("******************************* 开始修改ID功能 *******************************"); + + ResourceBundle bundle = ResourceBundle.getBundle("param_zh_CN"); + + + String host = bundle.getString("host"); + username = bundle.getString("username"); + password = bundle.getString("password"); + group = bundle.getString("group"); + + log.warn("File: " + filePath); + if(filePath==null || !filePath.endsWith(".xlsx")){ + throw new RuntimeException("File format not supported"); + } + log.warn("User: " + username); + log.warn("Password: " + password); + log.warn("Group: " + group); + log.warn("host: " + host); + + Connection connection=null; + LoginSoa loginSoa = new LoginSoa(); + try { + connection= loginSoa.loginSoa(host, username, password, group); + TcUtils.byPass("true",connection); + } catch (Exception e) { + log.warn("异常:",e); + } + if(connection==null){ + loginSoa.logout(); + System.exit(0); + return; + } + Map stateMap = null; + stateMap = connection.getClientSessionState(); + if (stateMap != null) { + for (Map.Entry entry : stateMap.entrySet()) { + log.warn(entry.getKey() + " 值:" + entry.getValue()); + } + } + TCSoaUserService tcUserService; + try { + tcUserService = new TCSoaUserService(); + } catch (Exception e) { + loginSoa.logout(); + System.exit(0); + throw new RuntimeException(e); + } + + + SavedQueryService queryService = SavedQueryService.getService(connection); + DataManagementService dmService = DataManagementService.getService(connection); + ImanQuery query = TcUtils.getQuery(dmService, queryService, "Item ID"); + + XSSFWorkbook workbook = null; + try { + FileInputStream file = new FileInputStream(filePath); + workbook = new XSSFWorkbook(file); + XSSFSheet sheet = workbook.getSheetAt(0); + System.out.println(sheet.getPhysicalNumberOfRows()); + for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) { + log.warn(String.format("********** sheet %d**********", i + 1)); + XSSFRow row = sheet.getRow(i); + XSSFCell cell = row.getCell(0); + XSSFCell cell1 = row.getCell(1); + XSSFCell cell2 = row.getCell(2); + if (cell == null) continue; + if (cell1 == null) continue; + if (cell2 == null) continue; + String oldId=""; + String newId=""; + String flId=""; + Boolean iserr=false; + switch (cell.getCellType()) { + case Cell.CELL_TYPE_STRING: + oldId = cell.getStringCellValue(); + break; + case Cell.CELL_TYPE_NUMERIC: + long temp= (long) cell.getNumericCellValue(); + oldId=String.valueOf(temp); + break; + case Cell.CELL_TYPE_FORMULA: + oldId = cell.getCellFormula(); + break; + case Cell.CELL_TYPE_BLANK: + default: + oldId = ""; + break; + } + switch (cell1.getCellType()) { + case Cell.CELL_TYPE_STRING: + oldId = cell1.getStringCellValue(); + break; + case Cell.CELL_TYPE_NUMERIC: + long temp= (long) cell1.getNumericCellValue(); + oldId=String.valueOf(temp); + break; + case Cell.CELL_TYPE_FORMULA: + oldId = cell1.getCellFormula(); + break; + case Cell.CELL_TYPE_BLANK: + default: + oldId = ""; + break; + } + switch (cell2.getCellType()) { + case Cell.CELL_TYPE_STRING: + oldId = cell2.getStringCellValue(); + break; + case Cell.CELL_TYPE_NUMERIC: + long temp= (long) cell2.getNumericCellValue(); + oldId=String.valueOf(temp); + break; + case Cell.CELL_TYPE_FORMULA: + oldId = cell2.getCellFormula(); + break; + case Cell.CELL_TYPE_BLANK: + default: + oldId = ""; + break; + } + ModelObject[] items = TcUtils.queryItems(dmService,queryService,query, ENTRIES, new String[]{oldId}); + + if (items.length > 0) { + for (int m = 0; m < items.length; m++) { + //先刷新对象 + ModelObject item = items[m]; + dmService.refreshObjects(new ModelObject[] {item}); + //然后加载需要的属性 + + + dmService.getProperties(new ModelObject[] {item}, new String[] { "item_id", "object_type", object_name}); +// dmService.getProperties(new ModelObject[] {item}, new String[] { "item_id", "object_type","object_name" }); + try { + oldId = item.getPropertyDisplayableValue("item_id"); + + } catch (NotLoadedException e) { + log.error(oldId+"加载属性失败",e); + iserr=true; + continue; + } +// if(targetID.equals(old_item_id)){ +// log.warn(targetID+":与old_item_id一致,跳过"); +// continue; +// }else { +// try { +// TcUtils.setProperty(item, hi4_old_item_id, new String[]{targetID}); +// } catch (Exception e) { +// log.error(targetID+":覆盖hi4_old_item_id属性失败",e); +// iserr=true; +// } +// } + + try { + ItemRevision rev = TcUtils.getLatestReleasedRev(dmService, (Item) item); + dmService.getProperties(new ModelObject[] {rev}, new String[] {"IMAN_master_form_rev"}); + ModelObject revForm = rev.get_IMAN_master_form_rev()[0]; + } catch (Exception e) { + log.error(oldId+"加载属性失败",e); + iserr=true; + continue; + } + + String uid = item.getUid(); + try { + Object[] objects = new Object[3]; + objects[0] = new String[]{uid}; + objects[1] = "item_id"; + objects[2] = newId; + tcUserService.call(connection,"connor_set_prop_value",objects ); + }catch (Exception e){ +// log.warn(targetID+"更新信息",e); + } + item= TcUtils.queryItemByUid(uid); + dmService.getProperties(new ModelObject[]{item}, new String[]{"item_id"}); + String NewItemId = item.getPropertyDisplayableValue("item_id"); + if(item==null){ + log.error(oldId+"UID获取对象失败"); + iserr=true; + }else { + // dmService.refreshObjects(new ModelObject[]{item}); + dmService.getProperties(new ModelObject[]{item}, new String[]{"revision_list","bom_view_tags"}); + //bomViewTags名称修改 + try { + ModelObject[] bomViewTags = ((Item) item).get_bom_view_tags(); + log.warn(String.format("%s:bom_view_tags 数量:%d",newId,bomViewTags==null?0:bomViewTags.length)); + if(bomViewTags!=null && bomViewTags.length>0){ + dmService.getProperties(new ModelObject[] {bomViewTags[0]}, new String[] {object_name}); + String bomViewTagName = bomViewTags[0].getPropertyDisplayableValue(object_name); + if (bomViewTagName.contains(oldId)) { + log.warn(oldId+":Bom视图名称:"+bomViewTagName); + String newName = bomViewTagName.replace(oldId, NewItemId); + log.warn(oldId+":Bom视图新名称:"+newName); + TcUtils.setProperty(bomViewTags[0],object_name,new String[]{newName}); + } + } + } catch (Exception e) { + log.error(oldId+":修改Bom视图名称出错",e); + iserr=true; + } + + try { + ModelObject[] revs = ((Item) item).get_revision_list(); + log.warn(String.format("%s:revs 数量:%d",oldId,revs==null?0:revs.length)); + //structure_revisions + for (int j = 0; j < revs.length; j++) { + ItemRevision Rev=((ItemRevision)revs[j]); + dmService.getProperties(new ModelObject[] {revs[j]}, new String[] {"IMAN_master_form_rev","structure_revisions"}); + ModelObject Form = Rev.get_IMAN_master_form_rev()[0]; + PSBOMViewRevision[] structureRevisions = Rev.get_structure_revisions(); + dmService.getProperties(new ModelObject[]{Form}, new String[]{object_name}); + String FormName = Form.getPropertyDisplayableValue(object_name); + + if (FormName.contains(oldId)) { + log.warn(oldId+":版本表单名称:"+FormName); + String newName = FormName.replace(oldId, newId); + log.warn(oldId+":版本表单新名称:"+newName); + TcUtils.setProperty(Form,object_name,new String[]{newName}); + + } + if(structureRevisions!=null && structureRevisions.length>0){ + dmService.getProperties(structureRevisions, new String[] {object_name}); + dmService.getProperties(new ModelObject[] {Form,structureRevisions[0]}, new String[] {object_name}); + String viewName = structureRevisions[0].getPropertyDisplayableValue(object_name); + if (viewName.contains(oldId)) { + log.warn(oldId+":Bom视图版本名称:"+viewName); + String newName = viewName.replace(oldId, newId); + log.warn(oldId+":Bom视图版本新名称:"+newName); + TcUtils.setProperty(structureRevisions[0],object_name,new String[]{newName}); + } + } + } + + } catch (Exception e) { + log.error(oldId+":修改 Bom视图版本名称||版本表单名称属性出错",e); + iserr=true; + } + } + +// ReservationService.getService(connection). + if(iserr) { + log.error(String.format("********** %s : 失败 以上是报错信息**********\n",oldId)); + }else { + log.fatal(String.format("********** %s : 成功 **********\n",oldId)); + } + } + + }else { + log.error(String.format("********** %s : 系统未查到该ID**********\n",newId)); + } + + + } + }catch (Exception e){ + log.error("错误",e); + } + + + + + + if(connection!=null){ + TcUtils.byPass("false",connection); + loginSoa.logout(); + + } + System.exit(0); + } + public static void changeComponentProperties(DataManagementService dmService,ModelObject objects) { + + + DataManagement.ItemElementProperties[] paramArrayOfItemElementProperties = null; + DataManagement.ItemElementProperties itemElementProperties = new DataManagement.ItemElementProperties(); + itemElementProperties.itemElement = objects; + HashMap attributes = new HashMap(); + attributes.put("item_id", "HX00000001"); + itemElementProperties.itemElemAttributes = attributes; + dmService.createOrUpdateItemElements(new DataManagement.ItemElementProperties[]{itemElementProperties}); + } + + +} \ No newline at end of file diff --git a/src/com/zf/Session.java b/src/com/zf/Session.java new file mode 100644 index 0000000..840cde7 --- /dev/null +++ b/src/com/zf/Session.java @@ -0,0 +1,225 @@ +//================================================== +// +// Copyright 2008 Siemens Product Lifecycle Management Software Inc. All Rights Reserved. +// +//================================================== + +package com.zf; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; +import java.util.Vector; + + +import org.apache.commons.httpclient.HttpState; + +import com.teamcenter.schemas.soa._2006_03.exceptions.InvalidCredentialsException; +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; +import com.teamcenter.services.strong.core.DataManagementService; +import com.teamcenter.services.strong.core.SessionService; +import com.teamcenter.services.strong.core._2006_03.Session.LoginResponse; +import com.teamcenter.soa.SoaConstants; +import com.teamcenter.soa.client.Connection; +import com.teamcenter.soa.client.model.ModelObject; +import com.teamcenter.soa.client.model.strong.User; +import com.teamcenter.soa.client.model.strong.WorkspaceObject; +import com.teamcenter.soa.exceptions.CanceledOperationException; +import com.teamcenter.soa.exceptions.NotLoadedException; + +import org.apache.log4j.Logger; + +public class Session +{ + /** + * Single instance of the Connection object that is shared throughtout + * the application. This Connection object is needed whenever a Service + * stub is instantiated. + */ + private static Connection connection; + private static final Logger log = Logger.getLogger(Session.class); + /** + * The credentialManager is used both by the Session class and the Teamcenter + * Services Framework to get user credentials. + * + */ + private static AppXCredentialManager credentialManager; + + /** + * Create an instance of the Session with a connection to the specified + * server. + * + * Add implementations of the ExceptionHandler, PartialErrorListener, + * ChangeListener, and DeleteListeners. + * + * @param host Address of the host to connect to, http://serverName:port/tc + */ + public Session(String host) + { + // Create an instance of the CredentialManager, this is used + // by the SOA Framework to get the user's credentials when + // challanged by the server (sesioin timeout on the web tier). + credentialManager = new AppXCredentialManager(); + + String protocol = (host.startsWith("http"))? SoaConstants.HTTP: SoaConstants.IIOP; + + // Create the Connection object, no contact is made with the server + // until a service request is made + connection = new Connection(host, new HttpState(), credentialManager, SoaConstants.REST, + protocol, false); + + // Add an ExceptionHandler to the Connection, this will handle any + // InternalServerException, communication errors, xml marshalling errors + // .etc + connection.setExceptionHandler(new AppXExceptionHandler()); + + // While the above ExceptionHandler is required, all of the following + // Listeners are optional. Client application can add as many or as few Listeners + // of each type that they want. + + // Add a Partial Error Listener, this will be notified when ever a + // a service returns partial errors. + connection.getModelManager().addPartialErrorListener(new AppXPartialErrorListener()); + + // Add a Change Listener, this will be notified when ever a + // a service returns model objects that have been updated. + connection.getModelManager().addChangeListener(new AppXUpdateObjectListener()); + + // Add a Delete Listener, this will be notified when ever a + // a service returns objects that have been deleted. + connection.getModelManager().addDeleteListener(new AppXDeletedObjectListener()); + + // Add a Request Listener, this will be notified before and after each + // service request is sent to the server. + Connection.addRequestListener( new AppXRequestListener() ); + + } + + /** + * Get the single Connection object for the application + * + * @return connection + */ + public static Connection getConnection() + { + return connection; + } + + /** + * Login to the Teamcenter Server + * + */ + public User login(String userName, String pwd,String group,String role,String sessionDiscriminator) throws InvalidCredentialsException { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + + LoginResponse out = sessionService.login(userName, pwd, + group, role,"", sessionDiscriminator); + + return out.user; + } + + /** + * Terminate the session with the Teamcenter Server + * + */ + public void logout() + { + // Get the service stub + SessionService sessionService = SessionService.getService(connection); + try + { + // ***************************** + // Execute the service operation + // ***************************** + sessionService.logout(); + } + catch (ServiceException e){} + } + + /** + * Print some basic information for a list of objects + * + * @param objects + */ + public static void printObjects(ModelObject[] objects) + { + if(objects == null) + return; + + SimpleDateFormat format = new SimpleDateFormat("M/d/yyyy h:mm a", new Locale("en", "US")); // Simple no time zone + + // Ensure that the referenced User objects that we will use below are loaded + getUsers( objects ); + + System.out.println("Name\t\tOwner\t\tLast Modified"); + System.out.println("====\t\t=====\t\t============="); + for (int i = 0; i < objects.length; i++) + { + if(!(objects[i] instanceof WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + try + { + String name = wo.get_object_string(); + User owner = (User) wo.get_owning_user(); + Calendar lastModified =wo.get_last_mod_date(); + + System.out.println(name + "\t" + owner.get_user_name() + "\t" + + format.format(lastModified.getTime())); + } + catch (NotLoadedException e) + { + // Print out a message, and skip to the next item in the folder + // Could do a DataManagementService.getProperties call at this point + System.out.println(e.getMessage()); + System.out.println("The Object Property Policy ($TC_DATA/soa/policies/Default.xml) is not configured with this property."); + } + } + + } + + + private static void getUsers( ModelObject[] objects ) + { + if(objects == null) + return; + + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + + List unKnownUsers = new Vector(); + for (int i = 0; i < objects.length; i++) + { + if(!(objects[i] instanceof WorkspaceObject )) + continue; + + WorkspaceObject wo = (WorkspaceObject)objects[i]; + + User owner = null; + try + { + owner = (User) wo.get_owning_user(); + owner.get_user_name(); + } + catch (NotLoadedException e) + { + if(owner != null) + unKnownUsers.add(owner); + } + } + User[] users = (User[])unKnownUsers.toArray(new User[unKnownUsers.size()]); + String[] attributes = { "user_name" }; + + + // ***************************** + // Execute the service operation + // ***************************** + dmService.getProperties(users, attributes); + + + } + + +} diff --git a/src/com/zf/StringHolder.java b/src/com/zf/StringHolder.java new file mode 100644 index 0000000..24e2df4 --- /dev/null +++ b/src/com/zf/StringHolder.java @@ -0,0 +1,11 @@ +package com.zf; + +public class StringHolder { + public String value = null; + + public StringHolder() {} + + public StringHolder(String value) { + this.value = value; + } +} diff --git a/src/com/zf/TCSoaUserService.java b/src/com/zf/TCSoaUserService.java new file mode 100644 index 0000000..6aef314 --- /dev/null +++ b/src/com/zf/TCSoaUserService.java @@ -0,0 +1,79 @@ +package com.zf; +import com.teamcenter.soa.client.Connection; + +public class TCSoaUserService { + public TCSoaUserService() { + } + + + public String call(Connection connection,String name,Object[] objects) { + return callUserSerivce(connection, name, objects); + } + + /** + * 调用UserService服务 + * + * @param methodName 服务名称 + * @param marshalledArguments 参数 + * @return + */ + public String callUserSerivce( + Connection connection, String methodName, Object[] marshalledArguments) { + ICCTUserService userService = new ICCTUserService(connection); + longSeqValue_uHolder holder1 = new longSeqValue_uHolder(); + IntHolder localIntHolder = new IntHolder(); + userService.getMethodParameters(methodName, holder1, localIntHolder); + int[] localObject1 = new int[0]; + if (holder1.value.is_seqValue()) { + localObject1 = holder1.value.seqValue(); + } + String[] values = new String[marshalledArguments.length]; + values = marshallArguments(localObject1, marshalledArguments); + stringSeqValue_u localObject2 = new stringSeqValue_u(); + localObject2.seqValue(values); + StringHolder localObject3 = new StringHolder(); + userService.callMethod(methodName, localObject2, localObject3); + return localObject3.value; + } + + private String[] marshallArguments(int[] paramArrayOfInt, Object[] paramArrayOfObject) { + int i = paramArrayOfObject.length; + String[] arrayOfString = new String[i]; + + for (int j = 0; j < i; j++) { + if (isArrayType(paramArrayOfInt[j])) { + // arrayOfString[j] = marshallArrayValue(paramArrayOfInt[j], paramArrayOfObject[j]); + } else { + arrayOfString[j] = marshallValue(paramArrayOfInt[j], paramArrayOfObject[j]); + } + } + return arrayOfString; + } + + private String marshallValue(int paramInt, Object paramObject) { + String localObject1 = ""; + switch (paramInt) { + case 5: + int localInteger = (Integer) paramObject; + localObject1 = localInteger + ""; + break; + + case 8: + String str1 = (String) paramObject; + localObject1 = str1; + break; + + default: + break; + } + return localObject1; + } + + private boolean isArrayType(int paramInt) { + boolean isok = false; + if (paramInt > 100) { + isok = true; + } + return isok; + } +} diff --git a/src/com/zf/TcUtility.java b/src/com/zf/TcUtility.java new file mode 100644 index 0000000..332df2a --- /dev/null +++ b/src/com/zf/TcUtility.java @@ -0,0 +1,191 @@ +package com.zf; + +import com.teamcenter.services.internal.loose.core._2011_06.ICT.Arg; +import com.teamcenter.services.internal.loose.core._2011_06.ICT.Array; +import com.teamcenter.services.internal.loose.core._2011_06.ICT.Entry; +import com.teamcenter.services.internal.loose.core._2011_06.ICT.Structure; + +public class TcUtility + { + public static Arg createArg(String argValue) + { + Arg arg = new Arg(); + arg.val = argValue; + return arg; + } + + + public Entry createEntry() + { + Entry arg = new Entry(); + arg.structure = new Structure[1]; + arg.structure[0] = new Structure(); + + return arg; + } + public static longSeqValue_u queryArg(Arg arg, longSeqValue_u argValue) + { + if (argValue == null) { + argValue = new longSeqValue_u(); + } + argValue.__default(); + if (arg.structure == null || arg.structure[0] == null) { + return null; + } + if (arg.structure[0].args == null) { + return argValue; + } + String dicVal = "0"; + if (argValue.discriminator()) { + dicVal = "1"; + } + if (arg.structure[0].args[0].val.equals(dicVal)) + { + return argValue; + } + if (arg.structure[0].args[0].val.equalsIgnoreCase("TRUE")) + { + argValue.seqValue(TcUtility.queryArg(arg.structure[0].args[1], argValue.seqValue())); + } + else + { + argValue.seqValue(new int[0]); + } + return argValue; + } + public static int[] queryArg(Arg arg, int[] argValue) + { + if (arg.array == null || arg.array.length == 0 || arg.array[0] == null) { + return null; + } + if (arg.array[0].entries == null) { + return null; + } + argValue = new int[arg.array[0].entries.length]; + for (int ii = 0; ii < arg.array[0].entries.length; ii++) + { + argValue[ii] = (int) TcUtility.queryEntry(arg.array[0].entries[ii], argValue[ii]); + } + return argValue; + } + public static int[] queryEntry(Entry arg, int[] argValue) + { + if (arg.array == null || arg.array.length == 0 || arg.array[0] == null) { + return null; + } + if (arg.array[0].entries == null) { + return null; + } + argValue = new int[arg.array[0].entries.length]; + for (int ii = 0; ii < arg.array[0].entries.length; ii++) + { + argValue[ii] = (int) TcUtility.queryEntry(arg.array[0].entries[ii], argValue[ii]); + } + return argValue; + } + public static int queryEntry(Entry arg, int argValue) + { + return Integer.parseInt(arg.val); + } + public static int queryArg(Arg arg, int argValue) + { + return Integer.parseInt(arg.val); + } + public static Arg createArg(stringSeqValue_u[] argValue) + { + Arg arg = new Arg(); + arg.array = new Array[1]; + arg.array[0] = new Array(); + arg.array[0].entries = new Entry[argValue.length]; + for (int ii = 0; ii < argValue.length; ii++) + { + arg.array[0].entries[ii] = TcUtility.createEntry(argValue[ii]); + } + return arg; + } + + public static Entry createEntry(stringSeqValue_u argValue) + { + Entry arg = new Entry(); + String discValue = Boolean.toString(argValue.discriminator()); + arg.structure = new Structure[1]; + arg.structure[0] = new Structure(); + if (discValue.equalsIgnoreCase("TRUE")) + { + arg.structure[0].args = new Arg[2]; + } + else + { + arg.structure[0].args = new Arg[1]; + } + arg.structure[0].args[0] = new Arg(); + arg.structure[0].args[0].val = discValue; + + //process union members + if (discValue.equalsIgnoreCase("TRUE")) + { + arg.structure[0].args[1] = TcUtility.createArg(argValue.seqValue()); + } + return arg; + } + + public static Arg createArg(String[] argValue) + { + Arg arg = new Arg(); + arg.array = new Array[1]; + arg.array[0] = new Array(); + arg.array[0].entries = new Entry[argValue.length]; + for (int ii = 0; ii < argValue.length; ii++) + { + arg.array[0].entries[ii] = TcUtility.createEntry(argValue[ii]); + } + return arg; + } + public static Entry createEntry(String argValue) + { + Entry arg = new Entry(); + arg.val = argValue; + return arg; + } + + public static Arg createArg(stringSeqValue_u argValue) + { + Arg arg = new Arg(); + String discValue =Boolean.toString( argValue.discriminator()); + arg.structure = new Structure[1]; + arg.structure[0] = new Structure(); + + if (discValue.equalsIgnoreCase("TRUE")) + { + + arg.structure[0].args = new Arg[2]; + } + else + { + arg.structure[0].args = new Arg[1]; + } + arg.structure[0].args[0] = new Arg(); + arg.structure[0].args[0].val = discValue; + + + //process union members + if (discValue.equalsIgnoreCase("TRUE")) + { + + + arg.structure[0].args[1] = TcUtility.createArg(argValue.seqValue()); + } + return arg; + } + public static String queryArgStringUnion(Arg arg, String argValue) + { + argValue = null; + if (arg.structure != null && arg.structure[0] != null && arg.structure[0].args != null && arg.structure[0].args[0].val.equalsIgnoreCase("TRUE")) + { + argValue = arg.structure[0].args[1].val; + } + return argValue; + } + } + + \ No newline at end of file diff --git a/src/com/zf/TcUtils.java b/src/com/zf/TcUtils.java new file mode 100644 index 0000000..97b3756 --- /dev/null +++ b/src/com/zf/TcUtils.java @@ -0,0 +1,379 @@ +package com.zf; + +import com.teamcenter.schemas.soa._2006_03.exceptions.ServiceException; + +import com.teamcenter.services.strong.administration.PreferenceManagementService; +import com.teamcenter.services.strong.classification.ClassificationService; +import com.teamcenter.services.strong.classification._2007_01.Classification; +import com.teamcenter.services.strong.core.DataManagementService; +import com.teamcenter.services.strong.core.SessionService; +import com.teamcenter.services.strong.core._2007_01.DataManagement; +import com.teamcenter.services.strong.query.SavedQueryService; +import com.teamcenter.services.strong.query._2006_03.SavedQuery; +import com.teamcenter.services.strong.query._2006_03.SavedQuery.GetSavedQueriesResponse; +import com.teamcenter.services.strong.query._2007_09.SavedQuery.QueryResults; +import com.teamcenter.services.strong.query._2007_09.SavedQuery.SavedQueriesResponse; +import com.teamcenter.services.strong.query._2008_06.SavedQuery.QueryInput; +import com.teamcenter.services.strong.workflow.WorkflowService; +import com.teamcenter.services.strong.workflow._2008_06.Workflow; +import com.teamcenter.soa.client.Connection; +import com.teamcenter.soa.client.model.ErrorValue; +import com.teamcenter.soa.client.model.ModelObject; +import com.teamcenter.soa.client.model.ServiceData; +import com.teamcenter.soa.client.model.strong.*; +import com.teamcenter.soa.exceptions.NotLoadedException; +import org.apache.log4j.Logger; +import org.omg.CORBA.StringHolder; + +import java.io.File; +import java.io.IOException; +import java.util.*; + +/** + * @author root + */ +public class TcUtils { + private static final Logger log = Logger.getLogger(TcUtils.class); + /** + * Perform a simple query of the database + */ + public static ModelObject[] queryItems(DataManagementService dmService,SavedQueryService queryService,ImanQuery query, String[] entries, String[] values) { + ModelObject[] foundObjs = new ModelObject[0]; + try { + + QueryInput[] savedQueryInput = new QueryInput[1]; + savedQueryInput[0] = new QueryInput(); + savedQueryInput[0].query = query; + savedQueryInput[0].entries = entries; + savedQueryInput[0].values = values; +// log.warn("savedQueryInput[0].entries" + Arrays.toString(savedQueryInput[0].entries)); + SavedQueriesResponse savedQueryResult = queryService.executeSavedQueries(savedQueryInput); + QueryResults found = savedQueryResult.arrayOfResults[0]; + if (found != null) { + String[] objectU = new String[found.objectUIDS.length]; + System.arraycopy(found.objectUIDS, 0, objectU, 0, found.objectUIDS.length); + ServiceData sd = dmService.loadObjects(objectU); + foundObjs = new ModelObject[sd.sizeOfPlainObjects()]; + for (int k = 0; k < sd.sizeOfPlainObjects(); k++) { + foundObjs[k] = sd.getPlainObject(k); + } + } + return foundObjs; + } catch (Exception e) { + log.error("ѯ[" + query + "]",e); + return foundObjs; + } + } + + + public static ImanQuery getQuery(DataManagementService dmService,SavedQueryService queryService,String queryName){ + ImanQuery query = null; + +// GetSavedQueriesResponse savedQueries = queryService.getSavedQueries(); + com.teamcenter.services.strong.query._2010_04.SavedQuery.FindSavedQueriesCriteriaInput findQueryInput + = new com.teamcenter.services.strong.query._2010_04.SavedQuery.FindSavedQueriesCriteriaInput(); + findQueryInput.queryNames=new String[]{queryName}; + com.teamcenter.services.strong.query._2010_04.SavedQuery.FindSavedQueriesResponse findSavedQueriesResponse = null; + try { + findSavedQueriesResponse = queryService.findSavedQueries(new com.teamcenter.services.strong.query._2010_04.SavedQuery.FindSavedQueriesCriteriaInput[]{findQueryInput}); + } catch (ServiceException e) { + throw new RuntimeException(e); + } + if(ServiceDataError(findSavedQueriesResponse.serviceData)){ + query=findSavedQueriesResponse.savedQueries[0]; + + try { + dmService.getProperties(new ModelObject[] { findSavedQueriesResponse.savedQueries[0] }, new String[] { "query_name" }); + log.warn("ѯ " + findSavedQueriesResponse.savedQueries[0].get_query_name() ); + } catch (NotLoadedException e) { + throw new RuntimeException(e); + } + } + + if (query == null) { + log.warn("ϵͳûҵ[" + queryName + "]ѯ!"); + return query; + } + SavedQuery.DescribeSavedQueriesResponse queryDescResp = queryService.describeSavedQueries(new ImanQuery[]{query}); + if(ServiceDataError(queryDescResp.serviceData)){ + for (int i = 0; i < queryDescResp.fieldLists.length; i++) { + for (int i1 = 0; i1 < queryDescResp.fieldLists[i].fields.length; i1++) { + log.warn(queryDescResp.fieldLists[i].fields[i1].attributeName); + log.warn(queryDescResp.fieldLists[i].fields[i1].entryName); + } + } + } + return query; + + } + + // жַǷΪ null հַոƱȣ + public static boolean isEmpty(String str) { + return str == null || str.trim().isEmpty(); + } + + /** + * ȡ·汾 + * + * @param dataManagementService + * @param item + * @return + * @throws Exception + */ + public static ItemRevision getLatestReleasedRev(DataManagementService dataManagementService, Item item) throws Exception { + if (item == null) { + return null; + } + dataManagementService.refreshObjects(new ModelObject[]{item}); + ItemRevision[] revs = getReleasedRevs(dataManagementService, item); + if (revs == null || revs.length == 0) { + return null; + } + dataManagementService.getProperties(revs, new String[]{"item_revision_id"}); + ItemRevision baseRev = revs[0]; + for (int i = 0; i < revs.length; i++) { + ItemRevision temp = revs[i]; + if (temp.get_item_revision_id().compareTo(baseRev.get_item_revision_id()) > 0) { + baseRev = temp; + } + } + return baseRev; + } + /** + * ȡİ汾 + * + * @param dataManagementService + * @param item + * @return + * @throws Exception + */ + private static ItemRevision[] getReleasedRevs(DataManagementService dataManagementService, Item item) throws Exception { + dataManagementService.refreshObjects(new ModelObject[]{item}); + dataManagementService.getProperties(new ModelObject[]{item}, new String[]{"revision_list"}); + ModelObject[] revs = item.get_revision_list(); + if (revs == null) { + return null; + } + List res = new ArrayList(); + dataManagementService.refreshObjects(revs); + dataManagementService.getProperties(revs, new String[]{"release_status_list"}); + for (int i = 0; i < revs.length; i++) { + ReleaseStatus[] rs = ((ItemRevision) revs[i]).get_release_status_list(); + if (rs != null && rs.length > 0) { + res.add((ItemRevision) revs[i]); + } + } + return res.toArray(new ItemRevision[]{}); + } + + + // + public static void createProcess(String[] uids, String process_name, String process_temp) { + try { + Connection connection = Session.getConnection(); + System.out.println("process_temp:" + process_temp); + System.out.println("revisionUid:" + uids.length); + // + WorkflowService wfService = WorkflowService.getService(connection); + + Workflow.ContextData contextData = new Workflow.ContextData(); + + String observerKey = ""; + String name = process_name; + String subject = ""; + String description = ""; + + contextData.processTemplate = process_temp; // update with your own ProcessTemplate. + contextData.subscribeToEvents = false; + contextData.subscriptionEventCount = 0; + contextData.attachmentCount = uids.length; + contextData.attachments = uids; + + int[] typeInts = new int[]{uids.length}; + for(int a = 0; a < uids.length; a++){ + typeInts[a] = 1; + } + contextData.attachmentTypes = typeInts; + // + Workflow.InstanceInfo instanceInfo = + wfService.createInstance(true, observerKey, name, subject, description, contextData); + + System.out.println("ɣ"); + } catch (Exception ex) { + System.out.println(ex.getMessage()); + } + } + + public static void deleteFile(File file) throws IOException { + //жǷڴļ + if (file.exists()) { + //жǷļ + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length > 0) { + for (File itemFile : files) { + if (itemFile.isDirectory() && itemFile.listFiles().length > 0) { + deleteFile(itemFile); + } else { + System.out.println("ɾļ,·=" + itemFile.getAbsolutePath()); + itemFile.delete(); + } + } + } + } else { + System.out.println("ļ,ֱɾ,·=" + file.getAbsolutePath()); + file.delete(); + } + } else { + System.out.println("ļ"); + } + } + + + +// public static String getPrefValue(String prefName) { +// PreferenceManagementService service = PreferenceManagementService.getService(Session.getConnection()); +// +// SessionService sessionService = SessionService.getService(Session.getConnection()); +// Session.ScopedPreferenceNames preferenceNames = new Session.ScopedPreferenceNames(); +// preferenceNames.names = new String[]{prefName}; +// preferenceNames.scope = "site"; +// com.teamcenter.services.strong.core._2010_04.Session.MultiPreferenceResponse2 resp = sessionService.getPreferences2(new Session.ScopedPreferenceNames[]{preferenceNames}); +// com.teamcenter.services.strong.core._2010_04.Session.ReturnedPreferences2[] prefs = resp.preferences; +// if (prefs == null || prefs.length == 0) { +// return ("ѡ + prefName + "); +// } +// String[] values = prefs[0].values; +// if (values == null || values.length == 0) { +// return "ѡ + prefName + δ"; +// } +// return values[0]; +// } +// +// //ѡƻȡѡֵ +// public static String[] getPreferenceValues(Session session, String preferenceName) throws Exception { +// PreferenceManagementService pmService = PreferenceManagementService.getService(session.getConnection()); +// Session. +// PreferenceManagement.GetPreferencesResponse getPreferencesResponse +// = pmService.getPreferences(new String[]{preferenceName}, false); +// checkPartialErrors(getPreferencesResponse.data); +// PreferenceManagement.CompletePreference[] completePreferences = getPreferencesResponse.response; +// PreferenceManagement.PreferenceValue preferenceValue = completePreferences[0].values; +// return preferenceValue.values; +// } + + + + public static ModelObject queryItemByUid(String uid) { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ModelObject[] items = loadObjects(new String[]{uid}, dmService); + if (items.length <= 0) { + return null; + } + dmService.refreshObjects(items); + return items[0]; + } + + public static ModelObject[] loadObjects(String[] ids, DataManagementService dmService) { + ServiceData sData = dmService.loadObjects(ids); + List lstObj = new ArrayList(16); + if (ServiceDataError(sData)) { + for (int i = 0; i < sData.sizeOfPlainObjects(); i++) { + lstObj.add(sData.getPlainObject(i)); + } + } + return lstObj.toArray(new ModelObject[0]); + } + + + + + + + public static boolean ServiceDataError(ServiceData data) { + return data.sizeOfPartialErrors() <= 0; + } + + public static void setProperties(String objectId, String[] keys, + String[] values) { + if (keys.length != values.length) { + return; + } + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + ModelObject[] obj = loadObjects(new String[]{objectId}, dmService); + if (obj.length == 0) { + return; + } + + Map ht = new HashMap(16); + + for (int i = 0; i < keys.length; i++) { + DataManagement.VecStruct vs = new DataManagement.VecStruct(); + + vs.stringVec = new String[]{values[i]}; + ht.put(keys[i], vs); + } + + dmService.setProperties(new ModelObject[]{obj[0]}, ht); + + } + public static void setProperty(ModelObject modelObject, String keys, + String[] values) throws Exception { + DataManagementService dmService = DataManagementService.getService(Session.getConnection()); + Map ht = new HashMap(16); + DataManagement.VecStruct vs = new DataManagement.VecStruct(); + vs.stringVec = values; + ht.put(keys, vs); + ServiceData serviceData = dmService.setProperties(new ModelObject[]{modelObject}, ht); + checkPartialErrors(serviceData); + + + } + + public static void byPass(String action,Connection connection){ + com.teamcenter.services.strong.core._2007_12.Session.StateNameValue[] propPairs = new com.teamcenter.services.strong.core._2007_12.Session.StateNameValue[1]; + + propPairs[0] = new com.teamcenter.services.strong.core._2007_12.Session.StateNameValue(); + + propPairs[0].name = new String("bypassFlag"); + + propPairs[0].value = action; + ServiceData serviceData = SessionService.getService(connection).setUserSessionState(propPairs); + try { + checkPartialErrors(serviceData); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static void checkPartialErrors(ServiceData serviceData) throws Exception { + StringBuffer buf = new StringBuffer(); + for (int x = 0; x < serviceData.sizeOfPartialErrors(); ++x) { + String[] messages = serviceData.getPartialError(x).getMessages(); + for (int y = 0; y < messages.length; ++y) { + buf.append(messages[y]); + buf.append("\n"); + } + } + if (buf.length() > 0) throw new Exception(buf.toString()); + } + + /** + * + * + */ + public static void SendItemRevisionToClass( ItemRevision rev, String classId) throws Exception { + ClassificationService classService = ClassificationService.getService(Session.getConnection()); + Classification.ClassificationObject[] icos = new Classification.ClassificationObject[1]; + Classification.CreateClassificationObjectsResponse createICOResponse = null; + icos[0] = new Classification.ClassificationObject(); + icos[0].classId = classId; + icos[0].clsObjTag = null; + icos[0].instanceId = classId; + icos[0].unitBase = "METRIC"; + icos[0].wsoId = rev; + createICOResponse = classService.createClassificationObjects(icos); + checkPartialErrors(createICOResponse.data); + + } +} diff --git a/src/com/zf/log4j.properties b/src/com/zf/log4j.properties new file mode 100644 index 0000000..f2bd702 --- /dev/null +++ b/src/com/zf/log4j.properties @@ -0,0 +1,39 @@ +log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n + +log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.infolog.Threshold = INFO +log4j.appender.infolog.File = soalog/item_id/zf_update_itemid_all.log +log4j.appender.infolog.layout = org.apache.log4j.PatternLayout +log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO +#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO + +log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.warnlog.Threshold = WARN +log4j.appender.warnlog.File = soalog/item_id/zf_update_itemid_warn.log +log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout +log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN +#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN + +log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.errorlog.Threshold = ERROR +log4j.appender.errorlog.File = soalog/item_id/zf_update_itemid_error.log +log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout +log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR +log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR + +log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.successlog.Threshold = FATAL +log4j.appender.successlog.File = soalog/item_id/zf_update_itemid_success.log +log4j.appender.successlog.layout = org.apache.log4j.PatternLayout +log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n \ No newline at end of file diff --git a/src/com/zf/longSeqValue_u.java b/src/com/zf/longSeqValue_u.java new file mode 100644 index 0000000..18e7d5e --- /dev/null +++ b/src/com/zf/longSeqValue_u.java @@ -0,0 +1,35 @@ +package com.zf; +public class longSeqValue_u { + private boolean __discriminator; + + private Object __value; + + + public longSeqValue_u() { + __default(); + } + + public boolean discriminator() { + return __discriminator; + } + + public void __default() { + this.__discriminator = false; + this.__value = null; + } + + public int[] seqValue() { + return (int[])__value; + } + + public void seqValue(int[] value) { + this.__discriminator = true; + this.__value = value; + } + + public boolean is_seqValue() { + return __discriminator; + } + +} + diff --git a/src/com/zf/longSeqValue_uHolder.java b/src/com/zf/longSeqValue_uHolder.java new file mode 100644 index 0000000..6c89a6b --- /dev/null +++ b/src/com/zf/longSeqValue_uHolder.java @@ -0,0 +1,14 @@ +package com.zf; +public class longSeqValue_uHolder { + public longSeqValue_u value; + + + public longSeqValue_uHolder() { + } + + public longSeqValue_uHolder(longSeqValue_u value) { + this.value = value; + } + +} + diff --git a/src/com/zf/param_zh_CN.properties b/src/com/zf/param_zh_CN.properties new file mode 100644 index 0000000..54d6430 --- /dev/null +++ b/src/com/zf/param_zh_CN.properties @@ -0,0 +1,15 @@ +#host=http://192.168.9.20:7001/tc +#username=admin +#password=admin +#host=http://10.19.245.251:58001/tc +#username=ojplm +#password=hand@123 +host=http://10.10.2.40:7001/tc +username=dcproxy +password=dcproxy +group=dba + + + + + diff --git a/src/com/zf/stringSeqValue_u.java b/src/com/zf/stringSeqValue_u.java new file mode 100644 index 0000000..b747ecb --- /dev/null +++ b/src/com/zf/stringSeqValue_u.java @@ -0,0 +1,35 @@ +package com.zf; +public class stringSeqValue_u { + private boolean __discriminator; + + private Object __value; + + + public stringSeqValue_u() { + __default(); + } + + public boolean discriminator() { + return __discriminator; + } + + public void __default() { + this.__discriminator = false; + this.__value = null; + } + + public String[] seqValue() { + return (String[])__value; + } + + public void seqValue(String[] value) { + this.__discriminator = true; + this.__value = value; + } + + public boolean is_seqValue() { + return __discriminator; + } + +} + diff --git a/src/log4j.properties b/src/log4j.properties new file mode 100644 index 0000000..d209f36 --- /dev/null +++ b/src/log4j.properties @@ -0,0 +1,39 @@ +log4j.rootLogger=info,stdout,infolog,warnlog,errorlog,successlog + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n + +log4j.appender.infolog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.infolog.Threshold = INFO +log4j.appender.infolog.File = soalog/item_id/Hisense_update_itemid_all.log +log4j.appender.infolog.layout = org.apache.log4j.PatternLayout +log4j.appender.infolog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.infolog.filter.infoFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.infolog.filter.infoFilter.LevelMin = INFO +#log4j.appender.infolog.filter.infoFilter.LevelMax = INFO + +log4j.appender.warnlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.warnlog.Threshold = WARN +log4j.appender.warnlog.File = soalog/item_id/Hisense_update_itemid_warn.log +log4j.appender.warnlog.layout = org.apache.log4j.PatternLayout +log4j.appender.warnlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +#log4j.appender.warnlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +#log4j.appender.warnlog.filter.warnFilter.LevelMin = WARN +#log4j.appender.warnlog.filter.warnFilter.LevelMax=WARN + +log4j.appender.errorlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.errorlog.Threshold = ERROR +log4j.appender.errorlog.File = soalog/item_id/Hisense_update_itemid_error.log +log4j.appender.errorlog.layout = org.apache.log4j.PatternLayout +log4j.appender.errorlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n +log4j.appender.errorlog.filter.warnFilter = org.apache.log4j.varia.LevelRangeFilter +log4j.appender.errorlog.filter.warnFilter.LevelMin = ERROR +log4j.appender.errorlog.filter.warnFilter.LevelMax=ERROR + +log4j.appender.successlog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.successlog.Threshold = FATAL +log4j.appender.successlog.File = soalog/item_id/Hisense_update_itemid_success.log +log4j.appender.successlog.layout = org.apache.log4j.PatternLayout +log4j.appender.successlog.layout.ConversionPattern = [%d{MM-dd HH:mm:ss}] [%-5p] [%c:%L] %m%n \ No newline at end of file diff --git a/src/param_zh_CN.properties b/src/param_zh_CN.properties new file mode 100644 index 0000000..54d6430 --- /dev/null +++ b/src/param_zh_CN.properties @@ -0,0 +1,15 @@ +#host=http://192.168.9.20:7001/tc +#username=admin +#password=admin +#host=http://10.19.245.251:58001/tc +#username=ojplm +#password=hand@123 +host=http://10.10.2.40:7001/tc +username=dcproxy +password=dcproxy +group=dba + + + + +