# Business Logic — JBSbatKKBndWdtOvrSendMl.isSingleCheckKKIFM207_INF1() [83 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKBndWdtOvrSendMl` |
| Layer | Service (Batch Service — `eo.business.service`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKBndWdtOvrSendMl.isSingleCheckKKIFM207_INF1()

This method performs **single-item validation** on the input data for the **Mail Bandwidth Limit Exceedance Notification Information File** (TXT-KKIFM207-INF1). The batch service `JBSbatKKBndWdtOvrSendMl` is responsible for sending email notifications to customers whose broadband bandwidth usage has exceeded contractual limits. This specific method validates individual record fields before the notification email is dispatched.

The method implements the **validation gate** design pattern: it sequentially examines six business fields, applying mandatory (non-empty) checks to all fields and length (character count) checks to only the service contract number and SYSID fields. If any validation fails, it logs a business error and immediately returns `false`, halting further processing of the current record. Only when all fields pass validation does it return `true`, indicating the record is clean and ready for the subsequent email sending flow.

The method operates within the batch notification dispatch workflow. It is called internally by the `execute()` method of `JBSbatKKBndWdtOvrSendMl` during batch processing of bandwidth exceedance notification records, acting as a data quality gate between data retrieval and email dispatch. This is a **shared validation utility** — private to the class, but essential to ensuring only correctly formatted notification records are sent to customers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isSingleCheckKKIFM207_INF1"])
    START --> STRVAL["strValue = null"]

    STRVAL --> SVC_GET["strValue = rsMap.get SVC_KEI_NO"]
    SVC_GET --> SVC_NULL{strValue == null or empty?}

    SVC_NULL -->|true| SVC_ERR["Log EKKB0060TE with SVC_KEI_NO"]
    SVC_NULL -->|false| SVC_LEN{JBSbatCheckUtil.invoke strValue ketasuu2}

    SVC_ERR --> SVC_RET["return false"]
    SVC_LEN -->|false| SVC_LEN_ERR["Log EKKB0070TE with SVC_KEI_NO"]
    SVC_LEN_ERR --> SVC_RET

    SVC_LEN -->|true| SYSID_GET["strValue = rsMap.get SYSID"]
    SYSID_GET --> SYSID_NULL{strValue == null or empty?}

    SYSID_NULL -->|true| SYSID_ERR["Log EKKB0060TE with SYSID"]
    SYSID_NULL -->|false| SYSID_LEN{JBSbatCheckUtil.invoke strValue ketasuu2}

    SYSID_ERR --> SYSID_RET["return false"]
    SYSID_LEN -->|false| SYSID_LEN_ERR["Log EKKB0070TE with SYSID"]
    SYSID_LEN_ERR --> SYSID_RET

    SYSID_LEN -->|true| KEISHA_GET["strValue = rsMap.get KEISHA_NM"]
    KEISHA_GET --> KEISHA_NULL{strValue == null or empty?}

    KEISHA_NULL -->|true| KEISHA_ERR["Log EKKB0060TE with KEISHA_NM"]
    KEISHA_NULL -->|false| KEISHA_RET["return false"]

    KEISHA_ERR --> KEISHA_RET

    KEISHA_RET --> MLAD_GET["strValue = rsMap.get MLAD"]
    MLAD_GET --> MLAD_NULL{strValue == null or empty?}

    MLAD_NULL -->|true| MLAD_ERR["Log EKKB0060TE with MLAD"]
    MLAD_NULL -->|false| MLAD_RET["return false"]

    MLAD_ERR --> MLAD_RET

    MLAD_RET --> TIKI_GET["strValue = rsMap.get TIKI_SGN_TCHI_TSHIRYO"]
    TIKI_GET --> TIKI_NULL{strValue == null or empty?}

    TIKI_NULL -->|true| TIKI_ERR["Log EKKB0060TE with TIKI_SGN_TCHI_TSHIRYO"]
    TIKI_NULL -->|false| TIKI_RET["return false"]

    TIKI_ERR --> TIKI_RET

    TIKI_RET --> SEND_GET["strValue = rsMap.get SEND_KBN"]
    SEND_GET --> SEND_NULL{strValue == null or empty?}

    SEND_NULL -->|true| SEND_ERR["Log EKKB0060TE with SEND_KBN"]
    SEND_NULL -->|false| SEND_RET["return false"]

    SEND_ERR --> SEND_RET

    SEND_RET --> TRUE_RET(["return true"])
```

**Processing Summary:**

The method executes a linear series of field validations using a repeated three-step pattern for each of the six fields:

1. **Fetch**: Extract the field value from `rsMap` into `strValue`.
2. **Mandatory Check**: If the value is `null` or empty, log error `EKKB0060TE` with the field identifier from `itemvalueMap`, then return `false` (short-circuit).
3. **Length Check** (fields 1–2 only): For `SVC_KEI_NO` and `SYSID`, additionally validate character count via `JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "10"})` — meaning the field must be between 0 and 10 characters. If invalid, log error `EKKB0070TE` and return `false`.

After all checks pass, the method returns `true`, indicating no validation errors were found.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `rsMap` | `HashMap` | Input data map for the Mail Bandwidth Limit Exceedance Notification Information File. Contains field values keyed by field name identifiers (`SVC_KEI_NO`, `SYSID`, `KEISHA_NM`, `MLAD`, `TIKI_SGN_TCHI_TSHIRYO`, `SEND_KBN`). The data originates from either a text file or database query. This is the primary data source for validation. |
| 2 | `itemvalueMap` | `HashMap` | Error message contextual values map. Contains display-friendly field labels keyed by the TXT-KKIFM207-INF1 field naming convention (e.g., `TXT-KKIFM207-INF1.SVC_KEI_NO`). Used exclusively when building error log messages to identify which field failed validation in error notifications. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `commonItem` | `JBSbatCommonItem` | Batch common item holder providing shared services including the error log printer (`commonItem.getLogPrint()`). |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatCheckUtil.invoke` | JBSbatCheckUtil | - | Calls character count validation utility. Validates field values against character length constraints using the `ketasuu2` rule (max 10 characters). |
| - | `JKKBatOneTimeLogWriter.printBusinessErrorLog` | JKKBatOneTimeLogWriter | - | Logs business-level error to the one-time error log. Triggered when a field fails mandatory or length validation. |
| - | `JKKHttpCommunicator.printBusinessErrorLog` | JKKHttpCommunicator | - | Logs business-level error for HTTP communication context. Used in error handling pathways. |
| - | `JBSbatKKEMoneyTktnIraiRnk.printBusinessErrorLog` | JBSbatKKEMoneyTktnIraiRnk | - | Logs business-level error in the money ticket receipt ranking batch context. |
| - | `JBSbatKKEMoneyTktnTkyoTchMailSksi.printBusinessErrorLog` | JBSbatKKEMoneyTktnTkyoTchMailSksi | JBSbatKKEMoneyTktnTkyoTchMailSksi | Logs business-level error in the Tokyo charge mail sending batch context. |

