Search in sources :

Example 6 with MatcherKey

use of org.jmesa.core.filter.MatcherKey in project OpenClinica by OpenClinica.

the class ViewRuleAssignmentTableFactory method configureTableFacade.

@Override
public void configureTableFacade(HttpServletResponse response, TableFacade tableFacade) {
    super.configureTableFacade(response, tableFacade);
    getColumnNamesMap();
    tableFacade.addFilterMatcher(new MatcherKey(Date.class, "loginAttemptDate"), new DateFilterMatcher("yyyy-MM-dd HH:mm"));
    tableFacade.addFilterMatcher(new MatcherKey(LoginStatus.class, "loginStatus"), new AvailableFilterMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "actionExecuteOn"), new GenericFilterMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "actionType"), new GenericFilterMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "actionSummary"), new GenericFilterMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "ruleSetRuleStatus"), new GenericFilterMatcher());
}
Also used : LoginStatus(org.akaza.openclinica.domain.technicaladmin.LoginStatus) DateFilterMatcher(org.jmesa.core.filter.DateFilterMatcher) Date(java.util.Date) MatcherKey(org.jmesa.core.filter.MatcherKey)

Example 7 with MatcherKey

use of org.jmesa.core.filter.MatcherKey in project OpenClinica by OpenClinica.

the class SDVUtil method renderSubjectsTableWithLimit.

public String renderSubjectsTableWithLimit(HttpServletRequest request, int studyId, int studySubjectId) {
    TableFacade tableFacade = createTableFacade("sdv", request);
    tableFacade.setStateAttr("restore");
    /*StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
        StudySubjectBean subjectBean = (StudySubjectBean) studySubjectDAO.findByPK(studySubjectId);*/
    String[] allColumns = new String[] { "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions" };
    tableFacade.setColumnProperties("studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions");
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "studySubjectStatus"), new SubjectStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "crfStatus"), new CrfStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvStatusActions"), new SdvStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvRequirementDefinition"), new SDVRequirementMatcher());
    int totalRowCount = 0;
    totalRowCount = setDataAndLimitVariablesSubjects(tableFacade, studyId, studySubjectId, request);
    //tableFacade.setItems(items);
    HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
    HtmlColumn studySubjectStatus = row.getColumn("studySubjectStatus");
    studySubjectStatus.getFilterRenderer().setFilterEditor(new SubjectStatusFilter());
    HtmlColumn crfStatus = row.getColumn("crfStatus");
    crfStatus.getFilterRenderer().setFilterEditor(new CrfStatusFilter());
    HtmlColumn sdvStatus = row.getColumn("sdvStatusActions");
    sdvStatus.getFilterRenderer().setFilterEditor(new SdvStatusFilter());
    HtmlColumn sdvRequirementDefinition = row.getColumn("sdvRequirementDefinition");
    sdvRequirementDefinition.getFilterRenderer().setFilterEditor(new SDVRequirementFilter());
    //fix HTML in columns
    setHtmlCellEditors(tableFacade, allColumns, true);
    //temporarily disable some of the filters for now
    turnOffFilters(tableFacade, new String[] { "personId", "secondaryId", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "lastUpdatedDate", "lastUpdatedBy" });
    //Create the custom toolbar
    SDVToolbar sDVToolbar = new SDVToolbar(true);
    // if(totalRowCount > 0){
    sDVToolbar.setMaxRowsIncrements(new int[] { 15, 50, totalRowCount });
    tableFacade.setToolbar(sDVToolbar);
    //Fix column titles
    HtmlTable table = (HtmlTable) tableFacade.getTable();
    //i18n caption; TODO: convert to Spring messages
    ResourceBundle resword = ResourceBundle.getBundle("org.akaza.openclinica.i18n.words", LocaleResolver.getLocale(request));
    String[] allTitles = { resword.getString("study_subject_ID"), resword.getString("site_id"), resword.getString("person_ID"), resword.getString("secondary_ID"), resword.getString("event_name"), resword.getString("event_date"), resword.getString("enrollment_date"), resword.getString("subject_status"), resword.getString("CRF_name") + " / " + resword.getString("version"), resword.getString("SDV_requirement"), resword.getString("CRF_status"), resword.getString("last_updated_date"), resword.getString("last_updated_by"), resword.getString("study_event_status"), resword.getString("SDV_status") + " / " + resword.getString("actions") };
    setTitles(allTitles, table);
    //format column dates
    formatColumns(table, new String[] { "eventDate", "enrollmentDate", "lastUpdatedDate" }, request);
    table.getTableRenderer().setWidth("800");
    return tableFacade.render();
}
Also used : HtmlTable(org.jmesa.view.html.component.HtmlTable) HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn) SDVToolbar(org.akaza.openclinica.controller.helper.table.SDVToolbar) TableFacadeFactory.createTableFacade(org.jmesa.facade.TableFacadeFactory.createTableFacade) TableFacade(org.jmesa.facade.TableFacade) ResourceBundle(java.util.ResourceBundle) MatcherKey(org.jmesa.core.filter.MatcherKey)

