/** * @see org.openmrs.OpenmrsObject#getId() */ @Override public Integer getId() { return getOrderTypeId(); }
/** * @see OrderService#getOrderTypeByConcept(Concept) */ @Test public void getOrderTypeByConcept_shouldGetOrderTypeMappedToTheGivenConcept() { OrderType orderType = orderService.getOrderTypeByConcept(Context.getConceptService().getConcept(5089)); Assert.assertNotNull(orderType); Assert.assertEquals(2, orderType.getOrderTypeId().intValue()); }
/** * @see OrderService#getOrderTypeByConceptClass(ConceptClass) */ @Test public void getOrderTypeByConceptClass_shouldGetOrderTypeMappedToTheGivenConceptClass() { OrderType orderType = orderService.getOrderTypeByConceptClass(Context.getConceptService().getConceptClass(1)); Assert.assertNotNull(orderType); Assert.assertEquals(2, orderType.getOrderTypeId().intValue()); }
/** * @see OrderService#saveOrder(org.openmrs.Order, OrderContext) */ @Test public void saveOrder_shouldSetOrderTypeIfNullButMappedToTheConceptClass() { TestOrder order = new TestOrder(); order.setPatient(patientService.getPatient(7)); order.setConcept(conceptService.getConcept(5497)); order.setOrderer(providerService.getProvider(1)); order.setCareSetting(orderService.getCareSetting(1)); order.setEncounter(encounterService.getEncounter(3)); order.setDateActivated(new Date()); orderService.saveOrder(order, null); assertEquals(2, order.getOrderType().getOrderTypeId().intValue()); }
/** * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#purge(java.lang.Object, * org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public void purge(OrderType delegate, RequestContext context) throws ResponseException { if (delegate.getOrderTypeId().equals(OpenmrsConstants.ORDERTYPE_DRUG)) { throw new IllegalArgumentException("You are not allowed to delete the Drug ordertype"); } Context.getOrderService().purgeOrderType(delegate); } }