# E-MISS MandatoryRule Implementation

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

## Overview

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

## Rule Description

**Rule Code**: E-MISS  
**Rule Type**: ERROR  
**Description**: Value missing  
**Rule Definition ID**: 65  
**Validation Message ID**: 65  
**Protocol**: Incidence (39 var) (Protocol ID: 11)

### Rule Logic

The `E-MISS` message is produced when:

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

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

## Configuration

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

- `target_id = 3` (`SOME_FIELDS`)
- `ruleDefinition_id = 65`
- one row per protocol 11 schema field that was configured as mandatory (`FIELD.mandatory = 1`) 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/MandatoryRule.java`
**Database migration SQL**: `docs/rules/E-MISS/MandatoryRule/E-MISS-MANDATORY_rule_registration.sql`
