Response increment(final CellSetModel model) {
    Table table = null;
    Increment increment = null;
    try {
      table = servlet.getTable(tableResource.getName());
      if (model.getRows().size() != 1) {
        servlet.getMetrics().incrementFailedIncrementRequests(1);
        return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
          .entity("Bad request: Number of rows specified is not 1." + CRLF).build();
      }
      RowModel rowModel = model.getRows().get(0);
      byte[] key = rowModel.getKey();
      if (key == null) {
        key = rowspec.getRow();
      }
      if (key == null) {
        servlet.getMetrics().incrementFailedIncrementRequests(1);
        return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
          .entity("Bad request: Row key found to be null." + CRLF).build();
      }

      increment = new Increment(key);
      increment.setReturnResults(returnResult);
      int i = 0;
      for (CellModel cell : rowModel.getCells()) {
        byte[] col = cell.getColumn();
        if (col == null) {
          try {
            col = rowspec.getColumns()[i++];
          } catch (ArrayIndexOutOfBoundsException e) {
            col = null;
          }
        }
        if (col == null) {
          servlet.getMetrics().incrementFailedIncrementRequests(1);
          return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
            .entity("Bad request: Column found to be null." + CRLF).build();
        }
        byte[][] parts = CellUtil.parseColumn(col);
        if (parts.length != 2) {
          servlet.getMetrics().incrementFailedIncrementRequests(1);
          return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
            .entity("Bad request: Column incorrectly specified." + CRLF).build();
        }
        increment.addColumn(parts[0], parts[1],
          Long.parseLong(Bytes.toStringBinary(cell.getValue())));
      }

      if (LOG.isDebugEnabled()) {
        LOG.debug("INCREMENT " + increment.toString());
      }
      Result result = table.increment(increment);

      if (returnResult) {
        if (result.isEmpty()) {
          servlet.getMetrics().incrementFailedIncrementRequests(1);
          return Response.status(Response.Status.NOT_MODIFIED).type(MIMETYPE_TEXT)
            .entity("Increment return empty." + CRLF).build();
        }

        CellSetModel rModel = new CellSetModel();
        RowModel rRowModel = new RowModel(result.getRow());
        for (Cell cell : result.listCells()) {
          rRowModel.addCell(new CellModel(cell));
        }
        rModel.addRow(rowModel);
        servlet.getMetrics().incrementSucessfulIncrementRequests(1);
        return Response.ok(rModel).build();
      }

      ResponseBuilder response = Response.ok();
      servlet.getMetrics().incrementSucessfulIncrementRequests(1);
      return response.build();
    } catch (Exception e) {
      servlet.getMetrics().incrementFailedIncrementRequests(1);
      return processException(e);
    } finally {
      if (table != null) {
        try {
          table.close();
        } catch (IOException ioe) {
          LOG.debug("Exception received while closing the table " + table.getName(), ioe);
        }
      }
    }
  }
Validates the input request parameters, parses columns from CellSetModel, and invokes Increment
on HTable.
@param model instance of CellSetModel
@return Response 200 OK, 304 Not modified, 400 Bad request
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java