Search in sources :

Example 26 with DateData

use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.

the class TaskStatusApi method getCompletionDate.

private DateData getCompletionDate(String path) {
    String dataName = path + "/Completed";
    SimpleData sd = getDataContext().getSimpleValue(dataName);
    if (sd instanceof DateData)
        return (DateData) sd;
    else
        return null;
}
Also used : DateData(net.sourceforge.processdash.data.DateData) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 27 with DateData

use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.

the class TaskStatusApi method doGet.

@Override
protected void doGet() throws IOException {
    checkRequestValidity();
    String path = getTargetPath();
    DateData completionDate = getCompletionDate(path);
    JSONObject json = new JSONObject();
    json.put("stat", "ok");
    json.put("taskPath", path);
    json.put("completionDate", completionDate == null ? null : WebApiUtils.DATE_FMT.format(completionDate.getValue()));
    out.write("Content-Type: application/json\r\n\r\n");
    out.write(json.toString());
    out.flush();
}
Also used : JSONObject(org.json.simple.JSONObject) DateData(net.sourceforge.processdash.data.DateData)

Example 28 with DateData

use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.

the class DataRepository method userPutValue.

public void userPutValue(String name, SaveableData value) {
    waitForCalculations();
    String aliasName = getAliasedName(name);
    putValue(aliasName, value, IS_NOT_DEFAULT_VAL);
    if (TIMESTAMPED_DATA_NAMES.matches(aliasName)) {
        putValue(aliasName + "/Edit_Timestamp", new DateData(), IS_NOT_DEFAULT_VAL);
    }
}
Also used : DateData(net.sourceforge.processdash.data.DateData) EscapeString(net.sourceforge.processdash.util.EscapeString)

Example 29 with DateData

use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.

the class DefaultTimeLoggingModel method shouldForceTimeLogEntry.

/**
     * In some usage scenarios, an individual needs to mark several tasks
     * complete in a row, but still reflect the fact that they "worked" on them.
     * If the timer is running when the user marks a task complete, and no time
     * has ever been logged against that task, round the current time log entry
     * up to 1 minute if it isn't there already.
     */
private boolean shouldForceTimeLogEntry(double elapsedMinutes) {
    // time log entry.
    if (elapsedMinutes > 1.0)
        return false;
    // paused at this very moment), don't force a time log entry.
    if (paused && !pauseInProgress)
        return false;
    // Check a user setting to see if this functionality is disabled.
    if (!Settings.getBool("pauseButton.forceCompletedTaskTime", true))
        return false;
    // Check the data repository to see if the current task has been
    // flagged as one that should never receive "forced" time log entries.
    String path = currentPhase.path();
    SaveableData sd = DataRepository.getInheritableValue(data, new StringBuffer(path), "Force_Completed_Task_Time");
    if (sd != null && sd.getSimpleValue().test() == false)
        return false;
    // If time has been logged against this task in the past, don't force
    // a new time log entry.
    String dataName = DataRepository.createDataName(path, "Time");
    if (sd != null && sd.getSimpleValue().test())
        return false;
    // Check to see if the current task was *just* marked complete. If so,
    // force a time log entry.
    dataName = DataRepository.createDataName(path, "Completed");
    sd = data.getSimpleValue(dataName);
    if (sd instanceof DateData) {
        Date completed = ((DateData) sd).getValue();
        long age = System.currentTimeMillis() - completed.getTime();
        if (age < 1000) {
            logger.fine("Forcing 1 minute time log entry for " + "completed task " + path);
            return true;
        }
    }
    return false;
}
Also used : DateData(net.sourceforge.processdash.data.DateData) SaveableData(net.sourceforge.processdash.data.SaveableData) Date(java.util.Date)

Example 30 with DateData

use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.

the class CumulativeDefectChartSnippet method addRow.

protected void addRow(ResultSet data, int row, Date d, int num, int cum) {
    DateData date = new DateData(d, true);
    date.setFormatAsDateOnly(true);
    data.setRowName(row, date.format());
    data.setData(row, 1, date);
    data.setData(row, 2, new DoubleData(num));
    data.setData(row, 3, new DoubleData(cum));
}
Also used : DateData(net.sourceforge.processdash.data.DateData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Aggregations

DateData (net.sourceforge.processdash.data.DateData)31 SimpleData (net.sourceforge.processdash.data.SimpleData)10 Date (java.util.Date)6 Iterator (java.util.Iterator)3 SaveableData (net.sourceforge.processdash.data.SaveableData)3 DataContext (net.sourceforge.processdash.data.DataContext)2 DoubleData (net.sourceforge.processdash.data.DoubleData)2 ListData (net.sourceforge.processdash.data.ListData)2 EscapeString (net.sourceforge.processdash.util.EscapeString)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 UUID (java.util.UUID)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 MalformedData (net.sourceforge.processdash.data.MalformedData)1 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)1