use of com.enonic.xp.content.ContentVersions in project xp by enonic.
the class FindContentVersionsCommand method doGetContentVersions.
private FindContentVersionsResult doGetContentVersions() {
this.nodeService.refresh(RefreshMode.STORAGE);
final NodeId nodeId = NodeId.from(this.contentId);
final NodeVersionQueryResult nodeVersionQueryResult = nodeService.findVersions(GetNodeVersionsParams.create().nodeId(nodeId).from(this.from).size(this.size).build());
final FindContentVersionsResult.Builder findContentVersionsResultBuilder = FindContentVersionsResult.create().hits(nodeVersionQueryResult.getHits()).totalHits(nodeVersionQueryResult.getTotalHits()).from(nodeVersionQueryResult.getFrom()).size(nodeVersionQueryResult.getSize());
final ContentVersionFactory contentVersionFactory = new ContentVersionFactory(this.nodeService);
final ContentVersions contentVersions = contentVersionFactory.create(nodeId, nodeVersionQueryResult.getNodeVersionsMetadata());
findContentVersionsResultBuilder.contentVersions(contentVersions);
return findContentVersionsResultBuilder.build();
}
use of com.enonic.xp.content.ContentVersions 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();
}
Aggregations