use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.
the class AuditableEntityDAO method findAllByStudy.
/**
* Note: The subclass must define findAllByStudyName before calling this
* method. Otherwise an empty array will be returned.
*
* @param study
* The study to which the entities belong.
* @return An array containing all the entities which belong to
* <code>study</code>.
*/
public ArrayList findAllByStudy(StudyBean study) {
ArrayList answer = new ArrayList();
if (findAllByStudyName == null) {
return answer;
}
setTypesExpected();
HashMap variables = new HashMap();
// study.study_id=?
variables.put(Integer.valueOf(1), Integer.valueOf(study.getId()));
// or study.parent_study_id=?
variables.put(Integer.valueOf(2), Integer.valueOf(study.getId()));
String sql = digester.getQuery(findAllByStudyName);
ArrayList alist = this.select(sql, variables);
Iterator it = alist.iterator();
while (it.hasNext()) {
AuditableEntityBean aeb = (AuditableEntityBean) this.getEntityFromHashMap((HashMap) it.next());
answer.add(aeb);
}
return answer;
}
use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.
the class ViewEventCRFContentServlet method getStudyEvent.
/*
* Get the Study Event to display on screen as well as print some of its
* information. Krikor 10/19/2006
*/
private StudyEventBean getStudyEvent(int eventId) throws Exception {
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
StudyBean studyWithSED = currentStudy;
if (currentStudy.getParentStudyId() > 0) {
studyWithSED = new StudyBean();
studyWithSED.setId(currentStudy.getParentStudyId());
}
AuditableEntityBean aeb = sedao.findByPKAndStudy(eventId, studyWithSED);
if (!aeb.isActive()) {
addPageMessage(respage.getString("the_SE_you_attempting_enter_data_not_belong"));
throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("SE_does_not_belong_current_study"), "1");
// >> changed tbh, 06/2009
}
StudyEventBean seb = (StudyEventBean) aeb;
StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(seb.getStudyEventDefinitionId());
seb.setStudyEventDefinition(sedb);
return seb;
}
use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.
the class TableOfContentsServlet method getEventCRFAndAction.
private void getEventCRFAndAction() {
ecdao = new EventCRFDAO(sm.getDataSource());
ecb = (EventCRFBean) request.getAttribute(INPUT_EVENT_CRF_BEAN);
if (ecb == null) {
int ecid = fp.getInt(INPUT_ID, true);
AuditableEntityBean aeb = ecdao.findByPKAndStudy(ecid, currentStudy);
if (!aeb.isActive()) {
ecb = new EventCRFBean();
} else {
ecb = (EventCRFBean) aeb;
}
action = fp.getString(INPUT_ACTION, true);
} else {
action = getActionForStage(ecb.getStage());
}
}
use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.
the class Validator method entityExistsInStudy.
protected boolean entityExistsInStudy(String fieldName, AuditableEntityDAO dao, StudyBean study) {
String fieldValue = getFieldValue(fieldName);
if (fieldValue == null) {
return false;
}
try {
int id = Integer.parseInt(fieldValue);
AuditableEntityBean e = dao.findByPKAndStudy(id, study);
if (!e.isActive()) {
return false;
}
} catch (Exception e) {
return false;
}
return true;
}
use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.
the class EnterDataForStudyEventServlet method getStudyEvent.
private StudyEventBean getStudyEvent(int eventId) throws Exception {
StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
StudyBean studyWithSED = currentStudy;
if (currentStudy.getParentStudyId() > 0) {
studyWithSED = new StudyBean();
studyWithSED.setId(currentStudy.getParentStudyId());
}
AuditableEntityBean aeb = sedao.findByPKAndStudy(eventId, studyWithSED);
if (!aeb.isActive()) {
addPageMessage(respage.getString("study_event_to_enter_data_not_belong_study"));
throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("study_event_not_belong_study"), "1");
}
StudyEventBean seb = (StudyEventBean) aeb;
StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(seb.getStudyEventDefinitionId());
seb.setStudyEventDefinition(sedb);
// A. Hamid mantis issue 5048
if (!(currentRole.isDirector() || currentRole.isCoordinator()) && seb.getSubjectEventStatus().isLocked()) {
seb.setEditable(false);
}
return seb;
}
Aggregations