/** Optionally expects boolean params 'deleted' and 'privilegeInheritanceBlocked' */ @Override public <T extends FsSecureBusinessObject> Object putRepresentation( T sbo, Object params, FsAccessToken token) { JSONObject data = (JSONObject) params; try { boolean deleted = data.getBoolean("deleted"); if (sbo.isDeleted() != deleted) { sbo.setDeleted(deleted); } } catch (JSONException e) { // do nothing, because we do not force a client to always send this information back to the // server } try { boolean privInheritanceBlocked = data.getBoolean("privilegeInheritanceBlocked"); if (sbo.isPrivilegeInheritanceBlocked() != privInheritanceBlocked) { sbo.setPrivilegeInheritanceBlocked(privInheritanceBlocked); } } catch (JSONException e) { // do nothing, because we do not force a client to always send this information back to the // server } return getRepresentation(sbo, params, token); }
/** Get general information about an SBO */ @Override public <T extends FsSecureBusinessObject> Object getRepresentation( T sbo, Object params, FsAccessToken token) { JSONObject res = new JSONObject(); try { // Set generic info attributes res.put("privilegeInheritanceBlocked", sbo.isPrivilegeInheritanceBlocked()); res.put("deleted", sbo.isDeleted()); } catch (JSONException e) { throw new JSONRequestException(e); } return res; }