[NAE-1770] Validation register frontend#293
Open
Kovy95 wants to merge 13 commits intorelease/8.0.0from
Open
Conversation
- WIP add ValidationRunner & ValidationDelegate - implement ValidationRegistry with ValidationService - run validatioins on setDataField and finishTask - add validation process
- implement ValidationRunner on startup
- rename validation runner to validation executioner due to compilation errors - update executioner and service and its method calls - implement an example test scenario - remove original validations package, comment out original validations tests
- reimplement original validations into validation delegate - resolve possible duplicities (field - validation name, register existing validation name) - review tests - except date/datetime between, text regex
- update validations regarding new petriflow schema
- rework closures to methods in ValidationDelegate - update validations execution - update FieldFactory and add new classes for validations - update validation tests
- update schema and related data structure
- update validation delegate and executioner - add more tests for dynamic validations - update other tests for new validations
- update transition validation in ValidationService
- refactor executioner - update ValidationRunner: mongo search - update validation process - update tests - remove unnecessary tests
- refactor ValidationExecutioner - fix ValidationRunner predicate - add null check to ValidationService - update validation process - fields behavior, validation type field - add more validation tests
- fix validation naming - fix task immediate data
Retoocs
requested changes
Mar 13, 2025
|
|
||
| Boolean weekend() { return (thisField instanceof DateField || thisField instanceof DateTimeField) && notEmpty() && thisField.rawValue.dayOfWeek.isWeekend() } | ||
|
|
||
| protected static LocalDate parseStringToLocalDate(String stringDate) { |
Contributor
There was a problem hiding this comment.
Is this needed? Can be used DateUtils.parseDate() instead?
|
|
||
| protected ValidationDelegate initDelegate(Case useCase, Field<?> thisField, List<String> validationNames) { | ||
| ValidationDelegate delegate = getValidationDelegate() | ||
| delegate.metaClass.useCase = useCase |
Contributor
There was a problem hiding this comment.
Why isn't useCase as proper attribute of ValidationDelegate?
| log.warn("Ignoring validations {} for case [{}]: field names are identical with validation names", fieldNames, useCase.stringId) | ||
| validationNames -= fieldNames | ||
| } | ||
| return validationNames |
Contributor
There was a problem hiding this comment.
I think we can reduce this to:
List<String> fieldNames = useCase.dataSet.fields.keySet() as List<String>
return validationNames.removeAll(fieldNames)
Disadvantage is, we cannot have the same log message anymore. So the question is how important is the log message.
| private IValidationService validationService | ||
|
|
||
| @Autowired | ||
| private CaseRepository caseRepository |
Contributor
There was a problem hiding this comment.
please use IWorkflowService's bean instead of direct interaction with repository
|
|
||
| private static final long serialVersionUID = -2385696520525471923L; | ||
|
|
||
| protected List<Argument> argument; |
|
|
||
| private final Map<String, Closure<Boolean>> validationsMap = new ConcurrentHashMap<>(); | ||
|
|
||
| public Closure<Boolean> addValidation(String name, Closure<Boolean> closure) { |
Contributor
There was a problem hiding this comment.
add javadoc for this methods, please
| @Override | ||
| public void validateTransition(Case useCase, Transition transition) { | ||
| transition.getDataSet().keySet().forEach(fieldId -> { | ||
| if (useCase.getDataSet().get(fieldId) != null) { |
Contributor
There was a problem hiding this comment.
create variable for useCase.getDataSet().get(fieldId)
| import com.netgrif.application.engine.validation.models.TextFieldValidation | ||
| import com.netgrif.application.engine.petrinet.domain.dataset.logic.action.ValidationDelegate | ||
|
|
||
| //import com.netgrif.application.engine.validation.domain.ValidationDataInput |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements NAE-1770 and NAE-1788
Dependencies
All new dependencies in engine 8
Third party dependencies
All new dependencies in engine 8
Blocking Pull requests
DEPENDS on NAE-1788
How Has Been This Tested?
manually
Test Configuration
<Please describe configuration for tests to run if applicable, like program parameters, host OS, VM configuration etc.>
Checklist: