public void configure(WebUI ui, Spec spec) { for (Record r : spec.getAllRecords()) { type_to_url.put(r.getID(), r.getWebURL()); } }
private void search_or_list_vocab( JSONObject out, Record rd, Instance n, Storage storage, JSONObject restriction, String resultstring, JSONObject temp) throws ExistException, UnimplementedException, UnderlyingStorageException, JSONException, UIException { JSONObject data = storage.getPathsJSON(rd.getID() + "/" + n.getTitleRef(), restriction); String[] paths = (String[]) data.get("listItems"); JSONObject pagination = new JSONObject(); if (data.has("pagination")) { pagination = data.getJSONObject("pagination"); pagination.put("numInstances", "1"); } JSONArray members = new JSONArray(); /* Get a view of each */ if (temp.has(resultstring)) { members = temp.getJSONArray(resultstring); } for (String result : paths) { if (temp.has(resultstring)) { temp.getJSONArray(resultstring) .put(generateMiniRecord(storage, rd.getID(), n.getTitleRef(), result)); members = temp.getJSONArray(resultstring); } else { members.put(generateMiniRecord(storage, rd.getID(), n.getTitleRef(), result)); } } out.put(resultstring, members); if (pagination != null) { if (temp.has("pagination")) { JSONObject pag2 = temp.getJSONObject("pagination"); String itemsInPage = pag2.getString("itemsInPage"); String pagSize = pag2.getString("pageSize"); String totalItems = pag2.getString("totalItems"); String numInstances = pag2.getString("numInstances"); String itemsInPage1 = pagination.getString("itemsInPage"); String pagSize1 = pagination.getString("pageSize"); String totalItems1 = pagination.getString("totalItems"); Integer numInstances1 = Integer.parseInt(numInstances); int iip = Integer.parseInt(itemsInPage) + Integer.parseInt(itemsInPage1); int ps = Integer.parseInt(pagSize) + Integer.parseInt(pagSize1); int ti = Integer.parseInt(totalItems) + Integer.parseInt(totalItems1); pagination.put("itemsInPage", Integer.toString(iip)); pagination.put("pageSize", Integer.toString(ps)); pagination.put("totalItems", Integer.toString(ti)); pagination.put("numInstances", Integer.toString(numInstances1++)); } out.put("pagination", pagination); } log.debug(restriction.toString()); }