@Override public IdPAttributeValue<?> apply(final IdPAttributeValue<?> input) { if (null == input) { return new EmptyAttributeValue(EmptyType.NULL_VALUE); } else { return input; } } };
/** {@inheritDoc} */ @Override public int hashCode() { return attribute.hashCode(); }
/** {@inheritDoc} */ @Override public int hashCode() { return value.hashCode(); }
/** * Gets attribute value. * * @param attribute the attribute * @return the attribute value */ protected IdPAttributeValue<?> getAttributeValue(final IdPAttribute attribute) { if (!attribute.getValues().isEmpty()) { return attribute.getValues().get(0); } return new EmptyAttributeValue(EmptyAttributeValue.EmptyType.NULL_VALUE); }
/** * Whether the IdP attribute is empty. * * @param input the IdP Attribute * @return true if the IdP attribute has no values or empty values, false otherwise */ private boolean isEmpty(@Nonnull final IdPAttribute input) { for (final IdPAttributeValue value : input.getValues()) { if (!(value instanceof EmptyAttributeValue)) { return false; } } return true; } }
/** * Gets the default return value. * * @return the default return value. */ @Nullable public String getDefaultValue() { if (null == defaultValue) { return null; } return defaultValue.getValue(); }
/** {@inheritDoc} */ @Override public int hashCode() { return Objects.hashCode(getValue(), scope); }
/** * Add the provided value to the provided list, converting {@link String} to {@link StringAttributeValue}. * * @param values the list to add to. * @param value the value to add. Known to be a {@link String} or an {@link IdPAttributeValue} */ private void addAsIdPAttributeValue(final List<IdPAttributeValue<?>> values, final Object value) { if (null == value) { values.add(new EmptyAttributeValue(EmptyType.NULL_VALUE)); } else if (value instanceof String) { values.add(StringAttributeValue.valueOf((String) value)); } else { values.add((IdPAttributeValue) value); } }
/** {@inheritDoc} */ @Override @Nonnull protected IdPAttribute newAttribute(@Nonnull final Attribute input, @Nonnull @NotEmpty final String id) { return new IdPAttribute(id); }
/** {@inheritDoc} */ @Override @Nonnull protected Map<Locale, String> getDisplayInfo(@Nonnull final IdPAttribute attribute) { return attribute.getDisplayNames(); } }
/** {@inheritDoc} */ @Override @Nonnull protected Map<Locale, String> getDisplayInfo(@Nonnull IdPAttribute attribute) { return attribute.getDisplayDescriptions(); } }
/** {@inheritDoc} */ @Override public int hashCode() { return Objects.hashCode(getValue(), valueLocale); }
/** {@inheritDoc} */ @Override public boolean equals(final Object other) { if (other == null) { return false; } if (this == other) { return true; } if (other instanceof IdPAttributePrincipal) { return attribute.equals(((IdPAttributePrincipal) other).getAttribute()); } return false; }
/** * Replaces the existing display descriptions for this attribute with the given ones. * * @param newDescriptions the new descriptions for this attribute */ public void setDisplayDescriptions(@Nullable @NullableElements final Map<Locale, String> newDescriptions) { displayDescriptions = checkedNamesFrom(newDescriptions); }
/** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof IdPAttribute)) { return false; } final IdPAttribute other = (IdPAttribute) obj; return java.util.Objects.equals(id, other.getId()); }
/** {@inheritDoc} */ @Override @Nonnull protected Map<Locale, String> getDisplayInfo(@Nonnull IdPAttribute attribute) { return attribute.getDisplayNames(); } }
/** {@inheritDoc} */ @Override @Nonnull protected Map<Locale, String> getDisplayInfo(@Nonnull final IdPAttribute attribute) { return attribute.getDisplayDescriptions(); } }
/** * Constructor. * * @param attribute the attribute we are encapsulating. * @param prefix the log path from the definition. */ public ScriptedIdPAttributeImpl(@Nonnull final IdPAttribute attribute, final String prefix) { encapsulatedAttribute = attribute; logPrefix = new StringBuilder(prefix).append(" scripted attribute '").append(attribute.getId()).append("':") .toString(); }
/** * Get the encapsulated attributeId. * * @return the id */ @Override @Nonnull @NotEmpty public String getId() { return encapsulatedAttribute.getId(); }