Search in sources :

Example 1 with ArchiveContentException

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);
    }
}
Also used : MoveNodeException(com.enonic.xp.node.MoveNodeException) NodeAccessException(com.enonic.xp.node.NodeAccessException) ArchiveContentException(com.enonic.xp.archive.ArchiveContentException) ArchiveContentsResult(com.enonic.xp.archive.ArchiveContentsResult) ContentAccessException(com.enonic.xp.content.ContentAccessException)

Example 2 with ArchiveContentException

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());
}
Also used : Content(com.enonic.xp.content.Content) ArchiveContentException(com.enonic.xp.archive.ArchiveContentException) Test(org.junit.jupiter.api.Test)

Aggregations

ArchiveContentException (com.enonic.xp.archive.ArchiveContentException)2 ArchiveContentsResult (com.enonic.xp.archive.ArchiveContentsResult)1 Content (com.enonic.xp.content.Content)1 ContentAccessException (com.enonic.xp.content.ContentAccessException)1 MoveNodeException (com.enonic.xp.node.MoveNodeException)1 NodeAccessException (com.enonic.xp.node.NodeAccessException)1 Test (org.junit.jupiter.api.Test)1