Search in sources :

Example 56 with SimpleData

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);
        }
    }
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 57 with SimpleData

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;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 58 with SimpleData

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);
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 59 with SimpleData

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;
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 60 with SimpleData

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, "/"));
}
Also used : FileNotFoundException(java.io.FileNotFoundException) SimpleData(net.sourceforge.processdash.data.SimpleData) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4