use of com.enonic.xp.archive.RestoreContentParams in project xp by enonic.
the class RestoreContentHandler method restore.
private List<String> restore(final ContentId sourceId, final ContentPath pathToRestore) {
final RestoreContentParams restoreParams = RestoreContentParams.create().contentId(sourceId).path(pathToRestore).build();
final RestoreContentsResult result = contentService.restore(restoreParams);
return result.getRestoredContents().stream().map(ContentId::toString).collect(Collectors.toList());
}
use of com.enonic.xp.archive.RestoreContentParams in project xp by enonic.
the class RestoreContentHandlerTest method testExample.
@Test
public void testExample() {
final Content content = TestDataFixtures.newExampleContent();
when(this.contentService.getByPath(ContentPath.from("/path/to/mycontent"))).thenReturn(content);
when(this.contentService.restore(Mockito.isA(RestoreContentParams.class))).thenAnswer(invocationOnMock -> invokeRestore((RestoreContentParams) invocationOnMock.getArguments()[0], content));
runScript("/lib/xp/examples/content/restore.js");
}
Aggregations