use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.
the class ArchivedDatasetFileDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
ArchivedDatasetFileBean fb = new ArchivedDatasetFileBean();
fb.setId(((Integer) hm.get("archived_dataset_file_id")).intValue());
fb.setDateCreated((Date) hm.get("date_created"));
fb.setName((String) hm.get("name"));
fb.setId(((Integer) hm.get("archived_dataset_file_id")).intValue());
fb.setDatasetId(((Integer) hm.get("dataset_id")).intValue());
fb.setExportFormatId(((Integer) hm.get("export_format_id")).intValue());
fb.setFileReference((String) hm.get("file_reference"));
fb.setRunTime(((Integer) hm.get("run_time")).doubleValue());
fb.setFileSize(((Integer) hm.get("file_size")).intValue());
fb.setOwnerId(((Integer) hm.get("owner_id")).intValue());
UserAccountDAO uaDAO = new UserAccountDAO(this.ds);
UserAccountBean owner = (UserAccountBean) uaDAO.findByPK(fb.getOwnerId());
fb.setOwner(owner);
return fb;
}
use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.
the class XsltTransformJob method initDependencies.
/**
* Initializes the dependencies of this job with the components from the Spring application context.
*
* @param scheduler
*/
private void initDependencies(Scheduler scheduler) {
try {
ApplicationContext ctx = (ApplicationContext) scheduler.getContext().get("applicationContext");
DataSource dataSource = ctx.getBean(DataSource.class);
mailSender = ctx.getBean(OpenClinicaMailSender.class);
auditEventDAO = ctx.getBean(AuditEventDAO.class);
datasetDao = ctx.getBean(DatasetDAO.class);
userAccountDao = ctx.getBean(UserAccountDAO.class);
studyDao = new StudyDAO(dataSource);
archivedDatasetFileDao = ctx.getBean(ArchivedDatasetFileDAO.class);
generateFileService = ctx.getBean(GenerateExtractFileService.class);
odmFileCreation = ctx.getBean(OdmFileCreation.class);
} catch (SchedulerException e) {
throw new IllegalStateException("Could not load dependencies from scheduler context", e);
}
}
use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.
the class AdminSystemServlet method processRequest.
// < ResourceBundleresword,resexception;
/*
* (non-Javadoc)
*
* @see org.akaza.openclinica.control.core.SecureController#processRequest()
*/
@Override
protected void processRequest() throws Exception {
// find last 5 modifed studies
StudyDAO sdao = new StudyDAO(sm.getDataSource());
ArrayList studies = (ArrayList) sdao.findAllByLimit(true);
request.setAttribute("studies", studies);
ArrayList allStudies = (ArrayList) sdao.findAll();
request.setAttribute("allStudyNumber", new Integer(allStudies.size()));
UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
ArrayList users = (ArrayList) udao.findAllByLimit(true);
request.setAttribute("users", users);
ArrayList allUsers = (ArrayList) udao.findAll();
request.setAttribute("allUserNumber", new Integer(allUsers.size()));
SubjectDAO subdao = new SubjectDAO(sm.getDataSource());
ArrayList subjects = (ArrayList) subdao.findAllByLimit(true);
request.setAttribute("subjects", subjects);
ArrayList allSubjects = (ArrayList) subdao.findAll();
request.setAttribute("allSubjectNumber", new Integer(allSubjects.size()));
CRFDAO cdao = new CRFDAO(sm.getDataSource());
ArrayList crfs = (ArrayList) cdao.findAllByLimit(true);
request.setAttribute("crfs", crfs);
ArrayList allCrfs = (ArrayList) cdao.findAll();
request.setAttribute("allCrfNumber", new Integer(allCrfs.size()));
resetPanel();
panel.setOrderedData(true);
setToPanel(resword.getString("in_the_application"), "");
if (allSubjects.size() > 0) {
setToPanel(resword.getString("subjects"), new Integer(allSubjects.size()).toString());
}
if (allUsers.size() > 0) {
setToPanel(resword.getString("users"), new Integer(allUsers.size()).toString());
}
if (allStudies.size() > 0) {
setToPanel(resword.getString("studies"), new Integer(allStudies.size()).toString());
}
if (allCrfs.size() > 0) {
setToPanel(resword.getString("CRFs"), new Integer(allCrfs.size()).toString());
}
panel.setStudyInfoShown(false);
forwardPage(Page.ADMIN_SYSTEM);
}
use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.
the class CreateJobImportServlet method setUpServlet.
/*
* Find all the form items and re-populate as necessary
*/
private void setUpServlet() throws Exception {
String directory = SQLInitServlet.getField("filePath") + DIR_PATH + File.separator;
logger.debug("found directory: " + directory);
// find all the form items and re-populate them if necessary
FormProcessor fp2 = new FormProcessor(request);
UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
StudyDAO sdao = new StudyDAO(sm.getDataSource());
// ArrayList studies = udao.findStudyByUser(ub.getName(), (ArrayList)
// sdao.findAll());
// request.setAttribute("studies", studies);
// tbh, replacing the above with another version, 06/2009
ArrayList<StudyBean> all = (ArrayList<StudyBean>) sdao.findAll();
ArrayList<StudyBean> finalList = new ArrayList<StudyBean>();
for (StudyBean sb : all) {
if (!(sb.getParentStudyId() > 0)) {
finalList.add(sb);
// System.out.println("found study name: " + sb.getName());
finalList.addAll(sdao.findAllByParent(sb.getId()));
}
}
// System.out.println("found list of studies: " + finalList.toString());
addEntityList("studies", finalList, respage.getString("a_user_cannot_be_created_no_study_as_active"), Page.ADMIN_SYSTEM);
// YW >>
// << tbh
request.setAttribute("filePath", directory);
// request.setAttribute("activeStudy", activeStudy);
request.setAttribute(JOB_NAME, fp2.getString(JOB_NAME));
request.setAttribute(JOB_DESC, fp2.getString(JOB_DESC));
request.setAttribute(EMAIL, fp2.getString(EMAIL));
request.setAttribute(HOURS, new Integer(fp2.getInt(HOURS)).toString());
request.setAttribute(MINUTES, new Integer(fp2.getInt(MINUTES)).toString());
}
use of org.akaza.openclinica.dao.login.UserAccountDAO in project OpenClinica by OpenClinica.
the class ListStudyUserServlet method processRequest.
@Override
public void processRequest() throws Exception {
FormProcessor fp = new FormProcessor(request);
UserAccountDAO udao = new UserAccountDAO(sm.getDataSource());
ArrayList users = udao.findAllAssignedUsersByStudy(currentStudy.getId());
EntityBeanTable table = fp.getEntityBeanTable();
ArrayList allStudyUserRows = StudyUserRoleRow.generateRowsFromBeans(users);
String[] columns = { resword.getString("user_name"), resword.getString("first_name"), resword.getString("last_name"), resword.getString("role"), resword.getString("study_name"), resword.getString("status"), resword.getString("actions") };
table.setColumns(new ArrayList(Arrays.asList(columns)));
table.hideColumnLink(6);
table.setQuery("ListStudyUser", new HashMap());
table.addLink(restext.getString("assign_new_user_to_current_study"), "AssignUserToStudy");
table.setRows(allStudyUserRows);
table.computeDisplay();
request.setAttribute("table", table);
request.setAttribute("siteRoleMap", Role.siteRoleMap);
request.setAttribute("studyRoleMap", Role.studyRoleMap);
request.setAttribute("study", currentStudy);
// request.setAttribute("users", users);
forwardPage(Page.LIST_USER_IN_STUDY);
}
Aggregations