The method getAllOrderTypes() is undefined for the type OrderService

Application Name: Platform Version Number: 2.0.1

Question: Hi! I’m very new to OpenMRS and as the title suggests I encountered the following error: The method getAllOrderTypes() is undefined for the type OrderService from the code

for (OrderType ot : orderService.getAllOrderTypes()) { if(ot.getName().equalsIgnoreCase(DrugOrderConcepts.ORDER_TYPE_DRUG_ORDER.getConceptName())) { orderType = ot; break; } }

I checked and I have the openmrs-web-2.0.1.jar in my build path. Am I missing something else?

P.S. I also tried using getOrderTypes(true) instead and it worked but I’m aware that it’s already deprecated.

getOrderTypes(boolean) is not deprecated. So go ahead and use it.

1 Like

Oh. I thought it was because it says here that it is http://resources.openmrs.org/doc-1.9/org/openmrs/api/OrderService.html#getOrderTypes()

That was as of version 1.9 of the platform. But version 1.10 introduced getOrderTypes(true) which is still in use in platform 2.0.1 which you are using, as you can see here https://github.com/openmrs/openmrs-core/blob/2.0.1/api/src/main/java/org/openmrs/api/OrderService.java#L585-L597

I see. Thank you for clearing it up! :smiley: