/** * @should add patient to cohort */ @Override public CohortMember1_8 save(CohortMember1_8 delegate) { addMemberToCohort(delegate); return delegate; }
@Override public Model getUPDATEModel(Representation rep) { return getCREATEModel(rep); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() */ @Override public DelegatingResourceDescription getUpdatableProperties() { return getCreatableProperties(); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#delete(java.lang.String, * java.lang.String, java.lang.String, * org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public void delete(String parentUniqueId, String uuid, String reason, RequestContext context) throws ResponseException { CohortMember1_8 delegate = getByUniqueId(uuid); if (delegate == null) throw new ObjectNotFoundException(); Cohort parent = Context.getCohortService().getCohortByUuid(parentUniqueId); setParent(delegate, parent); delete(delegate, reason, context); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#create(java.lang.String, * org.openmrs.module.webservices.rest.SimpleObject, * org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public Object create(String parentUniqueId, SimpleObject post, RequestContext context) throws ResponseException { Cohort parent = Context.getCohortService().getCohortByUuid(parentUniqueId); CohortMember1_8 delegate = newDelegate(); setParent(delegate, parent); delegate.setPatient(Context.getPatientService().getPatientByUuid(post.get("patient").toString())); delegate = save(delegate); return ConversionUtil.convertToRepresentation(delegate, Representation.DEFAULT); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingSubResource#retrieve(java.lang.String, * java.lang.String, org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public Object retrieve(String parentUniqueId, String uuid, RequestContext context) throws ResponseException { CohortMember1_8 delegate = getByUniqueId(uuid); if (delegate == null) throw new ObjectNotFoundException(); delegate.setCohort(Context.getCohortService().getCohortByUuid(parentUniqueId)); return asRepresentation(delegate, context.getRepresentation()); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#delete(java.lang.Object, * java.lang.String, org.openmrs.module.webservices.rest.web.RequestContext) */ @Override protected void delete(CohortMember1_8 delegate, String reason, RequestContext context) throws ResponseException { removeMemberFromCohort(delegate); }