Search in sources :

Example 1 with UpdateResultEventResponse

use of org.fisco.bcos.channel.test.contract.TableTest.UpdateResultEventResponse in project web3sdk by FISCO-BCOS.

the class TableTestClient method update.

private static void update(String[] args, TableTest tabletest) {
    if (args.length == 4) {
        try {
            String name = args[1];
            int item_id = Integer.parseInt(args[2]);
            String item_name = args[3];
            RemoteCall<TransactionReceipt> update = tabletest.update(name, BigInteger.valueOf(item_id), item_name);
            TransactionReceipt transactionReceipt = update.send();
            List<UpdateResultEventResponse> updateResultEvents = tabletest.getUpdateResultEvents(transactionReceipt);
            if (updateResultEvents.size() > 0) {
                for (int i = 0; i < updateResultEvents.size(); i++) {
                    UpdateResultEventResponse updateResultEventResponse = updateResultEvents.get(i);
                    System.out.println("updateCount = " + updateResultEventResponse.count.intValue());
                    logger.info("updateCount = " + updateResultEventResponse.count.intValue());
                }
            } else {
                System.out.println("t_test table does not exist.");
            }
        } catch (Exception e) {
            System.out.println("update transaction is abnormal, please check the environment");
        }
    } else {
        System.out.println("\nPlease enter as follow example:\n 1 1 update fruit 1 orange");
    }
}
Also used : UpdateResultEventResponse(org.fisco.bcos.channel.test.contract.TableTest.UpdateResultEventResponse) TransactionReceipt(org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt) TransactionException(org.fisco.bcos.web3j.protocol.exceptions.TransactionException)

Aggregations

UpdateResultEventResponse (org.fisco.bcos.channel.test.contract.TableTest.UpdateResultEventResponse)1 TransactionReceipt (org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt)1 TransactionException (org.fisco.bcos.web3j.protocol.exceptions.TransactionException)1