use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class TinyCGIBase method generatePostToken.
/**
* Generate a new, unique token and save it in the data repository.
*
* @param dataNameSuffix
* a suffix to use when constructing the name of the data
* repository data element
* @return a new, unique token.
* @since 1.14.0.1
*/
protected String generatePostToken(String dataNameSuffix) {
UUID uuid = UUID.randomUUID();
String result = uuid.toString();
String dataName = getPostTokenDataName(dataNameSuffix);
getDataRepository().putValue(dataName, StringData.create(result));
getDataRepository().putValue(dataName + "/TS", new DateData());
return result;
}
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();
}
}
}
use of net.sourceforge.processdash.data.DateData in project processdash by dtuma.
the class HierarchySynchronizer method getUserActivityAgeRange.
/** Check to see if the user has recorded project data recently */
private int getUserActivityAgeRange() {
// get the activity timestamp. If it is not present, we don't have
// any idea when the user recorded project data last. Stay on the
// safe side and assume that they are working on the project.
SimpleData d = getData(projectPath, TeamDataConstants.USER_ACTIVITY_TIMESTAMP);
if (!(d instanceof DateData))
return USER_ACTIVITY_MODERATE;
// get the age of the activity timestamp
DateData activityDate = (DateData) d;
long now = System.currentTimeMillis();
long activityAge = now - activityDate.getValue().getTime();
// if the activity timestamp is more than 30 days old, they are
// definitely not working on the project anymore
int activityCutoff = Settings.getInt("teamProject.inactivityAge", 30);
if (activityAge > activityCutoff * DateUtils.DAYS)
return USER_ACTIVITY_OLD;
// if the activity timestamp is less than 7 days old, they are
// definitely working on the project.
activityCutoff = Settings.getInt("teamProject.recentActivityAge", 7);
if (activityAge < activityCutoff * DateUtils.DAYS)
return USER_ACTIVITY_RECENT;
// their last activity was between 7 and 30 days ago.
return USER_ACTIVITY_MODERATE;
}
Aggregations