Search in sources :

Example 1 with RestoreContentException

use of com.enonic.xp.archive.RestoreContentException in project xp by enonic.

the class ContentServiceImplTest_restore method restore_not_archived.

@Test
public void restore_not_archived() throws Exception {
    final Content content = createContent(ContentPath.ROOT, "archive");
    final RestoreContentException ex = assertThrows(RestoreContentException.class, () -> this.contentService.restore(RestoreContentParams.create().contentId(content.getId()).restoreContentListener(listener).build()));
    assertEquals("/archive", ex.getPath().toString());
}
Also used : Content(com.enonic.xp.content.Content) RestoreContentException(com.enonic.xp.archive.RestoreContentException) Test(org.junit.jupiter.api.Test)

Example 2 with RestoreContentException

use of com.enonic.xp.archive.RestoreContentException in project xp by enonic.

the class RestoreContentCommand method execute.

RestoreContentsResult execute() {
    params.validate();
    try {
        final RestoreContentsResult restoredContents = doExecute();
        this.nodeService.refresh(RefreshMode.ALL);
        return restoredContents;
    } catch (MoveNodeException e) {
        throw new RestoreContentException(e.getMessage(), ContentNodeHelper.translateNodePathToContentPath(e.getPath()));
    } catch (NodeAccessException e) {
        throw new ContentAccessException(e);
    }
}
Also used : RestoreContentsResult(com.enonic.xp.archive.RestoreContentsResult) MoveNodeException(com.enonic.xp.node.MoveNodeException) NodeAccessException(com.enonic.xp.node.NodeAccessException) RestoreContentException(com.enonic.xp.archive.RestoreContentException) ContentAccessException(com.enonic.xp.content.ContentAccessException)

Aggregations

RestoreContentException (com.enonic.xp.archive.RestoreContentException)2 RestoreContentsResult (com.enonic.xp.archive.RestoreContentsResult)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