use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class TeamStartNotifier method checkAlreadyJoined.
private static void checkAlreadyJoined(DashboardContext ctx, PropertyKey key, String projectID) {
String dataName = DataRepository.createDataName(key.path(), PROJECT_ID);
SimpleData sd = ctx.getData().getSimpleValue(dataName);
if (sd != null && projectID.equals(sd.format())) {
throw new AlreadyJoinedException();
} else {
DashHierarchy hier = ctx.getHierarchy();
int i = hier.getNumChildren(key);
while (i-- > 0) {
PropertyKey childKey = hier.getChildKey(key, i);
checkAlreadyJoined(ctx, childKey, projectID);
}
}
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class TeamProjectSetupWizard method copyNodeIDsToHierarchy.
private static boolean copyNodeIDsToHierarchy(DataContext data, DashHierarchy hier, PropertyKey key) {
boolean madeChange = false;
SimpleData projectID = data.getSimpleValue(DataRepository.createDataName(key.path(), TeamDataConstants.PROJECT_ID));
if (projectID != null && projectID.test()) {
String nodeID = projectID.format() + ":root";
Prop p = hier.pget(key);
if (!nodeID.equals(p.getNodeID())) {
p.setNodeID(nodeID);
madeChange = true;
}
} else {
for (int i = hier.getNumChildren(key); i-- > 0; ) {
PropertyKey child = hier.getChildKey(key, i);
if (copyNodeIDsToHierarchy(data, hier, child))
madeChange = true;
}
}
return madeChange;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class TeamProjectSetupWizard method scanForMatchingProjects.
private void scanForMatchingProjects(DashHierarchy hier, PropertyKey node, String projectID, Map<String, String> matches) {
String path = node.path();
String dataName = DataRepository.createDataName(path, PROJECT_ID);
SimpleData sd = getDataRepository().getSimpleValue(dataName);
if (sd != null && projectID.equals(sd.format())) {
matches.put(path, hier.getID(node));
} else {
for (int i = hier.getNumChildren(node); i-- > 0; ) scanForMatchingProjects(hier, hier.getChildKey(node, i), projectID, matches);
}
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class TeamProjectSetupWizard method getSimpleValue.
/** Get a value from the data repository. */
protected 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 MigrationToolIndivLauncher method loadData.
private void loadData() throws Exception {
// validate the project path, and add to args
projectRoot = ctx.getHierarchy().findExistingKey(projectPath);
if (projectRoot == null)
throw new MigrationException("notTeamProject");
args.put(MigrationToolIndiv.PROJECT_PATH, projectPath);
// retrieve the target directory, validate it, and add to args
String targetDirName = ProcessDashboard.getDefaultDirectory();
targetDir = new File(targetDirName);
if (!targetDir.isDirectory())
throw new MigrationException(new FileNotFoundException(targetDirName));
args.put(MigrationToolIndiv.TARGET_DIR, targetDir.getAbsolutePath());
// check that the backup subdirectory exists - otherwise we're
// probably in bridged mode.
File backupSubdir = new File(targetDir, "backup");
if (!backupSubdir.isDirectory())
throw new MigrationException("cannotMigrate").add("bridgedMode");
// check to see if we are performing a migration
String rootTemplateID = ctx.getHierarchy().pget(projectRoot).getID();
if (!rootTemplateID.endsWith(INDIV2_ROOT))
args.put(MigrationToolIndiv.MIGRATION_NEEDED, "true");
// add the process ID to the args
String processId = getValue("Team_Process_PID").format();
args.put(MigrationToolIndiv.PROCESS_ID, processId);
// for a conversion, add the target process ID to the args
SimpleData sd = getValue("Team_Project_Conversion_Needed");
if (sd != null && sd.test()) {
targetPID = sd.format();
args.put(MigrationToolIndiv.TARGET_PROCESS_ID, targetPID);
}
// add the phase list to the args
ProcessUtil proc = new ProcessUtil(ctx.getData(), projectPath);
List phases = proc.getProcessListPlain("Phase_List");
args.put(MigrationToolIndiv.PHASE_LIST, StringUtils.join(phases, "/"));
}
Aggregations