@Override public void delete(Identifier identifier) throws RESTException { if (identifier.size() < 3) { throw new IllegalArgumentException( "Identifier not precise enough. Needs ID as well. " + identifier.toString()); } super.doDeleteCall(super.createFullURL(identifier)); }
@Override public Document read(Identifier identifier) throws RESTException, IOException { if (identifier.size() < 3) { throw new IllegalArgumentException( "Identifier not precise enough. Needs ID as well. " + identifier.toString()); } JSONObject response = super.doGetCall(super.createFullURL(identifier)); return r.readValue(response.toJSONString()); }
@Override public QueryResponseWrapper readAll(Identifier identifier, int limit, long offset) throws RESTException, IOException { if (identifier.size() < 2) { throw new IllegalArgumentException( "Identifier not precise enough. Needs Database and Table. " + identifier.toString()); } JSONObject response = super.doGetCall(super.createFullURL(identifier) + "/"); return rQuery.readValue(response.toJSONString()); }
@Override public boolean exists(Identifier identifier) throws RESTException { if (identifier.size() < 3) { throw new IllegalArgumentException( "Identifier not precise enough. Needs ID as well. " + identifier.toString()); } try { super.doGetCall(super.createFullURL(identifier)); return true; } catch (RESTException e) { if (e.getErrorCode() == 404) { return false; } else { throw e; } } }