Search in sources :

Example 1 with AddressSupportCompatibility

use of org.openmrs.module.coreapps.AddressSupportCompatibility in project openmrs-module-coreapps by openmrs.

the class FormatAddressFragmentController method controller.

public void controller(FragmentConfiguration config, FragmentModel model) {
    config.require("address");
    PersonAddress address = (PersonAddress) config.getAttribute("address");
    AddressSupportCompatibility addressSupport = Context.getRegisteredComponent("coreapps.AddressSupportCompatibility", AddressSupportCompatibility.class);
    Set<String> tokens = addressSupport.getNameMappings().keySet();
    List<String> formattedLines = new ArrayList<String>();
    for (String lineFormat : addressSupport.getLineByLineFormat()) {
        formattedLines.add(replaceWithProperties(lineFormat, tokens, address));
    }
    model.addAttribute("lines", formattedLines);
}
Also used : PersonAddress(org.openmrs.PersonAddress) AddressSupportCompatibility(org.openmrs.module.coreapps.AddressSupportCompatibility) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 PersonAddress (org.openmrs.PersonAddress)1 AddressSupportCompatibility (org.openmrs.module.coreapps.AddressSupportCompatibility)1