protected <T extends RestModel> T filterModel( Class<T> modelIface, T unfilteredModel, JsonFilter filter) throws Exception { JSONObject unfilteredJson = (JSONObject) JsonUtil.getJsonObject(unfilteredModel, false); // don't hide confidential properties JSONObject filteredJson = filter.trim(unfilteredJson); T filteredModel = getTypedModel(modelIface, filteredJson); filteredModel .trimmed(); // TBD - remove once the conversion to the new REST style guide is completed return filteredModel; }
protected JSONObject getJsonModel(RestModel typedModel) throws Exception { return (JSONObject) JsonUtil.getJsonObject(typedModel, false); // include confidential properties }