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