Search in sources :

Example 1 with InstantOnChangeFrontStr

use of org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStr 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 2 with InstantOnChangeFrontStr

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

InstantOnChangeFrontStr (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStr)2 InstantOnChangeFrontStrGroup (org.akaza.openclinica.service.crfdata.front.InstantOnChangeFrontStrGroup)2 HashMap (java.util.HashMap)1