Created
May 12, 2015 23:23
-
-
Save djazayeri/690a5b36845993af8993 to your computer and use it in GitHub Desktop.
OrderEntryConfigResource1_10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Resource(name = RestConstants.VERSION_1 + "/orderentryconfig", supportedClass = Object.class, supportedOpenmrsVersions = {"1.10.*", "1.11.*"}) | |
public class OrderEntryConfigResource1_10 implements Listable { | |
@Override | |
public SimpleObject getAll(RequestContext context) throws ResponseException { | |
OrderService orderService = Context.getOrderService(); | |
SimpleObject ret = new SimpleObject(); | |
// try/catch each of these to avoid failing in the case where one of these is not configured | |
try { | |
ret.put("drugRoutes", ConversionUtil.convertToRepresentation(orderService.getDrugRoutes(), context.getRepresentation())); | |
} catch (Exception ex) { } | |
try { | |
ret.put("drugDosingUnits", ConversionUtil.convertToRepresentation(orderService.getDrugDosingUnits(), context.getRepresentation())); | |
} catch (Exception ex) { } | |
try { | |
ret.put("drugDispensingUnits", ConversionUtil.convertToRepresentation(orderService.getDrugDispensingUnits(), context.getRepresentation())); | |
} catch (Exception ex) { } | |
try { | |
ret.put("durationUnits", ConversionUtil.convertToRepresentation(orderService.getDurationUnits(), context.getRepresentation())); | |
} catch (Exception ex) { } | |
try { | |
ret.put("testSpecimenSources", ConversionUtil.convertToRepresentation(orderService.getTestSpecimenSources(), context.getRepresentation())); | |
} catch (Exception ex) { } | |
try { | |
ret.put("orderFrequencies", ConversionUtil.convertToRepresentation(orderService.getOrderFrequencies(false), context.getRepresentation())); | |
} catch (Exception ex) { } | |
return ret; | |
} | |
@Override | |
public String getUri(Object instance) { | |
return RestConstants.URI_PREFIX + "/orderentryconfig"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment