@Override public JSONObject toJSON() { return this.family.toJSON(); }
@Override public JSONObject toJSON() { JSONObject response = new JSONObject(); response.put("family", this.family.toJSON()); // a new family may not have a pedigree Pedigree pedigree = this.family.getPedigree(); response.put("pedigree", (pedigree == null) ? null : pedigree.getData()); return response; }
@Override public JSONObject toJSON() { JSONObject response = new JSONObject(); response.put("family", this.family.toJSON()); // a new family may not have a pedigree Pedigree pedigree = this.family.getPedigree(); response.put("pedigree", (pedigree == null) ? null : pedigree.getData()); return response; }
@Override public Response getFamily(String id) { this.logger.debug("Retrieving patient [{}] family information via REST", id); Family family = this.familyTools.getFamilyForPatient(id); if (family == null) { this.logger.debug("No patint with id [{}] or the patient has no family", id); return Response.status(Status.NOT_FOUND).build(); } JSONObject json = family.toJSON(); json.put("links", this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); } }
@Override public Response getFamily(String id) { this.logger.debug("Retrieving patient [{}] family information via REST", id); Family family = this.familyTools.getFamilyForPatient(id); if (family == null) { this.logger.debug("No patint with id [{}] or the patient has no family", id); return Response.status(Status.NOT_FOUND).build(); } JSONObject json = family.toJSON(); json.put("links", this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); } }
private JSONObject getFullFamilyJSON(String familyID, Object[] summaryData, UriInfo uriInfo) { Family family = this.familyTools.getFamilyById(familyID); if (family != null) { JSONObject familyJSON = family.toJSON(); addMetadata(familyJSON, summaryData); return familyJSON; } return null; }
private JSONObject getFullFamilyJSON(String familyID, Object[] summaryData, UriInfo uriInfo) { Family family = this.familyTools.getFamilyById(familyID); if (family != null) { JSONObject familyJSON = family.toJSON(); addMetadata(familyJSON, summaryData); return familyJSON; } return null; }
@Override public Response getFamily(String id) { this.logger.warn("Retrieving family record [{}] via REST", id); Family family = this.repository.get(id); if (family == null) { this.logger.warn(NO_SUCH_FAMILY_ERROR_MESSAGE, id); return Response.status(Status.NOT_FOUND).build(); } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, family.getDocumentReference())) { this.logger.error("View access denied to user [{}] on family record [{}]", currentUser, id); return Response.status(Status.FORBIDDEN).build(); } JSONObject json = family.toJSON(); json.put("links", this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); }
@Override public Response getFamily(String id) { this.logger.warn("Retrieving family record [{}] via REST", id); Family family = this.repository.getFamilyById(id); if (family == null) { this.logger.warn(NO_SUCH_FAMILY_ERROR_MESSAGE, id); return Response.status(Status.NOT_FOUND).build(); } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(Right.VIEW, currentUser == null ? null : currentUser.getProfileDocument(), family.getDocumentReference())) { this.logger.error("View access denied to user [{}] on family record [{}]", currentUser, id); return Response.status(Status.FORBIDDEN).build(); } JSONObject json = family.toJSON(); json.put("links", this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(json, MediaType.APPLICATION_JSON_TYPE).build(); }