Class IdGenerator
java.lang.Object
io.appform.ranger.discovery.bundle.id.IdGenerator
Id generation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanUp()generate(IdGenerationRequest request) static IdGenerate id with given prefixstatic Idgenerate(String prefix, IdFormatter idFormatter) generateWithConstraints(String prefix, @NonNull String domain) Generate id that mathces all passed constraints.generateWithConstraints(String prefix, @NonNull String domain, boolean skipGlobal) Generate id that mathces all passed constraints.generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints) Generate id that mathces all passed constraints.generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints, boolean skipGlobal) Generate id that mathces all passed constraints.static voidinitialize(int node) static voidinitialize(int node, List<IdValidationConstraint> globalConstraints, Map<String, List<IdValidationConstraint>> domainSpecificConstraints) Generate id by parsing given stringstatic voidregisterDomain(Domain domain) static voidregisterDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints) static voidregisterDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints) static voidregisterGlobalConstraints(IdValidationConstraint... constraints) static voidregisterGlobalConstraints(List<IdValidationConstraint> constraints)
-
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
-
registerGlobalConstraints
-
registerGlobalConstraints
-
registerDomainSpecificConstraints
public static void registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints) -
registerDomainSpecificConstraints
public static void registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints) -
generate
Generate id with given prefix- Parameters:
prefix- String prefix with will be used to blindly merge- Returns:
- Generated Id
-
generate
-
generateWithConstraints
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 prefixdomain- 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 prefixdomain- Domain for constraint selectionskipGlobal- 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 prefixinConstraints- Constraints that need to be validated.- Returns:
- Id if it could be generated
-
parse
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 prefixinConstraints- Constraints that need to be validate.skipGlobal- Skip global constrains and use only passed ones- Returns:
- Id if it could be generated
-
generate
-