Commit 3f020ba2 authored by shyWang's avatar shyWang

PDM前端改造

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