package io.swagger.api.impl;

import io.swagger.api.*;
import io.swagger.api.KuduContext;
import io.swagger.model.*;

import io.swagger.model.RowEntry;

import java.util.List;
import io.swagger.api.NotFoundException;

import java.io.InputStream;

import org.glassfish.jersey.media.multipart.FormDataContentDisposition;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;

import com.stumbleupon.async.Callback;
import com.stumbleupon.async.Deferred;
import org.apache.kudu.client.*;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2016-09-29T00:36:11.447Z")
public class RowApiServiceImpl extends RowApiService {
    @Override
    public Response rowPut(String tableId, final RowEntry row, SecurityContext securityContext) throws NotFoundException {
        // Asynchronously add the row to a given table.
        AsyncKuduClient client = KuduContext.getInstance().getClient();
        final AsyncKuduSession session = client.newSession();

        // Submit an asynchronous request to get the table.
        Deferred<KuduTable> table = client.openTable(tableId);

        // Add callback to insert the data if the table does exist.
        table.addCallback(new Callback<Object,  KuduTable>() {
            @Override
            public Object call(KuduTable table) throws Exception {
                Insert insert = table.newInsert();
                PartialRow kuduRow = insert.getRow();
                row.getKuduRow(kuduRow);

                // Asyncronously insert the row. Ignore the result of the insert.
                Deferred<OperationResponse> insertHook = session.apply(insert);
                insertHook.addCallback(new Callback<Object, OperationResponse>() {
                    @Override
                    public Object call(OperationResponse resp) throws Exception {
                        if (resp.hasRowError()) {

                        } else {

                        }
                        return null;
                    }
                });
                return null;
            }
        });
        return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "Row inserted!")).build();
    }
}

@@ -818,32 +818,763 @@
 oundException %7B%0A
+        AsyncKuduClient client = KuduContext.getInstance().getClient();%0A        final AsyncKuduSession session = client.newSession();%0A        Deferred%3CKuduTable%3E table = client.openTable(tableId);%0A        KuduTable kuduTable = table.join();%0A        Insert insert = table.newInsert();%0A        PartialRow kuduRow = insert.getRow();%0A        row.getKuduRow(kuduRow);%0A        Deferred%3COperationResponse%3E insertHook = session.apply(insert);%0A        OperationResponse resp = insertHook.join()%0A        return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, %22Row inserted!%22)).build();%0A    %7D%0A%0A    public Response async_rowPut(String tableId, final RowEntry row, SecurityContext securityContext) throws NotFoundException %7B%0A
         // Async

Add a synchronized interface for pushing rows