# Business Logic — JBSbatTUBmpSwchSodTrn.singleCheckTU_T_BMP_KOJI_TU_SELECT_006() [19 LOC]

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

## 1. Role

### JBSbatTUBmpSwchSodTrn.singleCheckTU_T_BMP_KOJI_TU_SELECT_006()

This method performs a single-item validation check on input data (recorded in the `rsMap` parameter) during the **Honto (番ポ) construction work** batch processing flow — the Honto process handles installation/registration work orders for K-Opticom telecom services (fiber-to-the-home, broadband, and related infrastructure). Specifically, this method acts as a **business rule guard** that enforces data integrity when processing **corporate-to-individual code conversions** within the Honto construction workflow.

The method implements a **delegation guard pattern**: it inspects a discriminator field (`HOJIN_KOJIN_CD` — corporate/individual code) and, when the code indicates an **individual (KOJIN = "1")** classification — which is an invalid state in this context — it performs an additional mandatory validation on the system ID (`SYSID`) field. If the system ID is null or empty, it raises a business exception (`ETUB0010TE`) referencing the current record count and the field name, enabling batch processing to halt and log the offending record.

When the corporate/individual code does NOT indicate an individual classification (i.e., it is a corporate/法人 code), the method returns immediately without performing any checks — this is a no-op branch that allows the batch flow to proceed to the next processing stage. The method has **no CRUD operations** or database interactions; it is purely a validation/invariant-enforcement step in the batch processing chain.

The method is documented in Japanese as: "入力情報（番ポ工事）の単項目チェックを行います" (Performs single-item check on input data (Honto construction)). The design pattern used is a **conditional validation gate** — a common pattern in enterprise batch processors where certain record classifications require additional field-level checks before the record is eligible for downstream processing.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["singleCheckTU_T_BMP_KOJI_TU_SELECT_006(rsMap)"])
    COND1{"HOJIN_KOJIN_CD == KOJIN"}
    PROCESS1["strValue = rsMap.get(SYSID)"]
    COND2{"strValue == null OR empty"}
    THROW1["throw JBSbatBusinessException(ETUB0010TE, recordCnt, SYSID)"]
    END_RETURN(["Return / Exit"])

    START --> COND1
    COND1 -- "true (individual)" --> PROCESS1
    COND1 -- "false (corporate)" --> END_RETURN
    PROCESS1 --> COND2
    COND2 -- "null or empty" --> THROW1
    COND2 -- "valid value" --> END_RETURN
    THROW1 --> END_RETURN
```

**Branch explanation:**

- **Branch 1 (HOJIN_KOJIN_CD == KOJIN = "1")**: The corporate/individual discriminator indicates "individual" classification. In this context, an individual classification is considered invalid or exceptional, so the method performs an additional mandatory check: it retrieves the `SYSID` field value from `rsMap` and validates it is neither null nor empty. If the SYSID is missing, the method throws a `JBSbatBusinessException` with error code `ETUB0010TE`, passing the current `recordCnt` (batch record counter) and `"SYSID"` as context. If the SYSID is valid, the method proceeds to exit normally.

- **Branch 2 (HOJIN_KOJIN_CD != "1", i.e., corporate/法人 code)**: The record is classified as corporate. The method performs no additional checks and returns immediately, allowing the batch processing to continue to the next stage.

**Key Constants Resolved:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `JTUStrConst.KOJIN` | `"1"` | Individual (個人) classification code — used as a discriminator for corporate vs. individual customer records |
| `JBSbatTU_T_BMP_KOJI.HOJIN_KOJIN_CD` | `"HOJIN_KOJIN_CD"` | Corporate/Individual code field key in rsMap — distinguishes法人 (corporate) from 個人 (individual) |
| `JBSbatKK_T_SVC_KEI.SYSID` | `"SYSID"` | System ID field — a mandatory identifier for service contract records |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `rsMap` | `HashMap` | Input data record containing key-value pairs of field names and their values, sourced from either text file import or database extraction. Represents a single Honto (番ポ) construction work order record being processed in the batch. Keys are field identifiers (e.g., `HOJIN_KOJIN_CD`, `SYSID`) and values are their corresponding string data. |

**Instance Fields Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `recordCnt` | `int` | Batch record counter tracking the sequential count of records processed in the current batch run. Used in error messages to identify which record number triggered the validation failure. |

## 4. CRUD Operations / Called Services

This method performs **no direct CRUD operations** or service component calls. It is a pure validation method that operates solely on in-memory data (`rsMap`) and local state (`recordCnt`).

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | This method is a validation gate only; it does not read, create, update, or delete any data in the database. |

**Indirect dependencies:**

When the validation fails, the method throws a `JBSbatBusinessException` (error code `ETUB0010TE`), which propagates the error up to the caller's exception handler. The `JBSbatBusinessException` mechanism is part of K-Opticom's standard batch exception framework — it does not perform a database write but signals a business rule violation to the batch runtime.

## 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: —

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatTUBmpSwchSodTrn.execute()` | `execute()` → `singleCheckTU_T_BMP_KOJI_TU_SELECT_006(rsMap)` | — (validation gate only, no terminal CRUD) |

**Caller Details:**

- `JBSbatTUBmpSwchSodTrn.execute()` is the batch entry point method in the same class. It invokes `singleCheckTU_T_BMP_KOJI_TU_SELECT_006()` as part of the Honto (番ポ) construction work batch processing pipeline, passing each record's `rsMap` for validation before the batch proceeds to downstream operations (database access, service order creation, etc.).

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(HOJIN_KOJIN_CD equals KOJIN) [JTUStrConst.KOJIN="1"]` (L497)

> When the corporate/individual discriminator indicates "individual" classification, retrieve and validate the SYSID field. This is an invariant check: individual records in this Honto construction context must have a valid system ID.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strValue = (String) rsMap.get(JBSbatKK_T_SVC_KEI.SYSID)` // Retrieve SYSID from input record [-> `SYSID` = "SYSID"] |

**Block 1.1** — IF [nested] `(strValue == null OR " ".equals(strValue)) [String null/empty check]` (L504)

> If the SYSID field is null or empty, the record violates a mandatory field requirement. Throw a business exception to halt this record's processing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `throw new JBSbatBusinessException("ETUB0010TE", new String[]{ String.valueOf(recordCnt), "SYSID" })` // Raise validation failure for missing SYSID on record #recordCnt |

**Block 2** — ELSE (implicit: HOJIN_KOJIN_CD does NOT equal KOJIN = "1") (L497)

> When the corporate/individual discriminator indicates a corporate (法人) classification, no additional validation is needed. The method returns immediately and the batch flow continues to the next processing stage. This is a no-op pass-through branch.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `// No action — exit method, let batch flow proceed` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `HOJIN_KOJIN_CD` | Field | Corporate/Individual classification code — discriminator field that distinguishes法人 (corporate/business) customers from 個人 (individual/personal) customers in service contract records |
| `SYSID` | Field | System ID — a mandatory identifier for service contract records, used for internal system tracking and linkage between service order and customer data |
| `recordCnt` | Field | Batch record counter — sequential number tracking which record is being processed in the current batch run, used for error reporting |
| `rsMap` | Field | Record storage map — a HashMap containing key-value pairs of field names and their values, representing a single record from either text file import or database extraction |
| `KOJIN` | Constant | "1" — the classification code for 個人 (individual/personal) customers in K-Opticom's customer data model |
| `ETUB0010TE` | Error Code | Business exception error code indicating a mandatory field validation failure (ETUB = Error TUB = Error Batch Utility; TE = Type/Target Error) |
| Honto (番ポ) | Business term | Short for 番線工事 (hansen kouji) — line installation/construction work. K-Opticom's process for physically installing telecom infrastructure (fiber lines, broadband connections) at customer premises |
| 単項目チェック | Japanese term | Single-item check — a validation method that checks individual fields rather than cross-field or cross-record relationships |
| JBSbatTU_T_BMP_KOJI | Table Class | Constant class for the TU_T_BMP_KOJI table (番ポ工事 table) — stores Honto construction work order data |
| JBSbatKK_T_SVC_KEI | Table Class | Constant class for the KK_T_SVC_KEI table (サービス契約 table) — stores service contract data |
| JBSbatBusinessException | Exception Class | K-Opticom's standard batch business exception class, used to signal business rule violations during batch processing with error codes and contextual parameters |
| JTUStrConst | Constant Class | Shared string constants for the eo customer base system — contains standardized code values used across the application for classifications, statuses, and field names |
