Search in sources :

Example 11 with Entry

use of teamdash.wbs.ChangeHistory.Entry in project processdash by dtuma.

the class ProjectHistoryBridgedAbstract method initTimeDelta.

protected void initTimeDelta(ManifestEntry changeHist) {
    // these back to UTC timestamps.
    if (timeDelta == 0 && changeHist != null) {
        try {
            Element xml = parseXml(changeHist.getStream());
            ChangeHistory changes = new ChangeHistory(xml);
            Entry lastChange = changes.getLastEntry();
            long lastTimestamp = lastChange.getTimestamp().getTime();
            timeDelta = changeHist.lastMod - lastTimestamp;
            // the file modification time can normally differ from the
            // change timestamp by a second or two; but we are only
            // interested in the delta caused by time zone differences.
            // round the delta to an even half-hour interval.
            double fraction = timeDelta / (30.0 * DateUtils.MINUTES);
            timeDelta = (int) Math.round(fraction) * 30 * DateUtils.MINUTES;
        } catch (Exception e) {
        }
    }
}
Also used : ChangeHistory(teamdash.wbs.ChangeHistory) ZipEntry(java.util.zip.ZipEntry) Entry(teamdash.wbs.ChangeHistory.Entry) Element(org.w3c.dom.Element) ParseException(java.text.ParseException) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException)

Example 12 with Entry

use of teamdash.wbs.ChangeHistory.Entry in project processdash by dtuma.

the class TeamProjectMergeCoordinator method recordMergedChangeHistoryEntries.

private void recordMergedChangeHistoryEntries() {
    ChangeHistory baseChanges = new ChangeHistory(baseDir.getDirectory());
    ChangeHistory mainChanges = new ChangeHistory(mainDir.getDirectory());
    Entry lastBaseChange = baseChanges.getLastEntry();
    if (lastBaseChange == null)
        return;
    String lastBaseChangeUid = lastBaseChange.getUid();
    boolean sawLastBaseChange = false;
    for (Entry mainChange : mainChanges.getEntries()) {
        if (sawLastBaseChange)
            mergedChanges.add(mainChange);
        else if (mainChange.getUid().equals(lastBaseChangeUid))
            sawLastBaseChange = true;
    }
}
Also used : Entry(teamdash.wbs.ChangeHistory.Entry)

Aggregations

Entry (teamdash.wbs.ChangeHistory.Entry)12 ZipEntry (java.util.zip.ZipEntry)8 IOException (java.io.IOException)3 ChangeHistory (teamdash.wbs.ChangeHistory)3 File (java.io.File)2 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 Element (org.w3c.dom.Element)2 SAXException (org.xml.sax.SAXException)2 Dimension (java.awt.Dimension)1 BufferedOutputStream (java.io.BufferedOutputStream)1 InputStream (java.io.InputStream)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 TreeSet (java.util.TreeSet)1 Matcher (java.util.regex.Matcher)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 JList (javax.swing.JList)1 JScrollPane (javax.swing.JScrollPane)1 RobustFileOutputStream (net.sourceforge.processdash.util.RobustFileOutputStream)1