use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-pihcore by PIH.
the class RequireUtilTest method extensionRequiring.
private Extension extensionRequiring(String requires) {
Extension extension = new Extension();
extension.setRequire(requires);
return extension;
}
use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-pihcore by PIH.
the class PihConfigService method getAppAndExtensionConfig.
public AppAndExtensionConfig getAppAndExtensionConfig() {
AppAndExtensionConfig c = new AppAndExtensionConfig();
c.setLoadAppsFromClasspath(appFrameworkConfig.getLoadAppsFromClasspath());
c.setAppsEnabledByDefault(appFrameworkConfig.getAppsEnabledByDefault());
c.setExtensionsEnabledByDefault(appFrameworkConfig.getExtensionsEnabledByDefault());
for (AppTemplate appTemplate : appFrameworkService.getAllAppTemplates()) {
c.getAppTemplates().put(appTemplate.getId(), appTemplate);
}
List<AppDescriptor> enabledApps = appFrameworkService.getAllEnabledApps();
for (AppDescriptor app : appFrameworkService.getAllApps()) {
c.getApps().put(app.getId(), app);
if (enabledApps.contains(app)) {
c.getEnabledApps().add(app.getId());
}
}
List<Extension> enabledExtensions = appFrameworkService.getAllEnabledExtensions();
for (Extension extension : appFrameworkService.getAllExtensions(null)) {
c.getExtensions().put(extension.getId(), extension);
if (enabledExtensions.contains(extension)) {
c.getEnabledExtensions().add(extension.getId());
}
}
return c;
}
use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-pihcore by PIH.
the class CustomAppLoaderFactory method enableHIVForms.
private void enableHIVForms() {
enableHIVIntakeForm();
Extension hivFollowup = visitAction(CustomAppLoaderConstants.Extensions.HIV_ZL_FOLLOWUP_VISIT_ACTION, "pih.task.hivFollowup.label", "fas fa-fw fa-ribbon", "link", enterStandardHtmlFormLink(PihCoreUtil.getFormResource("hiv/hiv-followup.xml") + "&returnUrl=/" + WebConstants.CONTEXT_PATH + "/" + patientVisitsPageWithSpecificVisitUrl), PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_HIV_CONSULT_NOTE, and(sessionLocationHasTag("HIV Consult Location"), visitDoesNotHaveEncounterOfType(PihEmrConfigConstants.ENCOUNTERTYPE_HIV_INTAKE_UUID), visitDoesNotHaveEncounterOfType(PihEmrConfigConstants.ENCOUNTERTYPE_HIV_FOLLOWUP_UUID), or(and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_HIV_CONSULT_NOTE), patientHasActiveVisit()), userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE), and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY), patientVisitWithinPastThirtyDays(config)))));
extensions.add(hivFollowup);
extensions.add(cloneAsHivVisitAction(hivFollowup));
Extension hivDispensing = visitAction(CustomAppLoaderConstants.Extensions.HIV_ZL_DISPENSING_VISIT_ACTION, "pihcore.hivDispensing.short", "fas fa-fw fa-ribbon", "link", enterStandardHtmlFormLink(PihCoreUtil.getFormResource("hiv/hiv-dispensing.xml") + "&returnUrl=/" + WebConstants.CONTEXT_PATH + "/" + patientVisitsPageWithSpecificVisitUrl), PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_HIV_CONSULT_NOTE, and(sessionLocationHasTag("HIV Consult Location"), or(and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_HIV_CONSULT_NOTE), patientHasActiveVisit()), userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE), and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY), patientVisitWithinPastThirtyDays(config)))));
extensions.add(hivDispensing);
extensions.add(cloneAsHivVisitAction(hivDispensing));
// circular app for dispensiing
apps.add(addToHomePage(findPatientTemplateApp(CustomAppLoaderConstants.Apps.HIV_DISPENSING, "pihcore.hivDispensing.short", "fas fa-fw fa-ribbon", PihEmrConfigConstants.PRIVILEGE_APP_DISPENSING_APP_DISPENSE, "/htmlformentryui/htmlform/enterHtmlFormWithStandardUi.page?patientId={{patientId}}&definitionUiResource=" + PihCoreUtil.getFormResource("hiv/hiv-dispensing.xml") + "&returnUrl=/" + WebConstants.CONTEXT_PATH + "/coreapps/findpatient/findPatient.page?app=" + CustomAppLoaderConstants.Apps.HIV_DISPENSING + "&returnLabel=pihcore.hivDispensing.short", null, config.getFindPatientColumnConfig()), sessionLocationHasTag("HIV Consult Location")));
extensions.add(cloneAsHivVisitAction(findExtensionById(CustomAppLoaderConstants.Extensions.VITALS_CAPTURE_VISIT_ACTION)));
}
use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-pihcore by PIH.
the class CustomAppLoaderFactory method enableChemotherapy.
public void enableChemotherapy() {
Extension chemoOrdering = overallAction(CustomAppLoaderConstants.Extensions.CHEMO_ORDERING_VISIT_ACTION, "pih.task.orderChemo", "fas fa-fw fa-pills", "link", "owa/openmrs-owa-oncology/index.html?patientId={{patient.uuid}}/#physicianDashboard", PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_CONSULT_NOTE, and(sessionLocationHasTag("Consult Note Location"), or(and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_CONSULT_NOTE), patientHasActiveVisit()), userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE), and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY), patientVisitWithinPastThirtyDays(config)))));
extensions.add(chemoOrdering);
Extension chemoRecording = visitAction(CustomAppLoaderConstants.Extensions.CHEMO_RECORDING_VISIT_ACTION, "pih.task.recordChemo", "fas fa-fw fa-pills", "link", "owa/openmrs-owa-oncology/index.html?patientId={{patient.uuid}}&visitId={{visit.uuid}}/#nurseDashboard", PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_CONSULT_NOTE, and(sessionLocationHasTag("Consult Note Location"), or(and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_ENTER_CONSULT_NOTE), patientHasActiveVisit()), userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE), and(userHasPrivilege(PihEmrConfigConstants.PRIVILEGE_TASK_EMR_RETRO_CLINICAL_NOTE_THIS_PROVIDER_ONLY), patientVisitWithinPastThirtyDays(config)))));
extensions.add(chemoRecording);
extensions.add(cloneAsOncologyOverallAction(chemoOrdering));
extensions.add(cloneAsOncologyVisitAction(chemoRecording));
registerTemplateForEncounterType(PihEmrConfigConstants.ENCOUNTERTYPE_CHEMOTHERAPY_SESSION_UUID, findExtensionById(CustomAppLoaderConstants.EncounterTemplates.DEFAULT), "fas fa-fw fa-retweet", true, true, null, PihEmrConfigConstants.ENCOUNTERROLE_CONSULTINGCLINICIAN_UUID);
}
use of org.openmrs.module.appframework.domain.Extension in project openmrs-module-pihcore by PIH.
the class CustomAppLoaderUtil method extension.
public static Extension extension(String id, String label, String icon, String type, String urlOrScript, String privilege, String require, String extensionPoint, int order, Map<String, Object> extensionParams) {
Extension extension = new Extension(id, null, extensionPoint, type, label, null, order, privilege, null);
extension.setIcon(icon);
if (StringUtils.isNotBlank(require)) {
extension.setRequire(require);
}
if (type.equals("link")) {
extension.setUrl(urlOrScript);
} else if (type.equals("script")) {
extension.setScript(urlOrScript);
} else if (type.equals("fragment")) {
// don't use urlOrScript
} else {
throw new IllegalStateException("Invalid type: " + type);
}
if (extensionParams != null) {
extension.setExtensionParams(extensionParams);
}
return extension;
}
Aggregations