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);
}
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);
}
}
Aggregations