Java tutorial
/** * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at * http://mozilla.org/MPL/2.0/. * * This Source Code Form is also subject to the terms of the Health-Related Additional * Disclaimer of Warranty and Limitation of Liability available at * http://www.carewebframework.org/licensing/disclaimer. */ package org.carewebframework.smart.ui; import org.apache.commons.lang.StringUtils; import org.carewebframework.api.spring.SpringUtil; import org.carewebframework.common.QueryStringBuilder; import org.carewebframework.smart.SmartContextBase.ContextMap; /** * Container Implementation SMART on FHIR */ public class SmartContainer2 extends SmartContainerBase { private static final long serialVersionUID = 1L; /** * ISmartContextSubscriber.updateContext is called by the associated SMART context to notify * this container of a change to the context. */ @Override public void updateContext(String contextType, ContextMap context) { super.updateContext(contextType, context); refresh(); } public void refresh() { setSrc(getUrl()); } /** * Returns the url for the SMART plugin. * * @return SMART plugin url. */ private String getUrl() { String qs = getQueryString(); return qs.isEmpty() ? null : _manifest.getValue("index") + "?" + qs; } /** * Return query string for the SMART plugin. * * @return The query string. */ private String getQueryString() { QueryStringBuilder sb = new QueryStringBuilder(); for (ContextMap context : _context.values()) { String param = (String) context.get("param"); if (param != null) { sb.append(param, context.get("id")); } } if (sb.length() > 0) { sb.append("fhirServiceUrl", StringUtils.chomp(SpringUtil.getProperty("fhir.service.root.url"), "/")); } return sb.toString(); } }