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);
}
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();
}
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);
}
Aggregations