Search in sources :

Example 1 with EVTaskList

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);
}
Also used : EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) EVSchedule(net.sourceforge.processdash.ev.EVSchedule) EVTaskFilter(net.sourceforge.processdash.ev.EVTaskFilter) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) UserFilter(net.sourceforge.processdash.team.group.UserFilter) IOException(java.io.IOException) DefaultTaskLabeler(net.sourceforge.processdash.ev.DefaultTaskLabeler) Date(java.util.Date) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException) IOException(java.io.IOException) EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVDependencyCalculator(net.sourceforge.processdash.ev.EVDependencyCalculator) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 2 with EVTaskList

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);
}
Also used : TreePath(javax.swing.tree.TreePath) EVTask(net.sourceforge.processdash.ev.EVTask) EVTaskList(net.sourceforge.processdash.ev.EVTaskList)

Example 3 with EVTaskList

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;
}
Also used : EVTaskList(net.sourceforge.processdash.ev.EVTaskList) DataRepository(net.sourceforge.processdash.data.repository.DataRepository)

Example 4 with EVTaskList

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");
}
Also used : TreePath(javax.swing.tree.TreePath) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) EVTask(net.sourceforge.processdash.ev.EVTask) Iterator(java.util.Iterator) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 5 with EVTaskList

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));
    }
}
Also used : EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) SingleValueConfidenceInterval(net.sourceforge.processdash.ev.ci.SingleValueConfidenceInterval) Date(java.util.Date)

Aggregations

EVTaskList (net.sourceforge.processdash.ev.EVTaskList)26 EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)8 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)7 UserFilter (net.sourceforge.processdash.team.group.UserFilter)7 ArrayList (java.util.ArrayList)5 EVSchedule (net.sourceforge.processdash.ev.EVSchedule)5 EVTask (net.sourceforge.processdash.ev.EVTask)5 EVTaskListFilter (net.sourceforge.processdash.ev.EVTaskListFilter)5 Iterator (java.util.Iterator)4 TreePath (javax.swing.tree.TreePath)4 Date (java.util.Date)3 HashSet (java.util.HashSet)3 DefaultTaskLabeler (net.sourceforge.processdash.ev.DefaultTaskLabeler)3 EVDependencyCalculator (net.sourceforge.processdash.ev.EVDependencyCalculator)3 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)3 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 EVTaskFilter (net.sourceforge.processdash.ev.EVTaskFilter)2