use of org.akaza.openclinica.domain.crfdata.SCDItemMetadataBean in project OpenClinica by OpenClinica.
the class SimpleConditionalDisplayService method conditionalDisplayToBeShown.
/**
* Base on chosen option of a control item. scdItemId has to be initialized for SCDItemMetadataBean.
* @param dib
* @param showSCDItemIds.
* @return
*/
public static Set<Integer> conditionalDisplayToBeShown(DisplayItemBean dib, Set<Integer> showSCDItemIds) {
Set<Integer> showIds = showSCDItemIds;
// a conditional display item will be always after its control item.
ArrayList<SCDItemMetadataBean> cds = dib.getScdData().getScdSetsForControl();
if (cds.size() > 0) {
for (SCDItemMetadataBean cd : cds) {
Integer scdItemId = cd.getScdItemId();
if (scdItemId > 0) {
if (conditionalDisplayToBeShown(dib.getData().getValue(), cd)) {
showIds.add(scdItemId);
} else if (showIds.contains(scdItemId)) {
showIds.remove(scdItemId);
}
}
}
}
return showIds;
}
use of org.akaza.openclinica.domain.crfdata.SCDItemMetadataBean in project OpenClinica by OpenClinica.
the class SimpleConditionalDisplayService method getControlMetaIdAndSCDSetMap.
public HashMap<Integer, ArrayList<SCDItemMetadataBean>> getControlMetaIdAndSCDSetMap(int sectionId, ArrayList<SCDItemMetadataBean> scdSets) {
HashMap<Integer, ArrayList<SCDItemMetadataBean>> cdPairMap = new HashMap<Integer, ArrayList<SCDItemMetadataBean>>();
if (scdSets == null) {
logger.info("SimpleConditionalDisplayService.getControlMetaIdAndSCDSetMap() ArrayList<SCDItemMetadataBean> parameter is null.");
} else {
for (SCDItemMetadataBean scd : scdSets) {
Integer conId = scd.getControlItemFormMetadataId();
ArrayList<SCDItemMetadataBean> conScds = cdPairMap.containsKey(conId) ? cdPairMap.get(conId) : new ArrayList<SCDItemMetadataBean>();
conScds.add(scd);
cdPairMap.put(conId, conScds);
}
}
return cdPairMap;
}
use of org.akaza.openclinica.domain.crfdata.SCDItemMetadataBean in project OpenClinica by OpenClinica.
the class SimpleConditionalDisplayService method initSCDItems.
public ArrayList<DisplayItemBean> initSCDItems(ArrayList<DisplayItemBean> displayItems, ArrayList<SCDItemMetadataBean> cds, Set<Integer> showSCDItemIds) {
ArrayList<DisplayItemBean> dis = displayItems;
HashMap<Integer, SCDItemMetadataBean> scds = (HashMap<Integer, SCDItemMetadataBean>) this.getSCDMetaIdAndSCDSetMap(cds);
for (DisplayItemBean displayItem : dis) {
ItemFormMetadataBean meta = displayItem.getMetadata();
if (scds.containsKey(meta.getId())) {
SCDItemMetadataBean scdItemMetadataBean = scds.get(meta.getId());
scdItemMetadataBean.setScdItemId(meta.getItemId());
displayItem.getScdData().setScdItemMetadataBean(scdItemMetadataBean);
}
if (meta.getParentId() < 1) {
ArrayList<DisplayItemBean> cs = displayItem.getChildren();
for (DisplayItemBean c : cs) {
ItemFormMetadataBean cmeta = c.getMetadata();
if (scds.containsKey(cmeta.getId())) {
SCDItemMetadataBean scdItemMetadataBean = scds.get(cmeta.getId());
scdItemMetadataBean.setScdItemId(cmeta.getItemId());
c.getScdData().setScdItemMetadataBean(scdItemMetadataBean);
}
}
}
}
return dis;
}
Aggregations