# W-MISS ImportantRule Implementation

**HISTORY:**
...
###### 01/07/2026: ECARS-2480 - migrate univariant rules from ALL_FIELDS to SOME_FIELDS

## Overview

This document describes the field-level `ImportantRule`, which produces the `W-MISS` validation message.
The rule checks that configured important fields are not empty.

## Rule Description

**Rule Code**: W-MISS  
**Rule Type**: WARNING  
**Description**: Value missing  
**Rule Definition ID**: 68  
**Validation Message ID**: 146  
**Protocol**: Incidence (39 var) (Protocol ID: 11)

### Rule Logic

The `W-MISS` message is produced when:

- The field is included in `ruleToField` for the current protocol and rule.
- The field is configured with `FIELD.mandatory = 2`.
- The submitted value is empty or blank.

Fields not listed in `ruleToField` are skipped for ENCR protocol 11.

## Configuration

For ENCR protocol 11, `ImportantRule` uses explicit `ruleToField` targeting:

- `target_id = 3` (`SOME_FIELDS`)
- `ruleDefinition_id = 68`
- one row per protocol 11 schema field that was configured as important (`FIELD.mandatory = 2`) at migration time

This keeps the rule target list visible in database configuration and QCS-ADMIN.
The `FIELD.mandatory` value remains the validation parameter used by the rule, but it is not used as an implicit target selector for ENCR protocol 11.

## Implementation Files

**Java implementation**: `src/main/java/eu/europa/ec/jrc/qcs/engine/rule/field/ImportantRule.java`
**Database migration SQL**: `docs/rules/W-MISS/ImportantRule/W-MISS-IMPORTANT_rule_registration.sql`
