Commit 2ccf859e authored by hanson.yao's avatar hanson.yao

可视化功能开发

parent 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"%>
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;
}
}
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
package com.yonde.access.listener;
/**
* Created on 2023/5/22 0022
*
* @author
*/
public interface AddMemberListenerService {
}
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("所选用户不允许被添加到团队中!");
}
}
}
}
}
}
...@@ -14,4 +14,12 @@ public class CadFTPConfig { ...@@ -14,4 +14,12 @@ public class CadFTPConfig {
public static final String PASSWORD = "Aa12345678!"; public static final String PASSWORD = "Aa12345678!";
public static final String REMOTEPATH = "/"; public static final String REMOTEPATH = "/";
public static final String ROOTPATH = "D:/Inetpub/ftproot"; public static final String ROOTPATH = "D:/Inetpub/ftproot";
public static final String VISUALIZATIONPATH = "D:/Inetpub/ftproot/Visualization";
public static final String TRANSFERRESULTPATH = "D:/Inetpub/ftproot/3D_transfer_result";
} }
...@@ -39,4 +39,8 @@ public class CatiaInteConfigPropertiesUtil implements RemoteAccess { ...@@ -39,4 +39,8 @@ public class CatiaInteConfigPropertiesUtil implements RemoteAccess {
String[] types = getValue("BOM.AllowPartType").split(","); String[] types = getValue("BOM.AllowPartType").split(",");
return Arrays.asList(types); return Arrays.asList(types);
} }
public static String getFtpRootPath() throws Exception {
return getValue("ftp.rootPath");
}
} }
...@@ -778,4 +778,27 @@ public class EPMUtil { ...@@ -778,4 +778,27 @@ public class EPMUtil {
} }
public static String getOROid(Persistable per) throws WTException {
String oid = "";
if (per == null) {
throw new WTException("getOROid input param is null");
} else {
ObjectIdentifier oi = getObjectIdentifier(per);
if (oi != null) {
oid = "OR:" + oi.toString();
}
return oid;
}
}
private static ObjectIdentifier getObjectIdentifier(Object object) {
if (object == null) {
return null;
} else if (object instanceof ObjectReference) {
return (ObjectIdentifier)((ObjectReference)object).getKey();
} else {
return object instanceof Persistable ? PersistenceHelper.getObjectIdentifier((Persistable)object) : null;
}
}
} }
package com.yonde.cadpro.visualization; package com.yonde.cadpro.visualization;
import com.yonde.cadpro.util.DBUtil; import com.yonde.cadpro.util.DBUtil;
import com.yonde.cadpro.util.EPMUtil;
import com.yonde.cadpro.visualization.coordinate.AssembleTransformInfo; import com.yonde.cadpro.visualization.coordinate.AssembleTransformInfo;
import com.yonde.cadpro.visualization.coordinate.AssembleTransformSnapshot; import com.yonde.cadpro.visualization.coordinate.AssembleTransformSnapshot;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -34,8 +35,9 @@ public class AssembleTransformUtil { ...@@ -34,8 +35,9 @@ public class AssembleTransformUtil {
sql.append("and PARENTID = " + parentId); sql.append("and PARENTID = " + parentId);
} }
if (snapshotHash != 0) { if (snapshotHash != 0) {
sql.append("and snapshotHash = " + snapshotHash); sql.append("and SNAPSHOTHASH = '" + snapshotHash+"' ");
} }
System.out.println(">>>findAssembleTransformSnapshot sql:" + sql);
Object obj = DBUtil.queryForObject(sql.toString(), AssembleTransformSnapshot.class); Object obj = DBUtil.queryForObject(sql.toString(), AssembleTransformSnapshot.class);
if (obj != null) { if (obj != null) {
return (AssembleTransformSnapshot) obj; return (AssembleTransformSnapshot) obj;
...@@ -58,20 +60,21 @@ public class AssembleTransformUtil { ...@@ -58,20 +60,21 @@ public class AssembleTransformUtil {
StringBuffer sql = new StringBuffer("select * from ASSEMBLETRANSFORMINFO ast where 1 =1 "); StringBuffer sql = new StringBuffer("select * from ASSEMBLETRANSFORMINFO ast where 1 =1 ");
if (StringUtils.isNotBlank(snapshotId)) { if (StringUtils.isNotBlank(snapshotId)) {
sql.append("and snapshotId = " + snapshotId); sql.append("and SNAPSHOTID = " + snapshotId);
} }
if (StringUtils.isNotBlank(parentModel)) { if (StringUtils.isNotBlank(parentModel)) {
sql.append("and parentModel = " + parentModel); sql.append("and PARENTMODEL = " + parentModel);
} }
if (StringUtils.isNotBlank(childModel)) { if (StringUtils.isNotBlank(childModel)) {
sql.append("and childModel = " + childModel); sql.append("and CHILDMODEL = " + childModel);
} }
if (StringUtils.isNotBlank(transform)) { if (StringUtils.isNotBlank(transform)) {
sql.append("and transform = " + transform); sql.append("and TRANSFORM = " + transform);
} }
if (StringUtils.isNotBlank(identify)) { if (StringUtils.isNotBlank(identify)) {
sql.append("and identify = " + identify); sql.append("and IDENTIFY = " + identify);
} }
System.out.println(">>>findAssembleTransformInfo sql:" + sql);
Object obj = DBUtil.queryForObject(sql.toString(), AssembleTransformInfo.class); Object obj = DBUtil.queryForObject(sql.toString(), AssembleTransformInfo.class);
if (obj != null) { if (obj != null) {
result = (List<AssembleTransformInfo>) obj; result = (List<AssembleTransformInfo>) obj;
...@@ -103,7 +106,7 @@ public class AssembleTransformUtil { ...@@ -103,7 +106,7 @@ public class AssembleTransformUtil {
} }
/** /**
*创建 AssembleTransformInfo对象 * 创建 AssembleTransformInfo对象
* *
* @param snapshot * @param snapshot
* @param rootCAD * @param rootCAD
...@@ -111,17 +114,39 @@ public class AssembleTransformUtil { ...@@ -111,17 +114,39 @@ public class AssembleTransformUtil {
* @param epmMemberLink * @param epmMemberLink
* @param formatTransform * @param formatTransform
*/ */
public static AssembleTransformInfo newAssembleTransformInfo(AssembleTransformSnapshot snapshot, EPMDocument rootCAD, public static void newAssembleTransformInfo(AssembleTransformSnapshot snapshot, EPMDocument rootCAD,
EPMDocument linkedChildEPM, EPMMemberLink epmMemberLink,String formatTransform) throws WTException { EPMDocument linkedChildEPM, EPMMemberLink epmMemberLink, String formatTransform) throws WTException {
System.out.println(">>>newAssembleTransformInfo start......"); System.out.println(">>>newAssembleTransformInfo start......");
//insertinto table_name (column1,column2,column3,...)values(value1,value2,value3,...);
// assembleTransformInfo.setSnapshotId(CommonUtil.getOROid(snapshot)); StringBuffer insert = new StringBuffer(" insert into AssembleTransformInfo(SNAPSHOTID,ID,PARENTMODEL,CHILDMODEL,TRANSFORM,IDENTIFY) VALUES (");
// assembleTransformInfo.setParentModel(CommonUtil.getOROid(parentModle)); insert.append("'" + snapshot.getId() + "',");
// assembleTransformInfo.setChildModel(CommonUtil.getOROid(childModel)); insert.append("'" + System.currentTimeMillis() + "',");
// assembleTransformInfo.setIdentify(CommonUtil.getOROid(memberLink)); insert.append("'" + EPMUtil.getOROid(rootCAD) + "',");
// assembleTransformInfo.setTransform(transform); insert.append("'" + EPMUtil.getOROid(linkedChildEPM) + "',");
//StringBuffer sql = new StringBuffer(" insert into AssembleTransformInfo ('snapshotId','parentModel','childModel','transform','identify') " + insert.append("'" + EPMUtil.getOROid(epmMemberLink) + "',");
// "values( "+snapshot.getId()+","+ CommonUtil.getOROid(rootCAD)+","+formatTransform+","+CommonUtil.getOROid(memberLink)); insert.append("'" + formatTransform + "')");
return null; String insertSql = String.valueOf(insert);
System.out.println(">>>newAssembleTransformInfo insertSql:" + insertSql);
DBUtil.executeUpdate(insertSql);
}
/**
* 创建AssembleTransformSnapshot对象
*
* @param parentId
* @param snapshotHash
*/
public static AssembleTransformSnapshot newAssembleTransformSnapshot(String parentId, String snapshotHash) throws WTException {
System.out.println(">>>newAssembleTransformSnapshot start......");
String id = String.valueOf(System.currentTimeMillis());
StringBuffer insert = new StringBuffer(" insert into ASSEMBLETRANSFORMSNAPSHOT(ID,PARENTID,SNAPSHOTHASH) VALUES (");
insert.append("'" + id + "',");
insert.append("'" + parentId + "',");
insert.append("'" + snapshotHash + "')");
String insertSql = String.valueOf(insert);
System.out.println(">>>newAssembleTransformInfo insertSql:" + insertSql);
DBUtil.executeUpdate(insertSql);
return new AssembleTransformSnapshot(id, parentId, snapshotHash);
} }
} }
...@@ -206,23 +206,6 @@ public class VisualizationService { ...@@ -206,23 +206,6 @@ public class VisualizationService {
//4. 上传转可视化之后文件至contentHolder //4. 上传转可视化之后文件至contentHolder
if (StringUtils.isNotBlank(transformedFtpPath) && StringUtils.isNotBlank(transformedFileName)) { if (StringUtils.isNotBlank(transformedFtpPath) && StringUtils.isNotBlank(transformedFileName)) {
if (transferModel) { if (transferModel) {
//ftpUtil = new FtpUtil(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_HOST),
// Integer.valueOf(catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PORT)),
// catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_USERNAME),
// catiaTransferConfig.getValueByKey(CADProConstants.CONFIG_KEY_CATIA_FTP_PASSWORD));
//boolean connect = ftpUtil.connectServer();
//
//if (!connect) {
// throw new WTException("FTP连接失败,请重试或联系系统管理员。");
//}
//
////下载FTP文件夹
//ftpUtil.downloadFile(transformedFtpPath, tempFolderPath);
//ftpUtil.removeFile(transformedFtpPath);
//ftpUtil.closeServer();
// transformedFileName 0000000241.CATPart.xml
//tempFolderPath D:/ptc/Windchill_9.1/Windchill/temp/Visualization/c6df4cd0-61dc-4a8b-9b60-0d1ee5a80511/
String xmlFile = transformedFileRemotePath; String xmlFile = transformedFileRemotePath;
System.out.println("xmlFile : " + xmlFile); System.out.println("xmlFile : " + xmlFile);
//处理下载文件 //处理下载文件
...@@ -231,7 +214,6 @@ public class VisualizationService { ...@@ -231,7 +214,6 @@ public class VisualizationService {
String rootCADNumber = ""; String rootCADNumber = "";
File xml = new File(xmlFile); File xml = new File(xmlFile);
if (xml.exists()) { if (xml.exists()) {
//Object o = XmlUtils.convertXmlFileToObject(B3dRoot.class, xmlFile);
JAXBContext context = JAXBContext.newInstance(B3dRoot.class); JAXBContext context = JAXBContext.newInstance(B3dRoot.class);
Unmarshaller unmarshaller = context.createUnmarshaller(); Unmarshaller unmarshaller = context.createUnmarshaller();
//FileReader fr = new FileReader(xmlPath); //FileReader fr = new FileReader(xmlPath);
...@@ -269,12 +251,10 @@ public class VisualizationService { ...@@ -269,12 +251,10 @@ public class VisualizationService {
for (B3dPart part : oneLevelPartList) { for (B3dPart part : oneLevelPartList) {
String cadNumber = part.getPartNumber(); String cadNumber = part.getPartNumber();
System.out.println("cadNumber : " + cadNumber); System.out.println("cadNumber : " + cadNumber);
String b3dFilePath = part.getFilePath(); String b3dFilePath = part.getFilePath();
b3dFilePath = tempFolderPath + b3dFilePath; b3dFilePath = tempFolderPath + b3dFilePath;
System.out.println("b3dFilePath : " + b3dFilePath); System.out.println("b3dFilePath : " + b3dFilePath);
//String transform = StringUtils.trimToEmpty(part.getTransform());
String transform = StringUtils.trimToEmpty(part.getRelativeTransform()); String transform = StringUtils.trimToEmpty(part.getRelativeTransform());
System.out.println("transform : " + transform); System.out.println("transform : " + transform);
...@@ -320,7 +300,6 @@ public class VisualizationService { ...@@ -320,7 +300,6 @@ public class VisualizationService {
try { try {
tx = new Transaction(); tx = new Transaction();
tx.start(); tx.start();
//可视化成功后,存储坐标信息 //可视化成功后,存储坐标信息
Map<EPMDocument, String> allChildsEPMAppDatas = new HashMap<EPMDocument, String>(); Map<EPMDocument, String> allChildsEPMAppDatas = new HashMap<EPMDocument, String>();
Map<String, EPMDocument> allChildNumEPMs = new HashMap<String, EPMDocument>(); Map<String, EPMDocument> allChildNumEPMs = new HashMap<String, EPMDocument>();
...@@ -331,9 +310,7 @@ public class VisualizationService { ...@@ -331,9 +310,7 @@ public class VisualizationService {
QueryResult qr = PersistenceServerHelper.manager.expand(rootCAD, "uses", QueryResult qr = PersistenceServerHelper.manager.expand(rootCAD, "uses",
EPMMemberLink.class, false); EPMMemberLink.class, false);
if (qr != null) { if (qr != null) {
//CADNumber = {EPMMemberLink=EPMDocument}
Map<String, Map<EPMMemberLink, EPMDocument>> allChildLinks = new HashMap<String, Map<EPMMemberLink, EPMDocument>>(); Map<String, Map<EPMMemberLink, EPMDocument>> allChildLinks = new HashMap<String, Map<EPMMemberLink, EPMDocument>>();
//List<EPMDocument> allChilds = new ArrayList<EPMDocument>();
while (qr.hasMoreElements()) { while (qr.hasMoreElements()) {
EPMMemberLink memberLink = (EPMMemberLink) qr.nextElement(); EPMMemberLink memberLink = (EPMMemberLink) qr.nextElement();
Mastered tempUses = memberLink.getUses(); Mastered tempUses = memberLink.getUses();
...@@ -429,18 +406,18 @@ public class VisualizationService { ...@@ -429,18 +406,18 @@ public class VisualizationService {
} }
} }
if (snapshot == null) { if (snapshot == null) {
snapshot = new AssembleTransformSnapshot("", CommonUtil.getPersistableOid(rootCAD), cadStructureKey); snapshot = AssembleTransformUtil.newAssembleTransformSnapshot(CommonUtil.getPersistableOid(rootCAD), cadStructureKey);
} }
if (snapshot != null) { if (snapshot != null) {
Set<EPMMemberLink> allMemberlinks = memberLinkWithTrasform Set<EPMMemberLink> allMembership = memberLinkWithTrasform
.keySet(); .keySet();
for (EPMMemberLink epmMemberLink : allMemberlinks) { for (EPMMemberLink epmMemberLink : allMembership) {
Map<EPMDocument, String> epmTrans = memberLinkWithTrasform Map<EPMDocument, String> epmTrans = memberLinkWithTrasform
.get(epmMemberLink); .get(epmMemberLink);
if (epmTrans != null) { if (epmTrans != null) {
Set<Entry<EPMDocument, String>> epmKeyEntrys = epmTrans Set<Entry<EPMDocument, String>> epmKeyEnters = epmTrans
.entrySet(); .entrySet();
Iterator<Entry<EPMDocument, String>> itEntry = epmKeyEntrys Iterator<Entry<EPMDocument, String>> itEntry = epmKeyEnters
.iterator(); .iterator();
if (itEntry.hasNext()) { if (itEntry.hasNext()) {
Entry<EPMDocument, String> epmKeyEntry = itEntry Entry<EPMDocument, String> epmKeyEntry = itEntry
...@@ -518,11 +495,13 @@ public class VisualizationService { ...@@ -518,11 +495,13 @@ public class VisualizationService {
if (b3dPaths != null) { if (b3dPaths != null) {
for (String b3dPath : b3dPaths) { for (String b3dPath : b3dPaths) {
System.out.println("b3dPath : " + b3dPath); System.out.println("b3dPath : " + b3dPath);
//File b3dFile = FileUtil.file(b3dPath); File file = new File(transformedFileRemotePath);
String parent = file.getParent()+File.separator;
b3dPath = b3dPath.replace(tempFolderPath, parent);
File b3dFile = new File(b3dPath); File b3dFile = new File(b3dPath);
if (!b3dFile.exists() || b3dFile.isDirectory()) { if (!b3dFile.exists() || b3dFile.isDirectory()) {
logger.error("b3dPath File [" + b3dPath logger.error("b3dPath File [" + b3dPath + "] is not exist,continue...");
+ "] is not exist,continue...");
continue; continue;
} }
...@@ -535,46 +514,46 @@ public class VisualizationService { ...@@ -535,46 +514,46 @@ public class VisualizationService {
//处理PMI 轻量化文件 //处理PMI 轻量化文件
String fileName = FilenameUtils.getBaseName(b3dPath); //String fileName = FilenameUtils.getBaseName(b3dPath);
String b3dzExt = FilenameUtils.getExtension(b3dPath); //String b3dzExt = FilenameUtils.getExtension(b3dPath);
System.out.println("fileName : " + fileName); //System.out.println("fileName : " + fileName);
System.out.println("b3dzExt : " + b3dzExt); //System.out.println("b3dzExt : " + b3dzExt);
//
String pmiFileName = ""; //String pmiFileName = "";
if (fileName.contains("_0")) { //if (fileName.contains("_0")) {
pmiFileName = fileName.replace("_0", "_PMI"); // pmiFileName = fileName.replace("_0", "_PMI");
} else { //} else {
pmiFileName = fileName + "_PMI"; // pmiFileName = fileName + "_PMI";
} //}
System.out.println("pmiFileName : " + pmiFileName); //System.out.println("pmiFileName : " + pmiFileName);
//
String pmiB3dzFilePath = b3dFile.getParent() + "/" + pmiFileName + "." + b3dzExt; //String pmiB3dzFilePath = b3dFile.getParent() + "/" + pmiFileName + "." + b3dzExt;
System.out.println("pmiB3dzFilePath : " + pmiB3dzFilePath); //System.out.println("pmiB3dzFilePath : " + pmiB3dzFilePath);
File pmiB3dzFilePathFile = new File(pmiB3dzFilePath); //File pmiB3dzFilePathFile = new File(pmiB3dzFilePath);
if (!pmiB3dzFilePathFile.exists()) { //if (!pmiB3dzFilePathFile.exists()) {
System.out.println("pmiB3dzFilePath [" + pmiB3dzFilePath + "] is not exist,continue..."); // System.out.println("pmiB3dzFilePath [" + pmiB3dzFilePath + "] is not exist,continue...");
continue; // continue;
} //}
//
//新增CAD_HIDDEN_CONTENT存储PMI轻量化 ////新增CAD_HIDDEN_CONTENT存储PMI轻量化
epm = (EPMDocument) ContentUtil.addApplicationData(epm, //epm = (EPMDocument) ContentUtil.addApplicationData(epm,
"", pmiB3dzFilePath, modelAppDataId, // "", pmiB3dzFilePath, modelAppDataId,
ContentRoleType.toContentRoleType("CAD_HIDDEN_CONTENT")); // ContentRoleType.toContentRoleType("CAD_HIDDEN_CONTENT"));
//
//处理PMI XML ////处理PMI XML
String pmiXMLFilePath = b3dFile.getParent() + "/" //String pmiXMLFilePath = b3dFile.getParent() + "/"
+ pmiFileName + ".xml"; // + pmiFileName + ".xml";
System.out.println("pmiXMLFilePath : " + pmiXMLFilePath); //System.out.println("pmiXMLFilePath : " + pmiXMLFilePath);
File pmiXMLFilePathFile = new File(pmiXMLFilePath); //File pmiXMLFilePathFile = new File(pmiXMLFilePath);
if (!pmiXMLFilePathFile.exists()) { //if (!pmiXMLFilePathFile.exists()) {
System.out.println("pmiXMLFilePath [" + pmiXMLFilePath + "] is not exist,continue..."); // System.out.println("pmiXMLFilePath [" + pmiXMLFilePath + "] is not exist,continue...");
continue; // continue;
} //}
//
//新增CAD_HIDDEN_CONTENT存储PMI轻量化 ////新增CAD_HIDDEN_CONTENT存储PMI轻量化
epm = (EPMDocument) ContentUtil.addApplicationData(epm, //epm = (EPMDocument) ContentUtil.addApplicationData(epm,
"", pmiXMLFilePath, modelAppDataId, // "", pmiXMLFilePath, modelAppDataId,
ContentRoleType.XML_FRAGMENT); // ContentRoleType.XML_FRAGMENT);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment