Search in sources :

Example 1 with GetByIdsRequest

use of com.enonic.xp.repo.impl.storage.GetByIdsRequest in project xp by enonic.

the class GetBranchEntriesMethod method execute.

@Override
public void execute(final Collection<NodeId> nodeIds, final NodeBranchEntries.Builder builder) {
    final GetByIdsRequest getByIdsRequest = new GetByIdsRequest();
    for (final NodeId nodeId : nodeIds) {
        getByIdsRequest.add(GetByIdRequest.create().id(new BranchDocumentId(nodeId, context.getBranch()).toString()).storageSettings(StorageSource.create().storageName(StoreStorageName.from(context.getRepositoryId())).storageType(StaticStorageType.BRANCH).build()).returnFields(returnFields).routing(nodeId.toString()).build());
    }
    final GetResults getResults = this.storageDao.getByIds(getByIdsRequest);
    for (final GetResult getResult : getResults) {
        if (!getResult.isEmpty()) {
            final NodeBranchEntry nodeBranchEntry = NodeBranchVersionFactory.create(getResult.getReturnValues());
            builder.add(nodeBranchEntry);
        }
    }
}
Also used : GetResult(com.enonic.xp.repo.impl.storage.GetResult) NodeId(com.enonic.xp.node.NodeId) GetResults(com.enonic.xp.repo.impl.storage.GetResults) NodeBranchEntry(com.enonic.xp.node.NodeBranchEntry) GetByIdsRequest(com.enonic.xp.repo.impl.storage.GetByIdsRequest)

Aggregations

NodeBranchEntry (com.enonic.xp.node.NodeBranchEntry)1 NodeId (com.enonic.xp.node.NodeId)1 GetByIdsRequest (com.enonic.xp.repo.impl.storage.GetByIdsRequest)1 GetResult (com.enonic.xp.repo.impl.storage.GetResult)1 GetResults (com.enonic.xp.repo.impl.storage.GetResults)1