use of net.sourceforge.processdash.ev.EVTaskList 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.EVTaskList in project processdash by dtuma.
the class TaskScheduleDialog method showFilteredHTML.
public void showFilteredHTML() {
TreePath selectionPath = treeTable.getTree().getSelectionPath();
if (selectionPath == null)
return;
if (!saveOrCancel(true))
return;
// If the user has selected a node in the tree that has no siblings,
// we can move up a generation and start the filtering there.
EVTask task = (EVTask) selectionPath.getLastPathComponent();
EVTask parent = task.getParent();
while (parent != null && parent.getNumChildren() == 1) {
task = parent;
parent = task.getParent();
}
// main task list. We can just display the regular, unfiltered chart.
if (parent == null) {
showReport(taskListName, getUserFilter());
return;
}
// node and launch the report.
if (isMergedView()) {
String option = EVReportSettings.MERGED_PATH_FILTER_PARAM + "=" + HTMLUtils.urlEncode(getMergedPathFilterParam(task));
showReport(taskListName, option, getUserFilter(), REPORT_URL);
return;
}
// find the root of the task list containing the selected node.
EVTask root = task;
String subPath = null;
while (root != null && root.getFlag() == null) {
subPath = root.getName() + (subPath == null ? "" : "/" + subPath);
root = root.getParent();
}
EVTaskList subSchedule = findTaskListWithRoot(model, root);
if (subSchedule == null)
return;
String option;
if (task == root) {
// The selected node happens to be the root of some subschedule. No
// filtering is needed; just display the chart for that schedule.
option = null;
} else {
// if the task isn't the schedule root, send subpath to the report
option = EVReportSettings.PATH_FILTER_PARAM + "=" + HTMLUtils.urlEncode(subPath);
}
showReport(subSchedule.getTaskListName(), option, null, REPORT_URL);
}
use of net.sourceforge.processdash.ev.EVTaskList in project processdash by dtuma.
the class TeamProjectSetupWizard method getScheduleNameErr.
private String getScheduleNameErr() {
String scheduleName = getValue(IND_SCHEDULE);
if (scheduleName == null)
return "scheduleNameMissing";
if (!EVTaskListData.validName(scheduleName))
return "scheduleNameInvalid";
DataRepository data = getDataRepository();
if (EVTaskListData.exists(data, scheduleName) || EVTaskListRollup.exists(data, scheduleName)) {
// if a task list already exists with this name, check to see if
// it is empty (i.e., contains no tasks or subschedules). If it
// is empty, then it's OK to delete and replace it. If not, we
// should display an error message indicating that this schedule
// name is already taken.
EVTaskList tl = EVTaskList.openExisting(scheduleName, data, getPSPProperties(), getObjectCache(), false);
if (tl != null && !tl.getTaskRoot().isLeaf()) {
return "scheduleNameDuplicate";
}
}
return null;
}
use of net.sourceforge.processdash.ev.EVTaskList in project processdash by dtuma.
the class EditSubprojectList method updateEVSchedule.
private void updateEVSchedule(Map subprojects) {
String teamScheduleName = getValue("Project_Schedule_Name");
logger.log(Level.FINE, "Master project {0} updating master schedule \"{1}\"", new Object[] { getPrefix(), teamScheduleName });
// open the master schedule
EVTaskList schedule = EVTaskList.openExisting(teamScheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false);
if (!(schedule instanceof EVTaskListRollup)) {
logger.log(Level.WARNING, "could not find a rollup schedule named \"{0}\"", teamScheduleName);
return;
}
// empty all the children from the current master schedule.
EVTaskListRollup master = (EVTaskListRollup) schedule;
for (int i = master.getChildCount(master.getRoot()); i-- > 0; ) {
EVTask task = (EVTask) master.getChild(master.getRoot(), i);
master.removeTask(new TreePath(task.getPath()));
}
// now add the schedules of all the subprojects.
for (Iterator i = subprojects.values().iterator(); i.hasNext(); ) {
Subproject proj = (Subproject) i.next();
String dataName = DataRepository.createDataName(proj.path, "Project_Schedule_Name");
SimpleData d = getDataRepository().getSimpleValue(dataName);
if (d == null) {
logger.warning("Could not find schedule for subproject " + proj.path);
continue;
}
String subscheduleName = d.format();
if (!master.addTask(subscheduleName, getDataRepository(), getPSPProperties(), getObjectCache(), false)) {
logger.warning("Could not add schedule for subproject " + proj.path);
}
}
master.save();
logger.fine("saved changed task list");
}
use of net.sourceforge.processdash.ev.EVTaskList in project processdash by dtuma.
the class ConfidenceIntervalMemberCompletionDateChartData method recalc.
public void recalc() {
clearSeries();
lowerBound = upperBound = null;
// 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);
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;
String seriesName = nameHelper.get(tl);
// confidence interval
if (maybeAddSeries(tl.getSchedule().getMetrics().getDateConfidenceInterval(), seriesName))
continue;
// if no confidence interval is available, see if this schedule
// is 100% complete. If so, draw a vertical line on the chart.
Date completionDate = tl.getTaskRoot().getActualDate();
if (completionDate != null && maybeAddSeries(new SingleValueConfidenceInterval(completionDate.getTime()), seriesName))
continue;
// if no interval is available and we're less than 100% complete,
// see if they have a forecast date, and draw that as a single
// point on the chart.
Date forecastDate = tl.getSchedule().getMetrics().independentForecastDate();
if (forecastDate != null && !forecastDate.equals(EVSchedule.NEVER))
maybeAddSeries(new SinglePointXYChartSeries(seriesName, forecastDate.getTime(), 0));
}
}
Aggregations