# Business Logic — JBSbatKKAdChgFmtcelSodUpd.isSingleCheckKKIFM266_INF1() [73 LOC]

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

## 1. Role

### JBSbatKKAdChgFmtcelSodUpd.isSingleCheckKKIFM266_INF1()

This method performs single-item validation (単項目チェック) on input data for the Femtocell SOD (Service Order Data) Update Information File (TXT-KKIFM266-INF1). It is part of the Address Change Femtocell SOD Update Batch module, which handles batch processing of address changes associated with femtocell service contracts. The method serves as a data quality gate within the batch's record-by-record processing pipeline: it validates individual fields before the record is accepted into downstream processing or written to output.

The method implements a validation-dispatch design pattern where each input field goes through a consistent three-stage check sequence: mandatory presence, digit count (numeric range), and attribute (format) validation. This pattern is repeated for three fields — Service Contract Number (SVC_KEI_NO), Service Contract Generation Registration Timestamp (SVC_KEI_GENE_ADD_DTM), and Work Order Number (KOJIAK_NO). Each failed check immediately logs a specific business error via `printBusinessErrorLog` and returns `false` to signal rejection.

In the larger system, this method is called by `execute()` during batch processing of femtocell SOD update records. It acts as a shared validation utility within the service class, ensuring that incoming data from flat files or database sources conforms to the expected format and business rules before proceeding to business logic execution or database updates.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isSingleCheckKKIFM266_INF1(rsMap, itemvalueMap)"])

    START --> SVC_CHECK["Retrieve SVC_KEI_NO from rsMap"]
    SVC_CHECK --> SVC_NULL{"SVC_KEI_NO is null or empty?"}
    SVC_NULL -->|Yes| SVC_LOG["Log error EKKB0060TE for SVC_KEI_NO"]
    SVC_NULL -->|No| SVC_KETA["JBSbatCheckUtil.invoke(SVC_KEI_NO, ketasuu2, 0, 10)"]
    SVC_KETA --> SVC_KETA_OK{"Check passes?"}
    SVC_KETA_OK -->|No| SVC_LOG_KETA["Log error EKKB0070TE for SVC_KEI_NO"]
    SVC_KETA_OK -->|Yes| SVC_ATTR["JBSbatCheckUtil.invoke(SVC_KEI_NO, hannkakuesuuji1)"]
    SVC_ATTR --> SVC_ATTR_OK{"Check passes?"}
    SVC_ATTR_OK -->|No| SVC_LOG_ATTR["Log error EKKB0080TE for SVC_KEI_NO"]
    SVC_ATTR_OK -->|Yes| DTM_CHECK["Retrieve SVC_KEI_GENE_ADD_DTM from rsMap"]
    SVC_LOG --> SVC_RET["Return false"]
    SVC_LOG_KETA --> SVC_RET
    SVC_LOG_ATTR --> SVC_RET

    DTM_CHECK --> DTM_NULL{"SVC_KEI_GENE_ADD_DTM is null or empty?"}
    DTM_NULL -->|Yes| DTM_LOG["Log error EKKB0060TE for SVC_KEI_GENE_ADD_DTM"]
    DTM_NULL -->|No| DTM_KETA["JBSbatCheckUtil.invoke(SVC_KEI_GENE_ADD_DTM, ketasuu2, 0, 17)"]
    DTM_KETA --> DTM_KETA_OK{"Check passes?"}
    DTM_KETA_OK -->|No| DTM_LOG_KETA["Log error EKKB0070TE for SVC_KEI_GENE_ADD_DTM"]
    DTM_KETA_OK -->|Yes| DTM_ATTR["JBSbatCheckUtil.invoke(SVC_KEI_GENE_ADD_DTM, day_hour1)"]
    DTM_ATTR --> DTM_ATTR_OK{"Check passes?"}
    DTM_ATTR_OK -->|No| DTM_LOG_ATTR["Log error EKKB0080TE for SVC_KEI_GENE_ADD_DTM"]
    DTM_ATTR_OK -->|Yes| KOJIAK_CHECK["Retrieve KOJIAK_NO from rsMap"]
    DTM_LOG --> DTM_RET["Return false"]
    DTM_LOG_KETA --> DTM_RET
    DTM_LOG_ATTR --> DTM_RET

    KOJIAK_CHECK --> KOJIAK_KETA["JBSbatCheckUtil.invoke(KOJIAK_NO, ketasuu2, 0, 10)"]
    KOJIAK_KETA --> KOJIAK_KETA_OK{"Check passes?"}
    KOJIAK_KETA_OK -->|No| KOJIAK_LOG_KETA["Log error EKKB0070TE for KOJIAK_NO"]
    KOJIAK_KETA_OK -->|Yes| KOJIAK_ATTR["JBSbatCheckUtil.invoke(KOJIAK_NO, hannkakuesuuji1)"]
    KOJIAK_ATTR --> KOJIAK_ATTR_OK{"Check passes?"}
    KOJIAK_ATTR_OK -->|No| KOJIAK_LOG_ATTR["Log error EKKB0080TE for KOJIAK_NO"]
    KOJIAK_ATTR_OK -->|Yes| SUCCESS["Return true"]
    KOJIAK_LOG_KETA --> KOJIAK_RET["Return false"]
    KOJIAK_LOG_ATTR --> KOJIAK_RET
