-
Notifications
You must be signed in to change notification settings - Fork 6
[NAE-1770] Validation register frontend #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/8.0.0
Are you sure you want to change the base?
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
|
||
Boolean weekend() { return (thisField instanceof DateField || thisField instanceof DateTimeField) && notEmpty() && thisField.rawValue.dayOfWeek.isWeekend() } | ||
|
||
protected static LocalDate parseStringToLocalDate(String stringDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use IWorkflowService
's bean instead of direct interaction with repository
|
||
private static final long serialVersionUID = -2385696520525471923L; | ||
|
||
protected List<Argument> argument; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argument
-> arguments
|
||
private final Map<String, Closure<Boolean>> validationsMap = new ConcurrentHashMap<>(); | ||
|
||
public Closure<Boolean> addValidation(String name, Closure<Boolean> closure) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
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: