Search in sources :

Example 6 with EVTaskListRollup

use of net.sourceforge.processdash.ev.EVTaskListRollup in project processdash by dtuma.

the class TeamProjectSetupWizard method createTeamSchedule.

protected String createTeamSchedule(String scheduleName) {
    DataRepository data = getDataRepository();
    EVTaskListRollup rollup = new EVTaskListRollup(scheduleName, data, getPSPProperties(), getObjectCache(), false);
    rollup.save();
    // publish the newly created schedule, with no password required.
    String passwordDataName = "/ev /" + scheduleName + "/_Password_";
    data.putValue(passwordDataName, ImmutableDoubleData.TRUE);
    passwordDataName = "/ev /" + scheduleName + "/PW_STOR";
    data.putValue(passwordDataName, StringData.create(" none "));
    return rollup.getID();
}
Also used : EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) DataRepository(net.sourceforge.processdash.data.repository.DataRepository)

Example 7 with EVTaskListRollup

use of net.sourceforge.processdash.ev.EVTaskListRollup in project processdash by dtuma.

the class DataExtractionScaffold method getEVTaskLists.

private List<EVTaskList> getEVTaskLists(boolean includePersonal, boolean includeRollups) {
    String[] taskListNames = EVTaskList.findTaskLists(data);
    List<EVTaskList> result = new ArrayList<EVTaskList>(taskListNames.length);
    TaskLabeler taskLabeler = null;
    for (String taskListName : taskListNames) {
        EVTaskList tl = EVTaskList.openExisting(taskListName, data, hierarchy, null, false);
        if (tl instanceof EVTaskListData && !includePersonal)
            continue;
        if (tl instanceof EVTaskListRollup && !includeRollups)
            continue;
        tl.recalc();
        tl = new EVTaskListMerged(tl, false, true, null);
        if (taskLabeler == null) {
            taskLabeler = new DefaultTaskLabeler(this);
            taskLabeler.recalculate();
        }
        tl.setTaskLabeler(taskLabeler);
        result.add(tl);
    }
    return result;
}
Also used : DefaultTaskLabeler(net.sourceforge.processdash.ev.DefaultTaskLabeler) TaskLabeler(net.sourceforge.processdash.ev.TaskLabeler) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) ArrayList(java.util.ArrayList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) EVTaskListMerged(net.sourceforge.processdash.ev.EVTaskListMerged) DefaultTaskLabeler(net.sourceforge.processdash.ev.DefaultTaskLabeler)

Example 8 with EVTaskListRollup

use of net.sourceforge.processdash.ev.EVTaskListRollup in project processdash by dtuma.

the class EVWeekReport method writeReport.

private void writeReport(String taskListName, EVTaskList evModel, Date effDate, EVReportSettings settings, EVTaskFilter taskFilter, EVTaskListFilter privacyFilter, int purpose) throws IOException {
    EVSchedule schedule = evModel.getSchedule();
    double totalPlanTime = schedule.getMetrics().totalPlan();
    boolean hideNames = settings.getBool(EVReport.CUSTOMIZE_HIDE_NAMES);
    boolean showAssignedTo = (evModel instanceof EVTaskListRollup) && !hideNames;
    boolean showTimingIcons = (evModel instanceof EVTaskListData && !isExporting() && purpose == PLAIN_REPORT);
    boolean showMilestones = evModel.showMilestoneColumn();
    boolean showLabels = evModel.showLabelsColumn();
    int numOptionalCols = //
    (showAssignedTo ? 1 : 0) + (showMilestones ? 1 : 0) + (showLabels ? 1 : 0);
    boolean monthly = isMonthly(settings);
    Resources effRes = (monthly ? monthRes : resources);
    // Calculate the dates one week/month before and after the effective date.
    Date lastWeek, nextWeek;
    if (monthly) {
        long eff = effDate.getTime();
        lastWeek = roundToMonthEnd(new Date(eff - 5 * MILLIS_PER_WEEK));
        nextWeek = roundToMonthEnd(new Date(eff + MILLIS_PER_WEEK));
    } else {
        lastWeek = adjustDate(effDate, -EVSchedule.WEEK_MILLIS);
        nextWeek = adjustDate(effDate, EVSchedule.WEEK_MILLIS);
    }
    Date startDate = schedule.getStartDate();
    if (lastWeek.before(startDate))
        lastWeek = startDate;
    Date effDateDisplay = new Date(effDate.getTime() - 1000);
    Date nextWeekDisplay = new Date(nextWeek.getTime() - 1000);
    // calculate flags describing whether the actual current date falls
    // within our reporting period
    long now = System.currentTimeMillis();
    boolean reportingPeriodIncludesToday = (lastWeek.getTime() < now && now <= effDate.getTime());
    boolean reportingPeriodPrecedesToday = (effDate.getTime() < now && now <= nextWeek.getTime());
    // Calculate future cutoff dates for task dependency display
    Date dependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numDependencyWeeks", monthly ? 5 : 3));
    Date revDependDate = getFutureCutoffDate(effDate, Settings.getInt("ev.numReverseDependencyWeeks", 6));
    // Get a slice of the schedule representing the previous week.
    EVSchedule filteredSchedule = getEvSchedule(evModel, taskFilter);
    EVSchedule.Period weekSlice = EVScheduleRollup.getSlice(filteredSchedule, lastWeek, effDate);
    // Now scan the task list looking for information we need.
    TableModel tasks = evModel.getSimpleTableModel(taskFilter);
    int taskListLen = tasks.getRowCount();
    // keep track of tasks that should be displayed in the three lists.
    boolean[] completedLastWeek = new boolean[taskListLen];
    boolean[] inProgressThisWeek = new boolean[taskListLen];
    boolean[] dueThroughNextWeek = new boolean[taskListLen];
    byte[] progress = new byte[taskListLen];
    Map<String, DependencyForCoord> upcomingDependencies = new HashMap<String, DependencyForCoord>();
    List<RevDependencyForCoord> reverseDependencies = new ArrayList<RevDependencyForCoord>();
    Arrays.fill(completedLastWeek, false);
    Arrays.fill(inProgressThisWeek, false);
    Arrays.fill(dueThroughNextWeek, false);
    boolean oneCompletedLastWeek = false;
    boolean oneInProgressThisWeek = false;
    boolean oneDueNextWeek = false;
    // keep track of the people assigned to the current schedule
    Set allIndividuals = new HashSet();
    String ignoreIndividual = null;
    if (evModel instanceof EVTaskListData && purpose == PLAIN_REPORT)
        allIndividuals.add(ignoreIndividual = getOwner());
    // retrieve information about the actual time that was logged to tasks
    // during the effective time period
    double[] actualTimeThisWeek = getActualTimeSpent(tasks, lastWeek, effDate);
    double completedTasksTimeThisWeek = 0;
    double inProgressTasksTimeThisWeek = 0;
    // keep track of the two total plan/actual time to date for
    // completed tasks.
    double completedTasksTotalPlanTime = 0;
    double completedTasksTotalActualTime = 0;
    // keep track of plan and actual value, this week and to date
    double planValueThisWeek = 0;
    double valueEarnedThisWeek = 0;
    double planValueToDate = 0;
    double valueEarnedToDate = 0;
    for (int i = 0; i < taskListLen; i++) {
        double taskValue = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_DTIME_COLUMN));
        Date completed = (Date) tasks.getValueAt(i, EVTaskList.DATE_COMPLETE_COLUMN);
        // check to see if the task was due this week, or in the past
        Date due = (Date) tasks.getValueAt(i, EVTaskList.PLAN_DATE_COLUMN);
        if (due != null && due.before(effDate)) {
            planValueToDate += taskValue;
            if (!due.before(lastWeek))
                planValueThisWeek += taskValue;
        }
        if (completed != null && completed.before(effDate)) {
            completedTasksTotalPlanTime += taskValue;
            completedTasksTotalActualTime += parseTime(tasks.getValueAt(i, -EVTaskList.ACT_DTIME_COLUMN));
            valueEarnedToDate += taskValue;
            if (!completed.before(lastWeek) && completed.before(nextWeek)) {
                completedLastWeek[i] = oneCompletedLastWeek = true;
                completedTasksTimeThisWeek += actualTimeThisWeek[i];
                valueEarnedThisWeek += taskValue;
            } else if (actualTimeThisWeek[i] > 0) {
                // if the task was marked complete in the past, but
                // someone logged time against it this week, display
                // it in the "in progress" table.
                inProgressThisWeek[i] = oneInProgressThisWeek = true;
                inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
            }
        } else {
            Date replannedDue = (Date) tasks.getValueAt(i, EVTaskList.REPLAN_DATE_COLUMN);
            Date taskStarted = (Date) tasks.getValueAt(i, EVTaskList.ACT_START_DATE_COLUMN);
            // Check to see if the task was in progress this week
            if (taskStarted != null && taskStarted.before(effDate) && (completed == null || completed.after(effDate))) {
                inProgressThisWeek[i] = oneInProgressThisWeek = true;
                inProgressTasksTimeThisWeek += actualTimeThisWeek[i];
            }
            // Check to see if the task is due next week
            if ((due != null && due.after(startDate) && due.before(nextWeek)) || (replannedDue != null && replannedDue.after(startDate) && replannedDue.before(nextWeek))) {
                dueThroughNextWeek[i] = oneDueNextWeek = true;
            }
            if ((inProgressThisWeek[i] || dueThroughNextWeek[i]) && (due != null)) {
                if (!due.after(effDate))
                    progress[i] = BEHIND_SCHEDULE;
                else if (due.after(nextWeek))
                    progress[i] = AHEAD_OF_SCHEDULE;
            }
            Date projectedDate = (Date) tasks.getValueAt(i, EVTaskList.PROJ_DATE_COLUMN);
            findUpcomingDependencies(tasks, upcomingDependencies, i, projectedDate, dependDate, ignoreIndividual);
            // point in collecting reverse dependencies.
            if (!hideNames)
                findReverseDependencies(tasks, reverseDependencies, revDependDate, i);
        }
        List assignedTo = (List) tasks.getValueAt(i, -EVTaskList.ASSIGNED_TO_COLUMN);
        if (assignedTo != null)
            allIndividuals.addAll(assignedTo);
    }
    double cpi = completedTasksTotalPlanTime / completedTasksTotalActualTime;
    boolean showTimeThisWeek = (completedTasksTimeThisWeek > 0 || inProgressTasksTimeThisWeek > 0);
    // look up planned values from the schedule, if appropriate
    if (!monthly || Settings.getBool("ev.month.extrapolatePV", true)) {
        planValueThisWeek = weekSlice.planValue();
        planValueToDate = weekSlice.getCumPlanValue();
    }
    // look up earned values from the schedule, if not in monthly mode
    if (!monthly) {
        valueEarnedThisWeek = weekSlice.earnedValue();
        valueEarnedToDate = weekSlice.getCumEarnedValue();
    }
    if (isTopLevel(purpose)) {
        String taskListDisplayName = EVTaskList.cleanupName(taskListName);
        String titleHTML = effRes.format("Title_FMT", taskListDisplayName);
        titleHTML = HTMLUtils.escapeEntities(titleHTML);
        StringBuffer header = new StringBuffer(HEADER_HTML);
        StringUtils.findAndReplace(header, TITLE_VAR, titleHTML);
        if (taskFilter != null)
            header.insert(header.indexOf("</head>"), FILTER_HEADER_HTML);
        if (isExportingToExcel())
            StringUtils.findAndReplace(header, "hideIfCollapsed", "ignore");
        out.print(header);
        out.print("<h2>");
        String endDateStr = monthly ? formatMonth(effDateDisplay) : encodeHTML(effDateDisplay);
        out.print(effRes.format("Header_HTML_FMT", endDateStr));
        if (!isExporting() || getParameter(EFF_DATE_PARAM) == null) {
            if (lastWeek.compareTo(startDate) > 0)
                printNavLink(lastWeek, "Previous", settings, purpose);
            printNavLink(nextWeek, "Next", settings, purpose);
            if (!isExporting())
                printGoToDateLink(effDate, schedule, settings, purpose);
        }
        out.print("</h2>\n");
        EVReport.printFilterInfo(out, taskFilter, settings, isExporting(), isExportingToExcel());
        EVReport.printScheduleErrors(out, filteredSchedule.getMetrics().getErrors());
    } else {
        out.print("<div class='");
        out.print(purpose == LEAF_REPORT ? "collapsed" : "expanded");
        out.print("'><h2>");
        printExpansionIcon();
        out.print(encodeHTML(taskListName));
        out.print("</h2>\n");
        out.print("<div class='subsection");
        if (purpose != LEAF_REPORT)
            out.print(" hideIfCollapsed");
        out.print("'>");
    }
    String indivDetail = "";
    if (purpose == LEAF_REPORT)
        indivDetail = " class='hideIfCollapsed'";
    String hh = (purpose == SPLIT_REPORT ? "h2" : "h3");
    String personalDataID = evModel.getPersonalDataID();
    boolean shouldHideSummary = (privacyFilter != null && personalDataID != null && privacyFilter.include(personalDataID) == false);
    if (!shouldHideSummary) {
        interpOut("<" + hh + indivDetail + ">${Summary.Header}");
        if (isTopLevel(purpose) && showAssignedTo && !isExporting()) {
            String splitLink = (String) env.get("REQUEST_URI");
            if (purpose == PLAIN_REPORT)
                splitLink = HTMLUtils.appendQuery(splitLink, SPLIT_PARAM, "t");
            else
                splitLink = HTMLUtils.removeParam(splitLink, SPLIT_PARAM);
            out.print("&nbsp;&nbsp;<span class='nav'><a href='");
            out.print(splitLink);
            out.print("'>");
            out.print(resources.getHTML(purpose == PLAIN_REPORT ? "Show_Split" : "Show_Rollup"));
            out.print("</a></span>");
        }
        out.print("</" + hh + ">");
        out.print("<table border=1 name='summary'><tr><td></td><td></td>");
        if (taskFilter == null)
            interpOut("<td class=header colspan=3>${Summary.Direct_Hours}" + "</td><td></td>");
        interpOut("<td class=header colspan=3>${Summary.Earned_Value}" + //
        "</td></tr>\n" + "<tr><td></td><td></td>");
        if (taskFilter == null)
            interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td><td></td>");
        interpOut("<td class=header>${Summary.Plan}</td>" + "<td class=header>${Summary.Actual}</td>" + "<td class=header>${Summary.Ratio}</td></tr>\n");
        String thisWeekKey;
        String keySuffix = (monthly ? "_Month" : "_Week");
        if (reportingPeriodIncludesToday)
            thisWeekKey = "This" + keySuffix;
        else if (reportingPeriodPrecedesToday)
            thisWeekKey = "Last" + keySuffix;
        else
            thisWeekKey = "This_Period";
        out.print("<tr><td class=left>" + effRes.getHTML("Summary." + thisWeekKey) + "</td><td></td>");
        if (taskFilter == null) {
            double directTimeThisWeek;
            if (monthly)
                directTimeThisWeek = sumActualTime(actualTimeThisWeek);
            else
                directTimeThisWeek = weekSlice.getActualDirectTime();
            printTimeData(weekSlice.getPlanDirectTime(), directTimeThisWeek);
            out.print("<td></td>");
        }
        printPctData(//
        planValueThisWeek / totalPlanTime, valueEarnedThisWeek / totalPlanTime);
        out.print("</tr>\n");
        out.print("<tr><td class=left>" + encodeHTML(resources.format("Summary.To_Date_FMT", effDateDisplay)) + "</td><td></td>");
        double directTimeToDate = 0;
        if (taskFilter == null) {
            if (monthly)
                directTimeToDate = schedule.get(0).getActualDirectTime() + sumActualTime(getActualTimeSpent(tasks, startDate, effDate));
            else
                directTimeToDate = weekSlice.getCumActualDirectTime();
            printTimeData(weekSlice.getCumPlanDirectTime(), directTimeToDate);
            out.print("<td></td>");
        }
        printPctData(//
        planValueToDate / totalPlanTime, valueEarnedToDate / totalPlanTime);
        out.print("</tr>\n");
        double numWeeks = Double.NaN;
        if (startDate != null)
            numWeeks = (effDate.getTime() - startDate.getTime() - EVSchedule.dstDifference(startDate.getTime(), effDate.getTime())) / (double) MILLIS_PER_WEEK;
        if (monthly) {
            numWeeks = numWeeks / WEEKS_PER_MONTH;
            interpOut("<tr" + indivDetail + "><td class=left>" + "${Month.Summary.Average_per_Month}</td><td></td>");
        } else {
            interpOut("<tr" + indivDetail + "><td class=left>${Summary.Average_per_Week}</td><td></td>");
        }
        if (taskFilter == null) {
            double planTimePerWeek = weekSlice.getCumPlanDirectTime() / numWeeks;
            double actualTimePerWeek = directTimeToDate / numWeeks;
            printTimeData(planTimePerWeek, actualTimePerWeek);
            out.print("<td></td>");
        }
        double planEVPerWeek = planValueToDate / (totalPlanTime * numWeeks);
        double actualEVPerWeek = valueEarnedToDate / (totalPlanTime * numWeeks);
        printPctData(planEVPerWeek, actualEVPerWeek);
        out.print("</tr>\n");
        if (taskFilter == null) {
            interpOut("<tr" + indivDetail + "><td class=left>${Summary.Completed_Tasks_To_Date}" + "</td><td></td>");
            printData(formatTime(completedTasksTotalPlanTime), formatTime(completedTasksTotalActualTime), 1.0 / cpi, "timeFmt");
            out.print("<td></td><td></td><td></td><td></td></tr>\n");
        }
        out.print("</table>\n");
    }
    if (purpose == PLAIN_REPORT || purpose == LEAF_REPORT) {
        out.print("<div class='hideIfCollapsed'>\n");
        // create a table writer with appropriate renderers.
        HTMLTableWriter tableWriter = createTableWriter(evModel, hideNames, showTimingIcons);
        // to draw the completed tasks table, remove the "task with timing
        // icons" renderer if it happens to be in use.
        HTMLTableWriter.CellRenderer taskRenderer = tableWriter.getCellRenderer(EVTaskList.TASK_COLUMN);
        tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, EVReport.EV_CELL_RENDERER);
        String completedTasksTooltip = encodeHTML(resources.format("Completed_Tasks.Header_Tip_FMT", lastWeek, effDateDisplay));
        String completedTasksHeader;
        if (reportingPeriodIncludesToday)
            completedTasksHeader = effRes.getHTML("Completed_Tasks.Header");
        else if (reportingPeriodPrecedesToday)
            completedTasksHeader = effRes.getHTML("Completed_Tasks.Header_Last");
        else if (monthly)
            completedTasksHeader = effRes.format("Completed_Tasks.Header_Month_HTML_FMT", formatMonth(effDateDisplay));
        else
            completedTasksHeader = completedTasksTooltip;
        out.print("<h3 title='" + completedTasksTooltip + "'>" + completedTasksHeader + "</h3>\n");
        if (!oneCompletedLastWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printCompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, monthly);
            double totalPlannedTime = 0;
            double totalActualTime = 0;
            double totalPlannedValue = 0;
            for (int i = 0; i < taskListLen; i++) {
                if (!completedLastWeek[i])
                    continue;
                double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
                double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
                double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
                totalPlannedTime += taskPlannedTime;
                totalActualTime += taskActualTime;
                totalPlannedValue += taskPlannedValue;
                printCompletedLine(tableWriter, tasks, i, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels);
            }
            interpOut("<tr class='sortbottom'><td><b>${Completed_Tasks.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(totalPlannedTime) + "</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalActualTime) + "</td>");
            if (showTimeThisWeek) {
                out.print("<td class='timeFmt'>");
                out.print(formatTime(completedTasksTimeThisWeek) + "</td>");
            }
            if (totalPlannedTime > 0) {
                double totalPctSpent = totalActualTime / totalPlannedTime;
                out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
            } else {
                out.print("<td>&nbsp;</td>");
            }
            // Empty td for assigned to, planned date, and labels columns
            int noSumCol = 1 + numOptionalCols;
            for (int i = 0; i < noSumCol; ++i) out.print("<td>&nbsp;</td>");
            out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td></tr>\n");
            out.println("</table>");
        }
        // put the "task with timing icons" renderer back in place if necessary
        tableWriter.setCellRenderer(EVTaskList.TASK_COLUMN, taskRenderer);
        String inProgressTooltip = encodeHTML(resources.format("Tasks_In_Progress.Header_Tip_FMT", effDateDisplay));
        String inProgressHeader;
        if (reportingPeriodIncludesToday || reportingPeriodPrecedesToday)
            inProgressHeader = effRes.getHTML("Tasks_In_Progress.Header");
        else
            inProgressHeader = encodeHTML(resources.format("Tasks_In_Progress.Header_Long_FMT", effDateDisplay));
        out.print("<h3 title='" + inProgressTooltip + "'>" + inProgressHeader + "</h3>\n");
        if (!oneInProgressThisWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printUncompletedTaskTableHeader(showTimeThisWeek, showAssignedTo, showMilestones, showLabels, true, monthly);
            double totalPlannedTime = 0;
            double totalActualTime = 0;
            double totalPlannedValue = 0;
            double totalPlannedTimeRemaining = 0;
            double totalUnearnedValue = 0;
            for (int i = 0; i < taskListLen; ++i) {
                if (!inProgressThisWeek[i])
                    continue;
                double taskPlannedTime = parseTime(tasks.getValueAt(i, -EVTaskList.PLAN_TIME_COLUMN));
                double taskActualTime = parseTime(tasks.getValueAt(i, -EVTaskList.ACT_TIME_COLUMN));
                double taskPlannedValue = ((Double) tasks.getValueAt(i, -EVTaskList.PLAN_VALUE_COLUMN)).doubleValue();
                double taskPlannedTimeRemaining = taskPlannedTime - taskActualTime;
                double taskUnearnedValue = computeUnearnedValue(tasks, i);
                totalPlannedTime += taskPlannedTime;
                totalActualTime += taskActualTime;
                totalPlannedValue += taskPlannedValue;
                totalPlannedTimeRemaining += (taskPlannedTimeRemaining > 0) ? taskPlannedTimeRemaining : 0;
                totalUnearnedValue += taskUnearnedValue;
                printInProgressLine(tableWriter, tasks, progress[i], i, taskPlannedTimeRemaining, showTimeThisWeek ? actualTimeThisWeek : null, showAssignedTo, showMilestones, showLabels, taskUnearnedValue);
            }
            interpOut("<tr class='sortbottom'><td><b>${Tasks_In_Progress.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(totalPlannedTime) + "</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalActualTime) + "</td>");
            if (showTimeThisWeek) {
                out.print("<td class='timeFmt'>");
                out.print(formatTime(inProgressTasksTimeThisWeek) + "</td>");
            }
            out.print("<td>" + EVSchedule.formatPercent(totalPlannedValue) + "</td>");
            if (totalPlannedTime > 0) {
                double totalPctSpent = totalActualTime / totalPlannedTime;
                out.print("<td>" + EVSchedule.formatPercent(totalPctSpent) + "</td>");
            } else {
                out.print("<td>&nbsp;</td>");
            }
            // Empty td because there is no total for Planned Date and Dep.
            int noSumCol = 2 + numOptionalCols;
            for (int i = 0; i < noSumCol; ++i) out.print("<td>&nbsp;</td>");
            out.print("<td class='timeFmt'>");
            out.print(formatTime(totalPlannedTimeRemaining) + "</td>");
            out.println("<td>" + EVSchedule.formatPercent(totalUnearnedValue) + "</td>");
            out.println("</tr>\n</table>");
        }
        String dueTasksTooltip = encodeHTML(resources.format("Due_Tasks.Header_Tip_FMT", effDateDisplay, nextWeekDisplay));
        String dueTasksHeader;
        if (reportingPeriodIncludesToday)
            dueTasksHeader = effRes.getHTML("Due_Tasks.Header");
        else if (reportingPeriodPrecedesToday)
            dueTasksHeader = effRes.getHTML("Due_Tasks.Header_This");
        else
            dueTasksHeader = encodeHTML(resources.format("Due_Tasks.Header_Long_FMT", nextWeekDisplay));
        out.print("<h3 title='" + dueTasksTooltip + "'>" + dueTasksHeader + "</h3>\n");
        if (!oneDueNextWeek)
            interpOut("<p><i>${None}</i>\n");
        else {
            printUncompletedTaskTableHeader(false, showAssignedTo, showMilestones, showLabels, false, monthly);
            double timeRemaining = 0;
            for (int i = 0; i < taskListLen; i++) if (dueThroughNextWeek[i]) {
                double forecastTimeRemaining = computeTaskForecastTimeRemaining(tasks, i, cpi);
                printDueLine(tableWriter, tasks, progress[i], i, cpi, forecastTimeRemaining, showAssignedTo, showMilestones, showLabels);
                if (progress[i] != AHEAD_OF_SCHEDULE && forecastTimeRemaining > 0)
                    timeRemaining += forecastTimeRemaining;
            }
            out.print("<tr class='sortbottom'><td align=right colspan=");
            int colspan = 6 + numOptionalCols;
            out.print(Integer.toString(colspan));
            interpOut("><b>${Due_Tasks.Total}" + "&nbsp;</b></td><td class='timeFmt'>");
            out.print(formatTime(timeRemaining));
            out.println("</td></tr>\n</table>");
        }
        out.print("</div>\n");
    } else {
        EVTaskListRollup parentEVModel = (EVTaskListRollup) evModel;
        for (int i = 0; i < parentEVModel.getSubScheduleCount(); i++) {
            EVTaskList childModel = parentEVModel.getSubSchedule(i);
            String childName = EVTaskList.cleanupName(childModel.getTaskListName());
            int childPurpose = (childModel instanceof EVTaskListRollup ? SUB_REPORT : LEAF_REPORT);
            writeReport(childName, childModel, effDate, settings, taskFilter, privacyFilter, childPurpose);
        }
    }
    if (!isTopLevel(purpose)) {
        // end the "subsection" div we started earlier.
        out.print("</div></div>");
    } else {
        interpOut("<" + hh + ">${Dependencies.Header}</" + hh + ">\n");
        discardInternalReverseDependencies(upcomingDependencies, reverseDependencies, allIndividuals);
        if (upcomingDependencies.isEmpty() && reverseDependencies.isEmpty())
            interpOut("<p><i>${None}</i>\n");
        else {
            if (!hideNames && !reverseDependencies.isEmpty())
                printReverseDependencyTable(tasks, reverseDependencies, showAssignedTo);
            List<DependencyForCoord> depsForCoord = new ArrayList<DependencyForCoord>(upcomingDependencies.values());
            Collections.sort(depsForCoord);
            int pos = 0;
            for (DependencyForCoord coord : depsForCoord) {
                printUpcomingDependencies(coord, tasks, showAssignedTo, hideNames, showMilestones, showLabels, pos++);
            }
        }
        if (isExporting())
            EVReport.writeExportFooter(out);
        if (!isExportingToExcel())
            interpOut(EXPORT_HTML);
        out.print(FOOTER_HTML);
    }
}
Also used : HTMLTableWriter(net.sourceforge.processdash.ui.lib.HTMLTableWriter) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) List(java.util.List) HashSet(java.util.HashSet) EVSchedule(net.sourceforge.processdash.ev.EVSchedule) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) Date(java.util.Date) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) Resources(net.sourceforge.processdash.i18n.Resources) TableModel(javax.swing.table.TableModel)