Example 8 with MatcherKey

use of org.jmesa.core.filter.MatcherKey in project OpenClinica by OpenClinica.

the class SDVUtil method renderEventCRFTableWithLimit.

/*
    private int getTotalRowCount(FilterSet filterSet, int studyId) {


        EventCRFDAO eventCRFDAO = new EventCRFDAO(dataSource);

        if (filterSet.getFilters().size() == 0) {
            return eventCRFDAO.countEventCRFsByStudy(studyId, studyId);
        }

        int count = 0;
        //Filter for study subject label
        StudySubjectDAO studySubjectDAO = new StudySubjectDAO(dataSource);
        StudySubjectBean studySubjectBean = new StudySubjectBean();
        StudyDAO studyDAO = new StudyDAO(dataSource);
        StudyBean studyBean = (StudyBean) studyDAO.findByPK(studyId);
        String subjectValue = "";
        String eventNameValue = "";
        String eventDateValue = "";
        String crfStatus = "";
        String sdvStatus = "";
        String studyIdentifier = "";
        String sdvRequirement = "";

        for (Filter filter : filterSet.getFilters()) {

            if (filter.getProperty().equalsIgnoreCase("studySubjectId")) {
                subjectValue = filter.getValue();
                continue;
            }
            if (filter.getProperty().equalsIgnoreCase("eventName")) {
                eventNameValue = filter.getValue();
                continue;
            }

            if (filter.getProperty().equalsIgnoreCase("eventDate")) {
                eventDateValue = filter.getValue();
                continue;
            }

            if (filter.getProperty().equalsIgnoreCase("crfStatus")) {
                crfStatus = filter.getValue();
                continue;
            }

            if (filter.getProperty().equalsIgnoreCase("sdvStatus")) {
                sdvStatus = filter.getValue();
            }

            if (filter.getProperty().equalsIgnoreCase("studyIdentifier")) {
                studyIdentifier = filter.getValue();
            }

            if (filter.getProperty().equalsIgnoreCase("sdvRequirementDefinition")) {
                sdvRequirement = filter.getValue();
            }
        }

        SourceDataVerification sourceDataVerification = null;

        if (subjectValue.length() > 0) {
            return eventCRFDAO.countEventCRFsByStudySubjectLabel(subjectValue, studyId, studyId);
        }

        if (eventNameValue.length() > 0) {
            return eventCRFDAO.countEventCRFsByEventName(eventNameValue);
        }

        if (eventDateValue.length() > 0) {
            return eventCRFDAO.countEventCRFsByEventDate(studyId, eventDateValue);
        }
        //SubjectEventStatus.getSubjectEventStatusIdByName(crfStatus)
        if (crfStatus.length() > 0) {
            return eventCRFDAO.countEventCRFsByCRFStatus(studyId, Integer.parseInt(crfStatus));
        }

        if (sdvStatus.length() > 0) {
            return eventCRFDAO.countEventCRFsByStudySDV(studyId, ("complete".equalsIgnoreCase(sdvStatus)));
        }

        if (studyIdentifier.length() > 0) {
            return eventCRFDAO.countEventCRFsByStudyIdentifier(studyId, studyId, studyIdentifier);
        }

        if (sdvRequirement.length() > 0) {
            ArrayList<Integer> reqs = new ArrayList<Integer>();
            if (sdvRequirement.contains("&")) {
                for (String requirement : sdvRequirement.split("&")) {
                    reqs.add(SourceDataVerification.getByI18nDescription(requirement.trim()).getCode());
                }
            } else {
                reqs.add(SourceDataVerification.getByI18nDescription(sdvRequirement.trim()).getCode());
            }
            if (reqs.size() > 0) {
                Integer[] a = { 1 };
                return eventCRFDAO.countEventCRFsBySDVRequirement(studyId, studyId, reqs.toArray(a));
            }
        }

        return eventCRFDAO.countEventCRFsByStudy(studyId, studyId);
    }
    */
