All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vertexium.cypher.executionPlan.NameParameterExecutionStep Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.cypher.executionPlan;

import org.vertexium.cypher.VertexiumCypherQueryContext;
import org.vertexium.cypher.VertexiumCypherResult;

public class NameParameterExecutionStep extends DefaultExecutionStep implements ExecutionStepWithResultName {
    private final String resultName;
    private final String parameterName;

    public NameParameterExecutionStep(String resultName, String parameterName) {
        this.resultName = resultName;
        this.parameterName = parameterName;
    }

    @Override
    public String getResultName() {
        return resultName;
    }

    @Override
    public VertexiumCypherResult execute(VertexiumCypherQueryContext ctx, VertexiumCypherResult source) {
        return source.peek(row -> row.pushScope(getResultName(), ctx.getParameter(parameterName)));
    }

    @Override
    public String toString() {
        return String.format("%s {resultName='%s', parameterName='%s'}", super.toString(), resultName, parameterName);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy