hudson.model.DescriptorVisibilityFilter Java Examples

The following examples show how to use hudson.model.DescriptorVisibilityFilter. 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: DockerTemplate.java    From docker-plugin with MIT License 6 votes vote down vote up
/**
 * Get a list of all {@link NodePropertyDescriptor}s we can use to define DockerSlave NodeProperties.
 */
@SuppressWarnings("cast")
public List<NodePropertyDescriptor> getNodePropertiesDescriptors() {
    // Copy/paste hudson.model.Slave.SlaveDescriptor.nodePropertyDescriptors marked as @Restricted for reasons I don't get
    List<NodePropertyDescriptor> result = new ArrayList<>();
    Collection<NodePropertyDescriptor> list =
            (Collection) Jenkins.getInstance().getDescriptorList(NodeProperty.class);
    for (NodePropertyDescriptor npd : DescriptorVisibilityFilter.applyType(DockerTransientNode.class, list)) {
        if (npd.isApplicable(DockerTransientNode.class)) {
            result.add(npd);
        }
    }
    final Iterator<NodePropertyDescriptor> iterator = result.iterator();
    while (iterator.hasNext()) {
        final NodePropertyDescriptor de = iterator.next();
        // see https://issues.jenkins-ci.org/browse/JENKINS-47697
        if ("org.jenkinsci.plugins.matrixauth.AuthorizationMatrixNodeProperty".equals(de.getKlass().toJavaClass().getName())) {
            iterator.remove();
        }
    }
    return result;
}
 
Example #2
Source File: KubernetesCloud.java    From kubernetes-plugin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused") // used by jelly
public List<Descriptor<PodRetention>> getAllowedPodRetentions() {
    Jenkins jenkins = Jenkins.getInstanceOrNull();
    if (jenkins == null) {
        return new ArrayList<>(0);
    }
    return DescriptorVisibilityFilter.apply(this, jenkins.getDescriptorList(PodRetention.class));
}
 
Example #3
Source File: ContainerTemplate.java    From kubernetes-plugin with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused") // Used by jelly
@Restricted(DoNotUse.class) // Used by jelly
public List<? extends Descriptor> getEnvVarsDescriptors() {
    return DescriptorVisibilityFilter.apply(null, Jenkins.getInstance().getDescriptorList(TemplateEnvVar.class));
}
 
Example #4
Source File: PodTemplate.java    From kubernetes-plugin with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused") // Used by jelly
@Restricted(DoNotUse.class) // Used by jelly
public List<? extends Descriptor> getEnvVarsDescriptors() {
    return DescriptorVisibilityFilter.apply(null, Jenkins.getInstance().getDescriptorList(TemplateEnvVar.class));
}