use of com.enonic.xp.archive.ArchiveContentException in project xp by enonic.
the class ArchiveContentCommand method execute.
ArchiveContentsResult execute() {
params.validate();
try {
final ArchiveContentsResult archivedContents = doExecute();
this.nodeService.refresh(RefreshMode.ALL);
return archivedContents;
} catch (MoveNodeException e) {
throw new ArchiveContentException(e.getMessage(), ContentNodeHelper.translateNodePathToContentPath(e.getPath()));
} catch (NodeAccessException e) {
throw new ContentAccessException(e);
}
}
use of com.enonic.xp.archive.ArchiveContentException in project xp by enonic.
the class ContentServiceImplTest_archive method archive_already_archived.
@Test
public void archive_already_archived() throws Exception {
final Content content = createContent(ContentPath.ROOT, "content");
this.contentService.archive(ArchiveContentParams.create().contentId(content.getId()).build());
final ArchiveContentException ex = archiveContext().callWith(() -> assertThrows(ArchiveContentException.class, () -> this.contentService.archive(ArchiveContentParams.create().contentId(content.getId()).build())));
assertEquals("/content", ex.getPath().toString());
}
Aggregations