```

**Processing stages:**

1. **Service Contract Number (SVC_KEI_NO) validation** (L393–L411): Retrieves the value from `rsMap` and performs mandatory check, digit count validation (0–10 digits), and attribute validation (numeric character check).

2. **Service Contract Generation Registration Timestamp (SVC_KEI_GENE_ADD_DTM) validation** (L414–L432): Retrieves the timestamp from `rsMap` and performs mandatory check, digit count validation (0–17 digits — consistent with YYYYMMDDHHmmss format), and attribute validation (valid day/hour format check).

3. **Work Order Number (KOJIAK_NO) validation** (L435–L448): Retrieves the value from `rsMap` and performs digit count validation (0–10 digits) and attribute validation (numeric character check). Note: There is no mandatory check for this field — only format validations are applied.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `rsMap` | `HashMap` | Input data map containing extracted fields from the Femtocell SOD Update Information File (TXT-KKIFM266-INF1) or database query results. Keys are field identifiers (e.g., `"SVC_KEI_NO"`, `"SVC_KEI_GENE_ADD_DTM"`, `"KOJIAK_NO"`) and values are their corresponding string values. This is the primary data source being validated. |
| 2 | `itemvalueMap` | `HashMap` | Map holding display values used for error messages. Keys follow the format `"TXT-KKIFM266-INF1.<FIELD_NAME>"` (e.g., `"TXT-KKIFM266-INF1.SVC_KEI_NO"`) and values are human-readable field labels. Used to localize error messages with the correct field display names. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `commonItem` | `JBSbatCommonItem` | Shared common item container inherited from `JBSbatBusinessService`. Provides access to logging infrastructure (`getLogPrint()`) used to write business error logs when validation fails. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKBatOneTimeLogWriter.printBusinessErrorLog` | JKKBatOneTimeLogWriter | - | Calls `printBusinessErrorLog` in `JKKBatOneTimeLogWriter` |
| - | `JKKHttpCommunicator.printBusinessErrorLog` | JKKHttpCommunicator | - | Calls `printBusinessErrorLog` in `JKKHttpCommunicator` |
| - | `JBSbatKKEMoneyTktnIraiRnk.printBusinessErrorLog` | JBSbatKKEMoneyTktnIraiRnk | - | Calls `printBusinessErrorLog` in `JBSbatKKEMoneyTktnIraiRnk` |
| - | `JBSbatKKEMoneyTktnTkyoTchMailSksi.printBusinessErrorLog` | JBSbatKKEMoneyTktnTkyoTchMailSksi | - | Calls `printBusinessErrorLog` in `JBSbatKKEMoneyTktnTkyoTchMailSksi` |

### Detailed analysis of method calls within `isSingleCheckKKIFM266_INF1`:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| EXEC | `JBSbatCheckUtil.invoke` | - | - | Performs format validation on string values. Called with check type constants (`ketasuu2` for digit count, `hannkakuesuuji1` for numeric character check, `day_hour1` for timestamp format). Returns `true` if value passes the check, `false` otherwise. |
| EXEC | `commonItem.getLogPrint().printBusinessErrorLog` | - | - | Logs a business error to the error log output. Called with an error code (e.g., `EKKB0060TE`, `EKKB0070TE`, `EKKB0080TE`) and an array containing the field display name. Used for all three error types. |

**Error code mapping:**

| Error Code | Meaning | Trigger Condition |
|------------|---------|-------------------|
| `EKKB0060TE` | Mandatory check failure | Field value is `null` or empty string |
| `EKKB0070TE` | Digit count check failure | Field value digit count outside allowed range |
| `EKKB0080TE` | Attribute check failure | Field value does not match expected character format |

