use of com.enonic.xp.content.ContentVersion in project xp by enonic.
the class ContentVersionFactory method create.
public ContentVersions create(final NodeId nodeId, final NodeVersionsMetadata nodeVersionsMetadata) {
final ContentVersions.Builder contentVersionsBuilder = ContentVersions.create().contentId(ContentId.from(nodeId.toString()));
for (final NodeVersionMetadata nodeVersionMetadata : nodeVersionsMetadata) {
final ContentVersion contentVersion = create(nodeVersionMetadata);
contentVersionsBuilder.add(contentVersion);
}
return contentVersionsBuilder.build();
}
use of com.enonic.xp.content.ContentVersion in project xp by enonic.
the class ContentServiceImplTest_versions method get_archived_versions.
@Test
public void get_archived_versions() throws Exception {
final Content content = this.contentService.create(CreateContentParams.create().contentData(new PropertyTree()).displayName("content").parent(ContentPath.ROOT).name("myContent").type(ContentTypeName.folder()).build());
this.contentService.archive(ArchiveContentParams.create().contentId(content.getId()).build());
this.contentService.restore(RestoreContentParams.create().contentId(content.getId()).build());
final FindContentVersionsResult result = this.contentService.getVersions(FindContentVersionsParams.create().contentId(content.getId()).build());
assertEquals(5, result.getHits());
assertEquals(5, result.getTotalHits());
final ImmutableList<ContentVersion> versions = ImmutableList.copyOf(result.getContentVersions().iterator());
assertEquals(ContentVersionPublishInfo.CommitType.RESTORED, versions.get(0).getPublishInfo().getType());
assertEquals(ContentVersionPublishInfo.CommitType.ARCHIVED, versions.get(2).getPublishInfo().getType());
}
Aggregations