use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class HibernateAdministrationDAO method saveGlobalProperty.
/**
* @see org.openmrs.api.db.AdministrationDAO#saveGlobalProperty(org.openmrs.GlobalProperty)
*/
@Override
public GlobalProperty saveGlobalProperty(GlobalProperty gp) throws DAOException {
GlobalProperty gpObject = getGlobalPropertyObject(gp.getProperty());
if (gpObject != null) {
gpObject.setPropertyValue(gp.getPropertyValue());
gpObject.setDescription(gp.getDescription());
sessionFactory.getCurrentSession().update(gpObject);
return gpObject;
} else {
sessionFactory.getCurrentSession().save(gp);
return gp;
}
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class OrderServiceTest method saveOrder_shouldSetTheOrderNumberReturnedByTheConfiguredGenerator.
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldSetTheOrderNumberReturnedByTheConfiguredGenerator() {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID, "orderEntry.OrderNumberGenerator");
Context.getAdministrationService().saveGlobalProperty(gp);
Order order = new TestOrder();
order.setPatient(patientService.getPatient(7));
order.setConcept(conceptService.getConcept(5497));
order.setOrderer(providerService.getProvider(1));
order.setCareSetting(orderService.getCareSetting(1));
order.setOrderType(orderService.getOrderType(2));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
order = orderService.saveOrder(order, null);
assertTrue(order.getOrderNumber().startsWith(TimestampOrderNumberGenerator.ORDER_NUMBER_PREFIX));
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class OrderServiceTest method getDrugDispensingUnits_shouldReturnAnEmptyListIfNothingIsConfigured.
/**
* @see OrderService#getDrugDispensingUnits()
*/
@Test
public void getDrugDispensingUnits_shouldReturnAnEmptyListIfNothingIsConfigured() {
adminService.saveGlobalProperty(new GlobalProperty(OpenmrsConstants.GP_DRUG_DISPENSING_UNITS_CONCEPT_UUID, ""));
adminService.saveGlobalProperty(new GlobalProperty(OpenmrsConstants.GP_DRUG_DOSING_UNITS_CONCEPT_UUID, ""));
assertThat(orderService.getDrugDispensingUnits(), is(empty()));
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class OrderServiceTest method getDurationUnits_shouldReturnAnEmptyListIfNothingIsConfigured.
/**
* @see OrderService#getDurationUnits()
*/
@Test
public void getDurationUnits_shouldReturnAnEmptyListIfNothingIsConfigured() {
adminService.saveGlobalProperty(new GlobalProperty(OpenmrsConstants.GP_DURATION_UNITS_CONCEPT_UUID, ""));
assertThat(orderService.getDurationUnits(), is(empty()));
}
use of org.openmrs.GlobalProperty in project openmrs-core by openmrs.
the class FormServiceTest method createFormsLockedGPAndSetValue.
/**
* Creates a new Global Property to lock forms by setting its value
* @param propertyValue value for forms locked GP
*/
public void createFormsLockedGPAndSetValue(String propertyValue) {
GlobalProperty gp = new GlobalProperty(OpenmrsConstants.GLOBAL_PROPERTY_FORMS_LOCKED);
gp.setPropertyValue(propertyValue);
Context.getAdministrationService().saveGlobalProperty(gp);
}
Aggregations