本文整理汇总了Java中org.openmrs.module.Extension类的典型用法代码示例。如果您正苦于以下问题:Java Extension类的具体用法?Java Extension怎么用?Java Extension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Extension类属于org.openmrs.module包,在下文中一共展示了Extension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterate
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* Put the next extension into the request from the <code>extensions</code> iterator. If the
* current ext returns a non-null getBodyContentString(), print that to the request instead.
*/
private void iterate() {
Extension ext = extensions.next();
ext.initialize(parameterMap);
String overrideContent = ext.getOverrideContent(getBodyContentString());
if (overrideContent == null) {
log.debug("Adding ext: " + ext.getExtensionId() + " to pageContext class: " + ext.getClass());
pageContext.setAttribute("extension", ext);
// set up and apply the status variable
status.put(STATUS_FIRST, index == 0);
status.put(STATUS_LAST, !extensions.hasNext());
status.put(STATUS_INDEX, index++);
pageContext.setAttribute(varStatus, status);
} else {
try {
bodyContent.getEnclosingWriter().write(overrideContent);
}
catch (IOException io) {
log.warn("Cannot write override content of extension: " + ext.toString(), io);
}
}
}
示例2: getAllAddEncounterToVisitLinks
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* Searches for all modules implementing {@link AddEncounterToVisitExtension} and returns the
* set of links.
*
* @return the set of Links
* @should return empty set if there is no AddEncounterToVisitExtension
* @should return links if there are AddEncounterToVisitExtensions
*/
public static Set<Link> getAllAddEncounterToVisitLinks() {
List<Extension> extensions = ModuleFactory
.getExtensions("org.openmrs.module.web.extension.AddEncounterToVisitExtension");
if (extensions == null) {
return Collections.emptySet();
}
Set<Link> links = new TreeSet<Link>(new Comparator<Link>() {
@Override
public int compare(Link o1, Link o2) {
return o1.getLabel().compareTo(o2.getLabel());
}
});
for (Extension extension : extensions) {
AddEncounterToVisitExtension ext = (AddEncounterToVisitExtension) extension;
Set<Link> tmpLinks = ext.getAddEncounterToVisitLinks();
if (tmpLinks != null) {
links.addAll(tmpLinks);
}
}
return links;
}
示例3: doEndTag
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see javax.servlet.jsp.tagext.Tag#doEndTag()
*/
public int doEndTag() throws JspException {
try {
if (getBodyContent() != null) {
if (log.isDebugEnabled()) {
log.debug("Ending tag: " + bodyContent.getString());
}
if (extensions != null) {
getBodyContent().writeOut(bodyContent.getEnclosingWriter());
}
bodyContent.clearBody();
} else {
// the tag doesn't have a body, so initBody and doAfterBody have
// not been called. Do iterations now
while (extensions != null && extensions.hasNext()) {
Extension ext = extensions.next();
ext.initialize(parameterMap);
String overrideContent = ext.getOverrideContent("");
if (overrideContent != null) {
pageContext.getOut().write(overrideContent);
}
}
}
}
catch (java.io.IOException e) {
throw new JspTagException("IO Error while ending tag for point: " + pointId, e);
}
release();
return EVAL_PAGE;
}
示例4: getFormsModulesCanAddEncounterToVisit_shouldReturnFormsIfThereAreAddEncounterToVisitExtensions
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see ExtensionUtil#getFormsModulesCanAddEncounterToVisit()
* @verifies return forms if there are AddEncounterToVisitExtensions
*/
@Test
public void getFormsModulesCanAddEncounterToVisit_shouldReturnFormsIfThereAreAddEncounterToVisitExtensions()
throws Exception {
//given
AddEncounterToVisitExtension ext1 = mock(AddEncounterToVisitExtension.class);
Set<Link> links1 = new HashSet<Link>();
Link link1 = new Link();
link1.setLabel("a");
links1.add(link1);
Link link2 = new Link();
link2.setLabel("b");
links1.add(link2);
when(ext1.getAddEncounterToVisitLinks()).thenReturn(links1);
AddEncounterToVisitExtension ext2 = mock(AddEncounterToVisitExtension.class);
Set<Link> links2 = new HashSet<Link>();
Link link3 = new Link();
link3.setLabel("aa");
links2.add(link3);
when(ext2.getAddEncounterToVisitLinks()).thenReturn(links2);
List<Extension> extensions = new ArrayList<Extension>();
extensions.add(ext1);
extensions.add(ext2);
mockStatic(ModuleFactory.class);
when(ModuleFactory.getExtensions("org.openmrs.module.web.extension.AddEncounterToVisitExtension")).thenReturn(
extensions);
//when
Set<Link> allAddEncounterToVisitLinks = ExtensionUtil.getAllAddEncounterToVisitLinks();
//then
assertTrue(allAddEncounterToVisitLinks.contains(link1));
assertTrue(allAddEncounterToVisitLinks.contains(link2));
assertTrue(allAddEncounterToVisitLinks.contains(link3));
}
示例5: getSupportedFormEntryHandlers
import org.openmrs.module.Extension; //导入依赖的package包/类
public List<FormEntryHandler> getSupportedFormEntryHandlers() {
List<FormEntryHandler> handlers = new ArrayList<FormEntryHandler>();
List<Extension> extensions = ModuleFactory.getExtensions(FormEntryHandler.class.getName());
for (Extension extension : extensions) {
FormEntryHandler handler = (FormEntryHandler) extension;
if (SUPPORTED_MODULES.contains(handler.getModuleId())) {
handlers.add(handler);
}
}
return handlers;
}
示例6: getUILocations
import org.openmrs.module.Extension; //导入依赖的package包/类
public List<String> getUILocations(Form form) {
List<String> list = new ArrayList<String>();
list.add("patientDashboard.overallActions");
list.add("patientDashboard.visitActions");
list.add("registrationSummary.overallActions");
for (org.openmrs.module.appframework.domain.Extension extension : appService.getFormExtensions(form)) {
list.remove(extension.getExtensionPointId());
}
return list;
}
示例7: populateModel
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see org.openmrs.web.controller.PortletController#populateModel(javax.servlet.http.HttpServletRequest,
* java.util.Map)
*/
@Override
protected void populateModel(HttpServletRequest request, Map<String, Object> model) {
if (model.containsKey("formToEntryUrlMap")) {
return;
}
Person person = (Person) model.get("person");
if (person == null) {
throw new IllegalArgumentException("This portlet may only be used in the context of a Person");
}
FormEntryContext fec = new FormEntryContext(person);
Map<Form, FormEntryHandler> entryUrlMap = new TreeMap<Form, FormEntryHandler>(new Comparator<Form>() {
public int compare(Form left, Form right) {
int temp = left.getName().toLowerCase().compareTo(right.getName().toLowerCase());
if (temp == 0) {
temp = OpenmrsUtil.compareWithNullAsLowest(left.getVersion(), right.getVersion());
}
if (temp == 0) {
temp = OpenmrsUtil.compareWithNullAsGreatest(left.getId(), right.getId());
}
return temp;
}
});
List<Extension> handlers = ModuleFactory.getExtensions("org.openmrs.module.web.extension.FormEntryHandler",
MEDIA_TYPE.html);
if (handlers != null) {
for (Extension ext : handlers) {
FormEntryHandler handler = (FormEntryHandler) ext;
Collection<Form> toEnter = handler.getFormsModuleCanEnter(fec);
if (toEnter != null) {
for (Form form : toEnter) {
entryUrlMap.put(form, handler);
}
}
}
}
model.put("formToEntryUrlMap", entryUrlMap);
model.put("anyUpdatedFormEntryModules", handlers != null && handlers.size() > 0);
// determine whether it's need to show disclaimer on jsp page or not
// as current user does not have enough permissions to view at least one
// type of encounters
model.put("showDisclaimer", !Context.getEncounterService().canViewAllEncounterTypes(Context.getAuthenticatedUser()));
}
示例8: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
public MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}
示例9: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
public Extension.MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}
示例10: ConceptUsageExtension
import org.openmrs.module.Extension; //导入依赖的package包/类
public ConceptUsageExtension() {
this.mediaType = Extension.MEDIA_TYPE.html;
}
示例11: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see org.openmrs.module.Extension#getMediaType()
*/
@Override
public Extension.MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}
示例12: doStartTag
import org.openmrs.module.Extension; //导入依赖的package包/类
public int doStartTag() {
log.debug("Starting tag for extension point: " + pointId);
// "zero out" the extension list and other variables
extensions = null;
parameterMap = OpenmrsUtil.parseParameterList(parameters);
status = new HashMap<String, Object>();
List<Extension> extensionList = null;
List<Extension> validExtensions = new ArrayList<Extension>();
if (type != null && type.length() > 0) {
try {
Extension.MEDIA_TYPE mediaType = Enum.valueOf(Extension.MEDIA_TYPE.class, type);
log.debug("Getting extensions: " + pointId + " : " + mediaType);
extensionList = ModuleFactory.getExtensions(pointId, mediaType);
}
catch (IllegalArgumentException e) {
log.warn("extension point type: '" + type + "' is invalid. Must be enum of Extension.MEDIA_TYPE", e);
}
} else {
log.debug("Getting extensions: " + pointId);
extensionList = ModuleFactory.getExtensions(pointId);
}
if (extensionList != null) {
log.debug("Found " + extensionList.size() + " extensions");
if (requiredClass == null) {
validExtensions = extensionList;
} else {
try {
Class<?> clazz = Class.forName(requiredClass);
for (Extension ext : extensionList) {
if (!clazz.isAssignableFrom(ext.getClass())) {
log.warn("Extensions at this point (" + pointId + ") are " + "required to be of " + clazz
+ " or a subclass. " + ext.getClass() + " is not.");
} else {
validExtensions.add(ext);
}
}
}
catch (ClassNotFoundException ex) {
throw new IllegalArgumentException(ex);
}
}
extensions = validExtensions.iterator();
}
if (extensions == null || !extensions.hasNext()) {
extensions = null;
return SKIP_BODY;
} else {
return EVAL_BODY_BUFFERED;
}
}
示例13: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see AdministrationSectionExt#getMediaType()
*/
public Extension.MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}
示例14: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @see AdministrationSectionExt#getMediaType()
*/
public Extension.MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}
示例15: getMediaType
import org.openmrs.module.Extension; //导入依赖的package包/类
/**
* @return HTML
* @see org.openmrs.module.Extension#getMediaType()
*/
@Override
public Extension.MEDIA_TYPE getMediaType() {
return Extension.MEDIA_TYPE.html;
}