use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.
the class FormLayoutDAO method findAll.
public Collection findAll() {
this.setTypesExpected();
ArrayList al = new ArrayList();
ArrayList alist = this.select(digester.getQuery("findAll"));
Iterator it = alist.iterator();
while (it.hasNext()) {
FormLayoutBean eb = (FormLayoutBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.
the class FormLayoutDAO method update.
public EntityBean update(EntityBean eb) {
// UPDATE CRF_VERSION SET CRF_ID=?,STATUS_ID=?,NAME=?,
// DESCRIPTION=?,DATE_UPDATED=NOW(),UPDATE_ID=?,REVISION_NOTES =? WHERE
// CRF_VERSION_ID=?
FormLayoutBean ib = (FormLayoutBean) eb;
HashMap variables = new HashMap();
variables.put(new Integer(1), new Integer(ib.getCrfId()));
variables.put(new Integer(2), new Integer(ib.getStatus().getId()));
variables.put(new Integer(3), ib.getName());
variables.put(new Integer(4), ib.getDescription());
variables.put(new Integer(5), new Integer(ib.getUpdater().getId()));
variables.put(new Integer(6), ib.getRevisionNotes());
variables.put(new Integer(7), new Integer(ib.getId()));
this.execute(digester.getQuery("update"), variables);
return eb;
}
use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.
the class StudySubjectServiceImpl method populateUncompletedCRFsWithCRFAndVersions.
@SuppressWarnings({ "rawtypes", "unchecked" })
public void populateUncompletedCRFsWithCRFAndVersions(ArrayList<DisplayEventDefinitionCRFBean> uncompletedEventDefinitionCRFs, Map<Integer, FormLayoutBean> formLayoutById, Map<Integer, CRFBean> crfById) {
FormLayoutDAO formLayoutDAo = new FormLayoutDAO(dataSource);
int size = uncompletedEventDefinitionCRFs.size();
for (int i = 0; i < size; i++) {
DisplayEventDefinitionCRFBean dedcrf = uncompletedEventDefinitionCRFs.get(i);
CRFBean cb = crfById.get(dedcrf.getEdc().getCrfId());
dedcrf.getEdc().setCrf(cb);
ArrayList<FormLayoutBean> theVersions = (ArrayList<FormLayoutBean>) formLayoutDAo.findAllActiveByCRF(dedcrf.getEdc().getCrfId());
ArrayList<FormLayoutBean> versions = new ArrayList<FormLayoutBean>();
HashMap<String, FormLayoutBean> formLayoutIds = new HashMap<String, FormLayoutBean>();
for (int j = 0; j < theVersions.size(); j++) {
FormLayoutBean formLayout = theVersions.get(j);
formLayoutIds.put(String.valueOf(formLayout.getId()), formLayout);
}
if (!dedcrf.getEdc().getSelectedVersionIds().equals("")) {
String[] kk = dedcrf.getEdc().getSelectedVersionIds().split(",");
for (String string : kk) {
if (formLayoutIds.get(string) != null) {
versions.add(formLayoutIds.get(string));
}
}
} else {
versions = theVersions;
}
dedcrf.getEdc().setVersions(versions);
uncompletedEventDefinitionCRFs.set(i, dedcrf);
}
}
use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.
the class BatchCRFMigrationServlet method processRequest.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void processRequest() throws Exception {
FormProcessor fp = new FormProcessor(request);
ArrayList<CRFVersionBean> crfVersionList = null;
ArrayList<FormLayoutBean> formLayoutList = null;
ArrayList<StudyEventDefinitionBean> eventList = null;
ArrayList<StudyBean> siteList = null;
// checks which module the requests are from, manage or admin
String module = fp.getString(MODULE);
request.setAttribute(MODULE, module);
int crfId = fp.getInt(CRF_ID);
if (crfId == 0) {
addPageMessage(respage.getString("please_choose_a_CRF_to_view"));
forwardPage(Page.CRF_LIST);
} else {
CRFDAO cdao = new CRFDAO(sm.getDataSource());
// CRFVersionDAO vdao = new CRFVersionDAO(sm.getDataSource());
FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
CRFBean crf = (CRFBean) cdao.findByPK(crfId);
request.setAttribute("crfName", crf.getName());
// ArrayList<CRFVersionBean> versions = (ArrayList<CRFVersionBean>) vdao.findAllByCRF(crfId);
ArrayList<FormLayoutBean> formLayouts = (ArrayList<FormLayoutBean>) fldao.findAllByCRF(crfId);
crfVersionList = new ArrayList<CRFVersionBean>();
formLayoutList = new ArrayList<FormLayoutBean>();
for (FormLayoutBean version : formLayouts) {
if (version.getStatus().isAvailable())
formLayoutList.add(version);
}
// for (CRFVersionBean version : versions) {
// if (version.getStatus().isAvailable())
// crfVersionList.add(version);
// }
// crf.setVersions(crfVersionList);
crf.setFormLayouts(formLayoutList);
ArrayList<StudyBean> listOfSites = (ArrayList<StudyBean>) sdao().findAllByParent(currentStudy.getId());
siteList = new ArrayList<StudyBean>();
StudyBean studyBean = new StudyBean();
studyBean.setOid(currentStudy.getOid());
studyBean.setName(resterm.getString("Study_Level_Subjects_Only"));
siteList.add(studyBean);
for (StudyBean s : listOfSites) {
if (s.getStatus().isAvailable()) {
siteList.add(s);
}
}
ArrayList<StudyEventDefinitionBean> listOfDefn = seddao().findAllByStudy(currentStudy);
eventList = new ArrayList<StudyEventDefinitionBean>();
for (StudyEventDefinitionBean d : listOfDefn) {
if (d.getStatus().isAvailable()) {
eventList.add(d);
}
}
// if coming from change crf version -> display message
String crfVersionChangeMsg = fp.getString("isFromCRFVersionBatchChange");
if (crfVersionChangeMsg != null && !crfVersionChangeMsg.equals("")) {
addPageMessage(crfVersionChangeMsg);
}
request.setAttribute("study", currentStudy);
request.setAttribute("siteList", siteList);
request.setAttribute("eventList", eventList);
request.setAttribute(CRF, crf);
forwardPage(Page.BATCH_CRF_MIGRATION);
}
}
use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.
the class ViewCRFServlet method populate.
private Collection<TableColumnHolder> populate(CRFBean crf, ArrayList<FormLayoutBean> versions) {
HashMap<FormLayoutBean, ArrayList<TableColumnHolder>> hm = new HashMap<FormLayoutBean, ArrayList<TableColumnHolder>>();
List<TableColumnHolder> tableColumnHolders = new ArrayList<TableColumnHolder>();
for (FormLayoutBean versionBean : versions) {
hm.put(versionBean, new ArrayList<TableColumnHolder>());
}
List<RuleSetBean> ruleSets = getRuleSetService().getRuleSetsByCrfAndStudy(crf, currentStudy);
ruleSets = getRuleSetService().filterByStatusEqualsAvailable(ruleSets);
for (RuleSetBean ruleSetBean : ruleSets) {
if (ruleSetBean.getCrfVersion() == null) {
for (FormLayoutBean version : versions) {
hm.get(version).addAll(createFromRuleSet(ruleSetBean, version));
}
}
if (ruleSetBean.getCrfVersion() != null) {
hm.get(ruleSetBean.getCrfVersion()).addAll(createFromRuleSet(ruleSetBean, ruleSetBean.getFormLayout()));
}
}
for (ArrayList<TableColumnHolder> list : hm.values()) {
tableColumnHolders.addAll(list);
}
return tableColumnHolders;
}
Aggregations