Search in sources :

Example 1 with RowReorderOperation

use of com.google.refine.operations.row.RowReorderOperation in project OpenRefine by OpenRefine.

the class ReorderRowsCommand method createOperation.

@Override
protected AbstractOperation createOperation(Project project, HttpServletRequest request, EngineConfig engineConfig) throws Exception {
    String mode = request.getParameter("mode");
    SortingConfig sorting = null;
    try {
        String json = request.getParameter("sorting");
        sorting = (json == null) ? null : SortingConfig.reconstruct(json);
    } catch (IOException e) {
    // ignore
    }
    return new RowReorderOperation(Engine.stringToMode(mode), sorting);
}
Also used : IOException(java.io.IOException) RowReorderOperation(com.google.refine.operations.row.RowReorderOperation) SortingConfig(com.google.refine.sorting.SortingConfig)

Example 2 with RowReorderOperation

use of com.google.refine.operations.row.RowReorderOperation in project OpenRefine by OpenRefine.

the class ReorderRowsCommand method createOperation.

@Override
protected AbstractOperation createOperation(Project project, HttpServletRequest request, JSONObject engineConfig) throws Exception {
    String mode = request.getParameter("mode");
    JSONObject sorting = null;
    try {
        String json = request.getParameter("sorting");
        sorting = (json == null) ? null : ParsingUtilities.evaluateJsonStringToObject(json);
    } catch (JSONException e) {
    // ignore
    }
    return new RowReorderOperation(Engine.stringToMode(mode), sorting);
}
Also used : JSONObject(org.json.JSONObject) JSONException(org.json.JSONException) RowReorderOperation(com.google.refine.operations.row.RowReorderOperation)

Aggregations

RowReorderOperation (com.google.refine.operations.row.RowReorderOperation)2 SortingConfig (com.google.refine.sorting.SortingConfig)1 IOException (java.io.IOException)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1