Droids
  1. Droids
  2. DROIDS-93

Make the validation process more flexible with chain validators

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 0.1.0
    • Fix Version/s: 0.1.0
    • Component/s: core
    • Labels:
      None

      Description

      The validation process needs more flexibility - a chain of validators that are applied one after the other; when one would consider the entity invalid, the process would stop (voters). This way the separation of each validation rule can be done more cleanly and the validation process can be flexible by just plugging in different validators as needed, rather than gathering all the rules in a single validator.

        Activity

        Hide
        Javier Puerto added a comment -

        Thanks Eugen. I've to format a bit the code, please follow the project guidelines next time.

        Commited revision: 985450

        Show
        Javier Puerto added a comment - Thanks Eugen. I've to format a bit the code, please follow the project guidelines next time. Commited revision: 985450
        Hide
        Eugen Paraschiv added a comment -

        This is a simple usage example for the ChainTaskValidator implementation:

        final TaskValidator< Link > integrityTaskValidator = new IntegrityTaskValidator< Link >();
        final TaskValidator< Link > maxDepthTaskValidator = new MaxDepthTaskValidator< Link >( 1 );

        final ChainTaskValidator< Link > taskValidatorChain = new ChainTaskValidator< Link >();

        taskValidatorChain.addTaskValidator( integrityTaskValidator );
        taskValidatorChain.addTaskValidator( maxDepthTaskValidator );

        simpleQueue.setTaskValidator( taskValidatorChain );

        Show
        Eugen Paraschiv added a comment - This is a simple usage example for the ChainTaskValidator implementation: final TaskValidator< Link > integrityTaskValidator = new IntegrityTaskValidator< Link >(); final TaskValidator< Link > maxDepthTaskValidator = new MaxDepthTaskValidator< Link >( 1 ); final ChainTaskValidator< Link > taskValidatorChain = new ChainTaskValidator< Link >(); taskValidatorChain.addTaskValidator( integrityTaskValidator ); taskValidatorChain.addTaskValidator( maxDepthTaskValidator ); simpleQueue.setTaskValidator( taskValidatorChain );
        Hide
        Eugen Paraschiv added a comment -

        chain task validator implementation

        Show
        Eugen Paraschiv added a comment - chain task validator implementation

          People

          • Assignee:
            Unassigned
            Reporter:
            Eugen Paraschiv
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development