**Note:** This method does not perform direct database CRUD operations. It is a pure validation method that reads from input maps and delegates error logging to the shared batch logging infrastructure. No SC codes or database tables are directly accessed by this method.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch:JBSbatKKBndWdtOvrSendMl | `JBSbatKKBndWdtOvrSendMl.execute` -> `isSingleCheckKKIFM207_INF1` | `printBusinessErrorLog [-]` |

**Caller Description:**
- `JBSbatKKBndWdtOvrSendMl.execute()` is the batch entry point that processes bandwidth limit exceedance notification records. It iterates through fetched data and calls `isSingleCheckKKIFM207_INF1` as a per-record validation gate before dispatching notification emails. If this method returns `false` for any record, the batch flow skips that record and moves to the next.

## 6. Per-Branch Detail Blocks

**Block 1** — SET `(initialization)` (L431)

> Initialize the working string variable used across all field validations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = null` |

---

**Block 2** — IF `(mandatory check for SVC_KEI_NO)` (L435–442)

> Field: SVC_KEI_NO (Service Contract Number). This is the unique contract identifier. Check if the field is mandatory (non-null, non-empty).

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("SVC_KEI_NO")` // Extract service contract number [-> key: "SVC_KEI_NO"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.SVC_KEI_NO")})` // Log error when service contract number is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 3** — IF `(length check for SVC_KEI_NO)` (L444–449)

> Field: SVC_KEI_NO (Service Contract Number). Validate character count is within 0–10.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "10"})` // Character count must be 0-10 [-> rule: "ketasuu2", min: "0", max: "10"] |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0070TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.SVC_KEI_NO")})` // Log error when service contract number exceeds length limit [-> error code: "EKKB0070TE"] |
| 3 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 4** — IF `(mandatory check for SYSID)` (L455–462)

> Field: SYSID (System ID). This is the system identifier associated with the notification. Check if the field is mandatory (non-null, non-empty).

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("SYSID")` // Extract system ID [-> key: "SYSID"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.SYSID")})` // Log error when system ID is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 5** — IF `(length check for SYSID)` (L464–469)

