protected static Domain getDomainByName(CredentialsStore store, String domain) { if (StringUtils.equals("_", domain) || StringUtils.isBlank(domain) || "(global)".equals(domain)) { return Domain.global(); } else { for (Domain d : store.getDomains()) { if (domain.equals(d.getName())) { return d; } } } return null; }
protected static Domain getDomainByName(CredentialsStore store, String domain) { if (StringUtils.equals("_", domain) || StringUtils.isBlank(domain) || "(global)".equals(domain)) { return Domain.global(); } else { for (Domain d : store.getDomains()) { if (domain.equals(d.getName())) { return d; } } } return null; }
/** * Return the URL name. * * @return the URL name. */ @Exported @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "isGlobal() check implies that domain.getName() is null") public String getUrlName() { return isGlobal() ? "_" : Util.rawEncode(domain.getName()); }
/** * Return the URL name. * * @return the URL name. */ @Exported @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "isGlobal() check implies that domain.getName() is null") public String getUrlName() { return isGlobal() ? "_" : Util.rawEncode(domain.getName()); }
/** * Retrieves the domain with the matching name. * * @param name the name (or {@code null} to match {@link Domain#global()} as that is the domain with a null name) * @return the domain or {@code null} if there is no domain with the supplied name. * @since 2.1.1 */ @CheckForNull public Domain getDomainByName(@CheckForNull String name) { for (Domain d : getDomains()) { if (StringUtils.equals(name, d.getName())) { return d; } } return null; }
/** * Return the display name. * * @return the display name. */ @Exported public String getDisplayName() { return isGlobal() ? Messages.CredentialsStoreAction_GlobalDomainDisplayName() : domain.getName(); }
/** * Retrieves the domain with the matching name. * * @param name the name (or {@code null} to match {@link Domain#global()} as that is the domain with a null name) * @return the domain or {@code null} if there is no domain with the supplied name. * @since 2.1.1 */ @CheckForNull public Domain getDomainByName(@CheckForNull String name) { for (Domain d : getDomains()) { if (StringUtils.equals(name, d.getName())) { return d; } } return null; }
/** * Return the display name. * * @return the display name. */ @Exported public String getDisplayName() { return isGlobal() ? Messages.CredentialsStoreAction_GlobalDomainDisplayName() : domain.getName(); }
stdout.println(StringUtils.rightPad("Domain", maxIdLen) + " " + (domain.isGlobal() ? "(global)" : domain.getName())); stdout.println(StringUtils.rightPad("Description", maxIdLen) + " " + StringUtils .defaultString(domain.getDescription()));
stdout.println(StringUtils.rightPad("Domain", maxIdLen) + " " + (domain.isGlobal() ? "(global)" : domain.getName())); stdout.println(StringUtils.rightPad("Description", maxIdLen) + " " + StringUtils .defaultString(domain.getDescription()));
continue; if (value.equals(d.getName())) { return FormValidation.error(Messages.CredentialsStoreAction_DuplicateDomainNameMessage());
/** * Returns the map of {@link DomainWrapper} instances. * * @return the map of {@link DomainWrapper} instances. */ @Exported @NonNull public Map<String, DomainWrapper> getDomains() { Map<String, DomainWrapper> result = new TreeMap<String, DomainWrapper>(); for (Domain d : getStore().getDomains()) { String name; if (d.isGlobal()) { name = "_"; } else { name = d.getName(); } result.put(name, new DomainWrapper(this, d)); } return result; }
continue; if (value.equals(d.getName())) { return FormValidation.error(Messages.CredentialsStoreAction_DuplicateDomainNameMessage());
/** * Returns the map of {@link DomainWrapper} instances. * * @return the map of {@link DomainWrapper} instances. */ @Exported @NonNull public Map<String, DomainWrapper> getDomains() { Map<String, DomainWrapper> result = new TreeMap<String, DomainWrapper>(); for (Domain d : getStore().getDomains()) { String name; if (d.isGlobal()) { name = "_"; } else { name = d.getName(); } result.put(name, new DomainWrapper(this, d)); } return result; }
JSONObject data = req.getSubmittedForm(); Domain domain = req.bindJSON(Domain.class, data); String domainName = domain.getName(); if (domainName != null && getStore().addDomain(domain)) { return HttpResponses.redirectTo("./domain/" + Util.rawEncode(domainName));
JSONObject data = req.getSubmittedForm(); Domain domain = req.bindJSON(Domain.class, data); String domainName = domain.getName(); if (domainName != null && getStore().addDomain(domain)) { return HttpResponses.redirectTo("./domain/" + Util.rawEncode(domainName));
/** * Creates the children context menu with the supplied prefix to all URLs. * * @param prefix the prefix to prepend to relative urls. * @return the {@link ContextMenu} or {@code null} * @since 2.0 */ @CheckForNull public ContextMenu getChildrenContextMenu(String prefix) { ContextMenu menu = new ContextMenu(); for (Domain d : getStore().getDomains()) { MenuItem item = new MenuItem(d.getUrl(), getMenuItemIconUrlByClassSpec("icon-credentials-domain icon-md"), d.isGlobal() ? Messages.CredentialsStoreAction_GlobalDomainDisplayName() : d.getName() ); item.subMenu = new DomainWrapper(this, d).getContextMenu(ContextMenuIconUtils.buildUrl(prefix, d.getUrl())); menu.add(item); } return menu.items.isEmpty() ? null : menu; }
/** * Creates the children context menu with the supplied prefix to all URLs. * * @param prefix the prefix to prepend to relative urls. * @return the {@link ContextMenu} or {@code null} * @since 2.0 */ @CheckForNull public ContextMenu getChildrenContextMenu(String prefix) { ContextMenu menu = new ContextMenu(); for (Domain d : getStore().getDomains()) { MenuItem item = new MenuItem(d.getUrl(), getMenuItemIconUrlByClassSpec("icon-credentials-domain icon-md"), d.isGlobal() ? Messages.CredentialsStoreAction_GlobalDomainDisplayName() : d.getName() ); item.subMenu = new DomainWrapper(this, d).getContextMenu(ContextMenuIconUtils.buildUrl(prefix, d.getUrl())); menu.add(item); } return menu.items.isEmpty() ? null : menu; }
/** * Updates the domain configuration. * * @param req the request. * @return the response. * @throws ServletException if something goes wrong. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doConfigSubmit(StaplerRequest req) throws ServletException, IOException { if (!getStore().isDomainsModifiable()) { return HttpResponses.status(400); } getStore().checkPermission(MANAGE_DOMAINS); JSONObject data = req.getSubmittedForm(); Domain domain = req.bindJSON(Domain.class, data); String domainName = domain.getName(); if (domainName != null && getStore().updateDomain(this.domain, domain)) { return HttpResponses.redirectTo("../../domain/" + Util.rawEncode(domainName)); } return HttpResponses.redirectToDot(); }
/** * Updates the domain configuration. * * @param req the request. * @return the response. * @throws ServletException if something goes wrong. * @throws IOException if something goes wrong. */ @RequirePOST @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // stapler web method public HttpResponse doConfigSubmit(StaplerRequest req) throws ServletException, IOException { if (!getStore().isDomainsModifiable()) { return HttpResponses.status(400); } getStore().checkPermission(MANAGE_DOMAINS); JSONObject data = req.getSubmittedForm(); Domain domain = req.bindJSON(Domain.class, data); String domainName = domain.getName(); if (domainName != null && getStore().updateDomain(this.domain, domain)) { return HttpResponses.redirectTo("../../domain/" + Util.rawEncode(domainName)); } return HttpResponses.redirectToDot(); }