Search in sources :

Example 1 with MatrixConfiguration

use of hudson.matrix.MatrixConfiguration in project hudson-2.x by hudson.

the class ProjectServiceImpl method findProject.

public AbstractProject<?, ?> findProject(final String projectName) {
    checkProjectName(projectName);
    // Handle matrix-project/configuration projects.
    // First part is matrix-project name, second part is
    // matrix-configuration name
    String[] parts = projectName.split("/", 2);
    if (parts.length == 2) {
        log.debug("Detected matrix name: {}", projectName);
        AbstractProject<?, ?> parent = findProject(parts[0]);
        if (parent instanceof MatrixProject) {
            for (MatrixConfiguration config : ((MatrixProject) parent).getItems()) {
                if (parts[1].equals(config.getName())) {
                    log.debug("Selected matrix configuration: {}", config);
                    // config.checkPermission(Item.READ); // TODO needed?
                    return config;
                }
            }
        }
    }
    if (!getProjectNames().contains(projectName)) {
        log.debug("Project {} not in the list of job names.", projectName);
        return null;
    }
    AbstractProject<?, ?> project = getProjectByFullName(projectName);
    log.debug("Selected project: {}", project);
    return project;
}
Also used : MatrixProject(hudson.matrix.MatrixProject) MatrixConfiguration(hudson.matrix.MatrixConfiguration)

Aggregations

MatrixConfiguration (hudson.matrix.MatrixConfiguration)1 MatrixProject (hudson.matrix.MatrixProject)1