use of org.akaza.openclinica.bean.extract.DatasetBean in project OpenClinica by OpenClinica.
the class RemoveDatasetServlet method processRequest.
@Override
public void processRequest() throws Exception {
FormProcessor fp = new FormProcessor(request);
int dsId = fp.getInt("dsId");
DatasetDAO dsDAO = new DatasetDAO(sm.getDataSource());
DatasetBean dataset = (DatasetBean) dsDAO.findByPK(dsId);
StudyDAO sdao = new StudyDAO(sm.getDataSource());
StudyBean study = (StudyBean) sdao.findByPK(dataset.getStudyId());
checkRoleByUserAndStudy(ub, study.getParentStudyId(), study.getId());
if (study.getId() != currentStudy.getId() && study.getParentStudyId() != currentStudy.getId()) {
addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
forwardPage(Page.MENU_SERVLET);
return;
}
if (!ub.isSysAdmin() && dataset.getOwnerId() != ub.getId()) {
addPageMessage(respage.getString("no_have_correct_privilege_current_study") + " " + respage.getString("change_active_study_or_contact"));
forwardPage(Page.MENU_SERVLET);
return;
}
String action = request.getParameter("action");
if (resword.getString("remove_this_dataset").equalsIgnoreCase(action)) {
dataset.setStatus(Status.DELETED);
dsDAO.update(dataset);
// +
addPageMessage(respage.getString("dataset_removed"));
// "System Administrators can "+
// "restore it if necessary.");
request.setAttribute("table", getDatasetTable());
forwardPage(Page.VIEW_DATASETS);
} else if (resword.getString("cancel").equalsIgnoreCase(action)) {
request.setAttribute("table", getDatasetTable());
forwardPage(Page.VIEW_DATASETS);
} else {
request.setAttribute("dataset", dataset);
forwardPage(Page.REMOVE_DATASET);
}
}
use of org.akaza.openclinica.bean.extract.DatasetBean in project OpenClinica by OpenClinica.
the class DatasetDAO method findByNameAndStudy.
/**
*
* @param name
* @return
*/
public EntityBean findByNameAndStudy(String name, StudyBean study) {
DatasetBean eb = new DatasetBean();
this.setTypesExpected();
HashMap variables = new HashMap();
variables.put(Integer.valueOf(1), name);
variables.put(Integer.valueOf(2), Integer.valueOf(study.getId()));
String sql = digester.getQuery("findByNameAndStudy");
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
if (it.hasNext()) {
eb = (DatasetBean) this.getEntityFromHashMap((HashMap) it.next());
} else {
logger.warn("found no object: " + sql + " " + name);
}
return eb;
}
use of org.akaza.openclinica.bean.extract.DatasetBean in project OpenClinica by OpenClinica.
the class DatasetDAO method updateAll.
/**
* Update all columns of the dataset table except owner_id
*
* @param eb
* @return
*
* @author ywang (Feb., 2008)
*/
public EntityBean updateAll(EntityBean eb) {
eb.setActive(false);
DatasetBean db = (DatasetBean) eb;
HashMap variables = new HashMap();
HashMap nullVars = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(db.getStudyId()));
variables.put(Integer.valueOf(2), Integer.valueOf(db.getStatus().getId()));
variables.put(Integer.valueOf(3), db.getName());
variables.put(Integer.valueOf(4), db.getDescription());
variables.put(Integer.valueOf(5), db.getSQLStatement());
variables.put(Integer.valueOf(6), db.getDateLastRun());
variables.put(Integer.valueOf(7), Integer.valueOf(db.getNumRuns()));
variables.put(Integer.valueOf(8), Integer.valueOf(db.getUpdaterId()));
if (db.getApproverId() <= 0) {
// nullVars.put(Integer.valueOf(9), null);
// ABOVE IS WRONG; follow the example below:
nullVars.put(Integer.valueOf(9), Integer.valueOf(Types.NUMERIC));
variables.put(Integer.valueOf(9), null);
} else {
variables.put(Integer.valueOf(9), Integer.valueOf(db.getApproverId()));
}
variables.put(Integer.valueOf(10), db.getDateStart());
variables.put(Integer.valueOf(11), db.getDateEnd());
variables.put(Integer.valueOf(12), new Boolean(db.isShowEventLocation()));
variables.put(Integer.valueOf(13), new Boolean(db.isShowEventStart()));
variables.put(Integer.valueOf(14), new Boolean(db.isShowEventEnd()));
variables.put(Integer.valueOf(15), new Boolean(db.isShowSubjectDob()));
variables.put(Integer.valueOf(16), new Boolean(db.isShowSubjectGender()));
variables.put(Integer.valueOf(17), new Boolean(db.isShowEventStatus()));
variables.put(Integer.valueOf(18), new Boolean(db.isShowSubjectStatus()));
variables.put(Integer.valueOf(19), new Boolean(db.isShowSubjectUniqueIdentifier()));
variables.put(Integer.valueOf(20), new Boolean(db.isShowSubjectAgeAtEvent()));
variables.put(Integer.valueOf(21), new Boolean(db.isShowCRFstatus()));
variables.put(Integer.valueOf(22), new Boolean(db.isShowCRFversion()));
variables.put(Integer.valueOf(23), new Boolean(db.isShowCRFinterviewerName()));
variables.put(Integer.valueOf(24), new Boolean(db.isShowCRFinterviewerDate()));
variables.put(Integer.valueOf(25), new Boolean(db.isShowSubjectGroupInformation()));
variables.put(Integer.valueOf(26), new Boolean(false));
variables.put(Integer.valueOf(27), db.getODMMetaDataVersionName());
variables.put(Integer.valueOf(28), db.getODMMetaDataVersionOid());
variables.put(Integer.valueOf(29), db.getODMPriorStudyOid());
variables.put(Integer.valueOf(30), db.getODMPriorMetaDataVersionOid());
variables.put(Integer.valueOf(31), new Boolean(db.isShowSubjectSecondaryId()));
variables.put(Integer.valueOf(32), Integer.valueOf(db.getDatasetItemStatus().getId()));
variables.put(Integer.valueOf(33), Integer.valueOf(db.getId()));
this.execute(digester.getQuery("updateAll"), variables, nullVars);
if (isQuerySuccessful()) {
eb.setActive(true);
}
return eb;
}
use of org.akaza.openclinica.bean.extract.DatasetBean in project OpenClinica by OpenClinica.
the class DatasetDAO method update.
public EntityBean update(EntityBean eb) {
DatasetBean db = (DatasetBean) eb;
HashMap variables = new HashMap();
HashMap nullVars = new HashMap();
variables.put(Integer.valueOf(1), Integer.valueOf(db.getStudyId()));
variables.put(Integer.valueOf(2), Integer.valueOf(db.getStatus().getId()));
variables.put(Integer.valueOf(3), db.getName());
variables.put(Integer.valueOf(4), db.getDescription());
variables.put(Integer.valueOf(5), db.getSQLStatement());
variables.put(Integer.valueOf(6), db.getDateLastRun());
variables.put(Integer.valueOf(7), Integer.valueOf(db.getNumRuns()));
variables.put(Integer.valueOf(8), Integer.valueOf(db.getUpdaterId()));
if (db.getApproverId() <= 0) {
// nullVars.put(Integer.valueOf(9), null);
// ABOVE IS WRONG; follow the example below:
nullVars.put(Integer.valueOf(9), Integer.valueOf(Types.NUMERIC));
variables.put(Integer.valueOf(9), null);
} else {
variables.put(Integer.valueOf(9), Integer.valueOf(db.getApproverId()));
}
variables.put(Integer.valueOf(10), db.getDateStart());
variables.put(Integer.valueOf(11), db.getDateEnd());
variables.put(Integer.valueOf(12), Integer.valueOf(db.getId()));
this.execute(digester.getQuery("update"), variables, nullVars);
return eb;
}
use of org.akaza.openclinica.bean.extract.DatasetBean in project OpenClinica by OpenClinica.
the class DatasetDAO method findAll.
public Collection findAll() {
this.setTypesExpected();
ArrayList alist = this.select(digester.getQuery("findAll"));
ArrayList al = new ArrayList();
Iterator it = alist.iterator();
while (it.hasNext()) {
DatasetBean eb = (DatasetBean) this.getEntityFromHashMap((HashMap) it.next());
al.add(eb);
}
return al;
}
Aggregations