Search in sources :

Example 6 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class EditSubprojectList 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 7 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class EditSubprojectList method putValue.

protected void putValue(String name, SimpleData dataValue) {
    DataRepository data = getDataRepository();
    String prefix = getPrefix();
    if (prefix == null)
        prefix = "";
    String dataName = DataRepository.createDataName(prefix, name);
    data.putValue(dataName, dataValue);
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository)

Example 8 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class HandleFormAbstract method handleRegistration.

private void handleRegistration() throws IOException {
    log.entering("HandleForm", "handleRegistration");
    log.finer("query=" + env.get("QUERY_STRING"));
    DataRepository data = getDataRepository();
    String prefix = getDataPrefix();
    boolean unlocked = getUnlocked();
    if (!requiredTagOK(data, prefix)) {
        data = null;
        prefix = "No such project OR project/process mismatch";
    }
    FormDataSession session = new FormDataSession(data, prefix, unlocked);
    handleRegistrationImpl(session);
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository)

Example 9 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class GenericPlanSummaryForm method writeContents.

protected void writeContents() throws IOException {
    StringBuffer uri = new StringBuffer((String) env.get("SCRIPT_PATH"));
    uri.setLength(uri.length() - 6);
    uri.append(".shtm");
    String unit, units;
    DataRepository data = getDataRepository();
    String prefix = getPrefix();
    SimpleData d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
    units = (d != null ? d.format() : null);
    if (units == null || units.trim().length() == 0)
        units = resources.getString("Default_Units");
    int semicolonPos = units.indexOf(';');
    if (semicolonPos > -1) {
        unit = units.substring(0, semicolonPos);
        units = units.substring(semicolonPos + 1);
    } else if (units.endsWith("s")) {
        unit = units.substring(0, units.length() - 1);
    } else {
        unit = units;
    }
    HTMLUtils.appendQuery(uri, "Unit", unit);
    HTMLUtils.appendQuery(uri, "Units", units);
    DashHierarchy props = getPSPProperties();
    PropertyKey self = props.findExistingKey(getPrefix());
    int numPhases = props.getNumChildren(self);
    for (int i = 0; i < numPhases; i++) HTMLUtils.appendQuery(uri, "Phases", props.getChildKey(self, i).name());
    String text = getRequestAsString(uri.toString());
    out.write(text);
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 10 with DataRepository

use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.

the class DefectUtil method getWorkflowDefectPhases.

/**
     * If the given path is part of a team workflow, return a list of phases
     * that are appropriate for defect injection/removal.
     * 
     * @param taskPath
     *            the path of a task within the dashboard
     * @param context
     *            the dashboard context
     * @return a list of phases appropriate for the containing workflow.
     */
public static DefectPhaseList getWorkflowDefectPhases(String taskPath, DashboardContext context) {
    // retrieve the workflow info for the current project. If no workflow
    // info is found, return null.
    DataRepository data = context.getData();
    WorkflowInfo workflowInfo = WorkflowInfoFactory.get(data, taskPath);
    if (workflowInfo == null || workflowInfo.isEmpty())
        return null;
    // check to see if this is a PSP task.
    String path = taskPath;
    String parentPath = DataRepository.chopPath(taskPath);
    String phaseSuffix = null;
    if (isPspTask(data, parentPath)) {
        phaseSuffix = taskPath.substring(parentPath.length());
        path = parentPath;
    } else if (isPspTask(data, taskPath)) {
        phaseSuffix = "/Code";
        taskPath += "/Code";
    }
    // see if the current task came from a (potentially nested) workflow.
    // If so, create (potentially nested) workflow phase objects to
    // represent all of the enclosing workflow tasks.
    Map<String, DefectPhase> enclosingPhases = new HashMap();
    while (path != null) {
        // see if this task represents a phase in a workflow.
        String workflowId = getWorkflowID(data, path);
        if (workflowId != null && phaseSuffix != null)
            workflowId += phaseSuffix;
        Phase phase = workflowInfo.getPhase(workflowId);
        if (phase == null)
            // not a workflow phase. We are done.
            break;
        // represent subdivided tasks.)
        if (!enclosingPhases.containsKey(phase.getPhaseId())) {
            // task. Update their phase IDs to document this relationship.
            for (DefectPhase dp : enclosingPhases.values()) dp.phaseID = phase.getPhaseId() + "," + dp.phaseID;
            // enclosing phases
            for (Phase onePhase : phase.getWorkflow().getPhases()) {
                DefectPhase dp = new DefectPhase(onePhase);
                enclosingPhases.put(onePhase.getPhaseId(), dp);
            }
        }
        // step up to the parent and look for enclosing phases there, too
        path = DataRepository.chopPath(path);
        phaseSuffix = null;
    }
    // now that we have found the root of this enactment, scan all tasks
    // underneath to find any other workflows that are represented. Add
    // them to our result in the order they appear.
    DefectPhaseList result = new DefectPhaseList();
    result.workflowInfo = workflowInfo;
    if (!enclosingPhases.isEmpty()) {
        DashHierarchy hier = context.getHierarchy();
        result.workflowRoot = hier.findExistingKey(path);
        scanForWorkflowTasks(data, hier, result.workflowRoot, null, getDevelopmentPhases(data, path), result, new HashSet(), enclosingPhases, taskPath);
        // set the default injection phase, if necessary
        if (result.defaultRemovalPhase == -1)
            result.defaultInjectionPhase = -1;
        else if (result.defaultInjectionPhase == -1)
            result.defaultInjectionPhase = result.defaultRemovalPhase - 1;
    }
    return result;
}
Also used : Phase(net.sourceforge.processdash.process.WorkflowInfo.Phase) HashMap(java.util.HashMap) WorkflowInfo(net.sourceforge.processdash.process.WorkflowInfo) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) HashSet(java.util.HashSet)

Aggregations

DataRepository (net.sourceforge.processdash.data.repository.DataRepository)37 SimpleData (net.sourceforge.processdash.data.SimpleData)11 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)4 IOException (java.io.IOException)3 ListData (net.sourceforge.processdash.data.ListData)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 StringData (net.sourceforge.processdash.data.StringData)2 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1