---
title: "JBSbatKKAdChgTekkyoKjFinUpd.searchSvkeiExcCtrl()"
source_file: "source/koptBatch/src/eo/business/service/JBSbatKKAdChgTekkyoKjFinUpd.java"
created_at: 2026-06-28
method: "searchSvkeiExcCtrl(List<String> svcKeiNoList, List<String> lastUpdateList)"
---

# Business Logic — JBSbatKKAdChgTekkyoKjFinUpd.searchSvkeiExcCtrl() [18 LOC]

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

## 1. Role

### JBSbatKKAdChgTekkyoKjFinUpd.searchSvkeiExcCtrl()

This method performs **service contract exclusion control lookup**, a concurrency safety mechanism used during batch processing of telecom service contract modifications (address change, delivery completion, and finalization). Its business purpose is to verify that each service contract line item referenced in the batch processing scope actually exists in the exclusion control table (`KK_T_SVKEI_EXC_CTRL`) and to collect the current "last update datetime" of each contract for subsequent optimistic concurrency checking.

The method iterates over a list of service contract numbers (`svcKeiNoList`), performs a primary-key lookup for each one against the exclusion control table, and returns the contract number of the first missing contract — effectively acting as an early-existence gate. If all contracts are found, it populates `lastUpdateList` with the truncated last-update datetime strings and returns `null` to signal normal completion.

The caller (`execute()`) uses the return value to decide whether to proceed: if a non-null value is returned (meaning a contract was not found in the exclusion control table), the batch logs a business error (`EKKB0360KE`) and aborts. If `null` is returned, processing continues to the next step — a timestamp-based concurrency check via `timeStampCheckSvcExecHaita()`, which locks the records and compares datetimes to detect conflicting updates.

This method implements a **routing/dispatch pattern** with early exit on failure. It delegates the actual database query to an overloaded private helper `searchSvkeiExcCtrl(String svcKeiNo)` that performs a single-row primary-key select, and it uses `JBSbatStringUtil.Rtrim` to truncate datetime values to match the precision stored in the control table.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["searchSvkeiExcCtrl(svcKeiNoList, lastUpdateList)"])
    LOOP["For each svcKeiNo in svcKeiNoList"]
    CALL_SEARCH["searchSvkeiExcCtrl(svcKeiNo)"]
    PK_LOOKUP["selectByPrimaryKeys on KK_T_SVKEI_EXC_CTRL"]
    CHECK_NULL{"outMap == null?"}
    LOG_MISSING["printDebugLog: Service contract exclusion control information does not exist"]
    RETURN_ERR["Return svcKeiNo (error - missing contract)"]
    GET_DTM["outMap.getString(LAST_UPD_DTM)"]
    TRIM["JBSbatStringUtil.Rtrim(dt)"]
    ADD_LIST["lastUpdateList.add(truncated datetime)"]
    END_LOOP["End of loop iteration"]
    RETURN_OK["Return null (normal completion)"]

    START --> LOOP
    LOOP --> CALL_SEARCH
    CALL_SEARCH --> PK_LOOKUP
    PK_LOOKUP --> CHECK_NULL
    CHECK_NULL -->|true| LOG_MISSING
    LOG_MISSING --> RETURN_ERR
    CHECK_NULL -->|false| GET_DTM
    GET_DTM --> TRIM
    TRIM --> ADD_LIST
    ADD_LIST --> END_LOOP
    END_LOOP --> LOOP
    LOOP -->|no more items| RETURN_OK
