@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("handlerClassname"); description.addProperty("display", "textToDisplay"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; }
@Override @RepHandler(RefRepresentation.class) public SimpleObject asRef(FieldAnswer delegate) throws ConversionException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addSelfLink(); return convertDelegateToRepresentation(delegate, description); }
@RepHandler(RefRepresentation.class) public SimpleObject convertToRef(FormResource delegate) throws ConversionException { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("display"); addValueLink(rep, delegate); rep.addSelfLink(); return convertDelegateToRepresentation(delegate, rep); }
@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof RefRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("description"); description.addProperty("retired"); description.addSelfLink(); return description; } return super.getRepresentationDescription(rep); }
@RepHandler(RefRepresentation.class) public SimpleObject asRef(T delegate) throws ConversionException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); if (delegate.isVoided()) description.addProperty("voided"); description.addSelfLink(); return convertDelegateToRepresentation(delegate, description); }
@RepHandler(RefRepresentation.class) public SimpleObject convertToRef(T delegate) throws ConversionException { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("display"); if (delegate.isRetired()) rep.addProperty("retired"); rep.addSelfLink(); return convertDelegateToRepresentation(delegate, rep); }
@RepHandler(RefRepresentation.class) public SimpleObject asRef(Concept delegate) throws ConversionException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display", "displayString", Representation.DEFAULT); if (delegate.isRetired()) { description.addProperty("retired"); } description.addSelfLink(); return convertDelegateToRepresentation(delegate, description); }
@RepHandler(RefRepresentation.class) public SimpleObject asRef(UserAndPassword1_8 delegate) throws ConversionException { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); if (delegate.isRetired()) { description.addProperty("retired"); } description.addSelfLink(); return convertDelegateToRepresentation(delegate, description); }
@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("conceptReferenceTerm", Representation.REF); description.addProperty("conceptMapType", Representation.REF); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("conceptReferenceTerm", Representation.DEFAULT); description.addProperty("conceptMapType", Representation.DEFAULT); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("source", Representation.REF); description.addProperty("sourceCode"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display"); description.addProperty("uuid"); description.addProperty("source", Representation.DEFAULT); description.addProperty("sourceCode"); description.addProperty("comment"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
@RepHandler(FullRepresentation.class) public SimpleObject asFullRep(T delegate) throws Exception { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("display"); rep.addProperty("name"); rep.addProperty("description"); rep.addProperty("retired"); rep.addProperty("auditInfo"); rep.addSelfLink(); return convertDelegateToRepresentation(delegate, rep); }
@RepHandler(DefaultRepresentation.class) public SimpleObject asDefaultRep(FormResource delegate) throws Exception { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("name"); rep.addProperty("valueReference"); rep.addProperty("display"); addValueLink(rep, delegate); rep.addSelfLink(); rep.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return convertDelegateToRepresentation(delegate, rep); }
@RepHandler(DefaultRepresentation.class) public SimpleObject asDefaultRep(T delegate) throws Exception { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("display"); rep.addProperty("name"); rep.addProperty("description"); rep.addProperty("retired"); rep.addSelfLink(); rep.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return convertDelegateToRepresentation(delegate, rep); }
@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("value"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingConverter#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("name"); description.addProperty("description"); description.addProperty("retired"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); } else { description.addProperty("auditInfo"); } return description; } return null; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("name"); description.addProperty("description"); description.addProperty("retired"); description.addProperty("careSettingType"); description.addProperty("display"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); } else { description.addProperty("auditInfo"); } return description; } return null; }
@RepHandler(FullRepresentation.class) public SimpleObject asFullRep(FormResource delegate) throws Exception { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("name"); rep.addProperty("valueReference"); rep.addProperty("dataType"); rep.addProperty("handler"); rep.addProperty("handlerConfig"); rep.addProperty("display"); addValueLink(rep, delegate); rep.addSelfLink(); return convertDelegateToRepresentation(delegate, rep); }
/** * Assumes we can get a "display" property * * @param delegate * @return standard REF representation of delegate * @throws ConversionException */ @RepHandler(RefRepresentation.class) public SimpleObject convertToRef(Subclass delegate) throws ConversionException { DelegatingResourceDescription rep = new DelegatingResourceDescription(); rep.addProperty("uuid"); rep.addProperty("display"); if (delegate instanceof OpenmrsData) { if (((OpenmrsData) delegate).isVoided()) rep.addProperty("voided"); } else if (delegate instanceof OpenmrsMetadata) { if (((OpenmrsMetadata) delegate).isRetired()) rep.addProperty("retired"); } rep.addSelfLink(); return getResource().convertDelegateToRepresentation(delegate, rep); }
@Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("provider", Representation.REF); description.addProperty("encounterRole", Representation.REF); description.addProperty("voided"); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("provider", Representation.DEFAULT); description.addProperty("encounterRole", Representation.DEFAULT); description.addProperty("voided"); description.addProperty("auditInfo"); description.addSelfLink(); return description; } return null; }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(Representation) */ @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("uuid"); description.addProperty("display"); description.addProperty("description"); description.addProperty("aIsToB"); description.addProperty("bIsToA"); description.addProperty("displayAIsToB"); description.addProperty("displayBIsToA"); description.addProperty("retired"); description.addSelfLink(); if (rep instanceof DefaultRepresentation) { description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { description.addProperty("weight"); description.addProperty("auditInfo"); return description; } return null; }