@Override public JSONObject getProductListingByPlsid(int plsid) { ProductListing prod = productListingRepository.findOne(plsid); JSONObject object = new JSONObject(); if (prod != null) { object.put("partyid", prod.getParty().getPtyId()); object.put("productlisting", getProductlsiting(prod)); } return object; }
@Override public JSONArray getProductListingByPartyid(int partyid) { List<ProductListing> prdlisting = productListingRepository.findByptyId(partyid); JSONArray jsonrecords = new JSONArray(); JSONObject object; if (prdlisting != null) { for (ProductListing prdlist : prdlisting) { object = new JSONObject(); object.put("productlisting", getProductlsiting(prdlist)); object.put("partyid", prdlist.getParty().getPtyId()); jsonrecords.add(object); } } return jsonrecords; }