use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.
the class StudySubjectServiceImpl method getDisplayEventCRFs.
private List<DisplayEventCRFBean> getDisplayEventCRFs(List eventCRFs, UserAccountBean ub, StudyUserRoleBean currentRole, SubjectEventStatus status, StudyBean study, Set<Integer> nonEmptyEventCrf, Map<Integer, FormLayoutBean> formLayoutById, Map<Integer, CRFBean> crfById, Integer studyEventDefinitionId, List eventDefinitionCRFs) {
ArrayList<DisplayEventCRFBean> answer = new ArrayList<DisplayEventCRFBean>();
for (int i = 0; i < eventCRFs.size(); i++) {
EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
// populate the event CRF with its crf bean
int formLayoutId = ecb.getFormLayoutId();
FormLayoutBean flb = formLayoutById.get(formLayoutId);
ecb.setFormLayout(flb);
CRFBean cb = crfById.get(flb.getCrfId());
ecb.setCrf(cb);
EventDefinitionCRFBean edc = null;
Iterator it = eventDefinitionCRFs.iterator();
while (it.hasNext()) {
EventDefinitionCRFBean edcBean = (EventDefinitionCRFBean) it.next();
if (edcBean.getCrfId() == cb.getId()) {
edc = edcBean;
break;
}
}
// rules updated 112007 tbh
if (status.equals(SubjectEventStatus.LOCKED) || status.equals(SubjectEventStatus.SKIPPED) || status.equals(SubjectEventStatus.STOPPED)) {
ecb.setStage(DataEntryStage.LOCKED);
// we need to set a SED-wide flag here, because other edcs
// in this event can be filled in and change the status, tbh
} else if (status.equals(SubjectEventStatus.INVALID)) {
ecb.setStage(DataEntryStage.LOCKED);
} else if (!cb.getStatus().equals(Status.AVAILABLE)) {
ecb.setStage(DataEntryStage.LOCKED);
} else if (!flb.getStatus().equals(Status.AVAILABLE)) {
ecb.setStage(DataEntryStage.LOCKED);
}
// TODO need to refactor since this is similar to other code, tbh
if (edc != null) {
// System.out.println("edc is not null, need to set flags");
DisplayEventCRFBean dec = new DisplayEventCRFBean();
dec.setEventDefinitionCRF(edc);
// System.out.println("edc.isDoubleEntry()" +
// edc.isDoubleEntry() + ecb.getId());
dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
if (dec.isLocked()) {
// System.out.println("*** found a locked DEC:
// "+edc.getCrfName());
}
if (nonEmptyEventCrf.contains(ecb.getId())) {
// consider an event crf started only if item data get
// created
answer.add(dec);
}
}
}
return answer;
}
use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method fetchFormDetails.
public FormDefBean fetchFormDetails(CRFVersionBean crfVBean, FormDefBean formDef) {
CRFDAO<String, ArrayList> crfDao = new CRFDAO(this.ds);
CRFBean crfBean = (CRFBean) crfDao.findByPK(crfVBean.getCrfId());
formDef.setOid(crfVBean.getOid());
formDef.setName(crfBean.getName() + " - " + crfVBean.getName());
formDef.setRepeating("No");
FormDetailsBean formDetails = new FormDetailsBean();
formDetails.setName(crfVBean.getName());
formDetails.setOid(crfVBean.getOid());
formDetails.setParentFormOid(crfBean.getOid());
setSectionBean(formDetails, new Integer(crfVBean.getId()));
formDef.setFormDetails(formDetails);
return formDef;
}
use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.
the class CRFDAO method findByItemOid.
public CRFBean findByItemOid(String itemOid) {
CRFBean eb = new CRFBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), itemOid);
ArrayList alist = this.select(digester.getQuery("findByItemOid"), variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
}
return eb;
}
use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.
the class CRFDAO method findAllByLimit.
public Collection findAllByLimit(boolean hasLimit) {
this.setTypesExpected();
ArrayList alist = null;
if (hasLimit) {
alist = this.select(digester.getQuery("findAllByLimit"));
} else {
alist = this.select(digester.getQuery("findAll"));
}
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
CRFBean eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.
the class CRFDAO method findAllActiveByDefinition.
public Collection findAllActiveByDefinition(StudyEventDefinitionBean definition) {
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(definition.getId()));
ArrayList alist = this.select(digester.getQuery("findAllActiveByDefinition"), variables);
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
CRFBean eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
Aggregations