Search in sources :

Example 1 with Transaction

use of com.jd.blockchain.gateway.service.search.Transaction in project jdchain-core by blockchain-jd-com.

the class DataSearchServiceHandler method searchAll.

@Override
public Map<String, Object> searchAll(HashDigest ledgerHash, String keyword) {
    Map<String, Object> data = new HashMap<>();
    data.put("combine", true);
    // 区块
    LedgerBlock block = searchBlock(ledgerHash, keyword);
    if (null != block) {
        data.put("blocks", new LedgerBlock[] { block });
    }
    // 交易
    Transaction tx = searchTransaction(ledgerHash, keyword);
    if (null != tx) {
        data.put("txs", new Transaction[] { tx });
    }
    // 数据账户
    DataAccountInfo dataAccount = searchDataAccount(ledgerHash, keyword);
    if (null != dataAccount) {
        data.put("accounts", new DataAccountInfo[] { dataAccount });
    }
    // 事件账户
    BlockchainIdentity eventAccount = searchEventAccount(ledgerHash, keyword);
    if (null != eventAccount) {
        data.put("event_accounts", new BlockchainIdentity[] { eventAccount });
    }
    // 合约
    ContractInfo contract = searchContractAccount(ledgerHash, keyword);
    if (null != contract) {
        data.put("contracts", new ContractInfo[] { contract });
    }
    // 用户
    UserInfo user = searchUser(ledgerHash, keyword);
    if (null != user) {
        data.put("users", new UserInfo[] { user });
    }
    return data;
}
Also used : ContractInfo(com.jd.blockchain.ledger.ContractInfo) LedgerBlock(com.jd.blockchain.ledger.LedgerBlock) Transaction(com.jd.blockchain.gateway.service.search.Transaction) LedgerTransaction(com.jd.blockchain.ledger.LedgerTransaction) DataAccountInfo(com.jd.blockchain.ledger.DataAccountInfo) HashMap(java.util.HashMap) BlockchainIdentity(com.jd.blockchain.ledger.BlockchainIdentity) UserInfo(com.jd.blockchain.ledger.UserInfo)

Aggregations

Transaction (com.jd.blockchain.gateway.service.search.Transaction)1 BlockchainIdentity (com.jd.blockchain.ledger.BlockchainIdentity)1 ContractInfo (com.jd.blockchain.ledger.ContractInfo)1 DataAccountInfo (com.jd.blockchain.ledger.DataAccountInfo)1 LedgerBlock (com.jd.blockchain.ledger.LedgerBlock)1 LedgerTransaction (com.jd.blockchain.ledger.LedgerTransaction)1 UserInfo (com.jd.blockchain.ledger.UserInfo)1 HashMap (java.util.HashMap)1