---

# Business Logic — JBSbatKKAdChgPlaceNoChgRnki.initial() [13 LOC]

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

## 1. Role

### JBSbatKKAdChgPlaceNoChgRnki.initial()

This method performs the initialization processing for the **Address Change Place Number Change Link Component** (住所変更場所番号変更連携部品), a batch service responsible for handling the linkage between address changes and place number (installation site identifier) changes in K-Opticom's customer core system. Specifically, this class manages batch operations where a customer's registered address is updated and the associated equipment installation place number is synchronized across related service records.

The `initial()` method serves as the **entry-point initializer** in the batch service lifecycle, following the template-method pattern inherited from `JBSbatBusinessService`. It prepares the service instance by copying batch operational metadata (operation date, system code, job ID, log handler) from the common item parameter into the instance's protected fields, and instantiates the database access layer for the `KK_T_ADCHG_DTL` (Address Change Detail) table. This enables all subsequent processing in the batch flow to access consistent operational context and database connectivity.

The design pattern implemented is **delegation with lifecycle management**: initialization (`initial()`), main processing (`execute()`), and termination (`terminal()`) are the three standard phases of every batch business service in the framework. The `initial()` method is the first phase, executed exactly once when the batch service object is constructed and before any execute calls are dispatched.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])

    START --> SET["setCommonInfo(commonItem)"]

    SET --> INIT_DB["Initialize DB Access<br/>new JBSbatSQLAccess<br/>(commonItem, KK_T_ADCHG_DTL)"]

    INIT_DB --> END_NODE(["Return / Next"])
```

**Processing Steps:**

1. **Copy Common Info**: Delegates to `super.setCommonInfo(commonItem)` to populate all batch operational fields (`opeDate`, `onlineOpeDate`, `batchUserId`, `systemCode`, `logPrint`, `jobid`, `freeItem`, `commonItem`) from the incoming `JBSbatCommonItem` parameter. This ensures the service instance carries the correct context for logging, auditing, and job routing.

2. **Initialize DB Access Layer**: Creates a new `JBSbatSQLAccess` instance bound to the `KK_T_ADCHG_DTL` table, assigning it to the protected field `db_KK_T_ADCHG_DTL`. This database accessor is used by subsequent processing methods (e.g., in `execute()`) to query and update address change detail records.

**Requirements:**
- No conditional branches exist in this method — it executes unconditionally.
- The method is extremely simple because its role is purely infrastructural: set up context and database connectivity.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter envelope — carries all shared batch operational metadata including operation date, job ID, system code, batch user ID, and log print control. This object is the single source of operational context for the entire batch execution lifecycle. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| (none directly read) | — | This method only writes fields; it does not read any instance fields during initialization. |

**Constants referenced:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `D_TBL_NAME_KK_T_ADCHG_DTL` | `"KK_T_ADCHG_DTL"` | Table name for the Address Change Detail table — stores detail records of address changes linked to place number modifications. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatBusinessService.setCommonInfo` | JBSbatBusinessService | - (in-memory) | Delegates to parent's `setCommonInfo` to populate instance operational fields from `JBSbatCommonItem` |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_ADCHG_DTL` | Creates a database access layer instance targeting the address change detail table |

**Classification:** No actual database CRUD operations occur within `initial()` itself. The method only:
- Copies in-memory metadata via `setCommonInfo` (SET operation on instance fields).
- Constructs a `JBSbatSQLAccess` object (preparation for later R/U/D operations in `execute()` and `terminal()`).

## 5. Dependency Trace

### Callers of this method

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdChgCstScreenKidou | `JBSbatKKAdChgCstScreenKidou.initial(commonItem)` → `execRunObjPlaceNoChg.initial(commonItem)` | `setCommonInfo [SET] in-memory fields` |

