Search in sources :

Example 6 with InstantOnChangeFrontStrGroup

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

the class InstantOnChangeService method addToRepOrigins.

/**
     * Both origin and destination are in the same repeating group.
     * @param allItems
     * @param groupedOrigins
     */
public void addToRepOrigins(Map<String, Map<Integer, InstantOnChangeFrontStrGroup>> repOrigins, InstantOnChangePairContainer instantPair) {
    String oigOid = instantPair.getOriginItemGroupOid();
    Integer oigItemId = instantPair.getOriginItemId();
    if (oigOid.length() > 0 && oigItemId > 0 && instantPair.getDestItemId() > 0 && instantPair.getOptionValue().length() > 0) {
        if (repOrigins.containsKey(oigOid)) {
            Map<Integer, InstantOnChangeFrontStrGroup> strMap = repOrigins.get(oigOid);
            if (strMap == null) {
                logger.debug("repeating " + oigOid + " contains Null InstantOnChangeFrontStr.");
            } else {
                if (strMap.containsKey(oigItemId)) {
                    InstantOnChangeFrontStr repGrpFrontStr = strMap.get(oigItemId).getSameRepGrpFrontStr();
                    repGrpFrontStr.chainUpFrontStr(instantPair);
                } else {
                    InstantOnChangeFrontStr repGrp = new InstantOnChangeFrontStr();
                    repGrp.chainUpFrontStr(instantPair);
                    if (repGrp.getFrontStr().length() > 0) {
                        InstantOnChangeFrontStrGroup iocstr = new InstantOnChangeFrontStrGroup();
                        iocstr.setOriginItemId(oigItemId);
                        iocstr.setSameRepGrpFrontStr(repGrp);
                        strMap.put(oigItemId, iocstr);
                    }
                }
            }
        } else {
            InstantOnChangeFrontStr repGrp = new InstantOnChangeFrontStr();
            repGrp.chainUpFrontStr(instantPair);
            if (repGrp.getFrontStr().length() > 0) {
                Map<Integer, InstantOnChangeFrontStrGroup> smap = new HashMap<Integer, InstantOnChangeFrontStrGroup>();
                InstantOnChangeFrontStrGroup instantFrontStr = new InstantOnChangeFrontStrGroup();
                instantFrontStr.setOriginItemId(oigItemId);
                instantFrontStr.setSameRepGrpFrontStr(repGrp);
                smap.put(oigItemId, instantFrontStr);
                repOrigins.put(oigOid, smap);
            }
        }
    } else {
        logger.debug("Empty found upon origin_group_oid/item_ids/option_value, so no InstantOnChangeFrontStrGroup available.");
    }
}
Also used : InstantOnChangeFrontStrGroup(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup) HashMap(java.util.HashMap) InstantOnChangeFrontStr(org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStr)

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