```

**Processing flow:**

1. **Iteration** — The method loops through every service contract number in `svcKeiNoList` using a for-each construct.
2. **Per-contract PK lookup** — For each `svcKeiNo`, it calls the overloaded `searchSvkeiExcCtrl(String svcKeiNo)` which builds a primary-key lookup map and executes `selectByPrimaryKeys` on the `db_KK_T_SVKEI_EXC_CTRL` data source, querying table `KK_T_SVKEI_EXC_CTRL`.
3. **Existence check** — If the database returns `null` (no matching row found), the method logs a debug message indicating the service contract exclusion control information does not exist, and immediately returns the offending `svcKeiNo` as an error signal.
4. **Datetime extraction** — If the row exists, the method retrieves the `LAST_UPD_DTM` column value via `outMap.getString()`, applies `JBSbatStringUtil.Rtrim()` to truncate whitespace/datetime precision, and appends the result to the `lastUpdateList` parameter.
5. **Completion** — After processing all items without finding any missing contract, the method returns `null` to indicate successful completion. The caller will then proceed to the timestamp concurrency check phase.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcKeiNoList` | `List<String>` | List of service contract numbers (SVC_KEI_NO) — unique identifiers for service contract lines (e.g., FTTH, Telephone, TV subscriptions) being processed in the current batch operation. Each number is used as a primary key to look up a row in the exclusion control table. |
| 2 | `lastUpdateList` | `List<String>` | Output parameter — a list populated with the truncated last-update datetime values (LAST_UPD_DTM) retrieved from the exclusion control table. These datetimes are passed to the downstream `timeStampCheckSvcExecHaita()` method for optimistic concurrency control (lock-and-compare). |

