Search in sources :

Example 1 with InstantOnChangeService

use of org.akaza.openclinica.service.crfdata.InstantOnChangeService in project OpenClinica by OpenClinica.

the class DataEntryServlet method populateInstantOnChange.

protected void populateInstantOnChange(HttpSession session, EventCRFBean ecb, DisplaySectionBean section) {
    int cvId = ecb.getCRFVersionId();
    int sectionId = section.getSection().getId();
    InstantOnChangeService ins = (InstantOnChangeService) SpringServletAccess.getApplicationContext(getServletContext()).getBean("instantOnChangeService");
    InstantOnChangeFrontStrParcel strsInSec = new InstantOnChangeFrontStrParcel();
    HashMap<Integer, InstantOnChangeFrontStrGroup> nonRepOri = null;
    HashMap<String, Map<Integer, InstantOnChangeFrontStrGroup>> grpOri = null;
    HashMap<Integer, InstantOnChangeFrontStrParcel> instantOnChangeFrontStrParcels = (HashMap<Integer, InstantOnChangeFrontStrParcel>) session.getAttribute(CV_INSTANT_META + cvId);
    if (instantOnChangeFrontStrParcels != null && instantOnChangeFrontStrParcels.containsKey(sectionId)) {
        strsInSec = instantOnChangeFrontStrParcels.get(sectionId);
        nonRepOri = (HashMap<Integer, InstantOnChangeFrontStrGroup>) strsInSec.getNonRepOrigins();
        grpOri = (HashMap<String, Map<Integer, InstantOnChangeFrontStrGroup>>) strsInSec.getRepOrigins();
    } else if (instantOnChangeFrontStrParcels == null || instantOnChangeFrontStrParcels.size() == 0) {
        //if(ins.needRunInstantInSection(sectionId)) {
        boolean shouldSetAtt = false;
        instantOnChangeFrontStrParcels = (HashMap<Integer, InstantOnChangeFrontStrParcel>) ins.instantOnChangeFrontStrParcelInCrfVersion(cvId);
        if (instantOnChangeFrontStrParcels.size() > 0) {
            session.setAttribute(CV_INSTANT_META + cvId, instantOnChangeFrontStrParcels);
            if (instantOnChangeFrontStrParcels.containsKey(sectionId)) {
                strsInSec = instantOnChangeFrontStrParcels.get(sectionId);
                if (strsInSec != null) {
                    grpOri = (HashMap<String, Map<Integer, InstantOnChangeFrontStrGroup>>) strsInSec.getRepOrigins();
                    nonRepOri = (HashMap<Integer, InstantOnChangeFrontStrGroup>) strsInSec.getNonRepOrigins();
                }
            }
        }
    //}
    }
    if (grpOri != null && grpOri.size() > 0) {
        ins.itemGroupsInstantUpdate(section.getDisplayItemGroups(), grpOri);
    }
    if (nonRepOri != null && nonRepOri.size() > 0) {
        ins.itemsInstantUpdate(section.getDisplayItemGroups(), nonRepOri);
    }
}
Also used : InstantOnChangeFrontStrParcel(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrParcel) InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) InstantOnChangeService(org.akaza.openclinica.service.crfdata.InstantOnChangeService)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 InstantOnChangeService (org.akaza.openclinica.service.crfdata.InstantOnChangeService)1 InstantOnChangeFrontStrGroup (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup)1 InstantOnChangeFrontStrParcel (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrParcel)1