use of org.openmrs.DrugIngredient in project openmrs-module-webservices.rest by openmrs.
the class DrugIngredientResource1_11 method save.
/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#save(java.lang.Object)
*/
@Override
public DrugIngredient save(DrugIngredient newIngredient) {
// make sure that the ingredient has actually been added to the drug
boolean needToAdd = true;
for (DrugIngredient di : newIngredient.getDrug().getIngredients()) {
if (di.equals(newIngredient)) {
needToAdd = false;
break;
}
}
if (needToAdd) {
newIngredient.getDrug().getIngredients().add(newIngredient);
}
Context.getConceptService().saveDrug(newIngredient.getDrug());
return newIngredient;
}
use of org.openmrs.DrugIngredient in project openmrs-module-webservices.rest by openmrs.
the class DrugIngredientResource1_11Test method newObject.
@Override
public DrugIngredient newObject() {
DrugIngredient ingredient = new DrugIngredient();
ingredient.setIngredient(Context.getConceptService().getConcept(3));
ingredient.setUuid(getUuidProperty());
ingredient.setStrength(2d);
ingredient.setUnits(Context.getConceptService().getConcept(8));
return ingredient;
}
Aggregations