Commit 3f020ba2 authored by shyWang's avatar shyWang

PDM前端改造

对象创建文件夹优化
parent ae6ca9d4
...@@ -1250,18 +1250,10 @@ public class DocUtil implements RemoteAccess, Serializable { ...@@ -1250,18 +1250,10 @@ public class DocUtil implements RemoteAccess, Serializable {
document.setNumber(docNum); document.setNumber(docNum);
} }
// Set Folder // Set Folder
if (docFold == null) { if (docFold != null) {
docFold = FolderHelper.service.getFolder("Default", WTContainerRef.newWTContainerRef(container)); FolderHelper.assignLocation((FolderEntry) document, docFold);
/*
* if (folder == null || "".equals(folder)) {
* docFold = FolderHelper.service.getFolder("Default", WTContainerRef.newWTContainerRef(container));
* } else {
* docFold = FolderHelper.service.getFolder("Default/" + folder,
* WTContainerRef.newWTContainerRef(container));
* }
*/
} }
FolderHelper.assignLocation((FolderEntry) document, docFold);
// Set Container // Set Container
PersistenceHelper.manager.save(document); PersistenceHelper.manager.save(document);
logger.debug("=============create doc end============"); logger.debug("=============create doc end============");
......
...@@ -4,6 +4,7 @@ import com.yonde.basedata.vo.DxDocumentFolderVO; ...@@ -4,6 +4,7 @@ import com.yonde.basedata.vo.DxDocumentFolderVO;
import com.yonde.context.vo.DxContextVO; import com.yonde.context.vo.DxContextVO;
import com.yonde.doc.vo.DxDocumentVO; import com.yonde.doc.vo.DxDocumentVO;
import com.yonde.part.vo.DxPartVO; import com.yonde.part.vo.DxPartVO;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import wt.doc.WTDocument; import wt.doc.WTDocument;
import wt.folder.Folder; import wt.folder.Folder;
...@@ -50,22 +51,21 @@ public class DxDocUtil implements RemoteAccess, Serializable { ...@@ -50,22 +51,21 @@ public class DxDocUtil implements RemoteAccess, Serializable {
public static WTDocument createDoc(DxDocumentVO dxDocumentVO) throws WTException { public static WTDocument createDoc(DxDocumentVO dxDocumentVO) throws WTException {
WTContainer container = null; WTContainer container = null;
DxContextVO dxContext = dxDocumentVO.getDxContext(); DxContextVO dxContext = dxDocumentVO.getDxContext();
logger.error("dxContext Name======" + dxContext);
if (ObjectsUtil.nonNull(dxContext)) { if (ObjectsUtil.nonNull(dxContext)) {
String contextName = dxContext.getName(); String contextName = dxContext.getName();
logger.error("container Name======" + contextName);
container = ContainerUtil.getContainerByName(contextName); container = ContainerUtil.getContainerByName(contextName);
logger.error("container======" + container);
} }
if (ObjectsUtil.isNull(container)) { if (ObjectsUtil.isNull(container)) {
return null; return null;
} }
String folderPath = null; Folder folder = null;
DxDocumentFolderVO folderVO = dxDocumentVO.getDxDocumentFolder(); DxDocumentFolderVO folderVO = dxDocumentVO.getDxDocumentFolder();
if (ObjectsUtil.nonNull(folderVO)) { if (ObjectsUtil.nonNull(folderVO)) {
folderPath = folderVO.getFullPath(); String folderPath = folderVO.getFullPath();
if (StringUtils.isNotEmpty(folderPath)) {
folder = DxCommonUtils.makeFolder(folderPath, container.getContainerReference());
}
} }
Folder folder = DxCommonUtils.makeFolder(folderPath, container.getContainerReference());
//dxDocumentVO.getSubTypeName() //dxDocumentVO.getSubTypeName()
WTDocument doc = DocUtil.createDoc(dxDocumentVO.getNumber(), dxDocumentVO.getName(), WTDocument doc = DocUtil.createDoc(dxDocumentVO.getNumber(), dxDocumentVO.getName(),
container, folder, null); container, folder, null);
......
package com.yonde.common.entity; package com.yonde.common.entity;
import com.yonde.basedata.vo.IdVO;
import com.yonde.common.RfUtil;
import wt.fc.PersistenceHelper;
import wt.folder.Folder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DXFolder { public class DXFolder extends IdVO {
//文件夹名称 //文件夹名称
private String name = ""; private String name = "";
...@@ -18,10 +23,20 @@ public class DXFolder { ...@@ -18,10 +23,20 @@ public class DXFolder {
private String containerName = ""; private String containerName = "";
//容器oid //容器oid
private String containerOid = ""; private String containerOid = "";
//文件夹软类型全路径(本期项目文件夹有子类型)
private String fullType = ""; private Boolean isLeaf = false;
//子文件夹 //子文件夹
private List<DXFolder> children = new ArrayList<DXFolder>(); private List<DXFolder> children = new ArrayList<DXFolder>();
public DXFolder() {
}
public DXFolder(Folder folder) {
this.id = PersistenceHelper.getObjectIdentifier(folder).getId();
this.name = folder.getName();
this.containerName = folder.getContainerName();
this.fullPath = folder.getFolderPath();
}
public String getName() { public String getName() {
return name; return name;
} }
...@@ -58,18 +73,16 @@ public class DXFolder { ...@@ -58,18 +73,16 @@ public class DXFolder {
public void setContainerOid(String containerOid) { public void setContainerOid(String containerOid) {
this.containerOid = containerOid; this.containerOid = containerOid;
} }
public String getFullType() {
return fullType;
}
public void setFullType(String fullType) {
this.fullType = fullType;
}
public List<DXFolder> getChildren() { public List<DXFolder> getChildren() {
return children; return children;
} }
public void setChildren(List<DXFolder> children) { public void setChildren(List<DXFolder> children) {
this.children = children; this.children = children;
} }
public Boolean getLeaf() {
return isLeaf;
}
public void setLeaf(Boolean leaf) {
isLeaf = leaf;
}
} }
...@@ -57,8 +57,8 @@ public class FolderUtil implements RemoteAccess { ...@@ -57,8 +57,8 @@ public class FolderUtil implements RemoteAccess {
dxFolder.setContainerName(container.getName()); dxFolder.setContainerName(container.getName());
dxFolder.setContainerOid(CommonUtil.getPersistableOid((WTObject)container)); dxFolder.setContainerOid(CommonUtil.getPersistableOid((WTObject)container));
dxFolder.setCabinetOid(CommonUtil.getPersistableOid(cabinet)); dxFolder.setCabinetOid(CommonUtil.getPersistableOid(cabinet));
dxFolder.setFullType(CommonUtil.getType((WTObject)parentFolder)); //dxFolder.setFullType(CommonUtil.getType((WTObject)parentFolder));
dxFolder.setName(parentFolder.getName()); dxFolder.setName(parentFolder.getName());
dxFolder.setFullPath(parentFolder.getFolderPath()); dxFolder.setFullPath(parentFolder.getFolderPath());
dxFolder.setOid(CommonUtil.getPersistableOid((WTObject)parentFolder)); dxFolder.setOid(CommonUtil.getPersistableOid((WTObject)parentFolder));
...@@ -204,7 +204,6 @@ public class FolderUtil implements RemoteAccess { ...@@ -204,7 +204,6 @@ public class FolderUtil implements RemoteAccess {
public static Folder getFolder(String oid) throws WTException { public static Folder getFolder(String oid) throws WTException {
WTObject obj = (WTObject) CommonUtil.getPersistableByOid(oid); WTObject obj = (WTObject) CommonUtil.getPersistableByOid(oid);
Folder folder = null;
if(obj instanceof WTContainer){ if(obj instanceof WTContainer){
WTContainerRef containerRef = WTContainerRef.newWTContainerRef((WTContainer)obj); WTContainerRef containerRef = WTContainerRef.newWTContainerRef((WTContainer)obj);
Cabinet rootFolder = ((WTContainer) containerRef.getObject()).getDefaultCabinet(); Cabinet rootFolder = ((WTContainer) containerRef.getObject()).getDefaultCabinet();
......
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