Search in sources :

Example 1 with InstantOnChangeFrontStrGroup

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

the class InstantOnChangeService method itemGroupsInstantUpdate.

public void itemGroupsInstantUpdate(List<DisplayItemWithGroupBean> allItems, Map<String, Map<Integer, InstantOnChangeFrontStrGroup>> repOrigins) {
    for (int i = 0; i < allItems.size(); ++i) {
        if (allItems.get(i).isInGroup()) {
            List<DisplayItemGroupBean> digs = allItems.get(i).getItemGroups();
            String oid = allItems.get(i).getItemGroup().getItemGroupBean().getOid();
            for (DisplayItemGroupBean dig : digs) {
                if (repOrigins.containsKey(oid)) {
                    HashMap<Integer, InstantOnChangeFrontStrGroup> oMap = (HashMap<Integer, InstantOnChangeFrontStrGroup>) repOrigins.get(oid);
                    List<DisplayItemBean> items = dig.getItems();
                    for (DisplayItemBean dib : items) {
                        if (oMap.containsKey(dib.getItem().getId())) {
                            Integer itId = dib.getItem().getId();
                            dib.setInstantFrontStrGroup(oMap.get(itId));
                        }
                    }
                }
            }
        }
    }
}
Also used : DisplayItemGroupBean(org.akaza.openclinica.bean.submit.DisplayItemGroupBean) InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) HashMap(java.util.HashMap) DisplayItemBean(org.akaza.openclinica.bean.submit.DisplayItemBean)

Example 2 with InstantOnChangeFrontStrGroup

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

the class DisplayItemBean method setProperties.

private void setProperties() {
    data = new ItemDataBean();
    item = new ItemBean();
    metadata = new ItemFormMetadataBean();
    children = new ArrayList();
    numChildren = 0;
    numColumns = 0;
    dbData = new ItemDataBean();
    isSCDtoBeShown = false;
    scdData = new SCDData();
    blankDwelt = false;
    instantFrontStrGroup = new InstantOnChangeFrontStrGroup();
    isNewItem = true;
}
Also used : InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) SCDData(org.akaza.openclinica.service.crfdata.SCDData) ArrayList(java.util.ArrayList)

Example 3 with InstantOnChangeFrontStrGroup

use of org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup 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)

Example 4 with InstantOnChangeFrontStrGroup

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

the class InstantOnChangeService method addToNonRepOrigins.

public void addToNonRepOrigins(Map<Integer, InstantOnChangeFrontStrGroup> nonRepOrigins, InstantOnChangePairContainer instantPair) {
    Integer oigItemId = instantPair.getOriginItemId();
    if (oigItemId > 0 && instantPair.getDestItemId() > 0 && instantPair.getOptionValue().length() > 0) {
        if (nonRepOrigins.containsKey(oigItemId)) {
            InstantOnChangeFrontStrGroup istr = nonRepOrigins.get(oigItemId);
            InstantOnChangeFrontStr nonRep = istr.getNonRepFrontStr();
            nonRep.chainUpFrontStr(instantPair);
            istr.setNonRepFrontStr(nonRep);
        } else {
            InstantOnChangeFrontStr nonRep = new InstantOnChangeFrontStr();
            nonRep.chainUpFrontStr(instantPair);
            if (nonRep.getFrontStr().length() > 0) {
                InstantOnChangeFrontStrGroup istr = new InstantOnChangeFrontStrGroup();
                istr.setOriginItemId(oigItemId);
                istr.setNonRepFrontStr(nonRep);
                nonRepOrigins.put(oigItemId, istr);
            }
        }
    } else {
        logger.debug("Empty found upon item_ids/option_value, so no InstantOnChangeFrontStrGroup available.");
    }
}
Also used : InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) InstantOnChangeFrontStr(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStr)

Example 5 with InstantOnChangeFrontStrGroup

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

the class InstantOnChangeService method instantOnChangeFrontStrParcelInCrfVersion.

public Map<Integer, InstantOnChangeFrontStrParcel> instantOnChangeFrontStrParcelInCrfVersion(Integer crfVersionId) {
    Map<Integer, InstantOnChangeFrontStrParcel> parcels = new HashMap<Integer, InstantOnChangeFrontStrParcel>();
    Map<Integer, List<InstantOnChangePairContainer>> insMap = getItemFormMetadataDAO().sectionInstantMapInSameSection(crfVersionId);
    if (insMap == null || insMap.size() == 0) {
        logger.debug("cannot find instant-calculation item in crf_version =" + crfVersionId);
    } else {
        for (Integer sectionId : insMap.keySet()) {
            Map<String, Map<Integer, InstantOnChangeFrontStrGroup>> repOrigins = new HashMap<String, Map<Integer, InstantOnChangeFrontStrGroup>>();
            Map<Integer, InstantOnChangeFrontStrGroup> nonRepOrigins = new HashMap<Integer, InstantOnChangeFrontStrGroup>();
            List<InstantOnChangePairContainer> instantPairs = insMap.get(sectionId);
            if (instantPairs == null || instantPairs.size() == 0) {
                logger.debug("get empty instantPair list in section_id = " + sectionId);
            } else {
                for (InstantOnChangePairContainer meta : instantPairs) {
                    if (meta.getOriginRepeating().equals(Boolean.TRUE)) {
                        addToRepOrigins(repOrigins, meta);
                    } else {
                        addToNonRepOrigins(nonRepOrigins, meta);
                    }
                }
            }
            InstantOnChangeFrontStrParcel parcel = new InstantOnChangeFrontStrParcel();
            boolean doSet = false;
            if (repOrigins.size() > 0) {
                parcel.setRepOrigins(repOrigins);
                doSet = true;
            }
            if (nonRepOrigins.size() > 0) {
                parcel.setNonRepOrigins(nonRepOrigins);
                doSet = true;
            }
            if (doSet) {
                parcel.setCrfVersionId(crfVersionId);
                parcel.setSectionId(sectionId);
                parcels.put(sectionId, parcel);
            }
        }
    }
    return parcels;
}
Also used : InstantOnChangePairContainer(org.akaza.openclinica.domain.crfdata.InstantOnChangePairContainer) InstantOnChangeFrontStrParcel(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrParcel) InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) HashMap(java.util.HashMap) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

InstantOnChangeFrontStrGroup (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup)6 HashMap (java.util.HashMap)4 Map (java.util.Map)2 InstantOnChangeFrontStr (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStr)2 InstantOnChangeFrontStrParcel (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrParcel)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)1 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)1 InstantOnChangePairContainer (org.akaza.openclinica.domain.crfdata.InstantOnChangePairContainer)1 InstantOnChangeService (org.akaza.openclinica.service.crfdata.InstantOnChangeService)1 SCDData (org.akaza.openclinica.service.crfdata.SCDData)1