public String iconClassName() { if (StringUtils.isBlank(value)) { return ""; } final Run run = Stapler.getCurrentRequest().findAncestorObject(Run.class); if (run == null) { throw new IllegalStateException("Should only be called from value.jelly"); } StandardCredentials c = CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials(StandardCredentials.class, run.getParent(), ACL.SYSTEM, Collections.<DomainRequirement>emptyList()), CredentialsMatchers.withId(value)); if (c != null) { return c.getDescriptor().getIconClassName(); } c = CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials(StandardCredentials.class, run.getParent(), Jenkins.getAuthentication(), Collections.<DomainRequirement>emptyList()), CredentialsMatchers.withId(value)); if (c != null) { return c.getDescriptor().getIconClassName(); } return "icon-credentials-credential"; }
public String iconClassName() { if (StringUtils.isBlank(value)) { return ""; } final Run run = Stapler.getCurrentRequest().findAncestorObject(Run.class); if (run == null) { throw new IllegalStateException("Should only be called from value.jelly"); } StandardCredentials c = CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials(StandardCredentials.class, run.getParent(), ACL.SYSTEM, Collections.<DomainRequirement>emptyList()), CredentialsMatchers.withId(value)); if (c != null) { return c.getDescriptor().getIconClassName(); } c = CredentialsMatchers.firstOrNull( CredentialsProvider.lookupCredentials(StandardCredentials.class, run.getParent(), Jenkins.getAuthentication(), Collections.<DomainRequirement>emptyList()), CredentialsMatchers.withId(value)); if (c != null) { return c.getDescriptor().getIconClassName(); } return "icon-credentials-credential"; }