Skip to content

[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

Open
wants to merge 13 commits into
base: release/8.0.0
Choose a base branch
from
Open

Conversation

Kovy95
Copy link
Contributor

@Kovy95 Kovy95 commented Mar 12, 2025

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.>

Name Tested on
OS LinuxMint22
Runtime
Dependency Manager
Framework version
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @...
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

MartinSiran and others added 13 commits June 6, 2024 09:46
- 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) {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants