Search in sources :

Example 1 with EVTaskListFilter

use of net.sourceforge.processdash.ev.EVTaskListFilter 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));
    }
}
Also used : EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) EVSchedule(net.sourceforge.processdash.ev.EVSchedule) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList)

Example 2 with EVTaskListFilter

use of net.sourceforge.processdash.ev.EVTaskListFilter 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 3 with EVTaskListFilter

use of net.sourceforge.processdash.ev.EVTaskListFilter 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)

Example 4 with EVTaskListFilter

use of net.sourceforge.processdash.ev.EVTaskListFilter 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));
    }
}
Also used : EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) EVSchedule(net.sourceforge.processdash.ev.EVSchedule) UserFilter(net.sourceforge.processdash.team.group.UserFilter) EVTaskList(net.sourceforge.processdash.ev.EVTaskList)

Example 5 with EVTaskListFilter

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

the class EVReportSettings method checkPersonalDataPermission.

/**
     * If a filter is in place, check to see whether it violates a data privacy
     * permission. If so, install a "privacy block" group filter.
     * 
     * @param evModel
     *            the earned value task list, to which any filtering has already
     *            been applied
     * @param permissionID
     *            the ID of a data privacy permission to check
     */
public void checkPersonalDataPermission(EVTaskListRollup evModel, String permissionID) {
    // if no user filter is in place, or if it's already a block, return.
    if (userGroupFilter == null || userGroupFilter instanceof UserGroupPrivacyBlock)
        return;
    // see if the model contains data for only one person. If not, we're OK
    String personalDataID = evModel.getPersonalDataID();
    if (personalDataID == null)
        return;
    // if we've been granted permission to see this person's data, we're OK
    UserFilter pf = GroupPermission.getGrantedMembers(permissionID);
    EVTaskListFilter tlf = new EVTaskListGroupFilter(pf);
    if (tlf.include(personalDataID))
        return;
    // install a data privacy block filter to protect personal data.
    userGroupFilter = new UserGroupPrivacyBlock(userGroupFilter);
    evModel.applyTaskListFilter(new EVTaskListGroupFilter(userGroupFilter));
}
Also used : EVTaskListFilter(net.sourceforge.processdash.ev.EVTaskListFilter) EVTaskListGroupFilter(net.sourceforge.processdash.ev.EVTaskListGroupFilter) UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)

Aggregations

EVTaskListFilter (net.sourceforge.processdash.ev.EVTaskListFilter)6 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)6 UserFilter (net.sourceforge.processdash.team.group.UserFilter)6 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)5 EVSchedule (net.sourceforge.processdash.ev.EVSchedule)4 Date (java.util.Date)2 IOException (java.io.IOException)1 DefaultTaskLabeler (net.sourceforge.processdash.ev.DefaultTaskLabeler)1 EVDependencyCalculator (net.sourceforge.processdash.ev.EVDependencyCalculator)1 EVTaskFilter (net.sourceforge.processdash.ev.EVTaskFilter)1 EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)1 SingleValueConfidenceInterval (net.sourceforge.processdash.ev.ci.SingleValueConfidenceInterval)1 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)1 UserGroupPrivacyBlock (net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)1