Search in sources :

Example 1 with ListDiscNotesSubjectTableFactory

use of org.akaza.openclinica.control.submit.ListDiscNotesSubjectTableFactory in project OpenClinica by OpenClinica.

the class ListDiscNotesSubjectServlet method processRequest.

// < ResourceBundleresexception,respage;
@Override
protected void processRequest() throws Exception {
    String module = request.getParameter("module");
    String moduleStr = "manage";
    if (module != null && module.trim().length() > 0) {
        if ("submit".equals(module)) {
            request.setAttribute("module", "submit");
            moduleStr = "submit";
        } else if ("admin".equals(module)) {
            request.setAttribute("module", "admin");
            moduleStr = "admin";
        } else {
            request.setAttribute("module", "manage");
        }
    }
    // << tbh 02/2010 filter out the entire module parameter to catch injections
    // BWP 3098>> close the info side panel and show icons
    request.setAttribute("closeInfoShowIcons", true);
    // <<
    // Determine whether to limit the displayed DN's to a certain DN type
    int resolutionStatus = 0;
    try {
        resolutionStatus = Integer.parseInt(request.getParameter("resolutionStatus"));
    } catch (NumberFormatException nfe) {
        // Show all DN's
        resolutionStatus = -1;
    }
    // Determine whether we already have a collection of resolutionStatus
    // Ids, and if not
    // create a new attribute. If there is no resolution status, then the
    // Set object should be cleared,
    // because we do not have to save a set of filter IDs.
    boolean hasAResolutionStatus = resolutionStatus >= 1 && resolutionStatus <= 5;
    Set<Integer> resolutionStatusIds = (HashSet) session.getAttribute(RESOLUTION_STATUS);
    // remove the session if there is no resolution status
    if (!hasAResolutionStatus && resolutionStatusIds != null) {
        session.removeAttribute(RESOLUTION_STATUS);
        resolutionStatusIds = null;
    }
    if (hasAResolutionStatus) {
        if (resolutionStatusIds == null) {
            resolutionStatusIds = new HashSet<Integer>();
        }
        resolutionStatusIds.add(resolutionStatus);
        session.setAttribute(RESOLUTION_STATUS, resolutionStatusIds);
    }
    int discNoteType = 0;
    try {
        discNoteType = Integer.parseInt(request.getParameter("type"));
    } catch (NumberFormatException nfe) {
        // Show all DN's
        discNoteType = -1;
    }
    request.setAttribute(DISCREPANCY_NOTE_TYPE, discNoteType);
    DiscrepancyNoteUtil discNoteUtil = new DiscrepancyNoteUtil();
    // Generate a summary of how we are filtering;
    Map<String, List<String>> filterSummary = discNoteUtil.generateFilterSummary(discNoteType, resolutionStatusIds);
    if (!filterSummary.isEmpty()) {
        request.setAttribute(FILTER_SUMMARY, filterSummary);
    }
    locale = LocaleResolver.getLocale(request);
    StudyBean sbean = (StudyBean) session.getAttribute("study");
    // List<DiscrepancyNoteBean> allDiscNotes = discNoteUtil.getThreadedDNotesForStudy(sbean, resolutionStatusIds, sm.getDataSource(), discNoteType, true);
    // Map stats = discNoteUtil.generateDiscNoteSummary(allDiscNotes);
    Map stats = discNoteUtil.generateDiscNoteSummaryRefactored(sm.getDataSource(), currentStudy, resolutionStatusIds, discNoteType);
    request.setAttribute("summaryMap", stats);
    Set mapKeys = stats.keySet();
    request.setAttribute("mapKeys", mapKeys);
    // < resword =
    // ResourceBundle.getBundle("org.akaza.openclinica.i18n.words",locale);
    StudyDAO studyDAO = new StudyDAO(sm.getDataSource());
    StudySubjectDAO sdao = new StudySubjectDAO(sm.getDataSource());
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    SubjectGroupMapDAO sgmdao = new SubjectGroupMapDAO(sm.getDataSource());
    StudyGroupClassDAO sgcdao = new StudyGroupClassDAO(sm.getDataSource());
    StudyGroupDAO sgdao = new StudyGroupDAO(sm.getDataSource());
    StudySubjectDAO ssdao = new StudySubjectDAO(sm.getDataSource());
    EventCRFDAO edao = new EventCRFDAO(sm.getDataSource());
    EventDefinitionCRFDAO eddao = new EventDefinitionCRFDAO(sm.getDataSource());
    SubjectDAO subdao = new SubjectDAO(sm.getDataSource());
    DiscrepancyNoteDAO dnDAO = new DiscrepancyNoteDAO(sm.getDataSource());
    ListDiscNotesSubjectTableFactory factory = new ListDiscNotesSubjectTableFactory(ResourceBundleProvider.getTermsBundle(locale));
    factory.setStudyEventDefinitionDao(seddao);
    factory.setSubjectDAO(subdao);
    factory.setStudySubjectDAO(sdao);
    factory.setStudyEventDAO(sedao);
    factory.setStudyBean(currentStudy);
    factory.setStudyGroupClassDAO(sgcdao);
    factory.setSubjectGroupMapDAO(sgmdao);
    factory.setStudyDAO(studyDAO);
    factory.setCurrentRole(currentRole);
    factory.setCurrentUser(ub);
    factory.setEventCRFDAO(edao);
    factory.setEventDefintionCRFDAO(eddao);
    factory.setStudyGroupDAO(sgdao);
    factory.setDiscrepancyNoteDAO(dnDAO);
    factory.setModule(moduleStr);
    factory.setDiscNoteType(discNoteType);
    // factory.setStudyHasDiscNotes(allDiscNotes != null &&
    // !allDiscNotes.isEmpty());
    factory.setResolutionStatus(resolutionStatus);
    factory.setResolutionStatusIds(resolutionStatusIds);
    factory.setResword(ResourceBundleProvider.getWordsBundle(locale));
    String listDiscNotesHtml = factory.createTable(request, response).render();
    request.setAttribute("listDiscNotesHtml", listDiscNotesHtml);
    forwardPage(getJSP());
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ListDiscNotesSubjectTableFactory(org.akaza.openclinica.control.submit.ListDiscNotesSubjectTableFactory) StudyGroupClassDAO(org.akaza.openclinica.dao.managestudy.StudyGroupClassDAO) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) SubjectDAO(org.akaza.openclinica.dao.submit.SubjectDAO) StudyGroupDAO(org.akaza.openclinica.dao.managestudy.StudyGroupDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) List(java.util.List) DiscrepancyNoteUtil(org.akaza.openclinica.service.DiscrepancyNoteUtil) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO) HashSet(java.util.HashSet) DiscrepancyNoteDAO(org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO) SubjectGroupMapDAO(org.akaza.openclinica.dao.submit.SubjectGroupMapDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) EventDefinitionCRFDAO(org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO) StudySubjectDAO(org.akaza.openclinica.dao.managestudy.StudySubjectDAO) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) Map(java.util.Map)

Aggregations

HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)1 ListDiscNotesSubjectTableFactory (org.akaza.openclinica.control.submit.ListDiscNotesSubjectTableFactory)1 DiscrepancyNoteDAO (org.akaza.openclinica.dao.managestudy.DiscrepancyNoteDAO)1 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)1 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)1 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)1 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)1 StudyGroupClassDAO (org.akaza.openclinica.dao.managestudy.StudyGroupClassDAO)1 StudyGroupDAO (org.akaza.openclinica.dao.managestudy.StudyGroupDAO)1 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)1 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)1 SubjectDAO (org.akaza.openclinica.dao.submit.SubjectDAO)1 SubjectGroupMapDAO (org.akaza.openclinica.dao.submit.SubjectGroupMapDAO)1 DiscrepancyNoteUtil (org.akaza.openclinica.service.DiscrepancyNoteUtil)1