/** * Exposes the {@link #getLocalStores()} for the XML API. * * @return the {@link #getLocalStores()} for the XML API. * @since 2.1.0 */ @NonNull @SuppressWarnings("unused") // Stapler XML/JSON API @Exported(name = "stores") public Map<String,CredentialsStoreAction> getStoreActionsMap() { Map<String,CredentialsStoreAction> result = new TreeMap<String, CredentialsStoreAction>(); for (CredentialsStoreAction a: getStoreActions()) { result.put(a.getUrlName(), a); } return result; }
/** * Exposes the {@link #getLocalStores()} for the XML API. * * @return the {@link #getLocalStores()} for the XML API. * @since 2.1.0 */ @NonNull @SuppressWarnings("unused") // Stapler XML/JSON API @Exported(name = "stores") public Map<String,CredentialsStoreAction> getStoreActionsMap() { Map<String,CredentialsStoreAction> result = new TreeMap<String, CredentialsStoreAction>(); for (CredentialsStoreAction a: getStoreActions()) { result.put(a.getUrlName(), a); } return result; }
/** * Returns the {@link Item#getFullName()} or nearest approximation. * * @return the {@link Item#getFullName()} or nearest approximation. */ public final String getFullName() { String n; ModelObject context = getStore().getContext(); if (context instanceof Item) { n = ((Item) context).getFullName(); } else if (context instanceof ItemGroup) { n = ((ItemGroup) context).getFullName(); } else if (context instanceof User) { n = "user:" + ((User) context).getId(); } else { n = ""; } if (n.length() == 0) { return getUrlName(); } else { return n + '/' + getUrlName(); } }
/** * Returns the {@link Item#getFullName()} or nearest approximation. * * @return the {@link Item#getFullName()} or nearest approximation. */ public final String getFullName() { String n; ModelObject context = getStore().getContext(); if (context instanceof Item) { n = ((Item) context).getFullName(); } else if (context instanceof ItemGroup) { n = ((ItemGroup) context).getFullName(); } else if (context instanceof User) { n = "user:" + ((User) context).getId(); } else { n = ""; } if (n.length() == 0) { return getUrlName(); } else { return n + '/' + getUrlName(); } }
/** * Exposes the {@link #getStoreActions()} by {@link CredentialsStoreAction#getUrlName()} for Stapler. * * @param name the {@link CredentialsStoreAction#getUrlName()} to match. * @return the {@link CredentialsStoreAction} or {@code null} */ @CheckForNull @SuppressWarnings("unused") // Stapler binding public CredentialsStoreAction getStore(String name) { for (final CredentialsStore s : CredentialsProvider.lookupStores(getContext())) { if (context == s.getContext()) { // local stores only CredentialsStoreAction action = s.getStoreAction(); if (action != null && name.equals(action.getUrlName())) { return s.hasPermission(CredentialsProvider.VIEW) ? action : null; } } } return null; }
/** * Exposes the {@link #getStoreActions()} by {@link CredentialsStoreAction#getUrlName()} for Stapler. * * @param name the {@link CredentialsStoreAction#getUrlName()} to match. * @return the {@link CredentialsStoreAction} or {@code null} */ @CheckForNull @SuppressWarnings("unused") // Stapler binding public CredentialsStoreAction getStore(String name) { for (final CredentialsStore s : CredentialsProvider.lookupStores(getContext())) { if (context == s.getContext()) { // local stores only CredentialsStoreAction action = s.getStoreAction(); if (action != null && name.equals(action.getUrlName())) { return s.hasPermission(CredentialsProvider.VIEW) ? action : null; } } } return null; }
/** * {@inheritDoc} */ // In the general case we would implement ModelObjectWithChildren as the child actions could be viewed as children // but in this case we expose them in the sidebar, so they are more correctly part of the context menu. @Override public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { ContextMenu menu = new ContextMenu(); for (CredentialsStoreAction action : getStoreActions()) { ContextMenuIconUtils.addMenuItem( menu, "store", action, action.getContextMenu(ContextMenuIconUtils.buildUrl("store", action.getUrlName())) ); } return menu; }
/** * {@inheritDoc} */ // In the general case we would implement ModelObjectWithChildren as the child actions could be viewed as children // but in this case we expose them in the sidebar, so they are more correctly part of the context menu. @Override public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { ContextMenu menu = new ContextMenu(); for (CredentialsStoreAction action : getStoreActions()) { ContextMenuIconUtils.addMenuItem( menu, "store", action, action.getContextMenu(ContextMenuIconUtils.buildUrl("store", action.getUrlName())) ); } return menu; }
return relativeLink + "credentials/store/" + a.getUrlName() + "/"; return relativeLink + action.getUrlName() + "/";
return relativeLink + "credentials/store/" + a.getUrlName() + "/"; return relativeLink + action.getUrlName() + "/";
final String splitKey = domain.getParent().getUrlName() + "/"; int split = destination.lastIndexOf(splitKey); if (split == -1) {
final String splitKey = domain.getParent().getUrlName() + "/"; int split = destination.lastIndexOf(splitKey); if (split == -1) {