Search in sources :

Example 6 with AbstractOperation

use of com.google.refine.model.AbstractOperation in project OpenRefine by OpenRefine.

the class RemoveColumnCommand method doPost.

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        Project project = getProject(request);
        String columnName = request.getParameter("columnName");
        AbstractOperation op = new ColumnRemovalOperation(columnName);
        Process process = op.createProcess(project, new Properties());
        performProcessAndRespond(request, response, project, process);
    } catch (Exception e) {
        respondException(response, e);
    }
}
Also used : Project(com.google.refine.model.Project) AbstractOperation(com.google.refine.model.AbstractOperation) Process(com.google.refine.process.Process) ColumnRemovalOperation(com.google.refine.operations.column.ColumnRemovalOperation) Properties(java.util.Properties) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 7 with AbstractOperation

use of com.google.refine.model.AbstractOperation in project OpenRefine by OpenRefine.

the class RenameColumnCommand method doPost.

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        Project project = getProject(request);
        String oldColumnName = request.getParameter("oldColumnName");
        String newColumnName = request.getParameter("newColumnName");
        AbstractOperation op = new ColumnRenameOperation(oldColumnName, newColumnName);
        Process process = op.createProcess(project, new Properties());
        performProcessAndRespond(request, response, project, process);
    } catch (Exception e) {
        respondException(response, e);
    }
}
Also used : Project(com.google.refine.model.Project) AbstractOperation(com.google.refine.model.AbstractOperation) Process(com.google.refine.process.Process) Properties(java.util.Properties) ColumnRenameOperation(com.google.refine.operations.column.ColumnRenameOperation) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 8 with AbstractOperation

use of com.google.refine.model.AbstractOperation in project OpenRefine by OpenRefine.

the class EngineDependentCommand method doPost.

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        Project project = getProject(request);
        AbstractOperation op = createOperation(project, request, getEngineConfig(request));
        Process process = op.createProcess(project, new Properties());
        performProcessAndRespond(request, response, project, process);
    } catch (Exception e) {
        respondException(response, e);
    }
}
Also used : Project(com.google.refine.model.Project) AbstractOperation(com.google.refine.model.AbstractOperation) Process(com.google.refine.process.Process) Properties(java.util.Properties) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 9 with AbstractOperation

use of com.google.refine.model.AbstractOperation in project OpenRefine by OpenRefine.

the class TransposeColumnsIntoRowsCommand method doPost.

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        Project project = getProject(request);
        AbstractOperation op;
        String startColumnName = request.getParameter("startColumnName");
        int columnCount = Integer.parseInt(request.getParameter("columnCount"));
        boolean ignoreBlankCells = Boolean.parseBoolean(request.getParameter("ignoreBlankCells"));
        boolean fillDown = Boolean.parseBoolean(request.getParameter("fillDown"));
        String combinedColumnName = request.getParameter("combinedColumnName");
        if (combinedColumnName != null) {
            boolean prependColumnName = Boolean.parseBoolean(request.getParameter("prependColumnName"));
            String separator = request.getParameter("separator");
            op = new TransposeColumnsIntoRowsOperation(startColumnName, columnCount, ignoreBlankCells, fillDown, combinedColumnName, prependColumnName, separator);
        } else {
            String keyColumnName = request.getParameter("keyColumnName");
            String valueColumnName = request.getParameter("valueColumnName");
            op = new TransposeColumnsIntoRowsOperation(startColumnName, columnCount, ignoreBlankCells, fillDown, keyColumnName, valueColumnName);
        }
        Process process = op.createProcess(project, new Properties());
        performProcessAndRespond(request, response, project, process);
    } catch (Exception e) {
        respondException(response, e);
    }
}
Also used : Project(com.google.refine.model.Project) TransposeColumnsIntoRowsOperation(com.google.refine.operations.cell.TransposeColumnsIntoRowsOperation) AbstractOperation(com.google.refine.model.AbstractOperation) Process(com.google.refine.process.Process) Properties(java.util.Properties) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 10 with AbstractOperation

use of com.google.refine.model.AbstractOperation in project OpenRefine by OpenRefine.

the class MoveColumnCommand method doPost.

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        Project project = getProject(request);
        String columnName = request.getParameter("columnName");
        int index = Integer.parseInt(request.getParameter("index"));
        AbstractOperation op = new ColumnMoveOperation(columnName, index);
        Process process = op.createProcess(project, new Properties());
        performProcessAndRespond(request, response, project, process);
    } catch (Exception e) {
        respondException(response, e);
    }
}
Also used : Project(com.google.refine.model.Project) AbstractOperation(com.google.refine.model.AbstractOperation) ColumnMoveOperation(com.google.refine.operations.column.ColumnMoveOperation) Process(com.google.refine.process.Process) Properties(java.util.Properties) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Aggregations

AbstractOperation (com.google.refine.model.AbstractOperation)14 Process (com.google.refine.process.Process)12 Properties (java.util.Properties)12 IOException (java.io.IOException)11 ServletException (javax.servlet.ServletException)11 Project (com.google.refine.model.Project)10 HistoryEntry (com.google.refine.history.HistoryEntry)1 KeyValueColumnizeOperation (com.google.refine.operations.cell.KeyValueColumnizeOperation)1 MultiValuedCellJoinOperation (com.google.refine.operations.cell.MultiValuedCellJoinOperation)1 MultiValuedCellSplitOperation (com.google.refine.operations.cell.MultiValuedCellSplitOperation)1 TransposeColumnsIntoRowsOperation (com.google.refine.operations.cell.TransposeColumnsIntoRowsOperation)1 TransposeRowsIntoColumnsOperation (com.google.refine.operations.cell.TransposeRowsIntoColumnsOperation)1 ColumnMoveOperation (com.google.refine.operations.column.ColumnMoveOperation)1 ColumnRemovalOperation (com.google.refine.operations.column.ColumnRemovalOperation)1 ColumnRenameOperation (com.google.refine.operations.column.ColumnRenameOperation)1 DenormalizeOperation (com.google.refine.operations.row.DenormalizeOperation)1 RefineTest (com.google.refine.tests.RefineTest)1 StringReader (java.io.StringReader)1 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1