/** * {@inheritDoc} */ @Override public String getUrlName() { CredentialsStore store = getStore(); if (this == store.getStoreAction()) { Class<?> c = store.getClass(); while (c.getEnclosingClass() != null) { c = c.getEnclosingClass(); } String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", ""); if (StringUtils.isBlank(name)) { name = c.getSimpleName(); } return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), '-').toLowerCase(Locale.ENGLISH); } else { return "credential-store"; } }
/** * {@inheritDoc} */ @Override public String getUrlName() { CredentialsStore store = getStore(); if (this == store.getStoreAction()) { Class<?> c = store.getClass(); while (c.getEnclosingClass() != null) { c = c.getEnclosingClass(); } String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", ""); if (StringUtils.isBlank(name)) { name = c.getSimpleName(); } return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), '-').toLowerCase(Locale.ENGLISH); } else { return "credential-store"; } }
/** * {@inheritDoc} */ @Override public String getDisplayName() { CredentialsStore store = getStore(); if (this == store.getStoreAction()) { Class<?> c = store.getClass(); while (c.getEnclosingClass() != null) { c = c.getEnclosingClass(); } String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", ""); if (StringUtils.isBlank(name)) { name = c.getSimpleName(); } return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), ' '); } else { return Messages.CredentialsStoreAction_DisplayName(); } }
/** * {@inheritDoc} */ @Override public String getDisplayName() { CredentialsStore store = getStore(); if (this == store.getStoreAction()) { Class<?> c = store.getClass(); while (c.getEnclosingClass() != null) { c = c.getEnclosingClass(); } String name = c.getSimpleName().replaceAll("(?i)(Impl|Credentials|Provider|Store)+", ""); if (StringUtils.isBlank(name)) { name = c.getSimpleName(); } return StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(name), ' '); } else { return Messages.CredentialsStoreAction_DisplayName(); } }
/** * The {@link CredentialsStoreAction.DomainWrapper} instances. * * @return the {@link CredentialsStoreAction.DomainWrapper} instances. */ public Map<String, CredentialsStoreAction.DomainWrapper> getWrappers() { CredentialsStoreAction action = store.getStoreAction(); return action != null ? action.getDomains() : new CredentialsStoreAction() { /** * {@inheritDoc} */ @NonNull @Override public CredentialsStore getStore() { return store; } }.getDomains(); }
/** * The {@link CredentialsStoreAction.DomainWrapper} instances. * * @return the {@link CredentialsStoreAction.DomainWrapper} instances. */ public Map<String, CredentialsStoreAction.DomainWrapper> getWrappers() { CredentialsStoreAction action = store.getStoreAction(); return action != null ? action.getDomains() : new CredentialsStoreAction() { /** * {@inheritDoc} */ @NonNull @Override public CredentialsStore getStore() { return store; } }.getDomains(); }
/** * Exposes the {@link #getLocalStores()} {@link CredentialsStore#getStoreAction()}. * * @return the {@link #getLocalStores()} {@link CredentialsStore#getStoreAction()}. */ @NonNull @SuppressWarnings("unused") // Jelly EL public List<CredentialsStoreAction> getStoreActions() { List<CredentialsStoreAction> result = new ArrayList<CredentialsStoreAction>(); for (final CredentialsStore s : CredentialsProvider.lookupStores(getContext())) { if (context == s.getContext() && s.hasPermission(CredentialsProvider.VIEW)) { CredentialsStoreAction action = s.getStoreAction(); if (action != null) { result.add(action); } } } return result; }
/** * Exposes the {@link #getLocalStores()} {@link CredentialsStore#getStoreAction()}. * * @return the {@link #getLocalStores()} {@link CredentialsStore#getStoreAction()}. */ @NonNull @SuppressWarnings("unused") // Jelly EL public List<CredentialsStoreAction> getStoreActions() { List<CredentialsStoreAction> result = new ArrayList<CredentialsStoreAction>(); for (final CredentialsStore s : CredentialsProvider.lookupStores(getContext())) { if (context == s.getContext() && s.hasPermission(CredentialsProvider.VIEW)) { CredentialsStoreAction action = s.getStoreAction(); if (action != null) { result.add(action); } } } return result; }
/** * Checks if this action should be visible. * * @return {@code true} if the action should be visible. */ public boolean isVisible() { CredentialsStore store = getStore(); if (!store.getProvider().isEnabled()) { return false; } CredentialsStoreAction storeAction = store.getStoreAction(); if (storeAction != null && this != storeAction) { // 2.0+ implementations of CredentialsStore should be returning their action via getStoreAction() // and we want to display that action from ViewCredentialsAction // Old implementations will be returning null from getStoreAction() so we let them display as before // Forward looking implementations written against the old API will want to "hide" their old // action and display the new one returned from getStoreAction() which is what this hook enables. return false; } return store.hasPermission(CredentialsProvider.VIEW) && !store.getCredentialsDescriptors().isEmpty(); }
/** * Checks if this action should be visible. * * @return {@code true} if the action should be visible. */ public boolean isVisible() { CredentialsStore store = getStore(); if (!store.getProvider().isEnabled()) { return false; } CredentialsStoreAction storeAction = store.getStoreAction(); if (storeAction != null && this != storeAction) { // 2.0+ implementations of CredentialsStore should be returning their action via getStoreAction() // and we want to display that action from ViewCredentialsAction // Old implementations will be returning null from getStoreAction() so we let them display as before // Forward looking implementations written against the old API will want to "hide" their old // action and display the new one returned from getStoreAction() which is what this hook enables. return false; } return store.hasPermission(CredentialsProvider.VIEW) && !store.getCredentialsDescriptors().isEmpty(); }
/** * 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; }
return null; CredentialsStoreAction a = getStoreAction(); if (a != null) { return relativeLink + "credentials/store/" + a.getUrlName() + "/";
return null; CredentialsStoreAction a = getStoreAction(); if (a != null) { return relativeLink + "credentials/store/" + a.getUrlName() + "/";