**External state read by this method:**
- `db_KK_T_SVKEI_EXC_CTRL` — Instance field (inherited from superclass) providing database access to the `KK_T_SVKEI_EXC_CTRL` table via `selectByPrimaryKeys`.
- `super.logPrint` — Instance field (inherited from superclass) providing debug logging capability.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_SVKEI_EXC_CTRL.selectByPrimaryKeys` | JBSbatKKAdChgTekkyoKjFinUpd | KK_T_SVKEI_EXC_CTRL | Reads a row from the Service Contract Exclusion Control table using primary key SVC_KEI_NO |
| R | `JBSbatCommonDBInterface.getString` | JBSbatCommonDB | - | Retrieves a string value from the query result map (LAST_UPD_DTM column) |
| R | `JBSbatStringUtil.Rtrim` | JBSbatStringUtil | - | Truncates whitespace from datetime string |
| C | `List.add` | Java Collections | - | Appends truncated datetime to lastUpdateList |

### Detailed CRUD analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `searchSvkeiExcCtrl(String)` | JBSbatKKAdChgTekkyoKjFinUpd | KK_T_SVKEI_EXC_CTRL | Internal overloaded method that performs PK lookup via `selectByPrimaryKeys` on the service contract exclusion control table |
| R | `JBSbatCommonDBInterface.getString` | JBSbatCommonDB | - | Extracts the LAST_UPD_DTM column value from the query result |
| - | `JBSbatStringUtil.Rtrim` | JBSbatStringUtil | - | Trims trailing whitespace from the datetime string |
| C | `List.add` | Java Collections | - | Appends the truncated datetime to lastUpdateList |
| W | `super.logPrint.printDebugLog` | JACBatCommon | - | Writes debug log message when a contract record is not found |

## 5. Dependency Trace

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdChgTekkyoKjFinUpd.execute() | `execute()` → `searchSvkeiExcCtrl(svcKeiNoList, svKeiExcLastUpdateList)` | `selectByPrimaryKeys [R] KK_T_SVKEI_EXC_CTRL` |
| 2 | Batch: JBSbatKKAdChgTekkyoKjFinUpd.searchSvkeiExcCtrl() | `searchSvkeiExcCtrl(svcKeiNoList, lastUpdateList)` → `searchSvkeiExcCtrl(svcKeiNo)` (overloaded) | `selectByPrimaryKeys [R] KK_T_SVKEI_EXC_CTRL` |
| 3 | Batch: JBSbatKKAdChgTekkyoKjFinUpd.timeStampCheckSvcExecHaita() | `timeStampCheckSvcExecHaita(svcKeiNoList, lastUpdateList)` → `searchSvkeiExcCtrl(svcKeiNo)` | `selectByPrimaryKeys [R] KK_T_SVKEI_EXC_CTRL` |

**Call chain detail:** The primary caller is `JBSbatKKAdChgTekkyoKjFinUpd.execute()`, a batch processing entry point that handles telecom service contract modifications (address change, delivery completion, finalization). In the execution flow, after checking for conflicting reservation records, the batch creates an empty `svKeiExcLastUpdateList`, passes it along with the contract number list to `searchSvkeiExcCtrl()`, then based on the result either aborts (if a contract was not found) or proceeds to `timeStampCheckSvcExecHaita()` for optimistic concurrency locking.

## 6. Per-Branch Detail Blocks

**Block 1** — FOR_EACH `(for each svcKeiNo in svcKeiNoList)` (L622)

> Iterates through all service contract numbers provided for exclusion control validation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `searchSvkeiExcCtrl(svcKeiNo)` // Calls overloaded method to perform PK lookup on KK_T_SVKEI_EXC_CTRL |

**Block 1.1** — IF `(outMap == null)` (L625)

> Checks if the service contract record was found in the exclusion control table. If not found, logs a debug message and returns the missing contract number as an error signal to abort batch processing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `super.logPrint.printDebugLog("サービス契約排他制御情報が存在しません。")` // Debug log: "Service contract exclusion control information does not exist." |-> [-> "サービス契約排他制御情報が存在しません。"] |
| 2 | RETURN | `return svcKeiNo;` // Returns the contract number that was not found (error signal) |

**Block 1.2** — ELSE (implicit, outMap != null) (L630)

> The contract record exists in the exclusion control table. Extract the last-update datetime, truncate it, and append to the output list.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `outMap.getString(JBSbatKK_T_SVKEI_EXC_CTRL.LAST_UPD_DTM)` // Retrieves LAST_UPD_DTM column value |-> [-> "LAST_UPD_DTM"] |
| 2 | CALL | `JBSbatStringUtil.Rtrim(...)` // Truncates whitespace/datetime precision |
| 3 | EXEC | `lastUpdateList.add(truncatedDt)` // Appends the datetime to the output list |

**Block 2** — RETURN `(normal completion)` (L633)

> After the loop completes without finding any missing contracts, returns null to signal successful validation. The caller proceeds to the timestamp concurrency check phase.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // Normal completion — all contracts found in the exclusion control table |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service contract number — unique identifier for a service contract line item (e.g., a specific FTTH, Telephone, or TV subscription assigned to a customer) |
| `KK_T_SVKEI_EXC_CTRL` | Table | Service Contract Exclusion Control Table — a database table that tracks active service contracts and their last-update timestamps for optimistic concurrency control during batch processing |
| `LAST_UPD_DTM` | Field | Last update date/time — the timestamp of the most recent modification to a service contract exclusion control record; used for concurrency checks |
| `ADD_DTM` | Field | Registration date/time — the timestamp when the exclusion control record was first created |
| `ADD_OPEACNT` | Field | Registration operator account — the operator account that created the record |
| `UPD_DTM` | Field | Update date/time — the timestamp of the last update to the record (excluding the LAST_UPD_DTM tracking column) |
| `UPD_OPEACNT` | Field | Update operator account — the operator account that last modified the record |
| `DEL_DTM` | Field | Deletion date/time — the timestamp when the record was logically deleted |
| `DEL_OPEACNT` | Field | Deletion operator account — the operator account that performed the deletion |
| `MK_FLG` | Field | Mark flag — a soft-delete flag indicating whether the record is logically invalidated |
| `ADD_UNYO_YMD` | Field | Registration operation date — the business date when the record was registered |
| `SVC_KEI_NO` | Field | Service contract number — the primary key column used to look up exclusion control records |
| 排他制御 (Gatakaseigyo) | Domain | Concurrency control / exclusive control — a mechanism to prevent simultaneous modifications to the same record by different processes |
| 排他チェック (Gatakekkou) | Domain | Concurrency check — the process of comparing timestamps or lock states to detect conflicting updates |
| 最終更新年月日 (Saishu Koushin Nengappitsu) | Field | Last update year/month/day — a datetime field tracking when a record was last modified, used for optimistic locking |
| `EKKB0360KE` | Error Code | Business error code for "Service contract exclusion control table error" — logged when a contract number referenced in batch processing does not exist in the exclusion control table |
| `selectByPrimaryKeys` | Pattern | Database access pattern that retrieves a single record using primary key values; returns null if no matching record exists |
| Optimistic Concurrency | Pattern | A concurrency control approach that does not use database-level locks; instead compares timestamps (LAST_UPD_DTM) before and after an operation to detect conflicting updates |
