Search in sources :

Example 1 with TimeLog

use of net.sourceforge.processdash.log.time.TimeLog in project processdash by dtuma.

the class TimeLogPhaseWaterfallChart method getTimeLogEntries.

private List getTimeLogEntries() {
    String path = getPrefix();
    TimeLog tl = getDashboardContext().getTimeLog();
    List result;
    try {
        result = Collections.list(tl.filter(path, null, null));
        Collections.sort(result);
    } catch (IOException e) {
        e.printStackTrace();
        result = Collections.EMPTY_LIST;
    }
    return result;
}
Also used : TimeLog(net.sourceforge.processdash.log.time.TimeLog) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) IOException(java.io.IOException)

Example 2 with TimeLog

use of net.sourceforge.processdash.log.time.TimeLog in project processdash by dtuma.

the class TextMetricsFileExporter method run.

public void run() {
    try {
        outWriter = new RobustFileWriter(dest, "UTF-8");
        PrintWriter out = new PrintWriter(new BufferedWriter(outWriter));
        // Find and print any applicable task lists.
        Iterator i = ctx.getData().getKeys();
        Set taskListNames = new HashSet();
        String name;
        int pos;
        while (i.hasNext()) {
            name = (String) i.next();
            pos = name.indexOf(TASK_ORD_PREF);
            if (pos != -1 && Filter.matchesFilter(filter, name))
                taskListNames.add(name.substring(pos + TASK_ORD_PREF.length()));
        }
        i = taskListNames.iterator();
        String owner = ProcessDashboard.getOwnerName(ctx.getData());
        while (i.hasNext()) {
            name = (String) i.next();
            EVTaskList tl = EVTaskList.openExisting(name, ctx.getData(), ctx.getHierarchy(), ctx.getCache(), false);
            if (tl == null)
                continue;
            tl.recalc();
            String xml = tl.getAsXML(false);
            name = exportedScheduleDataName(owner, name);
            out.write(name + ",");
            out.write(StringData.escapeString(xml));
            out.println();
        }
        ctx.getData().dumpRepository(out, filter, DataRepository.DUMP_STYLE_TEXT);
        TimeLog tl = ctx.getTimeLog();
        Iterator keys = tl.filter(null, null, null);
        while (keys.hasNext()) {
            TimeLogEntry tle = (TimeLogEntry) keys.next();
            if (Filter.matchesFilter(filter, tle.getPath()))
                out.println(toAbbrevString(tle));
        }
        out.println(DefectXmlConstantsv1.DEFECT_START_TOKEN);
        DefectExporterXMLv1 exp = new DefectExporterXMLv1();
        exp.dumpDefects(ctx.getHierarchy(), filter, out);
        out.close();
        outWriter = null;
        completionStatus = new CompletionStatus(CompletionStatus.SUCCESS, dest, null);
    } catch (Exception ioe) {
        completionStatus = new CompletionStatus(CompletionStatus.ERROR, dest, ioe);
        System.out.println("IOException: " + ioe);
        tryCancel();
    }
    ctx.getData().gc(filter);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) BufferedWriter(java.io.BufferedWriter) TimeLog(net.sourceforge.processdash.log.time.TimeLog) TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) CompletionStatus(net.sourceforge.processdash.tool.export.mgr.CompletionStatus) Iterator(java.util.Iterator) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) RobustFileWriter(net.sourceforge.processdash.util.RobustFileWriter) PrintWriter(java.io.PrintWriter) HashSet(java.util.HashSet)

Example 3 with TimeLog

use of net.sourceforge.processdash.log.time.TimeLog in project processdash by dtuma.

the class TimeLogReport method getTimeLogEntries.

private List getTimeLogEntries() throws IOException {
    // ensure the user has permission to view time log entries
    UserFilter privacyFilt = GroupPermission.getGrantedMembers(PERMISSION);
    noPermission = (privacyFilt == null);
    someEntriesBlocked = false;
    if (noPermission)
        return Collections.EMPTY_LIST;
    TimeLog tl = null;
    List l = null;
    String type = getParameter("type");
    if ("rollup".equals(type)) {
        // permission to view time logs from "Everyone," block the data.
        if (!UserGroup.isEveryone(privacyFilt)) {
            someEntriesBlocked = true;
            return Collections.EMPTY_LIST;
        } else {
            tl = new RolledUpTimeLog.FromResultSet(getDashboardContext(), getPrefix(), parameters);
        }
    } else if ("db".equals(type)) {
        l = queryDatabaseForTimeLogEntries(privacyFilt);
    } else {
        tl = getDashboardContext().getTimeLog();
    }
    if (tl != null)
        l = Collections.list(tl.filter(getPrefix(), null, null));
    Collections.sort(l);
    return l;
}
Also used : TimeLog(net.sourceforge.processdash.log.time.TimeLog) RolledUpTimeLog(net.sourceforge.processdash.log.time.RolledUpTimeLog) UserFilter(net.sourceforge.processdash.team.group.UserFilter) RolledUpTimeLog(net.sourceforge.processdash.log.time.RolledUpTimeLog) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with TimeLog

use of net.sourceforge.processdash.log.time.TimeLog in project processdash by dtuma.

the class EVCalculatorData method recalculate.

