Search in sources :

Example 1 with ProjectJoin

use of com.google.refine.InterProjectModel.ProjectJoin in project OpenRefine by OpenRefine.

the class Cross method call.

@Override
public Object call(Properties bindings, Object[] args) {
    if (args.length == 3) {
        // from project is implied
        // from cell
        Object wrappedCell = args[0];
        Object toProjectName = args[1];
        Object toColumnName = args[2];
        if (wrappedCell != null && wrappedCell instanceof WrappedCell && toProjectName != null && toProjectName instanceof String && toColumnName != null && toColumnName instanceof String) {
            ProjectJoin join = ProjectManager.singleton.getInterProjectModel().getJoin(ProjectManager.singleton.getProjectMetadata(((Project) bindings.get("project")).id).getName(), ((WrappedCell) wrappedCell).columnName, (String) toProjectName, (String) toColumnName);
            return join.getRows(((WrappedCell) wrappedCell).cell.value);
        }
    }
    return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects a cell, a project name to join with, and a column name in that project");
}
Also used : ProjectJoin(com.google.refine.InterProjectModel.ProjectJoin) WrappedCell(com.google.refine.expr.WrappedCell) EvalError(com.google.refine.expr.EvalError)

Aggregations

ProjectJoin (com.google.refine.InterProjectModel.ProjectJoin)1 EvalError (com.google.refine.expr.EvalError)1 WrappedCell (com.google.refine.expr.WrappedCell)1