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.");
}
}
Aggregations