Search in sources :

Example 1 with Appendix

use of org.xel.Appendix in project elastic-core-maven by OrdinaryDude.

the class GetTaggedDataExtendTransactions method processRequest.

@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
    long taggedDataId = ParameterParser.getUnsignedLong(req, "transaction", true);
    List<Long> extendTransactions = TaggedData.getExtendTransactionIds(taggedDataId);
    JSONObject response = new JSONObject();
    JSONArray jsonArray = new JSONArray();
    Blockchain blockchain = Nxt.getBlockchain();
    Filter<Appendix> filter = (appendix) -> !(appendix instanceof Attachment.TaggedDataExtend);
    extendTransactions.forEach(transactionId -> jsonArray.add(JSONData.transaction(blockchain.getTransaction(transactionId), filter)));
    response.put("extendTransactions", jsonArray);
    return response;
}
Also used : Filter(org.xel.util.Filter) Attachment(org.xel.Attachment) HttpServletRequest(javax.servlet.http.HttpServletRequest) List(java.util.List) NxtException(org.xel.NxtException) JSONObject(org.json.simple.JSONObject) Blockchain(org.xel.Blockchain) JSONStreamAware(org.json.simple.JSONStreamAware) Nxt(org.xel.Nxt) Appendix(org.xel.Appendix) TaggedData(org.xel.TaggedData) JSONArray(org.json.simple.JSONArray) JSONObject(org.json.simple.JSONObject) Blockchain(org.xel.Blockchain) JSONArray(org.json.simple.JSONArray) Appendix(org.xel.Appendix)

Aggregations

List (java.util.List)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JSONArray (org.json.simple.JSONArray)1 JSONObject (org.json.simple.JSONObject)1 JSONStreamAware (org.json.simple.JSONStreamAware)1 Appendix (org.xel.Appendix)1 Attachment (org.xel.Attachment)1 Blockchain (org.xel.Blockchain)1 Nxt (org.xel.Nxt)1 NxtException (org.xel.NxtException)1 TaggedData (org.xel.TaggedData)1 Filter (org.xel.util.Filter)1