This method does not perform any database CRUD operations directly. It is a pure validation method that reads from input maps and writes error logs.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-], `printBusinessErrorLog` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdChgFmtcelSodUpd.execute() | `execute()` -> `isSingleCheckKKIFM266_INF1(inMap.getMap(), getItemvalueMap())` | `printBusinessErrorLog [EXEC] Error Log (EKKB0060TE/EKKB0070TE/EKKB0080TE)` |

**Call chain detail:**

The `execute()` method (the batch processing entry point for this class) processes femtocell SOD update records. For each input record, it calls `isSingleCheckKKIFM266_INF1()` to validate the record's key fields. If validation fails (returns `false`), the batch throws a `JBSbatBusinessException` with the line number of the failed record. If validation succeeds (returns `true`), the record is added to the output map list via `outputInItem.addOutMapList(inMap)`.

The caller resides in the same class (`JBSbatKKAdChgFmtcelSodUpd`), making this an internal helper method rather than an externally referenced utility. The broader batch workflow processes address change femtocell SOD update records received via file import (TXT-KKIFM266-INF1), validates them, and routes them through downstream processing (ESB service invocation for active records, or output writing for error handling).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Retrieve Service Contract Number (SVC_KEI_NO) (L393)

> Initializes a local variable and extracts the Service Contract Number field from the input map. This is the first field to be validated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String strValue = null;` // Initialize local holder variable |
| 2 | SET | `strValue = (String)rsMap.get("SVC_KEI_NO");` // Retrieve Service Contract Number from input map [-> Field: Femtocell SOD Update File. Service Contract Number] |

**Block 2** — [IF] Mandatory check for SVC_KEI_NO (L396)

> Checks whether the Service Contract Number is missing. This is a required field — if null or empty, the record is rejected with error EKKB0060TE. Comment: 必須チェック (Mandatory check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_NO")})` // Log mandatory check failure with field display name |
| 2 | RETURN | `return false;` // Validation failed — record rejected |

**Block 3** — [IF] Digit count check for SVC_KEI_NO (L403)

> Validates that the Service Contract Number has a valid digit count using `JBSbatCheckUtil.invoke`. The check type is `ketasuu2` (digit count) with a range of 0 to 10 digits. Comment: 桁数チェック (Digit count check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "10"})` // If digit count outside 0-10 range, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0070TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_NO")})` // Log digit count error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 4** — [IF] Attribute check for SVC_KEI_NO (L410)

> Validates that the Service Contract Number contains only numeric characters using `JBSbatCheckUtil.invoke` with check type `hannkakuesuuji1` (numeric character range check). Comment: 属性チェック (Attribute check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"hannkakuesuuji1"})` // If value contains non-numeric characters, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0080TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_NO")})` // Log attribute error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 5** — [SET] Retrieve Service Contract Generation Registration Timestamp (SVC_KEI_GENE_ADD_DTM) (L414)

> Initializes and extracts the timestamp field. This field represents when the service contract generation was registered, in YYYYMMDDHHmmss format. Comment: サービス契約＿世代登録年月日時分秒項目チェック (Service Contract Generation Registration DateTime field check).

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("SVC_KEI_GENE_ADD_DTM");` // Retrieve Service Contract Generation Registration Timestamp from input map |

**Block 6** — [IF] Mandatory check for SVC_KEI_GENE_ADD_DTM (L417)

> Checks whether the timestamp field is missing. Comment: 必須チェック (Mandatory check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0060TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_GENE_ADD_DTM")})` // Log mandatory check failure |
| 2 | RETURN | `return false;` // Validation failed |

**Block 7** — [IF] Digit count check for SVC_KEI_GENE_ADD_DTM (L424)

> Validates timestamp digit count. Uses `ketasuu2` (digit count) with range 0–17, which corresponds to the YYYYMMDDHHmmss timestamp format (14 digits) with allowance for shorter formats. Comment: 桁数チェック (Digit count check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "17"})` // If digit count outside 0-17 range, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0070TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_GENE_ADD_DTM")})` // Log digit count error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 8** — [IF] Attribute check for SVC_KEI_GENE_ADD_DTM (L431)

