Search in sources :

Example 1 with CreateResultEventResponse

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

the class TableTestClient method create.

private static void create(TableTest tabletest) throws Exception {
    TransactionReceipt receipt = tabletest.create().send();
    List<CreateResultEventResponse> createResultEvents = tabletest.getCreateResultEvents(receipt);
    if (createResultEvents.size() == 0) {
        System.out.println("create t_test table failed.");
        return;
    }
    CreateResultEventResponse createResultEventResponse = createResultEvents.get(0);
    int createCount = createResultEventResponse.count.intValue();
    System.out.println("create table ret:" + createCount);
    switch(createCount) {
        case PrecompiledCommon.PermissionDenied:
            System.out.println("non-authorized to create t_test table.");
            break;
        case PrecompiledCommon.PermissionDenied_RC3:
            System.out.println("non-authorized to create t_test table.");
            break;
        case PrecompiledCommon.TableExist:
            System.out.println("t_test table already exist.");
            break;
        case PrecompiledCommon.Success:
            System.out.println("create t_test table success.");
            break;
        default:
            System.out.println("unknown return value:" + createCount);
            break;
    }
}
Also used : CreateResultEventResponse(org.fisco.bcos.channel.test.contract.TableTest.CreateResultEventResponse) TransactionReceipt(org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt)

Aggregations

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