Search in sources :

Example 1 with ContextBuilder

use of com.enonic.xp.context.ContextBuilder in project xp by enonic.

the class NodeHandleFactory method create.

public NodeHandler create(final NodeHandleContext context) {
    final ContextBuilder contextBuilder = ContextBuilder.from(ContextAccessor.current());
    if (context.getRepoId() != null) {
        contextBuilder.repositoryId(context.getRepoId());
    }
    if (context.getBranch() != null) {
        contextBuilder.branch(context.getBranch());
    }
    contextBuilder.authInfo(getAuthInfo(context.getUsername(), context.getIdProvider(), context.getPrincipals()));
    return new NodeHandler(contextBuilder.build(), this.nodeService);
}
Also used : ContextBuilder(com.enonic.xp.context.ContextBuilder)

Example 2 with ContextBuilder

use of com.enonic.xp.context.ContextBuilder in project xp by enonic.

the class TaskRunnable method newContext.

private Context newContext() {
    final TaskContext taskContext = runnableTask.getTaskContext();
    final ContextBuilder context = ContextBuilder.create().authInfo(taskContext.getAuthInfo()).branch(taskContext.getBranch()).repositoryId(taskContext.getRepo());
    if (taskContext.getContentRootPath() != null) {
        context.attribute(CONTENT_ROOT_PATH_ATTRIBUTE, taskContext.getContentRootPath());
    }
    return context.build();
}
Also used : TaskContext(com.enonic.xp.impl.task.distributed.TaskContext) ContextBuilder(com.enonic.xp.context.ContextBuilder)

Example 3 with ContextBuilder

use of com.enonic.xp.context.ContextBuilder in project xp by enonic.

the class ContextHandlerBean method run.

public Object run(final ContextRunParams params) {
    final ContextBuilder builder = ContextBuilder.from(this.context.get());
    applyRepository(builder, params.repository);
    applyAuthInfo(builder, params.username, params.idProvider, params.principals);
    applyBranch(builder, params.branch);
    addAttributes(builder, params.attributes);
    return builder.build().callWith(params.callback);
}
Also used : ContextBuilder(com.enonic.xp.context.ContextBuilder)

Aggregations

ContextBuilder (com.enonic.xp.context.ContextBuilder)3 TaskContext (com.enonic.xp.impl.task.distributed.TaskContext)1