Package net.shibboleth.idp.ui.helper

# Class AttributeHelper

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.ui.helper.AttributeHelper

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public final class AttributeHelper extends AbstractIdentifiableInitializableComponent
Class to help Attribute Extraction in views.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Function<ProfileRequestContext,AttributeContext>`
`attributeContextStrategy`
How to get the AttributeContext we are looking at.
`private final org.slf4j.Logger`
`log`
Logger.

## Constructor Summary

Constructors
Constructor
Description
`AttributeHelper()`

## Method Summary

Modifier and Type
Method
Description
`String`
`getFirstAttributeDisplayValue(ProfileRequestContext prc, String attributeName)`
Return the first (filtered) attribute Value from the attribute of that name as a Display String.
`String`
`getFirstAttributeDisplayValue(ProfileRequestContext prc, String attributeName, String defaultValue)`
Return the first (filtered) attribute Value from the attribute of that name as a Display String.
`IdPAttributeValue`
`getFirstAttributeValue(ProfileRequestContext prc, String attributeName)`
Return the first (filtered) attribute Value from the attribute of that name as an `IdPAttributeValue`.
`String`
`getFirstUnfilteredAttributeDisplayValue(ProfileRequestContext prc, String attributeName)`
Return the first (unfiltered) attribute Value from the attribute of that name as a Display String.
`String`
`getFirstUnfilteredAttributeDisplayValue(ProfileRequestContext prc, String attributeName, String defaultValue)`
Return the first (unfiltered) attribute Value from the attribute of that name as a Display String.
`IdPAttributeValue`
`getFirstUnfilteredAttributeValue(ProfileRequestContext prc, String attributeName)`
Return the first (unfiltered) attribute Value from the attribute of that name as an `IdPAttributeValue`.
`private IdPAttributeValue`
`getFirstValue(IdPAttribute attribute)`
Helper method to get the first attribute name from the attribute.
`void`
`setAttributeContextStrategy(Function<ProfileRequestContext,AttributeContext> strategy)`
Set the way to get the `AttributeContext`.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`doInitialize, ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### attributeContextStrategy

@Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextStrategy
How to get the AttributeContext we are looking at.

### log

@Nonnull private final org.slf4j.Logger log
Logger.

## Constructor Details

### AttributeHelper

public AttributeHelper()

## Method Details

### setAttributeContextStrategy

public void setAttributeContextStrategy(@Nonnull Function<ProfileRequestContext,AttributeContext> strategy)
Set the way to get the `AttributeContext`.

Parameters:
  `strategy` - the strategy to use

### getFirstAttributeValue

@Nullable public IdPAttributeValue getFirstAttributeValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName)
Return the first (filtered) attribute Value from the attribute of that name as an `IdPAttributeValue`.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
Returns:
  The attribute value or null

### getFirstAttributeDisplayValue

@Nonnull public String getFirstAttributeDisplayValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName, @Nonnull String defaultValue)
Return the first (filtered) attribute Value from the attribute of that name as a Display String.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
  `defaultValue` - What to return if nothing found.
Returns:
  The default value or the attribute value

### getFirstAttributeDisplayValue

@Nonnull public String getFirstAttributeDisplayValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName)
Return the first (filtered) attribute Value from the attribute of that name as a Display String.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
Returns:
  The attribute value or ""

### getFirstUnfilteredAttributeValue

@Nullable public IdPAttributeValue getFirstUnfilteredAttributeValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName)
Return the first (unfiltered) attribute Value from the attribute of that name as an `IdPAttributeValue`.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
Returns:
  The attribute value or null

### getFirstUnfilteredAttributeDisplayValue

@Nonnull public String getFirstUnfilteredAttributeDisplayValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName, @Nonnull String defaultValue)
Return the first (unfiltered) attribute Value from the attribute of that name as a Display String.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
  `defaultValue` - What to return if nothing found
Returns:
  The default value or the attribute value

### getFirstUnfilteredAttributeDisplayValue

@Nonnull public String getFirstUnfilteredAttributeDisplayValue(@Nonnull ProfileRequestContext prc, @Nonnull @NotEmpty String attributeName)
Return the first (unfiltered) attribute Value from the attribute of that name as a Display String.

Parameters:
  `prc` - The ProfileRequestContext
  `attributeName` - The attribute name to look up
Returns:
  The attribute value or ""

### getFirstValue

@Nullable private IdPAttributeValue getFirstValue(@Nullable IdPAttribute attribute)
Helper method to get the first attribute name from the attribute.

Parameters:
  `attribute` - the Attribute or null if there wasn't one
Returns:
  the first attribute value or null