Class PlanComparators


  • public class PlanComparators
    extends Object
    Implements comparators to sort account requests within a provisioning plan.

    The comparators safely handle the case where two requests both have the property (e.g. both are enables), preserving existing ordering where the sort algorithm does so.

    Additionally, the “first” comparator methods will always retain Create requests at the start of the sequence.

    The motive behind creating this is the Salesforce connector. It executes the operations given blindly in the order they are received in the plan. However, certain operations must always precede others, resulting in a lot of code to handle this situation.

    • Constructor Summary

      Constructors 
      Constructor Description
      PlanComparators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Comparator<sailpoint.object.ProvisioningPlan.AttributeRequest> defaultAttributeSequence()
      Performs a default sort of requests, implementing the sequence (Create, Enable, Unlock, Modify, Lock, Disable, Delete)
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> defaultSequence()
      Performs a default sort of requests, implementing the sequence (Create, Enable, Unlock, Modify, Lock, Disable, Delete)
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> disablesFirst()
      Moves disables to the start of the sequence, before any other operation except create
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> disablesLast()
      Moves disables to the end of the sequence
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> enablesFirst()
      Moves enables to the start of the sequence, before any other operation except create
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> enablesLast()
      Moves enables to the end of the sequence
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> genericSort​(ToIntFunction<sailpoint.object.ProvisioningPlan.AccountRequest> function)
      A generic sorter that will use a ToIntFunction to transform the given AccountRequest into an integer value, then sort those.
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> specificFirst​(String which)
      Moves an account request containing the given attribute request to the start of the sequence, before any other operation except create.
      static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> specificLast​(String which)
      Moves any specific account requests containing the given attribute to the end of the sequence
    • Method Detail

      • defaultAttributeSequence

        public static Comparator<sailpoint.object.ProvisioningPlan.AttributeRequest> defaultAttributeSequence()
        Performs a default sort of requests, implementing the sequence (Create, Enable, Unlock, Modify, Lock, Disable, Delete)
        Returns:
        Sorter
      • defaultSequence

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> defaultSequence()
        Performs a default sort of requests, implementing the sequence (Create, Enable, Unlock, Modify, Lock, Disable, Delete)
        Returns:
        Sorter
      • disablesFirst

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> disablesFirst()
        Moves disables to the start of the sequence, before any other operation except create
        Returns:
        Sorter
      • disablesLast

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> disablesLast()
        Moves disables to the end of the sequence
        Returns:
        Sorter
      • enablesFirst

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> enablesFirst()
        Moves enables to the start of the sequence, before any other operation except create
        Returns:
        Sorter
      • enablesLast

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> enablesLast()
        Moves enables to the end of the sequence
        Returns:
        Sorter
      • genericSort

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> genericSort​(ToIntFunction<sailpoint.object.ProvisioningPlan.AccountRequest> function)
        A generic sorter that will use a ToIntFunction to transform the given AccountRequest into an integer value, then sort those.
        Parameters:
        function - The function to transform an AccountRequest into an appropriate integer
        Returns:
        A comparator to sort AccountRequests by that
      • specificFirst

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> specificFirst​(String which)
        Moves an account request containing the given attribute request to the start of the sequence, before any other operation except create.
        Parameters:
        which - The attribute name of the AttributeRequest to float to the top
        Returns:
        Sorter
      • specificLast

        public static Comparator<sailpoint.object.ProvisioningPlan.AccountRequest> specificLast​(String which)
        Moves any specific account requests containing the given attribute to the end of the sequence
        Parameters:
        which - Which attribute to look for
        Returns:
        Sorter