Search in sources :

Example 1 with GetResult

use of com.enonic.xp.repo.impl.storage.GetResult 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());
}
Also used : GetResult(com.enonic.xp.repo.impl.storage.GetResult) GetByIdRequest(com.enonic.xp.repo.impl.storage.GetByIdRequest)

Example 2 with GetResult

use of com.enonic.xp.repo.impl.storage.GetResult 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);
}
Also used : GetResult(com.enonic.xp.repo.impl.storage.GetResult) GetByIdRequest(com.enonic.xp.repo.impl.storage.GetByIdRequest)

Example 3 with GetResult

use of com.enonic.xp.repo.impl.storage.GetResult 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)

Example 4 with GetResult

use of com.enonic.xp.repo.impl.storage.GetResult 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());
}
Also used : GetResult(com.enonic.xp.repo.impl.storage.GetResult) GetByIdRequest(com.enonic.xp.repo.impl.storage.GetByIdRequest)

Aggregations

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