Search in sources :

Example 81 with SimpleData

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

Example 82 with SimpleData

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

Example 83 with SimpleData

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

Example 84 with SimpleData

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

Example 85 with SimpleData

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");
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) SimpleData(net.sourceforge.processdash.data.SimpleData) File(java.io.File)

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