Search in sources :

Example 1 with PersonFilter

use of net.sourceforge.processdash.tool.db.PersonFilter in project processdash by dtuma.

the class CompletedTasksMissingTime method getItems.

@Override
protected List<Object[]> getItems() throws IOException {
    // ensure the user has permission to view tasks with missing time
    PersonFilter privacyFilter = new //
    PersonFilter(//
    PERMISSION, getPdash().getQuery());
    if (privacyFilter.isBlock())
        return Collections.EMPTY_LIST;
    List<Object[]> items = super.getItems();
    for (Iterator<Object[]> i = items.iterator(); i.hasNext(); ) {
        Object[] row = i.next();
        Object personKey = row[7];
        if (!privacyFilter.include(personKey))
            i.remove();
    }
    return items;
}
Also used : PersonFilter(net.sourceforge.processdash.tool.db.PersonFilter)

Example 2 with PersonFilter

use of net.sourceforge.processdash.tool.db.PersonFilter in project processdash by dtuma.

the class SkippedWorkflowSteps method getItems.

@Override
protected List<Object[]> getItems() throws IOException {
    // ensure the user has permission to view skipped workflow steps
    PersonFilter privacyFilter = new //
    PersonFilter(//
    PERMISSION, getPdash().getQuery());
    if (privacyFilter.isBlock())
        return Collections.EMPTY_LIST;
    List<Object[]> allTasks = super.getItems();
    List<Object[]> skippedTasks = new LinkedList();
    int pos = 0;
    while (pos < allTasks.size()) {
        List<Object[]> enactmentTasks = getTasksForEnactment(allTasks, pos);
        if (shouldProcessEnactment(enactmentTasks)) {
            sortTasksWithinEnactment(enactmentTasks);
            findSkippedTasksInEnactment(skippedTasks, enactmentTasks, privacyFilter);
        }
        pos += enactmentTasks.size();
    }
    return skippedTasks;
}
Also used : PersonFilter(net.sourceforge.processdash.tool.db.PersonFilter) LinkedList(java.util.LinkedList)

Example 3 with PersonFilter

use of net.sourceforge.processdash.tool.db.PersonFilter in project processdash by dtuma.

the class RecentReviews method loadReviewData.

private void loadReviewData(HttpServletRequest req) throws IOException {
    // retrieve metadata about the team process
    PDashContext pdash = (PDashContext) req.getAttribute(PDashContext.REQUEST_ATTR);
    PDashData data = pdash.getData();
    String processID = data.getString(TeamDataConstants.PROCESS_ID);
    List<String> reviewPhases = data.getList("/" + processID + "/Review_Phase_List");
    // ensure the user has permission to view recent reviews
    PDashQuery query = pdash.getQuery();
    PersonFilter privacyFilter = new PersonFilter(PERMISSION, query);
    if (privacyFilter.isBlock()) {
        req.setAttribute("blocked", Boolean.TRUE);
        return;
    }
    // query the database for data about recently completed reviews
    String[] hql = getHql(req);
    List<Object[]> taskData = query.query(hql[0], processID, reviewPhases);
    List<Integer> planItemKeys = QueryUtils.pluckColumn(taskData, 0);
    List<Object[]> defectCounts = query.query(hql[1], planItemKeys);
    // build objects to hold the resulting data
    List<ReviewRow> reviews = new ArrayList<RecentReviews.ReviewRow>();
    for (Object[] oneRow : taskData) {
        if (privacyFilter.include(oneRow[8]))
            reviews.add(new ReviewRow(oneRow));
    }
    for (Object[] oneRow : defectCounts) storeDefectCounts(reviews, oneRow);
    req.setAttribute("reviews", reviews);
    // flag older reviews if necessary
    if (!reviews.isEmpty()) {
        Date newestDate = reviews.get(reviews.size() - 1).completionDate;
        long cutoff = newestDate.getTime() - 2 * DateUtils.WEEKS;
        boolean oneHidden = false;
        for (ReviewRow review : reviews) {
            if (review.setCutoff(cutoff))
                oneHidden = true;
        }
        req.setAttribute("hasHiddenRows", oneHidden);
    }
}
Also used : PersonFilter(net.sourceforge.processdash.tool.db.PersonFilter) PDashQuery(net.sourceforge.processdash.api.PDashQuery) ArrayList(java.util.ArrayList) PDashData(net.sourceforge.processdash.api.PDashData) Date(java.util.Date) PDashContext(net.sourceforge.processdash.api.PDashContext)

Aggregations

PersonFilter (net.sourceforge.processdash.tool.db.PersonFilter)3 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 PDashContext (net.sourceforge.processdash.api.PDashContext)1 PDashData (net.sourceforge.processdash.api.PDashData)1 PDashQuery (net.sourceforge.processdash.api.PDashQuery)1