Search in sources :

Example 1 with UserAccountDAO

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;
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Example 2 with UserAccountDAO

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);
    }
}
Also used : ArchivedDatasetFileDAO(org.akaza.openclinica.dao.extract.ArchivedDatasetFileDAO) ApplicationContext(org.springframework.context.ApplicationContext) GenerateExtractFileService(org.akaza.openclinica.service.extract.GenerateExtractFileService) SchedulerException(org.quartz.SchedulerException) OpenClinicaMailSender(org.akaza.openclinica.core.OpenClinicaMailSender) AuditEventDAO(org.akaza.openclinica.dao.admin.AuditEventDAO) OdmFileCreation(org.akaza.openclinica.service.extract.OdmFileCreation) DatasetDAO(org.akaza.openclinica.dao.extract.DatasetDAO) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) DataSource(javax.sql.DataSource)

Example 3 with UserAccountDAO

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);
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Example 4 with UserAccountDAO

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());
}
Also used : FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO)

Example 5 with UserAccountDAO

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);
}
Also used : HashMap(java.util.HashMap) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) EntityBeanTable(org.akaza.openclinica.web.bean.EntityBeanTable) ArrayList(java.util.ArrayList) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO)

Aggregations

UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)101 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)69 ArrayList (java.util.ArrayList)44 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)43 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)42 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)36 StudyUserRoleBean (org.akaza.openclinica.bean.login.StudyUserRoleBean)24 Date (java.util.Date)23 HashMap (java.util.HashMap)21 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)18 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)16 Locale (java.util.Locale)15 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)14 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)14 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)13 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)12 SubjectDAO (org.akaza.openclinica.dao.submit.SubjectDAO)12 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)11 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)10 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)10