> Field: SYSID (System ID). Validate character count is within 0–10.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "10"})` // Character count must be 0-10 [-> rule: "ketasuu2", min: "0", max: "10"] |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0070TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.SYSID")})` // Log error when system ID exceeds length limit [-> error code: "EKKB0070TE"] |
| 3 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 6** — IF `(mandatory check for KEISHA_NM)` (L473–480)

> Field: KEISHA_NM (Contractor Name / Customer Name). The name of the customer being notified. Only a mandatory check is performed (no length limit).

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("KEISHA_NM")` // Extract customer name [-> key: "KEISHA_NM"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.KEISHA_NM")})` // Log error when customer name is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 7** — IF `(mandatory check for MLAD)` (L483–490)

> Field: MLAD (Mail Destination / Email Address). The email address to which the notification will be sent. Only a mandatory check is performed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("MLAD")` // Extract email destination [-> key: "MLAD"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.MLAD")})` // Log error when email address is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 8** — IF `(mandatory check for TIKI_SGN_TCHI_TSHIRYO)` (L493–500)

> Field: TIKI_SGN_TCHI_TSHIRYO (Bandwidth Limit Notification Communication Volume / Usage Volume). The measured bandwidth usage amount that triggered the exceedance notification. Only a mandatory check is performed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("TIKI_SGN_TCHI_TSHIRYO")` // Extract notification usage volume [-> key: "TIKI_SGN_TCHI_TSHIRYO"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.TIKI_SGN_TCHI_TSHIRYO")})` // Log error when usage volume is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 9** — IF `(mandatory check for SEND_KBN)` (L502–509)

> Field: SEND_KBN (Send Classification / Send Type). Determines how the notification is dispatched (e.g., email, mail). Only a mandatory check is performed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("SEND_KBN")` // Extract send type classification [-> key: "SEND_KBN"] |
| 2 | IF | `strValue == null || "".equals(strValue)` // Mandatory check: field must not be null or empty |
| 3 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM207-INF1.SEND_KBN")})` // Log error when send type is missing [-> error code: "EKKB0060TE"] |
| 4 | RETURN | `return false` // Short-circuit: record is invalid |

---

**Block 10** — RETURN `(success)` (L510)

> All six fields passed validation. The record is clean and safe for the email dispatch flow to proceed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // No errors — record passes validation |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SVC_KEI_NO` | Field | Service Contract Number — the unique identifier for a customer's service contract line item. |
| `SYSID` | Field | System ID — the system identifier associated with the notification record. |
| `KEISHA_NM` | Field | Contractor Name (Customer Name) — the name of the customer receiving the bandwidth exceedance notification. |
| `MLAD` | Field | Mail Destination (Email Address) — the customer's email address to which the notification is sent. |
| `TIKI_SGN_TCHI_TSHIRYO` | Field | Bandwidth Limit Notification Communication Volume — the measured bandwidth usage amount that triggered the exceedance alert. Japanese: 帯域制限通知通信量. |
| `SEND_KBN` | Field | Send Classification (Send Type) — the dispatch method classification indicating how the notification should be delivered. |
| `TXT-KKIFM207-INF1` | Constant | File identifier prefix for the Mail Bandwidth Limit Exceedance Notification Information File — used as the key prefix in `itemvalueMap` for error message field labels. |
| `EKKB0060TE` | Error Code | Mandatory field check error — logged when a required field is null or empty. |
| `EKKB0070TE` | Error Code | Length/character count check error — logged when a field value exceeds the allowed character count. |
| `ketasuu2` | Validation Rule | Character count validation rule — validates that a field's length is within a specified range (0–10 characters for SVC_KEI_NO and SYSID). |
| `JBSbatCheckUtil.invoke` | Utility | Character count and format validation utility — invoked with a rule code and parameters to validate field values. |
| `JBSbatCommonItem` | Framework Class | Batch common item holder — provides shared batch services including error logging, system settings, and common batch parameters. |
| KKIFM207 | Process ID | Bandwidth Limit Exceedance Notification Information Mail — the batch process responsible for notifying customers of bandwidth usage exceedance. |
| `commonItem.getLogPrint()` | Framework Call | Error log printer interface — provides the `printBusinessErrorLog` method for recording business-level errors. |
| `rsMap` | Parameter | Input data map — holds field values for the current notification record, sourced from either a text file or database. |
| `itemvalueMap` | Parameter | Error message values map — holds display labels for fields, used in error messages for human-readable error reporting. |