Example 9 with EVTaskListRollup

use of net.sourceforge.processdash.ev.EVTaskListRollup in project processdash by dtuma.

the class EVReportSettings method getEffectiveFilter.

/** Build a task filter object that should be used to display the report.
     */
public EVTaskFilter getEffectiveFilter(EVTaskList evModel) {
    EVTaskFilter result = null;
    isRollup = evModel instanceof EVTaskListRollup;
    // first, look up any applicable label filter
    String labelFilter = null;
    if (parameters.containsKey(LABEL_FILTER_PARAM))
        labelFilter = getParameter(LABEL_FILTER_PARAM);
    else if (usingCustomizationSettings) {
        SimpleData val = getValue("settings//" + LABEL_FILTER_PARAM);
        labelFilter = (val == null ? null : val.format());
    }
    // if we found a label filter, apply it.
    if (StringUtils.hasValue(labelFilter)) {
        try {
            result = new EVLabelFilter(evModel, labelFilter, data);
        } catch (Exception e) {
        }
    }
    // next, look up any applicable path filter
    String pathFilter = null;
    if (parameters.containsKey(PATH_FILTER_PARAM))
        pathFilter = getParameter(PATH_FILTER_PARAM);
    else if (usingCustomizationSettings) {
        SimpleData val = getValue("settings//" + PATH_FILTER_PARAM);
        pathFilter = (val == null ? null : val.format());
    }
    // if we found a path filter, apply it
    if (StringUtils.hasValue(pathFilter)) {
        EVHierarchicalFilter hf = EVHierarchicalFilter.getFilter(evModel, pathFilter);
        if (hf != null)
            result = hf.appendFilter(result);
    } else {
        // next, look for a merged path filter
        String mergedPathFilter = null;
        if (parameters.containsKey(MERGED_PATH_FILTER_PARAM))
            mergedPathFilter = getParameter(MERGED_PATH_FILTER_PARAM);
        else if (usingCustomizationSettings) {
            SimpleData val = getValue("settings//" + MERGED_PATH_FILTER_PARAM);
            mergedPathFilter = (val == null ? null : val.format());
        }
        // if we found a merged path filter, apply it
        if (StringUtils.hasValue(mergedPathFilter)) {
            EVHierarchicalFilter hf = EVHierarchicalFilter.getFilterForMerged(evModel, mergedPathFilter);
            if (hf != null)
                result = hf.appendFilter(result);
        }
    }
    if (result != null)
        evModel.disableBaselineData();
    return result;
}
Also used : EVTaskFilter(net.sourceforge.processdash.ev.EVTaskFilter) EVLabelFilter(net.sourceforge.processdash.ev.EVLabelFilter) EVHierarchicalFilter(net.sourceforge.processdash.ev.EVHierarchicalFilter) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 10 with EVTaskListRollup

