Search in sources :

Example 1 with FindNodesByParentParams

use of com.enonic.xp.node.FindNodesByParentParams in project xp by enonic.

the class SecurityServiceImpl method getIdProviders.

@Override
public IdProviders getIdProviders() {
    final FindNodesByParentParams findByParent = FindNodesByParentParams.create().parentPath(IdProviderNodeTranslator.getIdProvidersParentPath()).build();
    final Nodes nodes = callWithContext(() -> {
        final FindNodesByParentResult result = this.nodeService.findByParent(findByParent);
        return this.nodeService.getByIds(result.getNodeIds());
    });
    return IdProviderNodeTranslator.fromNodes(nodes);
}
Also used : FindNodesByParentParams(com.enonic.xp.node.FindNodesByParentParams) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult) Nodes(com.enonic.xp.node.Nodes)

Example 2 with FindNodesByParentParams

use of com.enonic.xp.node.FindNodesByParentParams in project xp by enonic.

the class ApplyNodePermissionsCommand method applyPermissionsToChildren.

private void applyPermissionsToChildren(final Node parent) {
    final AccessControlList parentPermissions = parent.getPermissions();
    final FindNodesByParentParams findByParentParams = FindNodesByParentParams.create().parentPath(parent.path()).size(NodeSearchService.GET_ALL_SIZE_FLAG).build();
    final FindNodesByParentResult result = doFindNodesByParent(findByParentParams);
    final Nodes children = GetNodesByIdsCommand.create(this).ids(result.getNodeIds()).build().execute();
    for (Node child : children) {
        applyPermissions(parentPermissions, child);
    }
}
Also used : AccessControlList(com.enonic.xp.security.acl.AccessControlList) FindNodesByParentParams(com.enonic.xp.node.FindNodesByParentParams) Node(com.enonic.xp.node.Node) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult) Nodes(com.enonic.xp.node.Nodes)

Example 3 with FindNodesByParentParams

use of com.enonic.xp.node.FindNodesByParentParams in project xp by enonic.

the class RepositoryEntryServiceImpl method findRepositoryEntryIds.

@Override
public RepositoryIds findRepositoryEntryIds() {
    final ImmutableList.Builder<RepositoryId> repositoryIds = ImmutableList.builder();
    final FindNodesByParentParams findNodesByParentParams = FindNodesByParentParams.create().parentPath(RepositoryConstants.REPOSITORY_STORAGE_PARENT_PATH).size(-1).build();
    final FindNodesByParentResult findNodesByParentResult = createContext().callWith(() -> FindNodesByParentCommand.create().params(findNodesByParentParams).indexServiceInternal(this.indexServiceInternal).storageService(this.nodeStorageService).searchService(this.nodeSearchService).build().execute());
    findNodesByParentResult.getNodeIds().stream().map(nodeId -> RepositoryId.from(nodeId.toString())).forEach(repositoryIds::add);
    return RepositoryIds.from(repositoryIds.build());
}
Also used : RefreshMode(com.enonic.xp.node.RefreshMode) NodeStorageService(com.enonic.xp.repo.impl.storage.NodeStorageService) EventPublisher(com.enonic.xp.event.EventPublisher) Node(com.enonic.xp.node.Node) RepositoryIds(com.enonic.xp.repository.RepositoryIds) Branch(com.enonic.xp.branch.Branch) Component(org.osgi.service.component.annotations.Component) RepositoryId(com.enonic.xp.repository.RepositoryId) ImmutableList(com.google.common.collect.ImmutableList) UpdateNodeCommand(com.enonic.xp.repo.impl.node.UpdateNodeCommand) ContextAccessor(com.enonic.xp.context.ContextAccessor) RefreshCommand(com.enonic.xp.repo.impl.node.RefreshCommand) NodeEvents(com.enonic.xp.repo.impl.NodeEvents) ContextBuilder(com.enonic.xp.context.ContextBuilder) ByteSource(com.google.common.io.ByteSource) SystemConstants(com.enonic.xp.security.SystemConstants) RepositoryEvents(com.enonic.xp.repo.impl.RepositoryEvents) FindNodesByParentCommand(com.enonic.xp.repo.impl.node.FindNodesByParentCommand) InternalContext(com.enonic.xp.repo.impl.InternalContext) NodeSearchService(com.enonic.xp.repo.impl.search.NodeSearchService) AttachedBinary(com.enonic.xp.node.AttachedBinary) NodeId(com.enonic.xp.node.NodeId) UpdateNodeParams(com.enonic.xp.node.UpdateNodeParams) NodeBranchEntries(com.enonic.xp.node.NodeBranchEntries) BinaryService(com.enonic.xp.repo.impl.binary.BinaryService) IndexServiceInternal(com.enonic.xp.repo.impl.index.IndexServiceInternal) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult) DeleteNodeByIdCommand(com.enonic.xp.repo.impl.node.DeleteNodeByIdCommand) Context(com.enonic.xp.context.Context) Reference(org.osgi.service.component.annotations.Reference) FindNodesByParentParams(com.enonic.xp.node.FindNodesByParentParams) RepositoryConstants(com.enonic.xp.repository.RepositoryConstants) Repository(com.enonic.xp.repository.Repository) FindNodesByParentParams(com.enonic.xp.node.FindNodesByParentParams) ImmutableList(com.google.common.collect.ImmutableList) FindNodesByParentResult(com.enonic.xp.node.FindNodesByParentResult) RepositoryId(com.enonic.xp.repository.RepositoryId)

Aggregations

FindNodesByParentParams (com.enonic.xp.node.FindNodesByParentParams)3 FindNodesByParentResult (com.enonic.xp.node.FindNodesByParentResult)3 Node (com.enonic.xp.node.Node)2 Nodes (com.enonic.xp.node.Nodes)2 Branch (com.enonic.xp.branch.Branch)1 Context (com.enonic.xp.context.Context)1 ContextAccessor (com.enonic.xp.context.ContextAccessor)1 ContextBuilder (com.enonic.xp.context.ContextBuilder)1 EventPublisher (com.enonic.xp.event.EventPublisher)1 AttachedBinary (com.enonic.xp.node.AttachedBinary)1 NodeBranchEntries (com.enonic.xp.node.NodeBranchEntries)1 NodeId (com.enonic.xp.node.NodeId)1 RefreshMode (com.enonic.xp.node.RefreshMode)1 UpdateNodeParams (com.enonic.xp.node.UpdateNodeParams)1 InternalContext (com.enonic.xp.repo.impl.InternalContext)1 NodeEvents (com.enonic.xp.repo.impl.NodeEvents)1 RepositoryEvents (com.enonic.xp.repo.impl.RepositoryEvents)1 BinaryService (com.enonic.xp.repo.impl.binary.BinaryService)1 IndexServiceInternal (com.enonic.xp.repo.impl.index.IndexServiceInternal)1 DeleteNodeByIdCommand (com.enonic.xp.repo.impl.node.DeleteNodeByIdCommand)1