/** * Test bean which should be only loaded when module 'test1' is missing */ @OpenmrsProfile(modules = { "!test1" }) public class OpenmrsProfileWithoutTest1Module { }
/** * Test bean which should be only loaded when module 'missingModule' is missing */ @OpenmrsProfile(modules = { "!missingModule" }) public class OpenmrsProfileWithoutMissingModule {}
@OpenmrsProfile(openmrsPlatformVersion = "1.8") public class OpenmrsComponent1_8 { }
@OpenmrsProfile(openmrsPlatformVersion = "[1.6.* - 1.7.*]") public class OpenmrsComponent1_6To1_7 { }
/** * Test bean which should be only loaded when running on OpenMRS from 1.6 to 1.7. */ @Component @OpenmrsProfile(openmrsPlatformVersion = "[1.6.* - 1.7.*]") public class OpenmrsProfile1_6To1_7 {}
/** * Test bean which should be loaded on OpenMRS 1.10 and later */ @Component @OpenmrsProfile(openmrsPlatformVersion = "1.10") public class OpenmrsProfile1_10 {}
/** * Test bean which should be only loaded when running on OpenMRS 1.10 and later with the htmlformentry module */ @Component @OpenmrsProfile(openmrsPlatformVersion = "1.10", modules = { "htmlformentry:2.3" }) public class OpenmrsProfile1_10WithHtmlformentry {}
/** * Test bean which should be only loaded when running on OpenMRS from 1.6 to 1.8. */ @Component @OpenmrsProfile(openmrsPlatformVersion = "[1.6.* - 1.8.*]") public class OpenmrsProfile1_6To1_8 {}
/** * Test bean which should be loaded on OpenMRS 1.8 and later */ @Component @OpenmrsProfile(openmrsPlatformVersion = "1.8") public class OpenmrsProfile1_8 {}
/** * Test bean which should be only loaded when running on OpenMRS 1.8 and later with the htmlformentry module */ @Component @OpenmrsProfile(openmrsPlatformVersion = "1.8", modules = { "htmlformentry:2.3" }) public class OpenmrsProfile1_8WithHtmlformentry {}
/** * This is just a place holder to fix HTML-664 because according to TRUNK-14 RegimenSuggestion * was removed to be replaced with order sets */ @OpenmrsProfile(openmrsPlatformVersion = "2.*") public class StandardRegimenTagHandlerSupport2_0 implements StandardRegimenTagHandlerSupport { @Override public List<AttributeDescriptor> createAttributeDescriptors() { return Collections.unmodifiableList(new ArrayList<AttributeDescriptor>()); } @Override public String getSubstitution(FormEntrySession session, FormSubmissionController controllerActions, Map<String, String> parameters) { return null; } }
@OpenmrsProfile(openmrsPlatformVersion = "1.10.* - 1.12.*") public class StandardRegimenTagHandlerSupport1_10 implements StandardRegimenTagHandlerSupport { @Override public List<AttributeDescriptor> createAttributeDescriptors() { List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>(); attributeDescriptors.add(new AttributeDescriptor("discontinuedReasonConceptId", Concept.class)); attributeDescriptors.add(new AttributeDescriptor("discontinueReasonAnswers", Concept.class)); attributeDescriptors.add(new AttributeDescriptor("regimenCodes", RegimenSuggestion.class)); return Collections.unmodifiableList(attributeDescriptors); } @Override public String getSubstitution(FormEntrySession session, FormSubmissionController controllerActions, Map<String, String> parameters) { StandardRegimenElement1_10 element = new StandardRegimenElement1_10(session.getContext(), parameters); session.getSubmissionController().addAction(element); return element.generateHtml(session.getContext()); } }
@Component("htmlformentry.PatientServiceCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "2.*") public class PatientServiceCompatibility2_0 implements PatientServiceCompatibility { @Override public void exitFromCare(Patient patient, Date dateExited, Concept reasonForExit) throws APIException { //do nothing because this was moved to the exit from care module } }
@Component("htmlformentry.ConceptCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "2.*") public class ConceptCompatibility2_0 implements ConceptCompatibility { @Override public Boolean isAllowDecimal(ConceptNumeric cn) { return cn.isAllowDecimal(); } }
@Component("htmlformentry.ConceptCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "1.9.9 - 1.12.*") public class ConceptCompatibility1_9 implements ConceptCompatibility { @Override public Boolean isAllowDecimal(ConceptNumeric cn) { return cn.isPrecise(); } }
@Component("htmlformentry.RegimenSuggestionCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "2.*") public class RegimenSuggestionCompatibility2_0 implements RegimenSuggestionCompatibility { @Override public void AddDrugDependencies(String id, AttributeDescriptor attributeDescriptor, Set<OpenmrsObject> dependencies) { //this is left empty because RegimenSuggestion was removed in platform 2.0 } }
@Component("htmlformentry.PatientServiceCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "1.9.9 - 1.12.*") public class PatientServiceCompatibility1_9 implements PatientServiceCompatibility { @Override public void exitFromCare(Patient patient, Date dateExited, Concept reasonForExit) throws APIException { Context.getPatientService().exitFromCare(patient, dateExited, reasonForExit); } }
@Component("htmlformentry.EncounterServiceCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "1.9.9 - 1.12.*") public class EncounterServiceCompatibility1_9 implements EncounterServiceCompatibility { @Override public List<Encounter> getEncounters(Patient who, Location loc, Date fromDate, Date toDate, Collection<Form> enteredViaForms, Collection<EncounterType> encounterTypes, Collection<Provider> providers, Collection<VisitType> visitTypes, Collection<Visit> visits, boolean includeVoided) { return Context.getEncounterService().getEncounters(who, loc, fromDate, toDate, enteredViaForms, encounterTypes, providers, visitTypes, visits, includeVoided); } }
/** * Handles the {@code <drugOrder>} tag */ @Component @OpenmrsProfile(openmrsVersion = "[1.7.5 - 1.9.*]") public class DrugOrderTagHandlerSupport1_6 implements DrugOrderTagHandlerSupport { @Override public List<AttributeDescriptor> createAttributeDescriptors() { List<AttributeDescriptor> attributeDescriptors = new ArrayList<AttributeDescriptor>(); attributeDescriptors.add(new AttributeDescriptor("drugNames", Drug.class)); attributeDescriptors.add(new AttributeDescriptor("discontinuedReasonConceptId", Concept.class)); attributeDescriptors.add(new AttributeDescriptor("discontinueReasonAnswers", Concept.class)); return Collections.unmodifiableList(attributeDescriptors); } @Override public String getSubstitution(FormEntrySession session, FormSubmissionController controllerActions, Map<String, String> parameters) { DrugOrderSubmissionElement element = new DrugOrderSubmissionElement(session.getContext(), parameters); session.getSubmissionController().addAction(element); return element.generateHtml(session.getContext()); } }
@Component("htmlformentry.NameSupportCompatibility") @OpenmrsProfile(openmrsPlatformVersion = "2.*") public class NameSupportCompatibility2_0 implements NameSupportCompatibility { @Override public List<List<Map<String, String>>> getLines() { return getDefaultLayoutTemplate().getLines(); } @Override public String getLayoutToken() { return getDefaultLayoutTemplate().getLayoutToken(); } @Override public Map<String, String> getNameMappings() { return getDefaultLayoutTemplate().getNameMappings(); } private NameTemplate getDefaultLayoutTemplate() { return NameSupport.getInstance().getDefaultLayoutTemplate(); } @Override public int getMaxTokens() { return getDefaultLayoutTemplate().getMaxTokens(); } }