Class TemplateAttributeDefinition

    • Constructor Detail

      • TemplateAttributeDefinition

        public TemplateAttributeDefinition()
    • Method Detail

      • getTemplateText

        @NonnullAfterInit
        public String getTemplateText()
        Get the template text to be evaluated.
        Returns:
        the template
      • setTemplateText

        public void setTemplateText​(@Nullable
                                    String velocityTemplate)
        Set the literal text of the template to be evaluated.
        Parameters:
        velocityTemplate - template to be evaluated
      • getVelocityEngine

        @NonnullAfterInit
        public org.apache.velocity.app.VelocityEngine getVelocityEngine()
        Get the VelocityEngine to be used.
        Returns:
        the template
      • setVelocityEngine

        public void setVelocityEngine​(@Nonnull
                                      org.apache.velocity.app.VelocityEngine velocityEngine)
        Set the VelocityEngine to be used.
        Parameters:
        velocityEngine - engine to be used
      • doAttributeDefinitionResolve

        @Nonnull
        protected IdPAttribute doAttributeDefinitionResolve​(@Nonnull
                                                            AttributeResolutionContext resolutionContext,
                                                            @Nonnull
                                                            AttributeResolverWorkContext workContext)
                                                     throws ResolutionException
        Creates and populates the values for the resolved attribute. Implementations should not set, or otherwise manage, the resolved attribute's display name, description or encoders. Nor should the resultant attribute be recorded in the given resolution context.
        Specified by:
        doAttributeDefinitionResolve in class AbstractAttributeDefinition
        Parameters:
        resolutionContext - current attribute resolution context
        workContext - current resolver work context
        Returns:
        resolved attribute or null if nothing to resolve.
        Throws:
        ResolutionException - thrown if there is a problem resolving and creating the attribute
      • setupSourceValues

        private int setupSourceValues​(@Nonnull
                                      AttributeResolverWorkContext workContext,
                                      @Nonnull @NonnullElements
                                      Map<String,​Iterator<IdPAttributeValue>> sourceValues)
                               throws ResolutionException
        Set up a map which can be used to populate the template. The key is the attribute name and the value is the iterator to give all the names. We also return how deep the iteration will be and throw an exception if there is a mismatch in number of elements in any attribute.
        Parameters:
        workContext - source for dependencies
        sourceValues - to populate with the attribute iterators
        Returns:
        how many values in the attributes
        Throws:
        ResolutionException - if there is a mismatched count of attributes