/**
  * @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);
 }
コード例 #2
0
 private void validateOrderTypeClass(Order order, Errors errors) {
   OrderType orderType = order.getOrderType();
   if (orderType != null && !orderType.getJavaClass().isAssignableFrom(order.getClass())) {
     errors.rejectValue("orderType", "Order.error.orderTypeClassMismatchesOrderClass");
   }
 }