Search in sources :

Example 16 with Extension

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;
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension)

Example 17 with 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;
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) AppDescriptor(org.openmrs.module.appframework.domain.AppDescriptor) AppAndExtensionConfig(org.openmrs.module.pihcore.config.model.AppAndExtensionConfig) AppTemplate(org.openmrs.module.appframework.domain.AppTemplate)

Example 18 with Extension

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)));
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) CustomAppLoaderUtil.addFeatureToggleToExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.addFeatureToggleToExtension) CustomAppLoaderUtil.fragmentExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.fragmentExtension) CustomAppLoaderUtil.containsExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.containsExtension)

Example 19 with Extension

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);
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension) CustomAppLoaderUtil.addFeatureToggleToExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.addFeatureToggleToExtension) CustomAppLoaderUtil.fragmentExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.fragmentExtension) CustomAppLoaderUtil.containsExtension(org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.containsExtension)

Example 20 with Extension

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;
}
Also used : Extension(org.openmrs.module.appframework.domain.Extension)

Aggregations

Extension (org.openmrs.module.appframework.domain.Extension)40 Test (org.junit.Test)18 AppContextModel (org.openmrs.module.appframework.context.AppContextModel)7 ArrayList (java.util.ArrayList)5 Map (java.util.Map)4 PatientContextModel (org.openmrs.module.coreapps.contextmodel.PatientContextModel)4 CustomAppLoaderUtil.addFeatureToggleToExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.addFeatureToggleToExtension)4 CustomAppLoaderUtil.containsExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.containsExtension)4 CustomAppLoaderUtil.fragmentExtension (org.openmrs.module.pihcore.apploader.CustomAppLoaderUtil.fragmentExtension)4 VisitContextModel (org.openmrs.module.coreapps.contextmodel.VisitContextModel)3 VisitDomainWrapper (org.openmrs.module.emrapi.visit.VisitDomainWrapper)3 Redirect (org.openmrs.ui.framework.page.Redirect)3 Location (org.openmrs.Location)2 Patient (org.openmrs.Patient)2 AppDescriptor (org.openmrs.module.appframework.domain.AppDescriptor)2 SimpleObject (org.openmrs.ui.framework.SimpleObject)2 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Locale (java.util.Locale)1