/** * @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; } }
} else if (!gp.getPropertyValue().equals(version)) { log.info("Updating global property " + key + " to version: " + version); gp.setDescription(description); gp.setPropertyValue(version); as.saveGlobalProperty(gp);
propToUpdate.setDescription(coreProp.getDescription()); Context.getAdministrationService().saveGlobalProperty(propToUpdate);
/** * @throws HL7Exception * @throws IOException * @see HL7Service#processHL7InQueue(HL7InQueue) */ @Test public void processHL7InQueue_shouldCreateHL7InArchiveAfterSuccessfulParsing() throws HL7Exception, IOException { executeDataSet("org/openmrs/hl7/include/ORUTest-initialData.xml"); File tempDir = new File(System.getProperty("java.io.tmpdir"), HL7Constants.HL7_ARCHIVE_DIRECTORY_NAME); if (tempDir.exists() && tempDir.isDirectory()) Assert.assertEquals(true, OpenmrsUtil.deleteDirectory(tempDir)); //set a global property for the archives directory as a temporary folder GlobalProperty gp = new GlobalProperty(); gp.setProperty(OpenmrsConstants.GLOBAL_PROPERTY_HL7_ARCHIVE_DIRECTORY); gp.setPropertyValue(tempDir.getAbsolutePath()); gp.setDescription("temp test dir"); Context.getAdministrationService().saveGlobalProperty(gp); HL7Service hl7service = Context.getHL7Service(); Assert.assertEquals(0, hl7service.getAllHL7InArchives().size()); HL7InQueue queueItem = hl7service.getHL7InQueue(1); hl7service.processHL7InQueue(queueItem); Assert.assertEquals(1, hl7service.getAllHL7InArchives().size()); }