Source:
private void installConcepts() { GlobalProperty installedVersion = Context.getAdministrationService().getGlobalPropertyObject(ReferenceMetadataConstants.INSTALLED_VERSION_GP); if (installedVersion == null) { installedVersion = new GlobalProperty(ReferenceMetadataConstants.INSTALLED_VERSION_GP, "0"); } if (Integer.valueOf(installedVersion.getPropertyValue()) < ReferenceMetadataConstants.METADATA_VERSION) { ConceptService conceptService = Context.getConceptService(); ConceptClass frequency = conceptService.getConceptClassByUuid("8e071bfe-520c-44c0-a89b-538e9129b42a"); if (frequency != null) { if (!frequency.getId().equals(23)) { conceptService.purgeConceptClass(frequency); } } Context.flushSession(); DataImporter dataImporter = Context.getRegisteredComponent("dataImporter", DataImporter.class); dataImporter.importData("Reference_Application_Concepts-26.xml"); if (ModuleUtil.compareVersion(OpenmrsConstants.OPENMRS_VERSION_SHORT, "2.2") < 0) { dataImporter.importData("Reference_Application_Numeric_Concepts-24-pre2.x.xml"); } else { dataImporter.importData("Reference_Application_Numeric_Concepts-24-2.x.xml"); } dataImporter.importData("Reference_Application_Diagnoses-12.xml"); dataImporter.importData("Reference_Application_Order_Entry_and_Allergies_Concepts-19.xml"); try { Method method = Context.class.getMethod("updateSearchIndexForType", new Class[]{Class.class}); method.invoke(null, new Object[] {ConceptName.class}); } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { log.error("Failed to update search index", ex); } catch (IllegalAccessException ex) { log.error("Failed to update search index", ex); } installedVersion.setPropertyValue(ReferenceMetadataConstants.METADATA_VERSION.toString()); } Context.getAdministrationService().saveGlobalProperty(installedVersion); }

Target:
private void installConcepts() { GlobalProperty installedVersion = Context.getAdministrationService().getGlobalPropertyObject(ReferenceMetadataConstants.INSTALLED_VERSION_GP); if (installedVersion == null) { installedVersion = new GlobalProperty(ReferenceMetadataConstants.INSTALLED_VERSION_GP, "0"); } if (Integer.valueOf(installedVersion.getPropertyValue()) < ReferenceMetadataConstants.METADATA_VERSION) { ConceptService conceptService = Context.getConceptService(); ConceptClass frequency = conceptService.getConceptClassByUuid("8e071bfe-520c-44c0-a89b-538e9129b42a"); if (frequency != null) { if (!frequency.getId().equals(23)) { conceptService.purgeConceptClass(frequency); } } Context.flushSession(); DataImporter dataImporter = Context.getRegisteredComponent("dataImporter", DataImporter.class); dataImporter.importData("Reference_Application_Concepts-25.xml"); if (ModuleUtil.compareVersion(OpenmrsConstants.OPENMRS_VERSION_SHORT, "2.2") < 0) { dataImporter.importData("Reference_Application_Numeric_Concepts-24-pre2.x.xml"); } else { dataImporter.importData("Reference_Application_Numeric_Concepts-24-2.x.xml"); } dataImporter.importData("Reference_Application_Diagnoses-12.xml"); dataImporter.importData("Reference_Application_Order_Entry_and_Allergies_Concepts-19.xml"); try { Method method = Context.class.getMethod("updateSearchIndexForType", new Class[]{Class.class}); method.invoke(null, new Object[] {ConceptName.class}); } catch (NoSuchMethodException ex) { } catch (InvocationTargetException ex) { log.error("Failed to update search index", ex); } catch (IllegalAccessException ex) { log.error("Failed to update search index", ex); } installedVersion.setPropertyValue(ReferenceMetadataConstants.METADATA_VERSION.toString()); } Context.getAdministrationService().saveGlobalProperty(installedVersion); }