use of com.enonic.xp.repo.impl.storage.GetByIdRequest in project xp by enonic.
the class BranchServiceImpl method doGetById.
private NodeBranchEntry doGetById(final NodeId nodeId, final InternalContext context) {
final GetByIdRequest getByIdRequest = createGetByIdRequest(nodeId, context);
final GetResult getResult = this.storageDao.getById(getByIdRequest);
if (getResult.isEmpty()) {
return null;
}
return NodeBranchVersionFactory.create(getResult.getReturnValues());
}
use of com.enonic.xp.repo.impl.storage.GetByIdRequest in project xp by enonic.
the class StorageDaoImpl method getByIds.
@Override
public GetResults getByIds(final GetByIdsRequest requests) {
if (requests.getRequests().isEmpty()) {
return new GetResults();
}
final MultiGetRequestBuilder multiGetRequestBuilder = new MultiGetRequestBuilder(this.client, MultiGetAction.INSTANCE).setPreference(SearchPreference.LOCAL.getName());
for (final GetByIdRequest request : requests.getRequests()) {
final StorageSource storageSource = request.getStorageSource();
final MultiGetRequest.Item item = new MultiGetRequest.Item(storageSource.getStorageName().getName(), storageSource.getStorageType().getName(), request.getId());
if (request.getReturnFields().isNotEmpty()) {
item.fields(request.getReturnFields().getReturnFieldNames());
}
if (request.getRouting() != null) {
item.routing(request.getRouting());
}
multiGetRequestBuilder.add(item);
}
final MultiGetResponse multiGetItemResponses = this.client.multiGet(multiGetRequestBuilder.request()).actionGet();
return GetResultsFactory.create(multiGetItemResponses);
}
use of com.enonic.xp.repo.impl.storage.GetByIdRequest in project xp by enonic.
the class VersionServiceImpl method doGetById.
private NodeVersionMetadata doGetById(final NodeId nodeId, final NodeVersionId nodeVersionId, final InternalContext context) {
final GetByIdRequest getByIdRequest = GetByIdRequest.create().id(nodeVersionId.toString()).returnFields(VERSION_RETURN_FIELDS).storageSettings(createStorageSettings(context)).build();
final GetResult getResult = this.storageDao.getById(getByIdRequest);
if (getResult.isEmpty()) {
return null;
}
return NodeVersionFactory.create(getResult);
}
use of com.enonic.xp.repo.impl.storage.GetByIdRequest in project xp by enonic.
the class CommitServiceImpl method get.
@Override
public NodeCommitEntry get(final NodeCommitId nodeCommitId, final InternalContext context) {
final GetByIdRequest getByIdRequest = createGetByIdRequest(nodeCommitId, context);
final GetResult getResult = this.storageDao.getById(getByIdRequest);
if (getResult.isEmpty()) {
return null;
}
return NodeCommitEntryFactory.create(getResult.getReturnValues());
}
Aggregations