use of net.sourceforge.processdash.ev.EVTaskListRollup in project processdash by dtuma.

the class EVReport method getEVModel.

private void getEVModel() throws TinyCGIException {
    taskListName = settings.getTaskListName();
    if (taskListName == null)
        throw new TinyCGIException(400, "schedule name missing");
    else if (FAKE_MODEL_NAME.equals(taskListName)) {
        evModel = null;
        return;
    }
    long now = System.currentTimeMillis();
    synchronized (EVReport.class) {
        if (drawingChart && (now - lastRecalcTime < MAX_DELAY) && taskListName.equals(lastTaskListName)) {
            evModel = lastEVModel.get();
            if (evModel != null)
                return;
        }
    }
    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 rollup = (EVTaskListRollup) evModel;
        rollup.applyTaskListFilter(new EVTaskListGroupFilter(f));
        String permID = (parameters.containsKey(CHARTS_PARAM) ? EVPermissions.PERSONAL_CHARTS : EVPermissions.PERSONAL_REPORT);
        settings.checkPersonalDataPermission(rollup, permID);
    }
    EVDependencyCalculator depCalc = new EVDependencyCalculator(getDataRepository(), getPSPProperties(), getObjectCache());
    evModel.setDependencyCalculator(depCalc);
    evModel.setTaskLabeler(new DefaultTaskLabeler(getDashboardContext()));
    if (settings.getBool(CUSTOMIZE_HIDE_BASELINE))
        evModel.disableBaselineData();
    evModel.recalc();
    synchronized (EVReport.class) {
        lastTaskListName = taskListName;
        lastRecalcTime = now;
        lastEVModel = new WeakReference<EVTaskList>(evModel);
    }
}
Also used : EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) EVDependencyCalculator(net.sourceforge.processdash.ev.EVDependencyCalculator) EVTaskListRollup(net.sourceforge.processdash.ev.EVTaskListRollup) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) DefaultTaskLabeler(net.sourceforge.processdash.ev.DefaultTaskLabeler) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Aggregations

EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)13 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)8 ArrayList (java.util.ArrayList)3 DefaultTaskLabeler (net.sourceforge.processdash.ev.DefaultTaskLabeler)3 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)3 IOException (java.io.IOException)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 TableModel (javax.swing.table.TableModel)2 SimpleData (net.sourceforge.processdash.data.SimpleData)2 EVDependencyCalculator (net.sourceforge.processdash.ev.EVDependencyCalculator)2 EVSchedule (net.sourceforge.processdash.ev.EVSchedule)2 EVTaskFilter (net.sourceforge.processdash.ev.EVTaskFilter)2 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)2 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)2 EVTaskListMerged (net.sourceforge.processdash.ev.EVTaskListMerged)2 UserFilter (net.sourceforge.processdash.team.group.UserFilter)2 StringWriter (java.io.StringWriter)1