Class AbstractPersistentIdDataConnector

All Implemented Interfaces:
DataConnector, ResolverPlugin<Map<String,IdPAttribute>>, Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent, UnmodifiableComponent, DisposableBean

public abstract class AbstractPersistentIdDataConnector extends AbstractDataConnector
The basis of a DataConnector that handles persistent IDs that depend on a source IdPAttribute.
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • generatedAttribute

      @NonnullAfterInit private String generatedAttribute
      ID of the attribute generated by this data connector.
    • sourceInformation

      @NonnullAfterInit private String sourceInformation
      Information about the dependency.
  • Constructor Details

    • AbstractPersistentIdDataConnector

      public AbstractPersistentIdDataConnector()
  • Method Details

    • getSourceAttributeInformation

      @Nullable @NonnullAfterInit public String getSourceAttributeInformation()
      Get Information about the attribute whose first value is used when generating the computed ID. This is derived from the sourceID (if present) and/or the dependencies. Public purely as an aid to testing.
      Returns:
      log-friend information.
    • getGeneratedAttributeId

      @NonnullAfterInit public String getGeneratedAttributeId()
      Get the ID of the attribute generated by this connector.
      Returns:
      ID of the attribute generated by this connector
    • setGeneratedAttributeId

      public void setGeneratedAttributeId(@Nullable String newAttributeId)
      Set the ID of the attribute generated by this connector.
      Parameters:
      newAttributeId - what to set.
    • doDependencyInformation

      private void doDependencyInformation() throws ComponentInitializationException
      Do the dance with dependencies. Old style ones get the sourceId added (failing if it isn't there). New style ones get their names added to the information string.
      Throws:
      ComponentInitializationException - if the dependencies are not aligned correctly
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractDataConnector
      Throws:
      ComponentInitializationException
    • resolveSourceAttribute

      @Nullable protected String resolveSourceAttribute(@Nonnull AttributeResolverWorkContext workContext)
      Helper function to locate the source Attribute in the dependencies.
      Parameters:
      workContext - the context to look in
      Returns:
      the value, or null in any of the failure cases.
    • encodeAsAttribute

      @Nullable protected Map<String,IdPAttribute> encodeAsAttribute(@Nullable String value)
      Encode the provided string.
      Parameters:
      value - the value to encode or null if that failed
      Returns:
      null or the attribute.