Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BasicAPI
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杜科
BasicAPI
Commits
b93919a9
Commit
b93919a9
authored
Jun 15, 2023
by
hanson.yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
210-优化项开发
parent
dac003fb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
4552 additions
and
723 deletions
+4552
-723
access.properties
codebase/com/yonde/access/access.properties
+1
-0
CatiaIntegration.properties
codebase/com/yonde/config/CatiaIntegration.properties
+0
-0
CatiaTransfer.properties
codebase/com/yonde/config/cadpro/CatiaTransfer.properties
+20
-0
OfficeTransfer.properties
codebase/com/yonde/config/cadpro/OfficeTransfer.properties
+14
-0
listUtilities.jsp
codebase/netmarkets.jsp.site/listUtilities.jsp
+101
-0
AccessFilter.java
src/com/yonde/access/AccessFilter.java
+77
-0
CustomActionValidator.java
src/com/yonde/access/CustomActionValidator.java
+42
-0
AddMemberListenerService.java
src/com/yonde/access/listener/AddMemberListenerService.java
+9
-0
StandardAddMemberListenerService.java
...nde/access/listener/StandardAddMemberListenerService.java
+74
-0
CADProConstants.java
src/com/yonde/cadpro/CADProConstants.java
+26
-0
EBOMListenerService.java
src/com/yonde/cadpro/listener/EBOMListenerService.java
+9
-0
StandardEBOMListenerService.java
...om/yonde/cadpro/listener/StandardEBOMListenerService.java
+86
-0
CadCheckService.java
src/com/yonde/cadpro/service/CadCheckService.java
+1
-678
ModelService.java
src/com/yonde/cadpro/service/ModelService.java
+2
-2
CADDocumentUtil.java
src/com/yonde/cadpro/util/CADDocumentUtil.java
+1
-1
DBUtil.java
src/com/yonde/cadpro/util/DBUtil.java
+499
-0
ExtProperties.java
src/com/yonde/cadpro/util/ExtProperties.java
+133
-0
FTPOperation.java
src/com/yonde/cadpro/util/FTPOperation.java
+23
-42
FtpUtil.java
src/com/yonde/cadpro/util/FtpUtil.java
+329
-0
AssembleTransformUtil.java
...com/yonde/cadpro/visualization/AssembleTransformUtil.java
+127
-0
ConvertCatia2B3dUtil.java
...onde/cadpro/visualization/catia/ConvertCatia2B3dUtil.java
+92
-0
ConvertCatia2GlbUtil.java
...onde/cadpro/visualization/catia/ConvertCatia2GlbUtil.java
+67
-0
ConvertModel2B3dService.java
...e/cadpro/visualization/catia/ConvertModel2B3dService.java
+34
-0
ConvertModel2GlbService.java
...e/cadpro/visualization/catia/ConvertModel2GlbService.java
+34
-0
B3dPart.java
.../yonde/cadpro/visualization/catia/xmlb3dbean/B3dPart.java
+137
-0
B3dRoot.java
.../yonde/cadpro/visualization/catia/xmlb3dbean/B3dRoot.java
+57
-0
B3dStructer.java
...de/cadpro/visualization/catia/xmlb3dbean/B3dStructer.java
+146
-0
Part.java
src/com/yonde/cadpro/visualization/catia/xmlbean/Part.java
+70
-0
Root.java
src/com/yonde/cadpro/visualization/catia/xmlbean/Root.java
+71
-0
Structer.java
...om/yonde/cadpro/visualization/catia/xmlbean/Structer.java
+71
-0
AssembleTransformInfo.java
...adpro/visualization/coordinate/AssembleTransformInfo.java
+106
-0
AssembleTransformSnapshot.java
...o/visualization/coordinate/AssembleTransformSnapshot.java
+66
-0
VisualizationFacade.java
...onde/cadpro/visualization/facade/VisualizationFacade.java
+270
-0
VisualizationService.java
...nde/cadpro/visualization/facade/VisualizationService.java
+1748
-0
RfUtil.java
src/com/yonde/common/RfUtil.java
+9
-0
No files found.
codebase/com/yonde/access/access.properties
0 → 100644
View file @
b93919a9
FilterUser
=
SJY-kabuda
codebase/com/yonde/config/
cadpro/
CatiaIntegration.properties
→
codebase/com/yonde/config/CatiaIntegration.properties
View file @
b93919a9
File moved
codebase/com/yonde/config/cadpro/CatiaTransfer.properties
0 → 100644
View file @
b93919a9
#For Catia Transfer Web Service
Catia.Transfer.host
=
192.168.1.240
Catia.Transfer.port
=
8081
Catia.Transfer.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.serviceName
=
ConvertModel2GlbService
#For B3d
Catia.Transfer.B3d.host
=
192.168.1.240
Catia.Transfer.B3d.port
=
8081
Catia.Transfer.B3d.targetNameSpace
=
www.ptc.com/ws
Catia.Transfer.B3d.serviceName
=
ConvertModel2B3dService
#For FTP Config
Catia.ftp.host
=
192.168.1.240
Catia.ftp.port
=
21
Catia.ftp.username
=
ftpuser
Catia.ftp.password
=
Aa12345678!
Catia.ftp.remotePath
=
/
#Temp Path for FTP download, FTP upload, Server Temp store
Catia.tempFolderPath
=
/Visualization/
Catia.outFolderPath
=
/3D_transfer_result
Catia.support.format
=
CATProduct
\ No newline at end of file
codebase/com/yonde/config/cadpro/OfficeTransfer.properties
0 → 100644
View file @
b93919a9
#For Office Transfer Web Service
Office.Transfer.host
=
192.168.1.240
Office.Transfer.port
=
8082
Office.Transfer.targetNameSpace
=
www.ptc.com/ws
Office.Transfer.serviceName
=
ConvertOfficePDFService
#For FTP Config
Office.ftp.host
=
192.168.1.240
Office.ftp.port
=
21
Office.ftp.username
=
ftpuser
Office.ftp.password
=
Aa12345678!
Office.ftp.remotePath
=
/
#Temp Path for FTP download, FTP upload, Server Temp store
Office.tempFolderPath
=
/Visualization/
Office.support.format
=
doc docx xls xlsx ppt pptx
\ No newline at end of file
codebase/netmarkets.jsp.site/listUtilities.jsp
0 → 100644
View file @
b93919a9
<%@page
import=
"com.ptc.core.ui.navigationRB"
%>
<%
request
.
setAttribute
(
"browserWinTitleConst"
,
navigationRB
.
WIN_TITLE_SITE_TAB_UTIL
);
%>
<%@ include
file=
"/netmarkets/jsp/util/begin.jspf"
%>
<%@ page
import=
"java.util.concurrent.ConcurrentHashMap"
%>
<%@ page
import=
"wt.audit.AuditHelper"
%>
<%@ page
import=
"wt.org.WTUser"
%>
<%@ page
import=
"wt.session.SessionHelper"
%>
<%@ page
import=
"wt.inf.container.WTContainerRef"
%>
<%@ page
import=
"wt.inf.container.WTContainerHelper"
%>
<%@ page
import=
"com.ptc.netmarkets.util.misc.NmAction"
%>
<%@ page
import=
"com.ptc.netmarkets.util.beans.NmURLFactoryBean"
%>
<%@ page
import=
"wt.util.InstalledProperties"
%>
<!-- Build table to control which utilities are shown, Any entry for a title
signafies that that link is to be shown. The key used is the the name is
for getting the text value of the link lable from object rbinfo
-->
<%
System
.
out
.
println
(
">>>
listUtilities
.
jsp
start
...
");
// TODO: make this a tag
WTUser currentUser = (WTUser)SessionHelper.getPrincipal();
boolean isSiteAdmin = false;
WTContainerRef siteContainerRef = WTContainerHelper.service.getExchangeRef();
if (siteContainerRef != null) {
isSiteAdmin = WTContainerHelper.service.isAdministrator(siteContainerRef, currentUser);
}
if(!isSiteAdmin) {
NmAction.jsRedirectWithNoAccessMessage(out, new NmURLFactoryBean());
} else {
ConcurrentHashMap showUtility = new ConcurrentHashMap();
showUtility.put("
AUDITING_PURGE
" , "
Enable
");
showUtility.put("
AUDITING_LICENSE_USAGE
" , "
Enable
");
showUtility.put("
AUDITING_SECURITY_REPORT_QUERIES
", "
Enable
");
showUtility.put("
AUDITING_SECURITY_REPORTS
", "
Enable
");
showUtility.put("
CAD_AGENT
" , "
Enable
");
showUtility.put("
ESI_TRANSACTION_ADMIN
" , "
Enable
");
showUtility.put("
ESI_DISTRIBUTION_TARGET_ADMIN
" , "
Enable
");
showUtility.put("
CALENDAR_MANAGEMENT
" , "
Enable
");
showUtility.put("
INFO_ENGINE
" , "
Enable
");
showUtility.put("
MAPPING_MANAGEMENT
" , "
Enable
");
showUtility.put("
NUMBERING_SCHEMES
" , "
Enable
");
showUtility.put("
VERSIONING_SCHEMES
" , "
Enable
");
showUtility.put("
LIFE_CYCLE_ADMIN
" , "
Enable
");
showUtility.put("
POLICY_ADMINISTRATOR
" , "
Enable
");
showUtility.put("
PREFERENCE_MANAGER_X10
" , "
Enable
");
showUtility.put("
PARTICIPANT_ADMINISTRATION
", "
Enable
");
showUtility.put("
PRODUCT_VIEW
" , "
Enable
");
showUtility.put("
PRO_INTRALINK
" , "
Enable
");
showUtility.put("
PUBLISH_MONITOR
" , "
Enable
");
showUtility.put("
SMB_WIZARD
" , "
Enable
");
showUtility.put("
PUBLISH_SCHEDULER
" , "
Enable
");
showUtility.put("
PUBLISH_THB_CONTROL
" , "
Enable
");
showUtility.put("
PURGE_ADMINISTRATOR
" , "
Enable
");
showUtility.put("
QUEUE_MANAGER
" , "
Enable
");
showUtility.put("
REPLICATION_ADMINISTRATOR
", "
Enable
");
showUtility.put("
RULES_ADMINISTRATION
" , "
Enable
");
showUtility.put("
TASK_DELEGATE
" , "
Enable
");
showUtility.put("
OPTEGRA_GATEWAY
" , "
Enable
");
showUtility.put("
TYPE_ATTRIBUTE_MANAGER
" , "
Enable
");
showUtility.put("
TYPE_ATTRIBUTE_MANAGER_X20
","
Enable
");
showUtility.put("
WORKFLOW_TEMPLATES_ADMIN
" , "
Enable
");
showUtility.put("
WORKFLOW_ADMIN_DASHBOARD
" , "
Enable
");
showUtility.put("
VERSIONING_SCHEMES
" , "
Enable
");
showUtility.put("
VIEW_NETWORK
" , "
Enable
");
showUtility.put("
REPORT_MANAGER
" , "
Enable
");
showUtility.put("
PERSONAL_CABINETS
" , "
Enable
");
showUtility.put("
CLASSIFICATION_ADMINISTRATOR
", "
Enable
");
showUtility.put("
TEAM_ADMIN
" , "
Enable
");
showUtility.put("
SERVER_STATUS
" , "
Enable
");
showUtility.put("
TS_PORTAL
" , "
Enable
");
showUtility.put("
DASHBOARD
" , "
Enable
");
showUtility.put("
BUSINESS_RULES
" , "
Enable
");
showUtility.put("
SOFTWARE_ADAPTERS_ADMINISTRATOR
" , "
Enable
");
if ( InstalledProperties.isInstalled(InstalledProperties.RIALTO) ) {
showUtility.put("
SOFTWARE_ADAPTERS_ADMINISTRATOR
" , "
Enable
");
}
//don't show the import/export link if projectlink is installed standalone, SPR 1011638
if(InstalledProperties.isInstalled(InstalledProperties.PDMLINK)
|| InstalledProperties.isInstalled(InstalledProperties.WINDCHILL_PDM) ) {
showUtility.put("
IMPORT_EXPORT
" , "
Enable
");
}
//Don't show the promotion preference manager if projectlink is installed standalone
if(InstalledProperties.isInstalled(InstalledProperties.PDML_PROI)) {
showUtility.put("
PROMOTION_PREFERENCE_MANAGER
" , "
Enable
"
);
}
showUtility
=
com
.
yonde
.
access
.
AccessFilter
.
filter
(
null
,
currentUser
,
showUtility
);
%>
<%
request
.
setAttribute
(
"helpPath"
,
"SiteAdminUtilAbout"
);
%>
<%@ include
file=
"/netmarkets/jsp/object/commonUtilities.jsp"
%>
<%
}
// else is site admin
%>
<%@ include
file=
"/netmarkets/jsp/util/end.jspf"
%>
src/com/yonde/access/AccessFilter.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
access
;
import
org.apache.commons.lang.StringUtils
;
import
wt.inf.container.WTContainerRef
;
import
wt.org.WTUser
;
import
wt.util.WTProperties
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 实现三权控制
*/
public
class
AccessFilter
{
public
static
ConcurrentHashMap
filter
(
WTContainerRef
containerRef
,
WTUser
currentUser
,
ConcurrentHashMap
concurrentHashMap
)
throws
IOException
{
Map
<
String
,
String
>
accessModuleMap
=
initFilter
();
String
userName
=
currentUser
.
getName
();
String
orDefault
=
accessModuleMap
.
get
(
userName
);
if
(
orDefault
==
null
)
{
return
concurrentHashMap
;
}
else
{
return
getAllConcurrentHashMap
();
}
}
public
static
ConcurrentHashMap
getAllConcurrentHashMap
()
{
ConcurrentHashMap
showUtility
=
new
ConcurrentHashMap
();
showUtility
.
put
(
"AUDITING_PURGE"
,
"Enable"
);
showUtility
.
put
(
"AUDITING_LICENSE_USAGE"
,
"Enable"
);
showUtility
.
put
(
"AUDITING_SECURITY_REPORT_QUERIES"
,
"Enable"
);
showUtility
.
put
(
"AUDITING_SECURITY_REPORTS"
,
"Enable"
);
showUtility
.
put
(
"EXT_USER_MANAGE"
,
"Enable"
);
return
showUtility
;
}
public
static
Map
<
String
,
String
>
initFilter
()
throws
IOException
{
Map
<
String
,
String
>
filterUserMap
=
new
HashMap
<
String
,
String
>();
String
filterUser
=
File
.
separator
+
"codebase"
+
File
.
separator
+
"com"
+
File
.
separator
+
"yonde"
+
File
.
separator
+
"access"
+
File
.
separator
+
"access.properties"
;
Properties
properties
=
new
Properties
();
try
{
WTProperties
wtproperties
=
WTProperties
.
getLocalProperties
();
String
fullPath
=
wtproperties
.
getProperty
(
"wt.home"
)
+
filterUser
;
InputStream
inputStream
=
null
;
try
{
inputStream
=
new
FileInputStream
(
new
File
(
fullPath
));
properties
.
load
(
inputStream
);
}
finally
{
if
(
null
!=
inputStream
)
{
inputStream
.
close
();
}
}
String
property
=
properties
.
getProperty
(
"FilterUser"
);
String
[]
split
=
property
.
split
(
"-"
);
for
(
String
item:
split
)
{
String
value
=
filterUserMap
.
get
(
item
);
if
(
StringUtils
.
isBlank
(
value
)){
filterUserMap
.
put
(
item
,
item
);
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
filterUserMap
;
}
}
src/com/yonde/access/CustomActionValidator.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
access
;
import
com.ptc.core.ui.validation.*
;
import
org.apache.commons.lang.StringUtils
;
import
wt.org.WTPrincipal
;
import
wt.session.SessionHelper
;
import
java.util.Map
;
public
class
CustomActionValidator
implements
SimpleValidationFilter
{
public
CustomActionValidator
()
{
}
@Override
public
UIValidationStatus
preValidateAction
(
UIValidationKey
uiValidationKey
,
UIValidationCriteria
uiValidationCriteria
)
{
System
.
out
.
println
(
">>>CustomActionValidator start..."
);
WTPrincipal
principal
;
try
{
principal
=
SessionHelper
.
manager
.
getPrincipal
();
String
name
=
principal
.
getName
();
System
.
out
.
println
(
">>>CustomActionValidator name..."
+
name
);
Map
<
String
,
String
>
filterMap
=
AccessFilter
.
initFilter
();
String
value
=
filterMap
.
get
(
name
);
if
(!
StringUtils
.
isBlank
(
value
))
{
return
UIValidationStatus
.
HIDDEN
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
UIValidationStatus
.
ENABLED
;
}
@Override
public
UIValidationStatus
preValidateAttribute
(
UIValidationKey
uiValidationKey
,
UIValidationCriteria
uiValidationCriteria
)
{
return
null
;
}
@Override
public
UIValidationResultSet
preValidateMultiTargetAction
(
UIValidationKey
uiValidationKey
,
UIValidationCriteria
uiValidationCriteria
)
{
return
null
;
}
}
\ No newline at end of file
src/com/yonde/access/listener/AddMemberListenerService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
access
.
listener
;
/**
* Created on 2023/5/22 0022
*
* @author
*/
public
interface
AddMemberListenerService
{
}
src/com/yonde/access/listener/StandardAddMemberListenerService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
access
.
listener
;
import
com.yonde.access.AccessFilter
;
import
org.apache.commons.lang.StringUtils
;
import
wt.events.KeyedEvent
;
import
wt.events.KeyedEventListener
;
import
wt.fc.PersistenceManagerEvent
;
import
wt.org.MembershipLink
;
import
wt.org.WTPrincipal
;
import
wt.services.ManagerException
;
import
wt.services.ServiceEventListenerAdapter
;
import
wt.services.StandardManager
;
import
wt.util.WTException
;
import
java.io.Serializable
;
import
java.util.Map
;
public
class
StandardAddMemberListenerService
extends
StandardManager
implements
AddMemberListenerService
,
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
String
CLASSNAME
=
StandardAddMemberListenerService
.
class
.
getName
();
private
KeyedEventListener
listener
;
@Override
public
String
getConceptualClassname
()
{
return
CLASSNAME
;
}
public
static
StandardAddMemberListenerService
newStandardAddMemberListenerService
()
throws
WTException
{
StandardAddMemberListenerService
instance
=
new
StandardAddMemberListenerService
();
instance
.
initialize
();
return
instance
;
}
/**
* 添加需要监听的事件
*/
@Override
protected
void
performStartupProcess
()
throws
ManagerException
{
listener
=
new
WCEventListener
(
this
.
getConceptualClassname
());
//getManagerService().addEventListener(listener, PersistenceManagerEvent.generateEventKey(PersistenceManagerEvent.PRE_MODIFY));
getManagerService
().
addEventListener
(
listener
,
PersistenceManagerEvent
.
generateEventKey
(
PersistenceManagerEvent
.
PRE_STORE
));
}
/**
* 定义内部类,用来处理相应的事件
*/
class
WCEventListener
extends
ServiceEventListenerAdapter
{
public
WCEventListener
(
String
manager_name
)
{
super
(
manager_name
);
}
@Override
public
void
notifyVetoableEvent
(
Object
eve
)
throws
Exception
{
if
(!(
eve
instanceof
KeyedEvent
))
{
return
;
}
KeyedEvent
event
=
(
KeyedEvent
)
eve
;
String
eventType
=
event
.
getEventType
();
Object
target
=
event
.
getEventTarget
();
Map
<
String
,
String
>
filterMembers
=
AccessFilter
.
initFilter
();
if
(
target
instanceof
MembershipLink
)
{
if
(
PersistenceManagerEvent
.
PRE_STORE
.
equals
(
eventType
))
{
MembershipLink
membershipLink
=
(
MembershipLink
)
target
;
WTPrincipal
principal
=
membershipLink
.
getMember
();
String
filter
=
filterMembers
.
get
(
principal
.
getName
());
if
(
StringUtils
.
isNotBlank
(
filter
))
{
throw
new
WTException
(
"所选用户不允许被添加到团队中!"
);
}
}
}
}
}
}
src/com/yonde/cadpro/CADProConstants.java
View file @
b93919a9
...
@@ -91,4 +91,30 @@ public class CADProConstants {
...
@@ -91,4 +91,30 @@ public class CADProConstants {
public
static
String
EXPERIMENT
=
"Experiment"
;
//铁鸟
public
static
String
EXPERIMENT
=
"Experiment"
;
//铁鸟
}
}
//可视化配置
public
static
String
QUEUE_NAME_VISUALIZATION_OFFICE
=
"VisualizationOffice"
;
public
static
String
QUEUE_NAME_VISUALIZATION_CATIA
=
"VisualizationCatia"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_HOST
=
"Catia.Transfer.host"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_PORT
=
"Catia.Transfer.port"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_TARGETNAMESPACE
=
"Catia.Transfer.targetNameSpace"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_SERVICENAME
=
"Catia.Transfer.serviceName"
;
public
static
String
CONFIG_KEY_OFFICE_SUPPORT_FORMAT
=
"Office.support.format"
;
public
static
String
CONFIG_KEY_CATIA_SUPPORT_FORMAT
=
"Catia.support.format"
;
public
static
String
CONFIG_KEY_OFFICE_TEMPFOLDERPATH
=
"Office.tempFolderPath"
;
public
static
String
CONFIG_KEY_CATIA_TEMPFOLDERPATH
=
"Catia.tempFolderPath"
;
public
static
String
CONFIG_KEY_OFFICE_FTP_HOST
=
"Office.ftp.host"
;
public
static
String
CONFIG_KEY_OFFICE_FTP_PORT
=
"Office.ftp.port"
;
public
static
String
CONFIG_KEY_OFFICE_FTP_USERNAME
=
"Office.ftp.username"
;
public
static
String
CONFIG_KEY_OFFICE_FTP_PASSWORD
=
"Office.ftp.password"
;
public
static
String
CONFIG_KEY_CATIA_FTP_HOST
=
"Catia.ftp.host"
;
public
static
String
CONFIG_KEY_CATIA_FTP_PORT
=
"Catia.ftp.port"
;
public
static
String
CONFIG_KEY_CATIA_FTP_USERNAME
=
"Catia.ftp.username"
;
public
static
String
CONFIG_KEY_CATIA_FTP_PASSWORD
=
"Catia.ftp.password"
;
public
static
String
CONFIG_KEY_CATIA_OUTFOLDERPATH
=
"Catia.outFolderPath"
;
}
}
src/com/yonde/cadpro/listener/EBOMListenerService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
listener
;
/**
* Created on 2023/5/22 0022
*
* @author
*/
public
interface
EBOMListenerService
{
}
src/com/yonde/cadpro/listener/StandardEBOMListenerService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
listener
;
import
com.yonde.cadpro.CADProConstants
;
import
com.yonde.cadpro.visualization.facade.VisualizationFacade
;
import
org.apache.log4j.Logger
;
import
wt.content.ApplicationData
;
import
wt.content.ContentHolder
;
import
wt.content.ContentRoleType
;
import
wt.content.ContentServiceEvent
;
import
wt.events.KeyedEvent
;
import
wt.events.KeyedEventListener
;
import
wt.queue.ProcessingQueue
;
import
wt.services.ManagerException
;
import
wt.services.ServiceEventListenerAdapter
;
import
wt.services.StandardManager
;
import
wt.util.WTException
;
import
java.io.Serializable
;
public
class
StandardEBOMListenerService
extends
StandardManager
implements
EBOMListenerService
,
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
String
CLASSNAME
=
StandardEBOMListenerService
.
class
.
getName
();
private
static
final
Logger
logger
=
Logger
.
getLogger
(
CLASSNAME
);
private
KeyedEventListener
listener
;
@Override
public
String
getConceptualClassname
()
{
return
CLASSNAME
;
}
public
static
StandardEBOMListenerService
newStandardEBOMListenerService
()
throws
WTException
{
StandardEBOMListenerService
instance
=
new
StandardEBOMListenerService
();
instance
.
initialize
();
return
instance
;
}
/**
* 添加需要监听的事件
*/
@Override
protected
void
performStartupProcess
()
throws
ManagerException
{
listener
=
new
WCListenerEventListener
(
this
.
getConceptualClassname
());
//主内容
getManagerService
().
addEventListener
(
listener
,
ContentServiceEvent
.
generateEventKey
(
ContentServiceEvent
.
POST_UPLOAD
));
try
{
logger
.
debug
(
"performStartupProcess check Visualization Queue"
);
VisualizationFacade
.
getQueue
(
ProcessingQueue
.
class
,
CADProConstants
.
QUEUE_NAME_VISUALIZATION_CATIA
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"performStartupProcess getQueue for error..."
,
e
);
}
}
/**
* 定义内部类,用来处理相应的事件
*/
class
WCListenerEventListener
extends
ServiceEventListenerAdapter
{
public
WCListenerEventListener
(
String
manager_name
)
{
super
(
manager_name
);
}
@Override
public
void
notifyVetoableEvent
(
Object
eve
)
throws
Exception
{
System
.
out
.
println
(
">>>WCListenerEventListener notifyVetoableEvent start... eve:"
+
eve
);
if
(!(
eve
instanceof
KeyedEvent
))
{
return
;
}
KeyedEvent
event
=
(
KeyedEvent
)
eve
;
String
eventType
=
event
.
getEventType
();
if
(
ContentServiceEvent
.
POST_UPLOAD
.
equals
(
eventType
))
{
//&& target instanceof EPMDocument) {
if
(
event
instanceof
ContentServiceEvent
)
{
ContentServiceEvent
cse
=
(
ContentServiceEvent
)
event
;
ApplicationData
appData
=
cse
.
getApplicationData
();
ContentHolder
contentHolder
=
cse
.
getContentHolder
();
if
(
appData
!=
null
&&
contentHolder
!=
null
)
{
if
(
ContentRoleType
.
PRIMARY
.
equals
(
appData
.
getRole
()))
{
logger
.
debug
(
"contentHolder["
+
contentHolder
+
"] PRIMARY POST_UPLOAD,publish Visualization"
);
VisualizationFacade
.
createQueueEntry
(
contentHolder
);
}
}
}
}
}
}
}
src/com/yonde/cadpro/service/CadCheckService.java
View file @
b93919a9
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/service/ModelService.java
View file @
b93919a9
...
@@ -1815,12 +1815,12 @@ public class ModelService {
...
@@ -1815,12 +1815,12 @@ public class ModelService {
System
.
out
.
println
(
"isDrawing : "
+
isDrawing
);
System
.
out
.
println
(
"isDrawing : "
+
isDrawing
);
System
.
out
.
println
(
"modelThumbnailUri : "
+
modelThumbnailUri
);
System
.
out
.
println
(
"modelThumbnailUri : "
+
modelThumbnailUri
);
System
.
out
.
println
(
"modelRelativePath : "
+
modelRelativePath
);
System
.
out
.
println
(
"modelRelativePath : "
+
modelRelativePath
);
/*
if
(
StringUtils
.
isBlank
(
modelNumber
)
||
StringUtils
.
isBlank
(
modelName
)
if
(
StringUtils
.
isBlank
(
modelNumber
)
||
StringUtils
.
isBlank
(
modelName
)
||
StringUtils
.
isBlank
(
modelFileName
)
||
StringUtils
.
isBlank
(
modelFileUri
))
{
||
StringUtils
.
isBlank
(
modelFileName
)
||
StringUtils
.
isBlank
(
modelFileUri
))
{
throw
new
WTException
(
"待检入模型编号、名称、模型文件名称、模型文件Uri不能为空"
);
throw
new
WTException
(
"待检入模型编号、名称、模型文件名称、模型文件Uri不能为空"
);
}
}
*/
StringBuilder
baseCheckSB
=
new
StringBuilder
(
""
);
StringBuilder
baseCheckSB
=
new
StringBuilder
(
""
);
if
(
StringUtils
.
isBlank
(
modelNumber
))
{
if
(
StringUtils
.
isBlank
(
modelNumber
))
{
baseCheckSB
.
append
(
"待检入模型编号不能为空"
);
baseCheckSB
.
append
(
"待检入模型编号不能为空"
);
...
...
src/com/yonde/cadpro/util/CADDocumentUtil.java
View file @
b93919a9
...
@@ -6,7 +6,6 @@ import com.ptc.core.meta.type.mgmt.server.impl.TypeDomainHelper;
...
@@ -6,7 +6,6 @@ import com.ptc.core.meta.type.mgmt.server.impl.TypeDomainHelper;
import
com.yonde.cadpro.CADProConstants
;
import
com.yonde.cadpro.CADProConstants
;
import
com.yonde.common.CommonUtil
;
import
com.yonde.common.CommonUtil
;
import
com.yonde.common.IBAUtil
;
import
com.yonde.common.IBAUtil
;
import
com.yonde.common.PartUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
wt.doc.WTDocument
;
import
wt.doc.WTDocument
;
...
@@ -981,4 +980,5 @@ public class CADDocumentUtil {
...
@@ -981,4 +980,5 @@ public class CADDocumentUtil {
return
getEPM
(
document
.
getNumber
(),
otherVersion
,
(
String
)
null
);
return
getEPM
(
document
.
getNumber
(),
otherVersion
,
(
String
)
null
);
}
}
}
}
}
}
src/com/yonde/cadpro/util/DBUtil.java
0 → 100644
View file @
b93919a9
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/util/ExtProperties.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
util
;
import
org.apache.commons.lang.StringUtils
;
import
wt.util.WTProperties
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.util.*
;
/**
* Properties util .
*
*/
public
class
ExtProperties
{
private
Map
<
String
,
String
>
hmConfig
=
new
HashMap
<
String
,
String
>();
private
String
filepath
=
""
;
/**
* constructor
*
* @param configFilePath
*/
public
ExtProperties
(
String
configFilePath
)
{
this
.
filepath
=
configFilePath
;
readConfig
();
}
/**
*
* init read property file.
*
*/
@SuppressWarnings
(
"rawtypes"
)
public
void
readConfig
()
{
Properties
pro
=
new
Properties
();
try
{
String
wthome
=
(
String
)
(
WTProperties
.
getLocalProperties
()).
getProperty
(
"wt.home"
,
""
);
FileInputStream
fis
=
new
FileInputStream
(
wthome
+
File
.
separator
+
filepath
);
pro
.
load
(
fis
);
Enumeration
enuPro
=
pro
.
propertyNames
();
while
(
enuPro
.
hasMoreElements
())
{
String
proName
=
(
String
)
enuPro
.
nextElement
();
proName
=
StringUtils
.
trimToEmpty
(
proName
);
String
encodingProName
=
encodingStr
(
proName
,
"ISO8859-1"
,
"utf-8"
);
String
value
=
(
String
)
pro
.
getProperty
(
proName
);
value
=
StringUtils
.
trimToEmpty
(
value
);
value
=
encodingStr
(
value
,
"ISO8859-1"
,
"utf-8"
);
hmConfig
.
put
(
encodingProName
,
value
);
}
fis
.
close
();
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
private
String
encodingStr
(
String
str
,
String
source
,
String
target
)
{
String
returnStr
=
""
;
try
{
returnStr
=
new
String
(
str
.
getBytes
(
source
),
target
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
returnStr
=
str
;
}
return
returnStr
;
}
/**
*
* Get value by key.
*
* @param key
* @return String
*
*
*/
public
String
getValueByKey
(
String
key
)
{
String
strValue
=
(
String
)
hmConfig
.
get
(
key
);
if
(
strValue
==
null
||
""
.
equals
(
strValue
))
{
return
""
;
}
else
{
strValue
=
strValue
.
trim
();
return
strValue
;
}
}
/**
*
* Get values by key and delimiter.
*
* @param key
* @param delimiter
* @return List<String>
*
*
*/
public
List
<
String
>
getValuesByKeyAndDelimiter
(
String
key
,
String
delimiter
)
{
List
<
String
>
list
=
new
ArrayList
<
String
>();
String
strValue
=
(
String
)
hmConfig
.
get
(
key
);
if
(
strValue
==
null
||
""
.
equals
(
strValue
.
trim
()))
{
return
list
;
}
else
{
strValue
=
strValue
.
trim
();
String
[]
strValues
=
strValue
.
split
(
delimiter
);
for
(
String
value
:
strValues
)
{
list
.
add
(
value
);
}
return
list
;
}
}
/**
*
* Get all keys values.
*
* @return Map<String, String>
*
*
*/
public
Map
<
String
,
String
>
getAllKeysValues
()
{
Map
<
String
,
String
>
allKeysValues
=
new
HashMap
<
String
,
String
>();
allKeysValues
=
hmConfig
;
return
allKeysValues
;
}
public
void
reload
()
{
hmConfig
=
null
;
readConfig
();
}
}
src/com/yonde/cadpro/util/FTPOperation.java
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
util
;
package
com
.
yonde
.
cadpro
.
util
;
import
org.apache.commons.net.PrintCommandListener
;
import
org.apache.commons.net.PrintCommandListener
;
import
org.apache.commons.net.ftp.FTPClient
;
import
org.apache.commons.net.ftp.FTPClient
;
import
org.apache.commons.net.ftp.FTPFile
;
import
org.apache.commons.net.ftp.FTPFile
;
...
@@ -22,18 +23,17 @@ public class FTPOperation {
...
@@ -22,18 +23,17 @@ public class FTPOperation {
* connect FTP
* connect FTP
*/
*/
public
boolean
connect
(
String
hostName
,
int
port
,
String
userName
,
String
password
)
{
public
boolean
connect
(
String
hostName
,
int
port
,
String
userName
,
String
password
)
{
log
.
debug
(
"hostName : "
+
hostName
);
System
.
out
.
println
(
"hostName : "
+
hostName
);
log
.
debug
(
"port : "
+
port
);
System
.
out
.
println
(
"port : "
+
port
);
log
.
debug
(
"userName : "
+
userName
);
System
.
out
.
println
(
"userName : "
+
userName
);
log
.
debug
(
"password : "
+
password
);
System
.
out
.
println
(
"password : "
+
password
);
FTPClient
ftp
=
new
FTPClient
();
FTPClient
ftp
=
new
FTPClient
();
this
.
ftp
=
ftp
;
this
.
ftp
=
ftp
;
try
{
try
{
ftp
.
connect
(
hostName
,
port
);
ftp
.
connect
(
hostName
,
port
);
if
(
FTPReply
.
isPositiveCompletion
(
ftp
.
getReplyCode
()))
{
if
(
FTPReply
.
isPositiveCompletion
(
ftp
.
getReplyCode
()))
{
if
(
ftp
.
login
(
userName
,
password
))
{
if
(
ftp
.
login
(
userName
,
password
))
{
ftp
.
addProtocolCommandListener
(
ftp
.
addProtocolCommandListener
(
new
PrintCommandListener
(
new
PrintWriter
(
System
.
out
)));
new
PrintCommandListener
(
new
PrintWriter
(
System
.
out
)));
return
true
;
return
true
;
}
}
}
else
{
}
else
{
...
@@ -46,7 +46,6 @@ public class FTPOperation {
...
@@ -46,7 +46,6 @@ public class FTPOperation {
}
}
/**
/**
*
* disconnect FTP
* disconnect FTP
*/
*/
public
void
disconnect
()
{
public
void
disconnect
()
{
...
@@ -61,7 +60,6 @@ public class FTPOperation {
...
@@ -61,7 +60,6 @@ public class FTPOperation {
}
}
/**
/**
*
* Upload files.
* Upload files.
*/
*/
public
boolean
uploadFile
(
String
folderName
,
List
<
File
>
fileName
)
throws
Exception
{
public
boolean
uploadFile
(
String
folderName
,
List
<
File
>
fileName
)
throws
Exception
{
...
@@ -80,10 +78,8 @@ public class FTPOperation {
...
@@ -80,10 +78,8 @@ public class FTPOperation {
FileInputStream
fis
=
null
;
FileInputStream
fis
=
null
;
try
{
try
{
fis
=
new
FileInputStream
(
file
);
fis
=
new
FileInputStream
(
file
);
encodFileName
=
new
String
(
file
.
getName
().
getBytes
(
FILE_ENCODING_UTF8
),
encodFileName
=
new
String
(
file
.
getName
().
getBytes
(
FILE_ENCODING_UTF8
),
FILE_ENCODING_ISO8859_1
);
FILE_ENCODING_ISO8859_1
);
System
.
out
.
println
(
"uploadFile encodFileName: "
+
encodFileName
+
" oriFileName: "
+
file
.
getName
());
log
.
debug
(
"uploadFile encodFileName: "
+
encodFileName
+
" oriFileName: "
+
file
.
getName
());
success
=
ftp
.
storeFile
(
encodFileName
,
fis
);
success
=
ftp
.
storeFile
(
encodFileName
,
fis
);
}
finally
{
}
finally
{
fis
.
close
();
fis
.
close
();
...
@@ -101,9 +97,7 @@ public class FTPOperation {
...
@@ -101,9 +97,7 @@ public class FTPOperation {
}
}
/**
/**
*
* DownLoad File from specify directory in sever to local folder
* DownLoad File from specify directory in sever to local folder
*
*/
*/
public
File
downLoadFileFromFTP
(
String
ftpPath
,
String
fileName
,
String
toPath
)
public
File
downLoadFileFromFTP
(
String
ftpPath
,
String
fileName
,
String
toPath
)
throws
Exception
{
throws
Exception
{
...
@@ -130,7 +124,7 @@ public class FTPOperation {
...
@@ -130,7 +124,7 @@ public class FTPOperation {
try
{
try
{
fos
=
new
FileOutputStream
(
localFile
);
fos
=
new
FileOutputStream
(
localFile
);
String
encodeFileName
=
encodeFileName
(
fileName
);
String
encodeFileName
=
encodeFileName
(
fileName
);
log
.
debug
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
System
.
out
.
println
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
+
" , oriFileName:"
+
fileName
);
+
" , oriFileName:"
+
fileName
);
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
...
@@ -142,7 +136,7 @@ public class FTPOperation {
...
@@ -142,7 +136,7 @@ public class FTPOperation {
/*
/*
String remoteFilePath = ftpPath + fileName;
String remoteFilePath = ftpPath + fileName;
log.debug
("remoteFilePath : " + remoteFilePath);
System.out.println
("remoteFilePath : " + remoteFilePath);
FTPFile[] ftpFiles = ftp.listFiles(remoteFilePath);
FTPFile[] ftpFiles = ftp.listFiles(remoteFilePath);
if (ftpFiles == null || ftpFiles.length == 0) {
if (ftpFiles == null || ftpFiles.length == 0) {
throw new Exception("远程文件[" + remoteFilePath + "]不存在");
throw new Exception("远程文件[" + remoteFilePath + "]不存在");
...
@@ -177,7 +171,7 @@ public class FTPOperation {
...
@@ -177,7 +171,7 @@ public class FTPOperation {
long newProcess = localSize / step;
long newProcess = localSize / step;
if (newProcess > process) {
if (newProcess > process) {
process = newProcess;
process = newProcess;
log.debug
("下载进度:" + process);
System.out.println
("下载进度:" + process);
}
}
}
}
is.close();
is.close();
...
@@ -192,9 +186,7 @@ public class FTPOperation {
...
@@ -192,9 +186,7 @@ public class FTPOperation {
}
}
/**
/**
*
* DownLoad File from specify directory in sever to local folder
* DownLoad File from specify directory in sever to local folder
*
*/
*/
public
void
downloadFTPFolder
(
String
ftpPath
,
String
toPath
)
throws
Exception
{
public
void
downloadFTPFolder
(
String
ftpPath
,
String
toPath
)
throws
Exception
{
try
{
try
{
...
@@ -220,19 +212,19 @@ public class FTPOperation {
...
@@ -220,19 +212,19 @@ public class FTPOperation {
for
(
FTPFile
ftpFile
:
ftpFiels
)
{
for
(
FTPFile
ftpFile
:
ftpFiels
)
{
String
fileName
=
ftpFile
.
getName
();
String
fileName
=
ftpFile
.
getName
();
log
.
debug
(
"fileName : "
+
fileName
);
System
.
out
.
println
(
"fileName : "
+
fileName
);
if
(
fileName
.
startsWith
(
"."
))
{
if
(
fileName
.
startsWith
(
"."
))
{
log
.
debug
(
"fileName["
+
fileName
+
"] startsWith '.', continue..."
);
System
.
out
.
println
(
"fileName["
+
fileName
+
"] startsWith '.', continue..."
);
continue
;
continue
;
}
}
if
(
ftpFile
.
isFile
())
{
if
(
ftpFile
.
isFile
())
{
log
.
debug
(
" Is File"
);
System
.
out
.
println
(
" Is File"
);
File
localFile
=
new
File
(
localFileDir
,
fileName
);
File
localFile
=
new
File
(
localFileDir
,
fileName
);
FileOutputStream
fos
=
null
;
FileOutputStream
fos
=
null
;
try
{
try
{
fos
=
new
FileOutputStream
(
localFile
);
fos
=
new
FileOutputStream
(
localFile
);
String
encodeFileName
=
encodeFileName
(
fileName
);
String
encodeFileName
=
encodeFileName
(
fileName
);
log
.
debug
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
System
.
out
.
println
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
+
" , oriFileName:"
+
fileName
);
+
" , oriFileName:"
+
fileName
);
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
...
@@ -242,7 +234,7 @@ public class FTPOperation {
...
@@ -242,7 +234,7 @@ public class FTPOperation {
}
}
}
}
}
else
if
(
ftpFile
.
isDirectory
())
{
}
else
if
(
ftpFile
.
isDirectory
())
{
log
.
debug
(
" Is Dir"
);
System
.
out
.
println
(
" Is Dir"
);
downloadFTPFolder
(
ftpPath
+
fileName
+
"/"
,
toPath
+
fileName
+
"/"
);
downloadFTPFolder
(
ftpPath
+
fileName
+
"/"
,
toPath
+
fileName
+
"/"
);
}
}
}
}
...
@@ -253,9 +245,7 @@ public class FTPOperation {
...
@@ -253,9 +245,7 @@ public class FTPOperation {
}
}
/**
/**
*
* DownLoad File from specify directory in sever to local folder
* DownLoad File from specify directory in sever to local folder
*
*/
*/
public
File
downLoadFileFromFTP
(
String
ftpPath
,
String
sourceFileName
,
String
toPath
,
public
File
downLoadFileFromFTP
(
String
ftpPath
,
String
sourceFileName
,
String
toPath
,
String
toFileName
)
throws
Exception
{
String
toFileName
)
throws
Exception
{
...
@@ -282,7 +272,7 @@ public class FTPOperation {
...
@@ -282,7 +272,7 @@ public class FTPOperation {
try
{
try
{
fos
=
new
FileOutputStream
(
localFile
);
fos
=
new
FileOutputStream
(
localFile
);
String
encodeFileName
=
encodeFileName
(
sourceFileName
);
String
encodeFileName
=
encodeFileName
(
sourceFileName
);
log
.
debug
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
System
.
out
.
println
(
"downLoadFileFromFTP encodeFileName: "
+
encodeFileName
+
" , oriFileName:"
+
sourceFileName
);
+
" , oriFileName:"
+
sourceFileName
);
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
String
remoteFilePath
=
ftpPath
+
encodeFileName
;
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
ftp
.
retrieveFile
(
remoteFilePath
,
fos
);
...
@@ -305,9 +295,7 @@ public class FTPOperation {
...
@@ -305,9 +295,7 @@ public class FTPOperation {
}
}
/**
/**
*
* Check the FTP directory
* Check the FTP directory
*
*/
*/
public
boolean
isDirExist
(
String
dir
)
{
public
boolean
isDirExist
(
String
dir
)
{
try
{
try
{
...
@@ -319,7 +307,8 @@ public class FTPOperation {
...
@@ -319,7 +307,8 @@ public class FTPOperation {
}
}
}
}
/** Create a FTP multi-level directory
/**
* Create a FTP multi-level directory
*/
*/
public
void
createDir
(
String
dir
)
throws
IOException
{
public
void
createDir
(
String
dir
)
throws
IOException
{
if
(!
isDirExist
(
dir
))
{
if
(!
isDirExist
(
dir
))
{
...
@@ -345,15 +334,15 @@ public class FTPOperation {
...
@@ -345,15 +334,15 @@ public class FTPOperation {
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
FTPFile
tempFile
=
files
[
i
];
FTPFile
tempFile
=
files
[
i
];
String
oringinalName
=
tempFile
.
getName
();
String
oringinalName
=
tempFile
.
getName
();
log
.
debug
(
"oringinalName : "
+
oringinalName
);
System
.
out
.
println
(
"oringinalName : "
+
oringinalName
);
if
(
oringinalName
.
startsWith
(
"."
))
{
if
(
oringinalName
.
startsWith
(
"."
))
{
log
.
debug
(
"oringinalName["
+
oringinalName
+
"] startsWith '.', continue..."
);
System
.
out
.
println
(
"oringinalName["
+
oringinalName
+
"] startsWith '.', continue..."
);
continue
;
continue
;
}
}
String
encodeName
=
encodeFileName
(
oringinalName
);
String
encodeName
=
encodeFileName
(
oringinalName
);
log
.
debug
(
"encodeName : "
+
encodeName
);
System
.
out
.
println
(
"encodeName : "
+
encodeName
);
if
(
tempFile
.
isFile
())
{
if
(
tempFile
.
isFile
())
{
log
.
debug
(
"Is File"
);
System
.
out
.
println
(
"Is File"
);
ftp
.
deleteFile
(
remotePath
+
"/"
+
encodeName
);
ftp
.
deleteFile
(
remotePath
+
"/"
+
encodeName
);
}
else
{
}
else
{
removeAllFiles
(
remotePath
+
"/"
+
encodeName
);
removeAllFiles
(
remotePath
+
"/"
+
encodeName
);
...
@@ -361,12 +350,4 @@ public class FTPOperation {
...
@@ -361,12 +350,4 @@ public class FTPOperation {
}
}
ftp
.
removeDirectory
(
remotePath
);
ftp
.
removeDirectory
(
remotePath
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
FTPOperation
ftpOperation
=
new
FTPOperation
();
System
.
out
.
println
(
ftpOperation
.
connect
(
"114.115.155.252"
,
21
,
"ftp"
,
"ftp"
));
ftpOperation
.
downloadFTPFolder
(
"/3D_transfer_result/a1a69f5c-4aec-455b-9b15-2c24395de5a3/"
,
"D://"
);
}
}
}
src/com/yonde/cadpro/util/FtpUtil.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
util
;
import
sun.net.TelnetInputStream
;
import
sun.net.TelnetOutputStream
;
import
sun.net.ftp.FtpClient
;
import
java.io.*
;
import
java.util.List
;
import
java.util.StringTokenizer
;
/**
* 基于jdk1.6 sun ftp 上传,下载
* @author
*
*/
public
class
FtpUtil
{
private
String
ip
;
private
String
username
;
private
String
password
;
private
int
port
;
private
String
path
=
""
;
FtpClient
ftpClient
=
null
;
OutputStream
os
=
null
;
FileInputStream
is
=
null
;
public
static
final
String
SUFFIX
=
"\r\n"
;
public
FtpUtil
(
String
serverIP
,
int
port
,
String
username
,
String
password
)
{
this
.
ip
=
serverIP
;
this
.
username
=
username
;
this
.
password
=
password
;
this
.
port
=
port
;
}
/**
* 连接ftp服务器
*
* @throws IOException
*/
public
boolean
connectServer
(){
ftpClient
=
new
FtpClient
();
try
{
if
(
this
.
port
!=
-
1
){
ftpClient
.
openServer
(
this
.
ip
,
this
.
port
);
}
else
{
ftpClient
.
openServer
(
this
.
ip
);
}
ftpClient
.
login
(
this
.
username
,
this
.
password
);
if
(
this
.
path
.
length
()
!=
0
){
ftpClient
.
cd
(
this
.
path
);
// path是ftp服务下主目录的子目录
}
ftpClient
.
binary
();
// 用2进制上传、下载
System
.
out
.
println
(
"已登录到\""
+
ftpClient
.
pwd
()
+
"\"目录"
);
return
true
;
}
catch
(
IOException
e
){
e
.
printStackTrace
();
return
false
;
}
}
/**
* 断开与ftp服务器连接
*
* @throws IOException
*/
public
boolean
closeServer
(){
try
{
if
(
is
!=
null
)
{
is
.
close
();
}
if
(
os
!=
null
)
{
os
.
close
();
}
if
(
ftpClient
!=
null
)
{
ftpClient
.
closeServer
();
}
System
.
out
.
println
(
"已从服务器断开"
);
return
true
;
}
catch
(
IOException
e
){
e
.
printStackTrace
();
return
false
;
}
}
/**
* 检查文件夹在当前目录下是否存在
* @param dir
* @return
*/
public
boolean
isDirExist
(
String
dir
){
String
pwd
=
""
;
try
{
pwd
=
ftpClient
.
pwd
();
ftpClient
.
cd
(
dir
);
ftpClient
.
cd
(
pwd
);
}
catch
(
Exception
e
){
return
false
;
}
return
true
;
}
/**
* 在当前目录下创建文件夹
* @param dir
* @return
* @throws Exception
*/
public
boolean
createDir
(
String
dir
){
System
.
out
.
println
(
">>>createDir dir:"
+
dir
);
try
{
ftpClient
.
ascii
();
StringTokenizer
s
=
new
StringTokenizer
(
dir
,
"/"
);
//sign
s
.
countTokens
();
String
pathName
=
ftpClient
.
pwd
();
while
(
s
.
hasMoreElements
()){
pathName
=
pathName
+
"/"
+
(
String
)
s
.
nextElement
();
try
{
ftpClient
.
sendServer
(
"MKD "
+
pathName
+
"\r\n"
);
}
catch
(
Exception
e
)
{
e
=
null
;
return
false
;
}
ftpClient
.
readServerResponse
();
}
ftpClient
.
binary
();
return
true
;
}
catch
(
IOException
e1
){
e1
.
printStackTrace
();
return
false
;
}
}
/**
* ftp上传
* 如果服务器段已存在名为filename的文件夹,该文件夹中与要上传的文件夹中同名的文件将被替换
*
* @param filename 要上传的文件(或文件夹)名
* @return
* @throws Exception
*/
public
boolean
upload
(
String
filename
)
throws
Exception
{
String
newname
=
""
;
if
(
filename
.
indexOf
(
"/"
)
>
-
1
){
newname
=
filename
.
substring
(
filename
.
lastIndexOf
(
"/"
)
+
1
);
}
else
{
newname
=
filename
;
}
return
upload
(
filename
,
newname
);
}
/**
* ftp上传
* 如果服务器段已存在名为newName的文件夹,该文件夹中与要上传的文件夹中同名的文件将被替换
*
* @param fileName 要上传的文件(或文件夹)名
* @param newName 服务器段要生成的文件(或文件夹)名
* @return
*/
public
boolean
upload
(
String
fileName
,
String
newName
)
throws
Exception
{
try
{
String
saveFilename
=
new
String
(
fileName
.
getBytes
(
"utf-8"
),
"utf-8"
);
//打开本地待长传的文件
File
file_in
=
new
File
(
saveFilename
);
if
(!
file_in
.
exists
()){
throw
new
Exception
(
"此文件或文件夹["
+
file_in
.
getName
()
+
"]有误或不存在!"
);
}
if
(
file_in
.
isDirectory
()){
throw
new
Exception
(
"只允许上传文件!"
);
}
else
{
uploadFile
(
file_in
.
getAbsolutePath
(),
newName
);
}
if
(
is
!=
null
){
is
.
close
();
}
if
(
os
!=
null
){
os
.
close
();
}
return
true
;
}
catch
(
Exception
e
){
e
.
printStackTrace
();
System
.
err
.
println
(
"Exception e in Ftp upload(): "
+
e
.
toString
());
throw
new
Exception
(
"只允许上传文件!"
);
}
finally
{
try
{
if
(
is
!=
null
){
is
.
close
();
}
if
(
os
!=
null
){
os
.
close
();
}
}
catch
(
IOException
e
){
e
.
printStackTrace
();
}
}
}
/**
* 指定文件夹 批量上传文件
* @param folderPath 文件夹地址
* @param list 文件信息
* @return
* @throws Exception
*/
public
void
uploadFile
(
String
folderPath
,
List
<
File
>
list
)
throws
Exception
{
System
.
out
.
println
(
"***uploadFile folderPath:"
+
folderPath
+
" list:"
+
list
);
//切换至根目录后在切换至 要上传的目录下
ftpClient
.
cd
(
"/"
);
if
(!
isDirExist
(
folderPath
)){
System
.
out
.
println
(
"***uploadFile folderPath:"
+
folderPath
+
" not exist"
);
createDir
(
folderPath
);
}
ftpClient
.
cd
(
folderPath
);
for
(
File
upload:
list
)
{
String
name
=
upload
.
getName
();
System
.
out
.
println
(
">>>uploadFile upload is:"
+
upload
+
" name is:"
+
name
);
uploadFile
(
upload
.
getAbsolutePath
(),
folderPath
+
name
);
}
}
/**
* upload 上传文件
*
* @param fileName 要上传的文件名
* @param newName 上传后的新文件名
* @return -1 文件不存在 >=0 成功上传,返回文件的大小
* @throws Exception
*/
public
long
uploadFile
(
String
fileName
,
String
newName
)
throws
Exception
{
System
.
out
.
println
(
"<<<<uploadFile fileName:"
+
fileName
+
" newName:"
+
newName
);
long
result
=
0
;
TelnetOutputStream
os
=
null
;
FileInputStream
is
=
null
;
try
{
File
file_in
=
new
File
(
fileName
);
if
(!
file_in
.
exists
())
return
-
1
;
boolean
dirExist
=
this
.
isDirExist
(
newName
);
if
(!
dirExist
){
File
temp
=
new
File
(
newName
);
String
path
=
temp
.
getAbsolutePath
();
this
.
createDir
(
path
);
}
os
=
ftpClient
.
put
(
newName
);
result
=
file_in
.
length
();
is
=
new
FileInputStream
(
file_in
);
byte
[]
bytes
=
new
byte
[
1024
];
int
c
;
while
((
c
=
is
.
read
(
bytes
))
!=
-
1
){
os
.
write
(
bytes
,
0
,
c
);
}
}
finally
{
if
(
is
!=
null
){
is
.
close
();
}
if
(
os
!=
null
){
os
.
close
();
}
}
return
result
;
}
/**
* 从ftp下载文件到本地
*
* @param filename 服务器上的文件名
* @param newfilename 本地生成的文件名
* @return
* @throws Exception
*/
public
long
downloadFile
(
String
filename
,
String
newfilename
){
long
result
=
0
;
TelnetInputStream
is
=
null
;
FileOutputStream
os
=
null
;
try
{
is
=
ftpClient
.
get
(
filename
);
File
outfile
=
new
File
(
newfilename
);
os
=
new
FileOutputStream
(
outfile
);
byte
[]
bytes
=
new
byte
[
1024
];
int
c
;
while
((
c
=
is
.
read
(
bytes
))
!=
-
1
)
{
os
.
write
(
bytes
,
0
,
c
);
result
=
result
+
c
;
}
}
catch
(
IOException
e
){
e
.
printStackTrace
();
}
finally
{
try
{
if
(
is
!=
null
){
is
.
close
();
}
if
(
os
!=
null
){
os
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
result
;
}
/**
* 删除文件
* @param filePath
* @return
* @throws Exception
*/
public
boolean
removeFile
(
String
filePath
)
throws
Exception
{
System
.
out
.
println
(
">>>removeFile filePath:"
+
filePath
);
try
{
ftpClient
.
nameList
(
filePath
);
ftpClient
.
sendServer
(
"DELE "
+
filePath
+
SUFFIX
);
}
catch
(
Exception
e
){
throw
new
Exception
(
"文件["
+
filePath
+
"]不存在!"
);
}
return
true
;
}
}
\ No newline at end of file
src/com/yonde/cadpro/visualization/AssembleTransformUtil.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
;
import
com.yonde.cadpro.util.DBUtil
;
import
com.yonde.cadpro.visualization.coordinate.AssembleTransformInfo
;
import
com.yonde.cadpro.visualization.coordinate.AssembleTransformSnapshot
;
import
org.apache.commons.lang.StringUtils
;
import
wt.epm.EPMDocument
;
import
wt.epm.structure.EPMMemberLink
;
import
wt.util.WTException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created on 2023/5/26 0026
*
* @author
*/
public
class
AssembleTransformUtil
{
/**
* 根据parentId和 snapshotHash 查询 AssembleTransformSnapshot
*
* @param parentId
* @param snapshotHash
* @return
*/
public
static
AssembleTransformSnapshot
findAssembleTransformSnapshot
(
String
parentId
,
int
snapshotHash
)
throws
WTException
{
if
(
StringUtils
.
isBlank
(
parentId
)
&&
snapshotHash
==
0
)
{
throw
new
WTException
(
"参数信息不能同时为空!"
);
}
StringBuffer
sql
=
new
StringBuffer
(
"select * from ASSEMBLETRANSFORMSNAPSHOT ast where 1 =1 "
);
if
(
StringUtils
.
isNotBlank
(
parentId
))
{
sql
.
append
(
"and PARENTID = "
+
parentId
);
}
if
(
snapshotHash
!=
0
)
{
sql
.
append
(
"and snapshotHash = "
+
snapshotHash
);
}
Object
obj
=
DBUtil
.
queryForObject
(
sql
.
toString
(),
AssembleTransformSnapshot
.
class
);
if
(
obj
!=
null
)
{
return
(
AssembleTransformSnapshot
)
obj
;
}
else
{
return
null
;
}
}
/**
* @param snapshotId
* @param parentModel
* @param childModel
* @param transform
* @param identify
* @return
*/
public
static
List
<
AssembleTransformInfo
>
findAssembleTransformInfo
(
String
snapshotId
,
String
parentModel
,
String
childModel
,
String
transform
,
String
identify
)
{
List
<
AssembleTransformInfo
>
result
=
new
ArrayList
<
AssembleTransformInfo
>();
StringBuffer
sql
=
new
StringBuffer
(
"select * from ASSEMBLETRANSFORMINFO ast where 1 =1 "
);
if
(
StringUtils
.
isNotBlank
(
snapshotId
))
{
sql
.
append
(
"and snapshotId = "
+
snapshotId
);
}
if
(
StringUtils
.
isNotBlank
(
parentModel
))
{
sql
.
append
(
"and parentModel = "
+
parentModel
);
}
if
(
StringUtils
.
isNotBlank
(
childModel
))
{
sql
.
append
(
"and childModel = "
+
childModel
);
}
if
(
StringUtils
.
isNotBlank
(
transform
))
{
sql
.
append
(
"and transform = "
+
transform
);
}
if
(
StringUtils
.
isNotBlank
(
identify
))
{
sql
.
append
(
"and identify = "
+
identify
);
}
Object
obj
=
DBUtil
.
queryForObject
(
sql
.
toString
(),
AssembleTransformInfo
.
class
);
if
(
obj
!=
null
)
{
result
=
(
List
<
AssembleTransformInfo
>)
obj
;
}
return
result
;
}
/**
* 清除坐标信息
*
* @param delete
*/
public
static
void
deleteAssembleTransformInfo
(
List
<
AssembleTransformInfo
>
delete
)
{
String
deleteIds
=
""
;
for
(
AssembleTransformInfo
item
:
delete
)
{
deleteIds
=
deleteIds
+
"'"
+
item
.
getId
()
+
"',"
;
}
if
(
deleteIds
.
startsWith
(
"'"
))
{
deleteIds
=
deleteIds
.
substring
(
1
,
0
);
}
if
(
deleteIds
.
endsWith
(
","
))
{
deleteIds
=
deleteIds
.
substring
(
0
,
deleteIds
.
length
()
-
1
);
}
System
.
out
.
println
(
">>>deleteAssembleTransformInfo ids:"
+
deleteIds
);
String
deleteSql
=
"select * from ASSEMBLETRANSFORMINFO ast where ast.id in ("
+
deleteIds
+
")'"
;
System
.
out
.
println
(
">>>deleteAssembleTransformInfo deleteSql:"
+
deleteSql
);
DBUtil
.
executeUpdate
(
deleteSql
);
}
/**
*创建 AssembleTransformInfo对象
*
* @param snapshot
* @param rootCAD
* @param linkedChildEPM
* @param epmMemberLink
* @param formatTransform
*/
public
static
AssembleTransformInfo
newAssembleTransformInfo
(
AssembleTransformSnapshot
snapshot
,
EPMDocument
rootCAD
,
EPMDocument
linkedChildEPM
,
EPMMemberLink
epmMemberLink
,
String
formatTransform
)
throws
WTException
{
System
.
out
.
println
(
">>>newAssembleTransformInfo start......"
);
//insertinto table_name (column1,column2,column3,...)values(value1,value2,value3,...);
// assembleTransformInfo.setSnapshotId(CommonUtil.getOROid(snapshot));
// assembleTransformInfo.setParentModel(CommonUtil.getOROid(parentModle));
// assembleTransformInfo.setChildModel(CommonUtil.getOROid(childModel));
// assembleTransformInfo.setIdentify(CommonUtil.getOROid(memberLink));
// assembleTransformInfo.setTransform(transform);
//StringBuffer sql = new StringBuffer(" insert into AssembleTransformInfo ('snapshotId','parentModel','childModel','transform','identify') " +
// "values( "+snapshot.getId()+","+ CommonUtil.getOROid(rootCAD)+","+formatTransform+","+CommonUtil.getOROid(memberLink));
return
null
;
}
}
src/com/yonde/cadpro/visualization/catia/ConvertCatia2B3dUtil.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
;
import
com.yonde.cadpro.util.ExtProperties
;
import
com.yonde.doc.entity.WsResult
;
import
org.apache.log4j.Logger
;
import
javax.xml.namespace.QName
;
import
javax.xml.ws.Service
;
import
java.net.URL
;
public
class
ConvertCatia2B3dUtil
{
private
static
Logger
logger
=
Logger
.
getLogger
(
ConvertCatia2B3dUtil
.
class
);
//For B3d
public
static
String
CONFIG_KEY_CATIA_TRANSFER_B3D_HOST
=
"Catia.Transfer.B3d.host"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_B3D_PORT
=
"Catia.Transfer.B3d.port"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_B3D_TARGETNAMESPACE
=
"Catia.Transfer.B3d.targetNameSpace"
;
public
static
String
CONFIG_KEY_CATIA_TRANSFER_B3D_SERVICENAME
=
"Catia.Transfer.B3d.serviceName"
;
private
static
String
PROTOCOL_HTTP
=
"http://"
;
private
ExtProperties
catiaTransferConfig
=
null
;
public
ConvertCatia2B3dUtil
(
ExtProperties
catiaTransferConfig
)
throws
Exception
{
this
.
catiaTransferConfig
=
catiaTransferConfig
;
init
();
}
private
static
String
HOST
;
private
static
String
PORT
;
private
static
String
TARGETNAMESPACE
;
private
static
String
SERVICENAME
;
void
init
()
throws
Exception
{
if
(
catiaTransferConfig
==
null
)
{
throw
new
Exception
(
"Get Catia Transfer Config error"
);
}
HOST
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_HOST
);
PORT
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_PORT
);
TARGETNAMESPACE
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_TARGETNAMESPACE
);
SERVICENAME
=
catiaTransferConfig
.
getValueByKey
(
CONFIG_KEY_CATIA_TRANSFER_B3D_SERVICENAME
);
logger
.
debug
(
HOST
);
logger
.
debug
(
PORT
);
logger
.
debug
(
TARGETNAMESPACE
);
logger
.
debug
(
SERVICENAME
);
}
public
WsResult
convert
(
String
modelFilePath
)
{
WsResult
result
=
null
;
logger
.
debug
(
"modelFilePath : "
+
modelFilePath
);
//创建一个连接(地址对应的就是webservice服务器中的地址)
URL
wsdlDocumentLocation
=
null
;
try
{
wsdlDocumentLocation
=
new
URL
(
PROTOCOL_HTTP
+
HOST
+
":"
+
PORT
+
"/"
+
SERVICENAME
+
"?wsdl"
);
//这个参数,主要是根据我们设定的webService的接口来进行的
QName
serviceName
=
new
QName
(
PROTOCOL_HTTP
+
TARGETNAMESPACE
,
SERVICENAME
);
Service
ws
=
Service
.
create
(
wsdlDocumentLocation
,
serviceName
);
//获取到调用的对象内容
ConvertModel2B3dService
port
=
ws
.
getPort
(
ConvertModel2B3dService
.
class
);
result
=
port
.
convertModel2B3d
(
modelFilePath
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"Catia model 转 b3d失败"
,
e
);
}
return
result
;
}
public
static
void
main
(
String
[]
args
)
{
WsResult
result
=
null
;
//创建一个连接(地址对应的就是webservice服务器中的地址)
URL
wsdlDocumentLocation
=
null
;
try
{
wsdlDocumentLocation
=
new
URL
(
"http://127.0.0.1:8081/ConvertModel2B3dService?wsdl"
);
//这个参数,主要是根据我们设定的webService的接口来进行的
QName
serviceName
=
new
QName
(
PROTOCOL_HTTP
+
"www.ptc.com/ws"
,
"ConvertModel2B3dService"
);
Service
ws
=
Service
.
create
(
wsdlDocumentLocation
,
serviceName
);
//获取到调用的对象内容
ConvertModel2B3dService
port
=
ws
.
getPort
(
ConvertModel2B3dService
.
class
);
result
=
port
.
convertModel2B3d
(
"3f617cba-03e3-459c-bcc5-6a30efce36e3\\D5311T12000101.CATProduct"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"Catia model 转 b3d失败"
,
e
);
}
System
.
out
.
println
(
result
);
}
}
src/com/yonde/cadpro/visualization/catia/ConvertCatia2GlbUtil.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
;
import
com.yonde.cadpro.CADProConstants
;
import
com.yonde.cadpro.util.ExtProperties
;
import
com.yonde.doc.entity.WsResult
;
import
org.apache.log4j.Logger
;
import
javax.xml.namespace.QName
;
import
javax.xml.ws.Service
;
import
java.net.URL
;
public
class
ConvertCatia2GlbUtil
{
private
static
Logger
logger
=
Logger
.
getLogger
(
ConvertCatia2GlbUtil
.
class
);
private
static
String
PROTOCOL_HTTP
=
"http://"
;
private
ExtProperties
catiaTransferConfig
=
null
;
public
ConvertCatia2GlbUtil
(
ExtProperties
catiaTransferConfig
)
throws
Exception
{
this
.
catiaTransferConfig
=
catiaTransferConfig
;
init
();
}
private
static
String
HOST
;
private
static
String
PORT
;
private
static
String
TARGETNAMESPACE
;
private
static
String
SERVICENAME
;
void
init
()
throws
Exception
{
if
(
catiaTransferConfig
==
null
)
{
throw
new
Exception
(
"Get Catia Transfer Config error"
);
}
HOST
=
catiaTransferConfig
.
getValueByKey
(
CADProConstants
.
CONFIG_KEY_CATIA_TRANSFER_HOST
);
PORT
=
catiaTransferConfig
.
getValueByKey
(
CADProConstants
.
CONFIG_KEY_CATIA_TRANSFER_PORT
);
TARGETNAMESPACE
=
catiaTransferConfig
.
getValueByKey
(
CADProConstants
.
CONFIG_KEY_CATIA_TRANSFER_TARGETNAMESPACE
);
SERVICENAME
=
catiaTransferConfig
.
getValueByKey
(
CADProConstants
.
CONFIG_KEY_CATIA_TRANSFER_SERVICENAME
);
logger
.
debug
(
HOST
);
logger
.
debug
(
PORT
);
logger
.
debug
(
TARGETNAMESPACE
);
logger
.
debug
(
SERVICENAME
);
}
public
WsResult
convert
(
String
modelFilePath
)
{
WsResult
result
=
null
;
logger
.
debug
(
"modelFilePath : "
+
modelFilePath
);
//创建一个连接(地址对应的就是webservice服务器中的地址)
URL
wsdlDocumentLocation
=
null
;
try
{
wsdlDocumentLocation
=
new
URL
(
PROTOCOL_HTTP
+
HOST
+
":"
+
PORT
+
"/"
+
SERVICENAME
+
"?wsdl"
);
//这个参数,主要是根据我们设定的webService的接口来进行的
QName
serviceName
=
new
QName
(
PROTOCOL_HTTP
+
TARGETNAMESPACE
,
SERVICENAME
);
Service
ws
=
Service
.
create
(
wsdlDocumentLocation
,
serviceName
);
//获取到调用的对象内容
ConvertModel2GlbService
port
=
ws
.
getPort
(
ConvertModel2GlbService
.
class
);
result
=
port
.
convertModel2GLB
(
modelFilePath
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"Catia model 转 glb失败"
,
e
);
}
return
result
;
}
}
src/com/yonde/cadpro/visualization/catia/ConvertModel2B3dService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
;
import
com.yonde.doc.entity.WsResult
;
import
javax.jws.WebMethod
;
import
javax.jws.WebParam
;
import
javax.jws.WebResult
;
import
javax.jws.WebService
;
import
javax.jws.soap.SOAPBinding
;
import
javax.xml.ws.Action
;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*/
@WebService
(
name
=
"ConvertModel2B3dService"
,
targetNamespace
=
"http://www.ptc.com/ws"
)
@SOAPBinding
(
style
=
SOAPBinding
.
Style
.
RPC
)
public
interface
ConvertModel2B3dService
{
/**
* @param modelFilePath
* @return returns ext.yonde.visualization.WsResult
*/
@WebMethod
(
action
=
"convertModel2B3d"
)
@WebResult
(
name
=
"result"
,
partName
=
"result"
)
@Action
(
input
=
"convertModel2B3d"
,
output
=
"http://www.ptc.com/ws/ConvertModel2B3dService/convertModel2B3dResponse"
)
WsResult
convertModel2B3d
(
@WebParam
(
name
=
"modelFilePath"
,
partName
=
"modelFilePath"
)
String
modelFilePath
);
}
src/com/yonde/cadpro/visualization/catia/ConvertModel2GlbService.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
;
import
com.yonde.doc.entity.WsResult
;
import
javax.jws.WebMethod
;
import
javax.jws.WebParam
;
import
javax.jws.WebResult
;
import
javax.jws.WebService
;
import
javax.jws.soap.SOAPBinding
;
import
javax.xml.ws.Action
;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.9-b130926.1035
* Generated source version: 2.2
*/
@WebService
(
name
=
"ConvertModel2GlbService"
,
targetNamespace
=
"http://www.ptc.com/ws"
)
@SOAPBinding
(
style
=
SOAPBinding
.
Style
.
RPC
)
public
interface
ConvertModel2GlbService
{
/**
* @param modelFilePath
* @return returns ext.yonde.visualization.WsResult
*/
@WebMethod
(
action
=
"convertModel2GLB"
)
@WebResult
(
name
=
"result"
,
partName
=
"result"
)
@Action
(
input
=
"convertModel2GLB"
,
output
=
"http://www.ptc.com/ws/ConvertModel2GlbService/convertModel2GLBResponse"
)
WsResult
convertModel2GLB
(
@WebParam
(
name
=
"modelFilePath"
,
partName
=
"modelFilePath"
)
String
modelFilePath
);
}
src/com/yonde/cadpro/visualization/catia/xmlb3dbean/B3dPart.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlb3dbean
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"part"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"id"
,
"partNumber"
,
"filePath"
,
"r"
,
"g"
,
"b"
,
"a"
,
"transform"
,
"relativeTransform"
})
public
class
B3dPart
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3156286367782331873L
;
@XmlAttribute
String
name
;
@XmlAttribute
String
id
;
@XmlAttribute
String
partNumber
;
@XmlAttribute
String
filePath
;
@XmlAttribute
(
name
=
"R"
)
String
r
;
@XmlAttribute
(
name
=
"G"
)
String
g
;
@XmlAttribute
(
name
=
"B"
)
String
b
;
@XmlAttribute
(
name
=
"A"
)
String
a
;
@XmlElement
(
name
=
"TelativeTransform"
)
String
transform
;
@XmlElement
(
name
=
"RelativeTransform"
)
String
relativeTransform
;
public
B3dPart
()
{
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getFilePath
()
{
return
filePath
;
}
public
void
setFilePath
(
String
filePath
)
{
this
.
filePath
=
filePath
;
}
public
String
getPartNumber
()
{
return
partNumber
;
}
public
void
setPartNumber
(
String
partNumber
)
{
this
.
partNumber
=
partNumber
;
}
public
String
getR
()
{
return
r
;
}
public
void
setR
(
String
r
)
{
this
.
r
=
r
;
}
public
String
getG
()
{
return
g
;
}
public
void
setG
(
String
g
)
{
this
.
g
=
g
;
}
public
String
getB
()
{
return
b
;
}
public
void
setB
(
String
b
)
{
this
.
b
=
b
;
}
public
String
getA
()
{
return
a
;
}
public
void
setA
(
String
a
)
{
this
.
a
=
a
;
}
public
String
getTransform
()
{
return
transform
;
}
public
void
setTransform
(
String
transform
)
{
this
.
transform
=
transform
;
}
public
String
getRelativeTransform
()
{
return
relativeTransform
;
}
public
void
setRelativeTransform
(
String
relativeTransform
)
{
this
.
relativeTransform
=
relativeTransform
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/visualization/catia/xmlb3dbean/B3dRoot.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlb3dbean
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"root"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"part"
,
"structer"
})
public
class
B3dRoot
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2732283830517714713L
;
@XmlAttribute
String
name
;
List
<
B3dStructer
>
structer
;
List
<
B3dPart
>
part
;
public
B3dRoot
()
{
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
List
<
B3dStructer
>
getStructer
()
{
return
structer
;
}
public
void
setStructer
(
List
<
B3dStructer
>
structer
)
{
this
.
structer
=
structer
;
}
public
List
<
B3dPart
>
getPart
()
{
return
part
;
}
public
void
setPart
(
List
<
B3dPart
>
part
)
{
this
.
part
=
part
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
src/com/yonde/cadpro/visualization/catia/xmlb3dbean/B3dStructer.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlb3dbean
;
import
org.apache.commons.lang.builder.ToStringBuilder
;
import
org.apache.commons.lang.builder.ToStringStyle
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"structer"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"id"
,
"partNumber"
,
"r"
,
"g"
,
"b"
,
"a"
,
"structer"
,
"part"
,
"transform"
,
"relativeTransform"
})
public
class
B3dStructer
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8251841891622144991L
;
@XmlAttribute
String
name
;
@XmlAttribute
String
id
;
@XmlAttribute
String
partNumber
;
@XmlAttribute
(
name
=
"R"
)
String
r
;
@XmlAttribute
(
name
=
"G"
)
String
g
;
@XmlAttribute
(
name
=
"B"
)
String
b
;
@XmlAttribute
(
name
=
"A"
)
String
a
;
List
<
B3dStructer
>
structer
;
List
<
B3dPart
>
part
;
@XmlElement
(
name
=
"Transform"
)
String
transform
;
@XmlElement
(
name
=
"RelativeTransform"
)
String
relativeTransform
;
public
B3dStructer
()
{
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
List
<
B3dStructer
>
getStructer
()
{
return
structer
;
}
public
void
setStructer
(
List
<
B3dStructer
>
structer
)
{
this
.
structer
=
structer
;
}
public
List
<
B3dPart
>
getPart
()
{
return
part
;
}
public
void
setPart
(
List
<
B3dPart
>
part
)
{
this
.
part
=
part
;
}
public
String
getPartNumber
()
{
return
partNumber
;
}
public
void
setPartNumber
(
String
partNumber
)
{
this
.
partNumber
=
partNumber
;
}
public
String
getR
()
{
return
r
;
}
public
void
setR
(
String
r
)
{
this
.
r
=
r
;
}
public
String
getG
()
{
return
g
;
}
public
void
setG
(
String
g
)
{
this
.
g
=
g
;
}
public
String
getB
()
{
return
b
;
}
public
void
setB
(
String
b
)
{
this
.
b
=
b
;
}
public
String
getA
()
{
return
a
;
}
public
void
setA
(
String
a
)
{
this
.
a
=
a
;
}
public
String
getTransform
()
{
return
transform
;
}
public
void
setTransform
(
String
transform
)
{
this
.
transform
=
transform
;
}
public
String
getRelativeTransform
()
{
return
relativeTransform
;
}
public
void
setRelativeTransform
(
String
relativeTransform
)
{
this
.
relativeTransform
=
relativeTransform
;
}
@Override
public
String
toString
()
{
return
ToStringBuilder
.
reflectionToString
(
this
,
ToStringStyle
.
DEFAULT_STYLE
);
}
}
\ No newline at end of file
src/com/yonde/cadpro/visualization/catia/xmlbean/Part.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlbean
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"part"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"id"
,
"filePath"
,
"Transform"
,
})
public
class
Part
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3156286367782331873L
;
@XmlAttribute
String
name
;
@XmlAttribute
String
id
;
@XmlAttribute
String
filePath
;
@XmlElement
String
Transform
;
public
Part
()
{
}
public
Part
(
String
name
,
String
id
,
String
filePath
,
String
transform
)
{
this
.
name
=
name
;
this
.
id
=
id
;
this
.
filePath
=
filePath
;
Transform
=
transform
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getFilePath
()
{
return
filePath
;
}
public
void
setFilePath
(
String
filePath
)
{
this
.
filePath
=
filePath
;
}
public
String
getTransform
()
{
return
Transform
;
}
public
void
setTransform
(
String
transform
)
{
Transform
=
transform
;
}
@Override
public
String
toString
()
{
return
"Part [name="
+
name
+
", id="
+
id
+
", filePath="
+
filePath
+
", Transform="
+
Transform
+
"]"
;
}
}
src/com/yonde/cadpro/visualization/catia/xmlbean/Root.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlbean
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"root"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"id"
,
"structer"
,
"part"
})
public
class
Root
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
2105642517912621913L
;
@XmlAttribute
String
name
;
@XmlAttribute
String
id
;
// @XmlElement
// @XmlElementWrapper
List
<
Structer
>
structer
;
List
<
Part
>
part
;
public
Root
()
{
}
public
Root
(
String
name
,
String
id
,
List
<
Structer
>
structer
,
List
<
Part
>
part
)
{
this
.
name
=
name
;
this
.
id
=
id
;
this
.
structer
=
structer
;
this
.
part
=
part
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
List
<
Structer
>
getStructer
()
{
return
structer
;
}
public
void
setStructer
(
List
<
Structer
>
structer
)
{
this
.
structer
=
structer
;
}
public
List
<
Part
>
getPart
()
{
return
part
;
}
public
void
setPart
(
List
<
Part
>
part
)
{
this
.
part
=
part
;
}
@Override
public
String
toString
()
{
return
"Root [name="
+
name
+
", id="
+
id
+
", structer="
+
structer
+
", part="
+
part
+
"]"
;
}
}
src/com/yonde/cadpro/visualization/catia/xmlbean/Structer.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
catia
.
xmlbean
;
import
javax.xml.bind.annotation.*
;
import
java.io.Serializable
;
import
java.util.List
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
// XML文件中的根标识
@XmlRootElement
(
name
=
"structer"
)
// 控制JAXB 绑定类中属性和字段的排序
@XmlType
(
propOrder
=
{
"name"
,
"id"
,
"structer"
,
"part"
})
public
class
Structer
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8251841891622144991L
;
@XmlAttribute
String
name
;
@XmlAttribute
String
id
;
// @XmlElement
// @XmlElementWrapper
List
<
Structer
>
structer
;
List
<
Part
>
part
;
public
Structer
()
{
}
public
Structer
(
String
name
,
String
id
,
List
<
Structer
>
structer
,
List
<
Part
>
part
)
{
this
.
name
=
name
;
this
.
id
=
id
;
this
.
structer
=
structer
;
this
.
part
=
part
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
List
<
Structer
>
getStructer
()
{
return
structer
;
}
public
void
setStructer
(
List
<
Structer
>
structer
)
{
this
.
structer
=
structer
;
}
public
List
<
Part
>
getPart
()
{
return
part
;
}
public
void
setPart
(
List
<
Part
>
part
)
{
this
.
part
=
part
;
}
@Override
public
String
toString
()
{
return
"Structer [name="
+
name
+
", id="
+
id
+
", structer="
+
structer
+
", part="
+
part
+
"]"
;
}
}
\ No newline at end of file
src/com/yonde/cadpro/visualization/coordinate/AssembleTransformInfo.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
coordinate
;
import
java.io.Serializable
;
/**
* @description: 装配坐标转换矩阵记录,用于保存在一个父子装配快照下的坐标转换记录
* @author: ywang
**/
public
class
AssembleTransformInfo
implements
Serializable
{
private
String
id
;
/**
* Snapshot对象Id
*/
private
String
snapshotId
;
/**
* 父装配
*/
private
String
parentModel
;
/**
* 子模型
*/
private
String
childModel
;
/**
* 坐标转换矩阵
*/
private
String
transform
;
/**
* 唯一标识,与EPMMemberLink中的uniqueNDId一致
*/
private
String
identify
;
public
String
getSnapshotId
()
{
return
snapshotId
;
}
public
void
setSnapshotId
(
String
snapshotId
)
{
this
.
snapshotId
=
snapshotId
;
}
public
String
getParentModel
()
{
return
parentModel
;
}
public
void
setParentModel
(
String
parentModel
)
{
this
.
parentModel
=
parentModel
;
}
public
String
getChildModel
()
{
return
childModel
;
}
public
void
setChildModel
(
String
childModel
)
{
this
.
childModel
=
childModel
;
}
public
String
getTransform
()
{
return
transform
;
}
public
void
setTransform
(
String
transform
)
{
this
.
transform
=
transform
;
}
public
String
getIdentify
()
{
return
identify
;
}
public
void
setIdentify
(
String
identify
)
{
this
.
identify
=
identify
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
AssembleTransformInfo
()
{
}
public
AssembleTransformInfo
(
String
id
,
String
snapshotId
,
String
parentModel
,
String
childModel
,
String
transform
,
String
identify
)
{
this
.
id
=
id
;
this
.
snapshotId
=
snapshotId
;
this
.
parentModel
=
parentModel
;
this
.
childModel
=
childModel
;
this
.
transform
=
transform
;
this
.
identify
=
identify
;
}
@Override
public
String
toString
()
{
return
"AssembleTransformInfo{"
+
"id='"
+
id
+
'\''
+
", snapshotId='"
+
snapshotId
+
'\''
+
", parentModel='"
+
parentModel
+
'\''
+
", childModel='"
+
childModel
+
'\''
+
", transform='"
+
transform
+
'\''
+
", identify='"
+
identify
+
'\''
+
'}'
;
}
}
src/com/yonde/cadpro/visualization/coordinate/AssembleTransformSnapshot.java
0 → 100644
View file @
b93919a9
package
com
.
yonde
.
cadpro
.
visualization
.
coordinate
;
import
java.io.Serializable
;
/**
* @description: 装配矩阵关系对象,用于保存装配的装配关系各模型版本快照
* @author: ywang
**/
public
class
AssembleTransformSnapshot
implements
Serializable
{
private
String
id
;
/**
* 父装配ID
*/
private
String
parentId
;
/**
* 快照Hash值,用于快照搜索,
* 使用ParentNumber<version>|Child1Number<version>|Child2Number<version>|…|ChildnNumber<version>组成的字符串求哈希值,
* 如ASM001<A.2>|ASM001-1<A.3>|PART001-2<A.1>,对其求Hash
*/
private
String
snapshotHash
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getSnapshotHash
()
{
return
snapshotHash
;
}
public
void
setSnapshotHash
(
String
snapshotHash
)
{
this
.
snapshotHash
=
snapshotHash
;
}
public
AssembleTransformSnapshot
()
{
}
public
AssembleTransformSnapshot
(
String
id
,
String
parentId
,
String
snapshotHash
)
{
this
.
id
=
id
;
this
.
parentId
=
parentId
;
this
.
snapshotHash
=
snapshotHash
;
}
@Override
public
String
toString
()
{
return
"AssembleTransformSnapshot{"
+
"id='"
+
id
+
'\''
+
", parentId='"
+
parentId
+
'\''
+
", snapshotHash='"
+
snapshotHash
+
'\''
+
'}'
;
}
}
src/com/yonde/cadpro/visualization/facade/VisualizationFacade.java
0 → 100644
View file @
b93919a9
This diff is collapsed.
Click to expand it.
src/com/yonde/cadpro/visualization/facade/VisualizationService.java
0 → 100644
View file @
b93919a9
This diff is collapsed.
Click to expand it.
src/com/yonde/common/RfUtil.java
View file @
b93919a9
...
@@ -162,4 +162,13 @@ public class RfUtil {
...
@@ -162,4 +162,13 @@ public class RfUtil {
return
null
;
return
null
;
}
}
}
}
/**
* 获取对象的ida2a2值
*/
public
static
String
getIda2a2
(
WTObject
obj
)
{
long
ida2a2
=
obj
.
getPersistInfo
().
getObjectIdentifier
().
getId
();
return
ida2a2
+
""
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment