Search in sources :

Example 16 with DateData

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

the class ArchiveMetricsFileImporter method addImportMetadata.

private void addImportMetadata(Map<String, String> packageIDs) {
    String prefix = METADATA_DATA_NAME + "/" + EXPORTED_TAG + ".";
    defns.put(METADATA_DATA_NAME, TagData.getInstance());
    if (owner != null)
        defns.put(prefix + OWNER_ATTR, StringData.create(owner));
    if (exportTimestamp != null)
        defns.put(prefix + WHEN_ATTR, new DateData(exportTimestamp, false));
    if (XMLUtils.hasValue(srcDatasetID))
        defns.put(prefix + FROM_DATASET_ID_ATTR, StringData.create(srcDatasetID));
    ListData packageList = new ListData();
    String packagePrefix = prefix + PACKAGE_ELEM + "/";
    for (Map.Entry<String, String> e : packageIDs.entrySet()) {
        String id = e.getKey();
        String version = e.getValue();
        packageList.add(id);
        packageList.add(version);
        defns.put(packagePrefix + id, StringData.create(version));
    }
    defns.put(prefix + PACKAGE_ELEM, packageList);
}
Also used : DateData(net.sourceforge.processdash.data.DateData) HashMap(java.util.HashMap) Map(java.util.Map) ListData(net.sourceforge.processdash.data.ListData)

Example 17 with DateData

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

the class EVReportSettings method isTimestampRecent.

private boolean isTimestampRecent() {
    DateData settingsTimestamp = (DateData) getValue("settings//timestamp");
    if (settingsTimestamp == null)
        return false;
    long when = settingsTimestamp.getValue().getTime();
    long delta = System.currentTimeMillis() - when;
    if (10000 < delta && delta < MAX_SETTINGS_AGE)
        touchSettingsTimestamp();
    return (delta < MAX_SETTINGS_AGE);
}
Also used : DateData(net.sourceforge.processdash.data.DateData)

Example 18 with DateData

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

the class EVTask method userSetActualDate.

/** Messaged to indicate that the user has entered a new value for the
     * actual completion date of this task.
     * 
     * @param aValue the value entered by the user (a Date is expected)
     */
public void userSetActualDate(Object aValue) {
    if (!isCompletionDateEditable())
        return;
    if (isLeaf()) {
        String dataName = DataRepository.createDataName(fullName, DATE_COMPLETED_DATA_NAME);
        // save the Date object to the data repository
        if (aValue instanceof Date) {
            dateCompleted = (Date) aValue;
            data.userPutValue(dataName, new DateData(dateCompleted, true));
        } else {
            dateCompleted = null;
            data.userPutValue(dataName, null);
        }
    } else if (getNumChildren() == 1) {
        getChild(0).userSetActualDate(aValue);
        recalcDateCompleted();
        notifyListener(true);
    }
}
Also used : DateData(net.sourceforge.processdash.data.DateData) Date(java.util.Date)

Example 19 with DateData

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

the class ArchiveMetricsFileExporter method maybeSaveMaxActivityDate.

private void maybeSaveMaxActivityDate() {
    if (maxActivityDate != null && filter.size() == 1) {
        String path = (String) filter.iterator().next();
        String dataName = DataRepository.createDataName(path, DATA_TIMESTAMP_NAME);
        DateData timestamp = new DateData(maxActivityDate, true);
        ctx.getData().putValue(dataName, timestamp);
    }
}
Also used : DateData(net.sourceforge.processdash.data.DateData)

Example 20 with DateData

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

the class HierarchySynchronizer method doSync.

private void doSync() throws HierarchyAlterationException {
    phaseIDs = initPhaseIDs(processID);
    ListData nodeOrderData = new ListData();
    collectNodeOrderData(projectXML, nodeOrderData);
    getAllKnownWbsIds();
    Map<String, String> milestoneNames = syncMilestoneData(projectXML);
    ListData labelData = new ListData();
    ListData milestoneData = new ListData();
    if (isTeam()) {
        // for a team, get label data for all nodes in a project before
        // we prune the non-team nodes
        getLabelData(projectXML, milestoneNames, labelData, milestoneData);
        saveHierarchyFilterInfo(projectXML);
    }
    pruneWBS(projectXML, fullCopyMode, getNonprunableIDs(), Collections.EMPTY_SET);
    if (!isTeam()) {
        // for an individual, collect label data after pruning so we
        // only see labels that are relevant to our tasks.
        getLabelData(projectXML, milestoneNames, labelData, milestoneData);
        getScheduleData(projectXML);
    }
    changes = new ArrayList();
    discrepancies = new ListData();
    discrepancies.add(new Date());
    syncActions = buildSyncActions();
    SyncWorker syncWorker;
    if (whatIfMode) {
        DashHierarchy mockHierarchy = new DashHierarchy("");
        mockHierarchy.copy(this.hierarchy);
        this.hierarchy = mockHierarchy;
        syncWorker = new SyncWorkerWhatIf(dataRepository, mockHierarchy);
    } else {
        syncWorker = new SyncWorkerLive(dataRepository, deletionPermissions, completionPermissions);
    }
    if (debugLogInfo != null)
        syncWorker = SyncWorkerLogger.wrapWorker(syncWorker, debugLogInfo);
    this.data = syncWorker;
    forceData(projectPath, LABEL_LIST_DATA_NAME, labelData);
    forceData(projectPath, MILESTONE_LIST_DATA_NAME, milestoneData);
    forceData(projectPath, NODE_ORDER_DATA_NAME, nodeOrderData);
    forceData(projectPath, TeamDataConstants.CLOSED_PROJECT_FLAG, projectClosed ? ImmutableDoubleData.TRUE : null);
    if (!isTeam()) {
        syncSchedule();
        saveWorkflowUrlData();
        checkForUserInactivity();
    }
    sync(syncWorker, projectPath, projectXML);
    if (!isTeam())
        updateWorkflowPhasesInDefects();
    processDeferredDeletions(syncWorker);
    readChangesFromWorker(syncWorker);
    String discrepancyDataName = DataRepository.createDataName(projectPath, SyncDiscrepancy.DISCREPANCIES_DATANAME);
    dataRepository.putValue(discrepancyDataName, discrepancies);
    if (!whatIfMode || changes.isEmpty()) {
        String timestampDataName = DataRepository.createDataName(projectPath, TeamDataConstants.LAST_SYNC_TIMESTAMP);
        dataRepository.putValue(timestampDataName, new DateData());
    }
    // unneeded files from the team dashboard directory.
    if (isTeam() && !whatIfMode && !fullCopyMode && !syncWorker.getNodesDeleted().isEmpty()) {
        try {
            DashController.scrubDataDirectory();
            logger.info("HierarchySynchronizer scrubbed team " + "dashboard directory.");
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
}
Also used : DateData(net.sourceforge.processdash.data.DateData) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ArrayList(java.util.ArrayList) Date(java.util.Date) ListData(net.sourceforge.processdash.data.ListData) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData)

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