> Validates timestamp format using `day_hour1` check type, which ensures the value contains valid date and hour components. Comment: 属性チェック (Attribute check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"day_hour1"})` // If timestamp format is invalid, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0080TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.SVC_KEI_GENE_ADD_DTM")})` // Log attribute error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 9** — [SET] Retrieve Work Order Number (KOJIAK_NO) (L435)

> Retrieves the Work Order Number field. This identifies the specific construction work order associated with the femtocell SOD update. Comment: 工事案件番号項目チェック (Work Order Number field check). Note: No mandatory check is performed for this field — only format validations are applied.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String)rsMap.get("KOJIAK_NO");` // Retrieve Work Order Number from input map [-> Field: Femtocell SOD Update File. Work Order Number] |

**Block 10** — [IF] Digit count check for KOJIAK_NO (L438)

> Validates Work Order Number digit count using `ketasuu2` with range 0–10 digits. Comment: 桁数チェック (Digit count check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"ketasuu2", "0", "10"})` // If digit count outside 0-10 range, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0070TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.KOJIAK_NO")})` // Log digit count error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 11** — [IF] Attribute check for KOJIAK_NO (L445)

> Validates Work Order Number contains only numeric characters using `hannkakuesuuji1` check type. Comment: 属性チェック (Attribute check).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `!JBSbatCheckUtil.invoke(strValue, new String[]{"hannkakuesuuji1"})` // If value contains non-numeric characters, check fails |
| 2 | EXEC | `commonItem.getLogPrint().printBusinessErrorLog("EKKB0080TE", new String[]{(String)itemvalueMap.get("TXT-KKIFM266-INF1.KOJIAK_NO")})` // Log attribute error |
| 3 | RETURN | `return false;` // Validation failed |

**Block 12** — [RETURN] Success path (L451)

> All validations passed. The record is valid and can proceed to downstream processing. Comment: 単項目チェックを行います。 (Perform single-item check).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // All checks passed — no errors, record accepted |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SVC_KEI_NO` | Field | Service Contract Number — the unique identifier for a service contract line item in the femtocell SOD update file. Validated as 0–10 digits, numeric characters only. |
| `SVC_KEI_GENE_ADD_DTM` | Field | Service Contract Generation Registration Date/Time — the timestamp when a generation of the service contract was registered. Format: YYYYMMDDHHmmss (14 digits). Validated as 0–17 digits with valid day/hour format. |
| `KOJIAK_NO` | Field | Work Order Number — the unique identifier for a construction work order (工事案件) associated with the femtocell SOD update. Validated as 0–10 digits, numeric characters only. No mandatory check — may be optional/nullable. |
| `TXT-KKIFM266-INF1` | File | Femtocell SOD Update Information File — the input flat file format for the femtocell service order data update batch. "INF1" denotes the input record type. |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity representing a service order for network equipment (e.g., femtocell base stations). |
| Femtocell | Business term | A small cellular base station used in residential or small business environments to improve mobile coverage. The address change batch processes updates to femtocell service contract information. |
| `commonItem` | Instance field | Shared common item container (`JBSbatCommonItem`) providing access to utility services including logging infrastructure (`getLogPrint()`). Inherited from parent class `JBSbatBusinessService`. |
| `ketasuu2` | Check type constant | Digit count validation — verifies the number of digits in a numeric string falls within a specified range. |
| `hannkakuesuuji1` | Check type constant | Numeric character range validation — verifies that a string contains only numeric characters (0–9). |
| `day_hour1` | Check type constant | Day/hour format validation — verifies that a timestamp string contains valid date and time components. |
| `EKKB0060TE` | Error code | Mandatory check failure — the required field is null or empty. "TE" suffix indicates error type category. |
| `EKKB0070TE` | Error code | Digit count check failure — the field value has too many or too few digits. |
| `EKKB0080TE` | Error code | Attribute check failure — the field value contains invalid characters for its expected format. |
| `JBSbatCheckUtil` | Utility class | Framework utility class for input validation checks (digit count, character range, date format, etc.). |
| `printBusinessErrorLog` | Method | Error logging method that writes business-level errors to the batch error log output. Called via `commonItem.getLogPrint()`. |
| `JKBSbatBusinessException` | Exception class | Business exception thrown when batch processing encounters a validation or processing error. Used in the caller `execute()` to signal record rejection. |
| Address Change | Business operation | The overall batch process that handles address modifications for customers with active femtocell service contracts. The SOD update is a downstream consequence of the address change. |
| 単項目チェック | Japanese term | Single-item check — field-level validation of individual input data items against business rules (mandatory, format, range). |
