Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,16 @@ private void moveOrCopyAttachmentsJcrNodes(List<Attachment> attachments,
String destPath = destNode.getPath().concat("/").concat(attachmentNode.getName());
if (!copy && !attachment.isEXoDrive()) {
Node sourceEntityIdNode = attachmentNode.getParent();
session.move(attachmentNode.getPath(), destPath);
attachmentNode = (Node) session.getItem(destPath);
attachmentNode.addMixin(NodetypeConstant.EXO_HIDDENABLE);
session.save();
Workspace workspace = session.getWorkspace();
workspace.move(attachmentNode.getPath(), destPath);
Node copyNode = (Node) session.getItem(destPath);
copyNode.addMixin(NodetypeConstant.EXO_HIDDENABLE);
if (attachments.size() - 1 == index && sourceEntityIdNode != null
&& sourceEntityIdNode.getPrimaryNodeType().isNodeType(NodetypeConstant.NT_FOLDER)) {
sourceEntityIdNode.remove();
}
session.save();
copyNode.save();
} else {
session.save();
Workspace workspace = session.getWorkspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ public void moveAttachmentsToEntity() throws Exception {
List<Attachment> attachmentList = new ArrayList<>();
Attachment attachment = new Attachment();
attachment.setId("1");
Workspace workspace = mock(Workspace.class);
Session session = mock(Session.class);
Node node = mock(Node.class);
when(session.getWorkspace()).thenReturn(workspace);
ExtendedNode extendedNode = mock(ExtendedNode.class);
ProjectDto projectDto = new ProjectDto();
projectDto.setId(1L);
Expand Down Expand Up @@ -189,7 +191,7 @@ public void moveAttachmentsToEntity() throws Exception {
when(extendedNode.getPath()).thenReturn("destPath");
when(node.getParent()).thenReturn(node);
processesAttachmentService.moveAttachmentsToEntity(1L, 1L, "workflow", 1L, "workdraft", 1L);
verify(session, times(1)).move("srcPath", "destPath/test");
verify(workspace, times(1)).move("srcPath", "destPath/test");

}

Expand Down