use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class AbstractSyncWorker method markLeafComplete.
public void markLeafComplete(String path) {
if (completionPermissions == null || completionPermissions.contains(getOriginalPath(path))) {
String completionDataName = dataName(path, "Completed");
if (getSimpleValue(completionDataName) != null)
return;
SimpleData actualTime = getSimpleValue(dataName(path, "Time"));
if (actualTime instanceof NumberData) {
double time = ((NumberData) actualTime).getDouble();
DoubleData estimatedTime = new DoubleData(time, true);
doPutValue(dataName(path, "Estimated Time"), estimatedTime);
doPutValue(dataName(path, syncDataName("Estimated Time")), estimatedTime);
}
DateData now = new DateData();
doPutValue(completionDataName, now);
doPutValue(syncDataName(completionDataName), now);
nodesCompleted.add(path);
}
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class AbstractSyncWorker method markLeafIncomplete.
public boolean markLeafIncomplete(String path) {
String completionDataName = dataName(path, "Completed");
String syncDataName = syncDataName(completionDataName);
SimpleData completionDate = getSimpleValue(completionDataName);
SimpleData syncDate = getSimpleValue(syncDataName);
if (completionDate != null && dataEquals(completionDate, syncDate)) {
doPutValue(completionDataName, null);
doPutValue(syncDataName, null);
return true;
} else {
return false;
}
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class MoveProjectWizard method getSimpleValue.
/** Get a value from the data repository. */
private SimpleData getSimpleValue(String name) {
DataRepository data = getDataRepository();
String prefix = getPrefix();
if (prefix == null)
prefix = "";
String dataName = DataRepository.createDataName(prefix, name);
SimpleData d = data.getSimpleValue(dataName);
return d;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class MoveProjectWizard method checkProject.
/**
* Checks to ensure that the prefix points to a team or master project.
* If so, sets the projectType and processID fields accordingly.
* If not, throws a {@link MoveProjectException}.
* @throws MoveProjectException
*/
private void checkProject() throws MoveProjectException {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(getPrefix());
String templateID = hierarchy.getID(key);
if (templateIs(templateID, MASTER_ROOT)) {
this.isMaster = true;
putValue(TEAM_MASTER_FLAG, "t");
putValue(TEAM_NAME, "Master");
putValue(TEAM_NAME_LOWER, "master");
} else if (templateIs(templateID, TEAM_ROOT)) {
this.isMaster = false;
putValue(TEAM_MASTER_FLAG, (SimpleData) null);
putValue(TEAM_NAME, "Team");
putValue(TEAM_NAME_LOWER, "team");
} else {
putValue(TEAM_NAME, "");
putValue(TEAM_NAME_LOWER, "");
throw new MoveProjectException("notTeamProject");
}
projectID = getStringValue(TeamDataConstants.PROJECT_ID);
if (!hasValue(projectID))
throw new MoveProjectException("noProjectID");
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class MigrationToolTeam method checkConversionPreconditions.
private void checkConversionPreconditions() throws MigrationException {
if (Settings.isReadOnly())
throw new MigrationException("isReadOnly");
ProcessDashboard dash = (ProcessDashboard) ctx;
if (dash.isHierarchyEditorOpen())
throw new MigrationException("hierarchyEditorOpen");
DataContext data = ctx.getData().getSubcontext(projectPath);
SimpleData sd = data.getSimpleValue("Master_Project_Path");
if (sd != null && sd.test())
throw new MigrationException("belongsToMasterProject");
sd = data.getSimpleValue("Team_Process_PID");
currentPID = (sd == null ? null : sd.format());
if (targetPID == null || targetPID.equals(currentPID))
throw new MigrationException("targetPIDIsNoChange").add("targetPID", targetPID);
newRootTemplateID = targetPID + TEAM_ROOT;
if (!DashController.getTemplates().containsKey(newRootTemplateID))
throw new MigrationException("targetTemplateNotInstalled").add("targetPID", targetPID);
sd = data.getSimpleValue("Team_Data_Directory");
if (sd == null || !sd.test())
throw new MigrationException("noTeamDataDir");
teamDataDirectory = new File(sd.format());
if (!teamDataDirectory.isDirectory())
throw new MigrationException("cannotFindTeamDataDir");
}
Aggregations