/*public String renderAllEventCRFTable(List<EventCRFBean> eventCRFBeans,
                                         HttpServletRequest request){

        Collection<SubjectSDVContainer> items = getSubjectRows(eventCRFBeans,request);

        //The number of items represents the total number of returned rows
        int totalRowCount =0;
        if(items != null && items.size() > 0) {
            totalRowCount = items.size();
        }
        TableFacade tableFacade = createTableFacade("sdv", request);
        tableFacade.setStateAttr("restore");

        String[] allColumns = new String[]{"studySubjectId","personId","secondaryId",
          "eventName", "eventDate","enrollmentDate","studySubjectStatus","crfNameVersion","crfStatus",
          "lastUpdatedDate","lastUpdatedBy","sdvStatusActions"};

        tableFacade.setColumnProperties("studySubjectId","personId","secondaryId",
          "eventName",
          "eventDate","enrollmentDate","studySubjectStatus","crfNameVersion","crfStatus",
          "lastUpdatedDate",
          "lastUpdatedBy","sdvStatusActions");

        tableFacade.addFilterMatcher(new MatcherKey(String.class, "studySubjectStatus"),
          new SubjectStatusMatcher());
        tableFacade.setItems(items);

        HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
        HtmlColumn studySubjectStatus = row.getColumn("studySubjectStatus");
        studySubjectStatus.getFilterRenderer().setFilterEditor(new SubjectStatusFilter());


        //fix HTML in columns
        setHtmlCellEditors(tableFacade,allColumns,true);


        //Create the custom toolbar
        SDVToolbar  sDVToolbar = new SDVToolbar();

        // if(totalRowCount > 0){
        if(totalRowCount <= 25){
            sDVToolbar.setMaxRowsIncrements(new int[]{10,15,totalRowCount});}
        else if(totalRowCount <= 50){
            sDVToolbar.setMaxRowsIncrements(new int[]{10,25,totalRowCount});
        } else if(totalRowCount > 0) {
            sDVToolbar.setMaxRowsIncrements(new int[]{15,50,100});
        }
        tableFacade.setToolbar(sDVToolbar);

        //Fix column titles
        HtmlTable table = (HtmlTable) tableFacade.getTable();
        //i18n caption; TODO: convert to Spring messages
        ResourceBundle resourceBundle = ResourceBundle.getBundle(
          "org.akaza.openclinica.i18n.words",LocaleResolver.getLocale(request));

        String[] allTitles = {"Study Subject Id","Person Id","Secondary Id" ,"Event Name",
          "Event Date","Enrollment Date","Subject Status","CRF Name / Version","CRF Status",
          "Last Updated Date",
          "Last Updated By","SDV Status / Actions"};

        setTitles(allTitles,table);

        //format column dates
        formatColumns(table,new String[]{"eventDate","enrollmentDate","lastUpdatedDate"},
          request);

        table.getTableRenderer().setWidth("800");
        return tableFacade.render();
    }*/
