use of net.sourceforge.processdash.ev.EVSchedule in project processdash by dtuma.
the class EarnedValueMemberTrendChartData method recalc.
public void recalc() {
clearSeries();
// see if the user has permission to view personal data in this chart
UserFilter f = GroupPermission.getGrantedMembers(permissionID);
if (f == null)
return;
EVTaskListFilter pf = new EVTaskListGroupFilter(f);
EVSchedule schedule = rollup.getSchedule();
double mult = 100.0 / schedule.getMetrics().totalPlan();
series.add(schedule.getPlanTrendChartSeries());
MemberChartNameHelper nameHelper = new MemberChartNameHelper(rollup);
for (int i = 0; i < rollup.getSubScheduleCount(); i++) {
EVTaskList tl = rollup.getSubSchedule(i);
String personalDataID = tl.getPersonalDataID();
if (personalDataID != null && !pf.include(personalDataID))
continue;
EVSchedule subschedule = tl.getSchedule();
String seriesName = nameHelper.get(tl);
maybeAddSeries(subschedule.getActualValueTrendChartSeries(seriesName, mult));
}
}
use of net.sourceforge.processdash.ev.EVSchedule in project processdash by dtuma.
the class EVWeekReport method writeContents.
/** Generate CGI output. */
protected void writeContents() throws IOException {
EVReportSettings settings = new EVReportSettings(getDataRepository(), parameters, getPrefix());
// Get the name of the earned value model to report on.
String taskListName = settings.getTaskListName();
if (taskListName == null)
throw new IOException("No EV task list specified.");
// Load and recalculate the named earned value model.
EVTaskList evModel = EVTaskList.openExisting(taskListName, getDataRepository(), getPSPProperties(), getObjectCache(), // change notification not required
false);
if (evModel == null)
throw new TinyCGIException(404, "Not Found", "No such task/schedule");
UserFilter f = settings.getUserGroupFilter();
if (f != null && !UserGroup.isEveryone(f) && evModel instanceof EVTaskListRollup)
((EVTaskListRollup) evModel).applyTaskListFilter(new EVTaskListGroupFilter(f));
EVTaskFilter taskFilter = settings.getEffectiveFilter(evModel);
EVTaskListFilter privacyFilter = null;
UserFilter pf = GroupPermission.getGrantedMembers(EVPermissions.PERSONAL_WEEK);
if (!UserGroup.isEveryone(pf))
privacyFilter = new EVTaskListGroupFilter(pf);
EVDependencyCalculator depCalc = new EVDependencyCalculator(getDataRepository(), getPSPProperties(), getObjectCache());
evModel.setDependencyCalculator(depCalc);
evModel.setTaskLabeler(new DefaultTaskLabeler(getDashboardContext()));
evModel.recalc();
EVSchedule schedule = evModel.getSchedule();
String effDateParam = getParameter(EFF_DATE_PARAM);
Date effDate = null;
if (effDateParam != null)
try {
effDate = new Date(Long.parseLong(effDateParam));
} catch (Exception e) {
}
boolean monthly = isMonthly(settings);
if (effDate == null || parameters.containsKey(ADJ_EFF_DATE_PARAM)) {
// if the user hasn't specified an effective date, then use the
// current time to round the effective date to the nearest week.
// With a Sunday - Saturday schedule, the following line will show
// the report for the previous week through Tuesday, and will
// start showing the next week's report on Wednesday.
Date now = effDate;
if (now == null)
now = EVCalculator.getFixedEffectiveDate();
if (now == null)
now = new Date();
int dayOffset = (monthly ? 0 : (effDate == null ? 3 : 7));
Date effDateTime = new Date(now.getTime() + EVSchedule.WEEK_MILLIS * dayOffset / 7);
// now, identify the schedule boundary that precedes the effective
// date and time; use that as the effective date.
Date scheduleEnd = schedule.getLast().getEndDate();
Date firstPeriodEnd = schedule.get(1).getEndDate();
if (effDateTime.compareTo(scheduleEnd) >= 0) {
if (effDate == null)
effDate = maybeRoundToMonthEnd(monthly, scheduleEnd);
else if (monthly)
effDate = roundToMonthEnd(effDate);
else
effDate = extrapolateWeekAfterScheduleEnd(effDateTime, scheduleEnd);
} else if (monthly) {
Date scheduleStart = schedule.get(1).getBeginDate();
if (effDateTime.before(scheduleStart))
effDateTime = scheduleStart;
effDate = roundToMonthEnd(effDateTime);
} else if (effDateTime.compareTo(firstPeriodEnd) <= 0)
effDate = firstPeriodEnd;
else
effDate = schedule.getPeriodStart(effDateTime);
// make certain we have an effective date to proceed with.
if (effDate == null)
effDate = maybeRoundToMonthEnd(monthly, new Date());
}
int purpose = PLAIN_REPORT;
if (evModel instanceof EVTaskListRollup && parameters.containsKey(SPLIT_PARAM))
purpose = SPLIT_REPORT;
writeReport(taskListName, evModel, effDate, settings, taskFilter, privacyFilter, purpose);
}
use of net.sourceforge.processdash.ev.EVSchedule in project processdash by dtuma.
the class DirectTimeMemberTrendChartData method recalc.
public void recalc() {
clearSeries();
// see if the user has permission to view personal data in this chart
UserFilter f = GroupPermission.getGrantedMembers(permissionID);
if (f == null)
return;
EVTaskListFilter pf = new EVTaskListGroupFilter(f);
EVSchedule schedule = rollup.getSchedule();
series.add(schedule.getPlanTrendChartSeries());
MemberChartNameHelper nameHelper = new MemberChartNameHelper(rollup);
for (int i = 0; i < rollup.getSubScheduleCount(); i++) {
EVTaskList tl = rollup.getSubSchedule(i);
String personalDataID = tl.getPersonalDataID();
if (personalDataID != null && !pf.include(personalDataID))
continue;
EVSchedule subschedule = tl.getSchedule();
String seriesName = nameHelper.get(tl);
maybeAddSeries(subschedule.getActualTimeTrendChartSeries(seriesName));
}
}
use of net.sourceforge.processdash.ev.EVSchedule in project processdash by dtuma.
the class EVMetricsWidget method getWidgetComponent.
public Component getWidgetComponent(Map environment, Map parameters) {
EVSchedule schedule = (EVSchedule) environment.get(EVSnippetEnvironment.SCHEDULE_KEY);
EVMetrics m = schedule.getMetrics();
JTable table = new JTable(m);
table.removeColumn(table.getColumnModel().getColumn(3));
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setPreferredSize(new Dimension(100, 100));
DescriptionPane descr = new DescriptionPane(m, table.getSelectionModel());
Box result = Box.createVerticalBox();
result.add(scrollPane);
result.add(Box.createVerticalStrut(2));
result.add(descr);
return result;
}
use of net.sourceforge.processdash.ev.EVSchedule in project processdash by dtuma.
the class EVReport method writeCombinedChart.
public void writeCombinedChart() throws IOException {
// Create the data for the chart to draw.
EVSchedule s = getEvSchedule(settings.getEffectiveFilter(evModel));
xydata = s.getCombinedChartData();
// possibly hide lines on the chart, at user request.
boolean hidePlan = settings.getBool(CUSTOMIZE_HIDE_PLAN_LINE);
if (hidePlan)
xydata = new XYDatasetFilter(xydata).setSeriesHidden("Plan_Value", hidePlan);
// Alter the appearance of the chart.
maybeWriteParam("title", "Cost & Schedule");
super.writeContents();
}
Aggregations