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);
}
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);
}
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);
}
}
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);
}
}
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();
}
}
}
Aggregations