Search in sources :

Example 1 with PDashData

use of net.sourceforge.processdash.api.PDashData in project processdash by dtuma.

the class WBSChangeHistoryReport method loadHistory.

private void loadHistory(HttpServletRequest req) throws ProjectHistoryException {
    PDashContext ctx = PDashServletUtils.getContext(req);
    PDashData data = ctx.getData();
    ProjectHistory hist = ProjectHistoryFactory.getProjectHistory(data);
    if (hist == null)
        throw new ProjectHistoryException("Not_Team_Project_HTML_FMT", ctx.getProjectPath());
    String dateParam = req.getParameter("before");
    Date beforeDate = dateParam == null ? null : new Date(Long.parseLong(dateParam));
    ProjectChangeList changes;
    try {
        changes = ProjectChangeListFactory.getChanges(hist, beforeDate, 10, true, true);
    } catch (IOException ioe) {
        throw hist.wrapException(ioe);
    }
    req.setAttribute("changes", changes);
    req.setAttribute("followupTimestamp", changes.getFollowupTimestamp());
    // compute the URI that will be used to open WBS hyperlinks
    String processID = data.getString("Team_Process_PID");
    String modeIndicator = Settings.isPersonalMode() ? "indiv" : "forteam";
    String openWbsUri = "../" + processID + "/setup/openWBS.shtm?trigger&" + modeIndicator + "&showItem=";
    req.setAttribute("openWbsUri", openWbsUri);
}
Also used : PDashContext(net.sourceforge.processdash.api.PDashContext) ProjectChangeList(teamdash.hist.ProjectChangeList) PDashData(net.sourceforge.processdash.api.PDashData) ProjectHistory(teamdash.hist.ProjectHistory) IOException(java.io.IOException) ProjectHistoryException(teamdash.hist.ProjectHistoryException) Date(java.util.Date)

Example 2 with PDashData

use of net.sourceforge.processdash.api.PDashData 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

Date (java.util.Date)2 PDashContext (net.sourceforge.processdash.api.PDashContext)2 PDashData (net.sourceforge.processdash.api.PDashData)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 PDashQuery (net.sourceforge.processdash.api.PDashQuery)1 PersonFilter (net.sourceforge.processdash.tool.db.PersonFilter)1 ProjectChangeList (teamdash.hist.ProjectChangeList)1 ProjectHistory (teamdash.hist.ProjectHistory)1 ProjectHistoryException (teamdash.hist.ProjectHistoryException)1