public String renderEventCRFTableWithLimit(HttpServletRequest request, int studyId, String pathPrefix) {
    //boolean showMoreLink = Boolean.parseBoolean(request.getAttribute("showMoreLink").toString());//commented by Jamuna, throwing null pointer exception
    boolean showMoreLink = Boolean.parseBoolean(request.getAttribute("showMoreLink") == null ? "false" : request.getAttribute("showMoreLink").toString());
    TableFacade tableFacade = createTableFacade("sdv", request);
    tableFacade.setStateAttr("sdv_restore");
    resformat = ResourceBundleProvider.getFormatBundle(LocaleResolver.getLocale(request));
    this.pathPrefix = pathPrefix;
    String[] allColumns = new String[] { "sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions" };
    tableFacade.setColumnProperties("sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions");
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "studySubjectStatus"), new SubjectStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "crfStatus"), new CrfStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvStatus"), new SdvStatusMatcher());
    tableFacade.addFilterMatcher(new MatcherKey(String.class, "sdvRequirementDefinition"), new SDVRequirementMatcher());
    this.setDataAndLimitVariables(tableFacade, studyId, request);
    //tableFacade.setItems(items);
    HtmlRow row = (HtmlRow) tableFacade.getTable().getRow();
    HtmlColumn studySubjectStatus = row.getColumn("studySubjectStatus");
    studySubjectStatus.getFilterRenderer().setFilterEditor(new SubjectStatusFilter());
    HtmlColumn crfStatus = row.getColumn("crfStatus");
    crfStatus.getFilterRenderer().setFilterEditor(new CrfStatusFilter());
    HtmlColumn actions = row.getColumn("sdvStatusActions");
    actions.getFilterRenderer().setFilterEditor(new DefaultActionsEditor(LocaleResolver.getLocale(request)));
    HtmlColumn sdvStatus = row.getColumn("sdvStatus");
    sdvStatus.getFilterRenderer().setFilterEditor(new SdvStatusFilter());
    HtmlColumn sdvRequirementDefinition = row.getColumn("sdvRequirementDefinition");
    sdvRequirementDefinition.getFilterRenderer().setFilterEditor(new SDVRequirementFilter());
    //fix HTML in columns
    setHtmlCellEditors(tableFacade, allColumns, true);
    //temporarily disable some of the filters for now
    turnOffFilters(tableFacade, new String[] { "personId", "secondaryId", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "lastUpdatedDate", "lastUpdatedBy", "eventDate", "studyEventStatus" });
    turnOffSorts(tableFacade, new String[] { "sdvStatus", "studySubjectId", "studyIdentifier", "personId", "secondaryId", "eventName", "eventDate", "enrollmentDate", "studySubjectStatus", "crfNameVersion", "sdvRequirementDefinition", "crfStatus", "lastUpdatedDate", "lastUpdatedBy", "studyEventStatus", "sdvStatusActions" });
    //Create the custom toolbar
    SDVToolbar sDVToolbar = new SDVToolbar(showMoreLink);
    // if(totalRowCount > 0){
    sDVToolbar.setMaxRowsIncrements(new int[] { 15, 25, 50 });
    tableFacade.setToolbar(sDVToolbar);
    tableFacade.setView(new SDVView(LocaleResolver.getLocale(request), request));
    //Fix column titles
    HtmlTable table = (HtmlTable) tableFacade.getTable();
    //i18n caption; TODO: convert to Spring messages
    ResourceBundle resword = ResourceBundle.getBundle("org.akaza.openclinica.i18n.words", LocaleResolver.getLocale(request));
    String[] allTitles = { resword.getString("SDV_status"), resword.getString("study_subject_ID"), resword.getString("site_id"), resword.getString("person_ID"), resword.getString("secondary_ID"), resword.getString("event_name"), resword.getString("event_date"), resword.getString("enrollment_date"), resword.getString("subject_status"), resword.getString("CRF_name") + " / " + resword.getString("version"), resword.getString("SDV_requirement"), resword.getString("CRF_status"), resword.getString("last_updated_date"), resword.getString("last_updated_by"), resword.getString("study_event_status"), resword.getString("actions") };
    setTitles(allTitles, table);
    //format column dates
    formatColumns(table, new String[] { "eventDate", "enrollmentDate", "lastUpdatedDate" }, request);
    table.getTableRenderer().setWidth("800");
    return tableFacade.render();
}
Also used : HtmlTable(org.jmesa.view.html.component.HtmlTable) HtmlRow(org.jmesa.view.html.component.HtmlRow) HtmlColumn(org.jmesa.view.html.component.HtmlColumn) SDVToolbar(org.akaza.openclinica.controller.helper.table.SDVToolbar) TableFacadeFactory.createTableFacade(org.jmesa.facade.TableFacadeFactory.createTableFacade) TableFacade(org.jmesa.facade.TableFacade) DefaultActionsEditor(org.akaza.openclinica.control.DefaultActionsEditor) ResourceBundle(java.util.ResourceBundle) MatcherKey(org.jmesa.core.filter.MatcherKey)

