Class IdGenerator

java.lang.Object
io.appform.ranger.discovery.bundle.id.IdGenerator

public class IdGenerator extends Object
Id generation
  • Constructor Details

    • IdGenerator

      public IdGenerator()
  • Method Details

    • initialize

      public static void initialize(int node)
    • cleanUp

      public static void cleanUp()
    • initialize

      public static void initialize(int node, List<IdValidationConstraint> globalConstraints, Map<String,List<IdValidationConstraint>> domainSpecificConstraints)
    • registerDomain

      public static void registerDomain(Domain domain)
    • registerGlobalConstraints

      public static void registerGlobalConstraints(IdValidationConstraint... constraints)
    • registerGlobalConstraints

      public static void registerGlobalConstraints(List<IdValidationConstraint> constraints)
    • registerDomainSpecificConstraints

      public static void registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints)
    • registerDomainSpecificConstraints

      public static void registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints)
    • generate

      public static Id generate(String prefix)
      Generate id with given prefix
      Parameters:
      prefix - String prefix with will be used to blindly merge
      Returns:
      Generated Id
    • generate

      public static Id generate(String prefix, IdFormatter idFormatter)
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints(String prefix, @NonNull @NonNull String domain)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      domain - Domain for constraint selection
      Returns:
      Return generated id or empty if it was impossible to satisfy constraints and generate
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints(String prefix, @NonNull @NonNull String domain, boolean skipGlobal)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      domain - Domain for constraint selection
      skipGlobal - Skip global constrains and use only passed ones
      Returns:
      Id if it could be generated
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      inConstraints - Constraints that need to be validated.
      Returns:
      Id if it could be generated
    • parse

      public static Optional<Id> parse(String idString)
      Generate id by parsing given string
      Parameters:
      idString - String idString
      Returns:
      Id if it could be generated
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints, boolean skipGlobal)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      inConstraints - Constraints that need to be validate.
      skipGlobal - Skip global constrains and use only passed ones
      Returns:
      Id if it could be generated
    • generate

      public static Optional<Id> generate(IdGenerationRequest request)