public void recalculate() {
    resetData();
    recalcBaselineData(taskRoot);
    scheduleStartDate = schedule.getStartDate();
    reorderCompletedTasks = Settings.getBool("ev.sortCompletedTasks", true);
    rezeroAtStartDate = getBoolSetting(EVMetadata.REZERO_ON_START_DATE, true);
    pruneNodes(taskRoot, false);
    double levelOfEffort = calculateLevelOfEffort(taskRoot);
    //      System.out.println("total level of effort = " + (levelOfEffort*100));
    taskRoot.recalcPlanTimes();
    taskRoot.recalcDateCompleted();
    completionDate = taskRoot.dateCompleted;
    effectiveDate = getEffectiveDate();
    evLeaves = new LinkedList();
    getEVLeaves(taskRoot);
    if (containsTaskOrdinals(taskRoot))
        assignTaskOrdinals(taskRoot, 1);
    sortEVLeafList(evLeaves);
    //        debugEVLeafList(evLeaves);
    // clean up the schedule
    schedule.setLevelOfEffort(levelOfEffort);
    schedule.cleanUp();
    schedule.recalcCumPlanTimes();
    // find time logged to tasks before the start of the schedule.
    TimeLog log = timeLog;
    try {
        if (rezeroAtStartDate)
            saveActualPreTime(log);
    } catch (IOException ioe) {
        ioe.printStackTrace();
        schedule.getMetrics().addError("Unable to retrieve time log data.", taskRoot);
    }
    // calculate planned and actual earned values, planned dates, and
    // planned and actual cumulative earned values
    calcTaskValues(evLeaves);
    saveCompletedTaskValues(evLeaves);
    // reset the EVMetrics object
    schedule.setEffectiveDate(effectiveDate);
    schedule.getMetrics().reset(scheduleStartDate, effectiveDate, schedule.getPeriodStart(effectiveDate), schedule.getPeriodEnd(effectiveDate));
    schedule.getMetrics().loadBaselineData(taskRoot);
    // record actual time spent on tasks.
    try {
        saveActualScheduleTime(log);
    } catch (IOException ioe) {
        ioe.printStackTrace();
        schedule.getMetrics().addError("Unable to retrieve time log data.", taskRoot);
    }
    schedule.recalcCumActualTimes();
    // recalculate the EVMetrics object
    taskRoot.checkForNodeErrors(schedule.getMetrics(), 0, new ArrayList(), new ArrayList(), false);
    recalcMetrics(taskRoot, schedule.getMetrics());
    schedule.getMetrics().recalcScheduleTime(schedule);
    // create confidence intervals for cost and time
    createCostConfidenceInterval();
    createTimeErrConfidenceInterval();
    replanDateCalculator.calculateForecastDates(taskRoot, schedule, schedule.getMetrics(), evLeaves);
    forecastDateCalculator.calculateForecastDates(taskRoot, schedule, schedule.getMetrics(), evLeaves);
    taskList.scanForMilestoneErrors(evLeaves);
    recalculateTaskHierarchy(taskRoot);
    saveCompletedTaskCosts(evLeaves);
    // create confidence interval for schedule
    createScheduleConfidenceInterval();
    schedule.getMetrics().recalcComplete(schedule);
    schedule.firePreparedEvents();
}
Also used : TimeLog(net.sourceforge.processdash.log.time.TimeLog) DashboardTimeLog(net.sourceforge.processdash.log.time.DashboardTimeLog) ArrayList(java.util.ArrayList) IOException(java.io.IOException) LinkedList(java.util.LinkedList)

Example 5 with TimeLog

use of net.sourceforge.processdash.log.time.TimeLog in project processdash by dtuma.

the class OpenTimeLogEditor method showRollupTimeLog.

private void showRollupTimeLog() {
    // ensure the user has permission to view time logs for everyone
    if (!UserGroup.isEveryone(GroupPermission.getGrantedMembers(PERMISSION))) {
        Component parent = null;
        if (getDashboardContext() instanceof Component)
            parent = (Component) getDashboardContext();
        JOptionPane.showMessageDialog(parent, TimeLogEditor.resources.getStrings("Team_Forbidden.Message"), TimeLogEditor.resources.getString("Team_Forbidden.Title"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    TimeLog tl = new RolledUpTimeLog.FromResultSet(getDashboardContext(), getPrefix(), parameters);
    TimeLogEditor e = new TimeLogEditor(tl, getAugmentedHierarchy(), null, null);
    if (parameters.containsKey(RolledUpTimeLog.FromResultSet.MERGE_PREFIXES_PARAM))
        try {
            e.narrowToPath(getPrefix());
        } catch (IllegalArgumentException iae) {
        // this will be thrown if we attempt to narrow to a prefix that
        // does not exist.  It's best to ignore the error and proceed.
        }
    String displayPrefix = AnalysisPage.localizePrefix(getPrefix());
    String title = TimeLogEditor.resources.format("Time_Log_Viewer_Window_Title_FMT", displayPrefix);
    e.setTitle(title);
}
Also used : TimeLog(net.sourceforge.processdash.log.time.TimeLog) RolledUpTimeLog(net.sourceforge.processdash.log.time.RolledUpTimeLog) Component(java.awt.Component)

Aggregations

TimeLog (net.sourceforge.processdash.log.time.TimeLog)5 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 RolledUpTimeLog (net.sourceforge.processdash.log.time.RolledUpTimeLog)2 Component (java.awt.Component)1 BufferedWriter (java.io.BufferedWriter)1 PrintWriter (java.io.PrintWriter)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)1 DashboardTimeLog (net.sourceforge.processdash.log.time.DashboardTimeLog)1 TimeLogEntry (net.sourceforge.processdash.log.time.TimeLogEntry)1 UserFilter (net.sourceforge.processdash.team.group.UserFilter)1 CompletionStatus (net.sourceforge.processdash.tool.export.mgr.CompletionStatus)1 RobustFileWriter (net.sourceforge.processdash.util.RobustFileWriter)1