**Caller Details:**
- **JBSbatKKAdChgCstScreenKidou** — The parent batch coordinator that manages multiple linked address change operations. It instantiates `JBSbatKKAdChgPlaceNoChgRnki` as `execRunObjPlaceNoChg` and calls `initial()` on it alongside other sub-services (smart billing link, place number change info extraction, etc.) as part of the overall address change coordination batch.
- The class naming convention (`KKAdChg` = Address Change, `CstScreenKidou` = Customer/Screen Dispatch) indicates this is a dispatching CBS (Common Business Service) batch that orchestrates multiple specialized address-change sub-batches.

**Downstream calls FROM this method:**
- `initial()` itself does not call any service methods beyond `setCommonInfo` and the SQL access constructor.
- The DB access object `db_KK_T_ADCHG_DTL` created here is used by `execute()` for reading/writing address change detail records, and closed in `terminal()`.

## 6. Per-Branch Detail Blocks

### Block 1 — [CALL] `setCommonInfo(commonItem)` (L76)

> Invokes the parent class method to copy batch operational metadata from the common item parameter into this service instance's protected fields.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem);` // Set batch operational info from common item parameter [-> opeDate, onlineOpeDate, batchUserId, systemCode, logPrint, jobid, freeItem, commonItem] |

### Block 2 — [CALL/SET] DB Access Initialization (L79)

> Creates the SQL access layer for the address change detail table. This is a conditional feature added per IKK-2013-0000707 change request (2013-04-03).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_ADCHG_DTL = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_ADCHG_DTL);` // Create DB accessor for KK_T_ADCHG_DTL [-> D_TBL_NAME_KK_T_ADCHG_DTL="KK_T_ADCHG_DTL"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_ADCHG_DTL` | Table | Address Change Detail Table — stores detail records of address changes in K-Opticom's customer core system. |
| `JBSbatKKAdChgPlaceNoChgRnki` | Class | Address Change Place Number Change Link Component — batch service that handles synchronization between address changes and equipment installation place number updates. |
| `commonItem` | Field/Param | Batch Common Item — the central parameter envelope carrying all shared batch operational context (job ID, operation date, system code, log handler, etc.). |
| `setCommonInfo` | Method | Sets operational metadata fields (operation date, system code, batch user ID, job ID, log handler, free item) from a `JBSbatCommonItem` onto the service instance. |
| `JBSbatSQLAccess` | Class | Database access abstraction layer — provides structured access to database tables via predefined SQL definitions. |
| `initial()` | Method | Batch service initialization lifecycle method — first phase of the batch service execution pattern (initial → execute → terminal). |
| `execute()` | Method | Batch service main processing lifecycle method — second phase, performs the core business logic. |
| `terminal()` | Method | Batch service termination lifecycle method — third phase, performs cleanup such as closing DB connections. |
| `JBSbatBusinessService` | Class | Abstract base class for all batch business services — defines the lifecycle template (initial, execute, terminal) and shared operational fields. |
| `JBSbatKKAdChgCstScreenKidou` | Class | Address Change Customer Screen Dispatch Batch — parent CBS batch that orchestrates multiple address-change sub-batches including this service. |
| `KKSV0711` | Constant | Use Case ID — identifies this service's use case within the batch framework. |
| `KKSV0711OP` | Constant | Operation ID — identifies this service's specific operation within the use case. |
| `KKSV071101CC` | Constant | Fixed text key — user-defined string constant used as a map key for input/output parameter passing. |
| IKK-2013-0000707 | Change Request | Internal change request dated 2013-04-03 that added the `KK_T_ADCHG_DTL` table access layer to this batch service. |
| BATCH | Context | Asynchronous batch processing unit — runs independently of online transactions, typically processing large volumes of data records at scheduled intervals. |
| CBS | Acronym | Common Business Service — a shared service layer that provides business logic accessible to multiple screens or batch processes. |
| SC | Acronym | Service Component — a fine-grained service layer handling specific business operations, typically mapped to a single CRUD action on a specific entity/table. |
| `usecase_id` | Field | Internal use case identifier — tracks which business use case invoked this batch for auditing and tracing purposes. |
| `operation_id` | Field | Internal operation identifier — tracks the specific operation within a use case for detailed auditing. |

---
