/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ @Override public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = super.getCreatableProperties(); description.addRequiredProperty("problem"); description.addProperty("modifier"); description.addProperty("sortWeight"); return description; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("modifier"); description.addProperty("sortWeight"); description.addProperty("problem", Representation.REF); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("modifier"); description.addProperty("sortWeight"); description.addProperty("problem", Representation.DEFAULT); return description; } return null; }
@Override public Model getCREATEModel(Representation rep) { return ((ModelImpl) super.getCREATEModel(rep)) .property("problem", new RefProperty("#/definitions/ConceptCreate")) .property("modifier", new EnumProperty(ProblemModifier.class)) .property("sortWeight", new DoubleProperty()) .required("problem"); }
@Override public Model getGETModel(Representation rep) { ModelImpl model = (ModelImpl) super.getGETModel(rep); if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { model .property("modifier", new EnumProperty(ProblemModifier.class)) .property("sortWeight", new DoubleProperty()); } if (rep instanceof DefaultRepresentation) { model .property("problem", new RefProperty("#/definitions/ConceptGetRef")); } else if (rep instanceof FullRepresentation) { model .property("problem", new RefProperty("#/definitions/ConceptGet")); } return model; }
/** * Gets allergies for a given patient (paged according to context if necessary) only if a * patient parameter exists in the request set on the {@link RequestContext} * * @param context * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(RequestContext) */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult(); return new NeedsPaging<Allergy>(Context.getPatientService().getAllergies(patient), context); } //currently this is not supported since the superclass throws an exception return super.doSearch(context); }
@Override public Model getCREATEModel(Representation rep) { return ((ModelImpl) super.getCREATEModel(rep)) .property("allergyType", new EnumProperty(AllergyType.class)) .property("reaction", new ObjectProperty() .property("uuid", new StringProperty())) .property("severity", new EnumProperty(AllergySeverity.class)) .property("allergen", new StringProperty()); }
@Override public Model getGETModel(Representation rep) { ModelImpl model = ((ModelImpl) super.getGETModel(rep)) .property("allergyType", new EnumProperty(AllergyType.class)) .property("reaction", new RefProperty("#/definitions/ConceptGetRef")) .property("severity", new EnumProperty(AllergySeverity.class)) .property("allergen", new RefProperty("#/definitions/ConceptGetRef")); if (rep instanceof FullRepresentation) { model .property("reaction", new RefProperty("#/definitions/ConceptGet")) .property("allergen", new RefProperty("#/definitions/ConceptGet")); } return model; }
/** * Gets problems for a given patient (paged according to context if necessary) only if a patient * parameter exists in the request set on the {@link RequestContext} * * @param context * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#doSearch(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override protected PageableResult doSearch(RequestContext context) { String patientUuid = context.getRequest().getParameter("patient"); if (patientUuid != null) { Patient patient = ((PatientResource1_8) Context.getService(RestService.class).getResourceBySupportedClass( Patient.class)).getByUniqueId(patientUuid); if (patient == null) return new EmptySearchResult(); return new NeedsPaging<Problem>(Context.getPatientService().getProblems(patient), context); } //currently this is not supported since the superclass throws an exception return super.doSearch(context); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() */ @Override public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = super.getCreatableProperties(); description.addRequiredProperty("allergyType"); description.addRequiredProperty("allergen"); description.addProperty("reaction"); description.addProperty("severity"); return description; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("allergyType"); description.addProperty("reaction", Representation.REF); description.addProperty("severity"); description.addProperty("allergen", Representation.REF); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = super.getRepresentationDescription(rep); description.addProperty("allergyType"); description.addProperty("reaction", Representation.DEFAULT); description.addProperty("severity"); description.addProperty("allergen", Representation.DEFAULT); return description; } return null; }