hudson.model.JobProperty Java Examples

The following examples show how to use hudson.model.JobProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GogsProjectProperty.java    From gogs-webhook-plugin with MIT License 6 votes vote down vote up
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) {
    GogsProjectProperty tpp = null;

    if (req != null) {
        tpp = req.bindJSON(
                GogsProjectProperty.class,
                formData.getJSONObject(GOGS_PROJECT_BLOCK_NAME)
        );
    }
    if (tpp != null) {
        LOGGER.finest(formData.toString());
        LOGGER.finest(tpp.gogsBranchFilter);

        gogsSecret = tpp.gogsSecret;
        gogsBranchFilter = tpp.gogsBranchFilter;
    }
    return tpp;
}
 
Example #2
Source File: TemplateImplementationProperty.java    From ez-templates with Apache License 2.0 6 votes vote down vote up
@Override
public JobProperty<?> newInstance(StaplerRequest request, JSONObject formData) throws FormException {
    if (formData.size() > 0 && formData.has("useTemplate")) {
        JSONObject useTemplate = formData.getJSONObject("useTemplate");

        String templateJobName = useTemplate.getString("templateJobName");
        boolean syncMatrixAxis = useTemplate.getBoolean("syncMatrixAxis");
        boolean syncDescription = useTemplate.getBoolean("syncDescription");
        boolean syncBuildTriggers = useTemplate.getBoolean("syncBuildTriggers");
        boolean syncDisabled = useTemplate.getBoolean("syncDisabled");
        boolean syncSecurity = useTemplate.getBoolean("syncSecurity");
        boolean syncScm = useTemplate.getBoolean("syncScm");
        boolean syncOwnership = useTemplate.getBoolean("syncOwnership");
        boolean syncAssignedLabel = useTemplate.getBoolean("syncAssignedLabel");

        return new TemplateImplementationProperty(templateJobName, syncMatrixAxis, syncDescription, syncBuildTriggers, syncDisabled, syncSecurity, syncScm, syncOwnership, syncAssignedLabel);
    }

    return null;
}
 
Example #3
Source File: BuildStatusAction.java    From github-autostatus-plugin with MIT License 5 votes vote down vote up
private void addGlobalProperties() {
    if (run instanceof WorkflowRun) {
        WorkflowRun workflowRun = (WorkflowRun) run;
        List<JobProperty<? super WorkflowJob>> properties = workflowRun.getParent().getAllProperties();
        for (JobProperty property : properties) {
            jobParameters.put(property.getClass().getSimpleName(), property);
        }
    }
}
 
Example #4
Source File: ProjectUtils.java    From ez-templates with Apache License 2.0 5 votes vote down vote up
public static Collection<AbstractProject> findProjectsWithProperty(final Class<? extends JobProperty<?>> property) {
    List<AbstractProject> projects = Jenkins.getInstance().getAllItems(AbstractProject.class);
    return Collections2.filter(projects, new Predicate<AbstractProject>() {
        @Override
        public boolean apply(AbstractProject abstractProject) {
            return abstractProject.getProperty(property) != null;
        }
    });
}
 
Example #5
Source File: TemplateProperty.java    From ez-templates with Apache License 2.0 5 votes vote down vote up
@Override
public JobProperty<?> newInstance(StaplerRequest request, JSONObject formData) throws FormException {
    if (formData.size() > 0) {
        return new TemplateProperty();
    }
    return null;
}
 
Example #6
Source File: IOpenShiftPluginDescriptor.java    From jenkins-plugin with Apache License 2.0 4 votes vote down vote up
default EnvVars buildEnvVars() {
    EnvVars allOverrides = new EnvVars(EnvVars.masterEnvVars);
    // when running outside of an openshift pod, global env vars like
    // SKIP_TLS will not exist in master env vars
    if (Jenkins.getInstance().getGlobalNodeProperties() != null) {
        if (Jenkins.getInstance().getGlobalNodeProperties()
                .get(hudson.slaves.EnvironmentVariablesNodeProperty.class) != null) {
            if (Jenkins
                    .getInstance()
                    .getGlobalNodeProperties()
                    .get(hudson.slaves.EnvironmentVariablesNodeProperty.class)
                    .getEnvVars() != null) {
                allOverrides
                        .putAll(Jenkins
                                .getInstance()
                                .getGlobalNodeProperties()
                                .get(hudson.slaves.EnvironmentVariablesNodeProperty.class)
                                .getEnvVars());
            }
        }
    }
    String[] reqPieces = Stapler.getCurrentRequest().getRequestURI()
            .split("/");
    if (reqPieces != null && reqPieces.length > 2) {
        for (Job j : Jenkins.getInstance().getAllItems(Job.class)) {
            if (j.getName().equals(reqPieces[2])) {
                List<JobProperty> jps = j.getAllProperties();
                for (JobProperty jp : jps) {
                    if (jp instanceof ParametersDefinitionProperty) {
                        ParametersDefinitionProperty prop = (ParametersDefinitionProperty) jp;
                        for (ParameterDefinition param : prop
                                .getParameterDefinitions()) {
                            allOverrides.put(param.getName(), param
                                    .getDefaultParameterValue().getValue()
                                    .toString());
                        }
                    }
                }
            }
        }
    }
    return allOverrides;
}
 
Example #7
Source File: GitLabConnectionProperty.java    From gitlab-plugin with GNU General Public License v2.0 4 votes vote down vote up
@Override
public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
    return req.bindJSON(GitLabConnectionProperty.class, formData);
}
 
Example #8
Source File: DynamicSubProject.java    From DotCi with MIT License 4 votes vote down vote up
@Override
public <T extends JobProperty> T getProperty(final Class<T> clazz) {
    return getParent().getProperty(clazz);
}