REQ-3540: 复制模版市场
This commit is contained in:
parent
5e9cd3a7ed
commit
df64dcb265
@ -20,7 +20,7 @@ import cn.axzo.nanopart.doc.dao.FileTemplateDao;
|
||||
import cn.axzo.nanopart.doc.entity.FileTemplate;
|
||||
import cn.axzo.nanopart.doc.entity.IndexNode;
|
||||
import cn.axzo.nanopart.doc.file.index.IndexManager;
|
||||
import cn.axzo.nanopart.doc.file.index.NodeCopyEventTransactional;
|
||||
import cn.axzo.nanopart.doc.file.index.SubtreeCopyEventTransactional;
|
||||
import cn.axzo.nanopart.doc.file.index.domain.IndexNodes;
|
||||
import cn.axzo.nanopart.doc.utils.BizTransactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -30,7 +30,7 @@ import lombok.RequiredArgsConstructor;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class FileTemplateManager implements ApplicationListener<NodeCopyEventTransactional> {
|
||||
public class FileTemplateManager implements ApplicationListener<SubtreeCopyEventTransactional> {
|
||||
|
||||
private final IndexManager indexManager;
|
||||
private final FileTemplateDao fileTemplateDao;
|
||||
@ -86,7 +86,7 @@ public class FileTemplateManager implements ApplicationListener<NodeCopyEventTra
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(NodeCopyEventTransactional event) {
|
||||
public void onApplicationEvent(SubtreeCopyEventTransactional event) {
|
||||
if (event.getSrcNode().getContext() != IndexNodeContext.FILE_TEMPLATE)
|
||||
return;
|
||||
for (IndexNode fileNode : indexManager.collectValidSubtreeNodes(event.getCopiedRoot(), IndexNodeType.FILE))
|
||||
|
||||
@ -230,7 +230,7 @@ public class IndexManager {
|
||||
srcRoot.walkDown(copyNodeVisitor);
|
||||
indexNodeDao.saveBatch(TreeUtils.collectValues(srcRoot));
|
||||
IndexNode copiedRoot = connectNodes(srcRoot, destParent);
|
||||
applicationContext.publishEvent(new NodeCopyEventTransactional(this, src, copiedRoot));
|
||||
applicationContext.publishEvent(new SubtreeCopyEventTransactional(this, src, copiedRoot));
|
||||
return copiedRoot;
|
||||
}
|
||||
|
||||
|
||||
@ -10,12 +10,12 @@ import lombok.Getter;
|
||||
* @author yanglin
|
||||
*/
|
||||
@Getter
|
||||
public class NodeCopyEventTransactional extends ApplicationEvent {
|
||||
public class SubtreeCopyEventTransactional extends ApplicationEvent {
|
||||
|
||||
private final IndexNode srcNode;
|
||||
private final IndexNode copiedRoot;
|
||||
|
||||
public NodeCopyEventTransactional(Object source, IndexNode srcNode, IndexNode copiedRoot) {
|
||||
public SubtreeCopyEventTransactional(Object source, IndexNode srcNode, IndexNode copiedRoot) {
|
||||
super(source);
|
||||
this.srcNode = srcNode;
|
||||
this.copiedRoot = copiedRoot;
|
||||
@ -25,7 +25,7 @@ import cn.axzo.nanopart.doc.entity.IndexNode;
|
||||
import cn.axzo.nanopart.doc.entity.TemplateDatabase;
|
||||
import cn.axzo.nanopart.doc.file.BizCodeGenerator;
|
||||
import cn.axzo.nanopart.doc.file.index.IndexManager;
|
||||
import cn.axzo.nanopart.doc.file.index.NodeCopyEventTransactional;
|
||||
import cn.axzo.nanopart.doc.file.index.SubtreeCopyEventTransactional;
|
||||
import cn.axzo.nanopart.doc.file.index.domain.IndexNodes;
|
||||
import cn.axzo.nanopart.doc.utils.BizTransactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -35,7 +35,7 @@ import lombok.RequiredArgsConstructor;
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class TemplateDatabaseManager implements ApplicationListener<NodeCopyEventTransactional> {
|
||||
public class TemplateDatabaseManager implements ApplicationListener<SubtreeCopyEventTransactional> {
|
||||
|
||||
private final IndexManager indexManager;
|
||||
private final TemplateDatabaseDao templateDatabaseDao;
|
||||
@ -114,7 +114,7 @@ public class TemplateDatabaseManager implements ApplicationListener<NodeCopyEven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(NodeCopyEventTransactional event) {
|
||||
public void onApplicationEvent(SubtreeCopyEventTransactional event) {
|
||||
if (event.getSrcNode().getContext() != IndexNodeContext.TEMPLATE_DATABASE)
|
||||
return;
|
||||
if (event.getSrcNode().getNodeType() != IndexNodeType.DATABASE)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user