Example 9 with MatcherKey

use of org.jmesa.core.filter.MatcherKey in project OpenClinica by OpenClinica.

the class ListSubjectTableFactory method configureTableFacade.

@Override
public void configureTableFacade(HttpServletResponse response, TableFacade tableFacade) {
    super.configureTableFacade(response, tableFacade);
    tableFacade.addFilterMatcher(new MatcherKey(Date.class, "subject.createdDate"), new DateFilterMatcher(getDateFormat()));
    tableFacade.addFilterMatcher(new MatcherKey(Date.class, "subject.updatedDate"), new DateFilterMatcher(getDateFormat()));
    // tableFacade.addFilterMatcher(new MatcherKey(Status.class, "subject.status"), new GenericFilterMatecher());
    tableFacade.addFilterMatcher(new MatcherKey(Status.class, "subject.status"), new StatusFilterMatecher());
    tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class, "subject.owner"), new GenericFilterMatecher());
    tableFacade.addFilterMatcher(new MatcherKey(UserAccountBean.class, "subject.updater"), new GenericFilterMatecher());
}
Also used : Status(org.akaza.openclinica.bean.core.Status) UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) DateFilterMatcher(org.jmesa.core.filter.DateFilterMatcher) Date(java.util.Date) MatcherKey(org.jmesa.core.filter.MatcherKey)

Example 10 with MatcherKey

use of org.jmesa.core.filter.MatcherKey in project OpenClinica by OpenClinica.

the class EventStatusStatisticsTableFactory method configureTableFacade.

@Override
public void configureTableFacade(HttpServletResponse response, TableFacade tableFacade) {
    super.configureTableFacade(response, tableFacade);
    tableFacade.addFilterMatcher(new MatcherKey(Date.class, "loginAttemptDate"), new DateFilterMatcher("yyyy-MM-dd hh:mm"));
}
Also used : DateFilterMatcher(org.jmesa.core.filter.DateFilterMatcher) Date(java.util.Date) MatcherKey(org.jmesa.core.filter.MatcherKey)

Aggregations

MatcherKey (org.jmesa.core.filter.MatcherKey)15 Date (java.util.Date)8 DateFilterMatcher (org.jmesa.core.filter.DateFilterMatcher)8 Status (org.akaza.openclinica.bean.core.Status)6 SubjectEventStatus (org.akaza.openclinica.bean.core.SubjectEventStatus)4 ResourceBundle (java.util.ResourceBundle)2 ResolutionStatus (org.akaza.openclinica.bean.core.ResolutionStatus)2 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)2 SDVToolbar (org.akaza.openclinica.controller.helper.table.SDVToolbar)2 LoginStatus (org.akaza.openclinica.domain.technicaladmin.LoginStatus)2 TableFacade (org.jmesa.facade.TableFacade)2 TableFacadeFactory.createTableFacade (org.jmesa.facade.TableFacadeFactory.createTableFacade)2 HtmlColumn (org.jmesa.view.html.component.HtmlColumn)2 HtmlRow (org.jmesa.view.html.component.HtmlRow)2 HtmlTable (org.jmesa.view.html.component.HtmlTable)2 DefaultActionsEditor (org.akaza.openclinica.control.DefaultActionsEditor)1