---

# Business Logic — JKKKikiIchiranKkKaifukuCC.execKikiKaifuku() [54 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKKikiIchiranKkKaifukuCC` |
| Layer | CC / Common Component |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKKikiIchiranKkKaifukuCC.execKikiKaifuku()

The `execKikiKaifuku` method is the central recovery ( restoration ) dispatcher for equipment provision service contracts within the K-Opticom customer base system. "Equipment provision service" (`機器提供サービス`) refers to telecom services where customer-held terminal equipment (e.g., ONUs, routers) is leased or rented as part of a broadband/FTTH subscription. This method examines three key date fields extracted from the equipment provision service contract consent message (`EKK0341A010`) — namely the service start date (`SVC_STA_YMD`), termination date (`KEI_CNC_YMD`), and inspection date (`SHOSA_YMD`) — and routes the recovery processing into one of four mutually exclusive business branches based on which date is populated.

The design pattern implemented is a **routing/dispatch** pattern: the method acts as a smart router that inspects the temporal state of a service contract and delegates to specialized sub-processes (`execEKK0341C380`, `execEKK0341C390`, `execEKK0341C410`, `execEKK0341C420`), each handling a distinct lifecycle stage. In three of the four branches (post-recovery, pre-service termination, post-inspection cancellation), the method further checks whether the function code equals `"1"` (function code for check and registration) and, if so, triggers an additional address update step (`isKktkSvcKeiJyushoUpdate`) to synchronize the customer's registered address.

This method serves as a **shared utility** invoked from the screen-level handler `execKikiIchiranKikiKaifuku` when a user initiates a contract recovery or cancellation operation from the equipment provision service inquiry/return screen. It ensures that the correct recovery process is applied based on the current lifecycle state of the service, maintaining data consistency across the service contract records and any dependent address information.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKikiKaifuku(params)"])
    GET_CC_MSG["Get ccMsg from param.getData(dataMapKey)"]
    GET_MSG["Get ekk0341a010Msg from temporaryData (TEMPLATE_ID_EKK0341A010)"]
    EXTRACT_DATES["Extract svcStrtYmd, keiTeiketuYmd, shosaYmd from message"]
    COND_SVC["svcStrtYmd is not empty"]
    CALL_C380["execEKK0341C380<br/>(Equipment provision service contract recovery)"]
    COND_KEI["keiTeiketuYmd is not empty"]
    CALL_C390["execEKK0341C390<br/>(Pre-service equipment provision contract recovery)"]
    COND_FUNC1_A["func_code == 1"]
    CALL_UPDATE_A["isKktkSvcKeiJyushoUpdate<br/>(Address update)"]
    COND_SHOSA["shosaYmd is not empty"]
    CALL_C420["execEKK0341C420<br/>(Post-inspection equipment contract cancellation)"]
    COND_FUNC1_B["func_code == 1"]
    CALL_UPDATE_B["isKktkSvcKeiJyushoUpdate<br/>(Address update)"]
    ELSE_BRANCH["Default (no date populated)"]
    CALL_C410["execEKK0341C410<br/>(Pre-inspection equipment contract cancellation)"]
    COND_FUNC1_C["func_code == 1"]
    CALL_UPDATE_C["isKktkSvcKeiJyushoUpdate<br/>(Address update)"]
    END_NODE(["Return / Next"])

    START --> GET_CC_MSG
    GET_CC_MSG --> GET_MSG
    GET_MSG --> EXTRACT_DATES
    EXTRACT_DATES --> COND_SVC
    COND_SVC -- true --> CALL_C380
    COND_SVC -- false --> COND_KEI
    COND_KEI -- true --> CALL_C390
    CALL_C390 --> COND_FUNC1_A
    COND_FUNC1_A -- true --> CALL_UPDATE_A
    COND_FUNC1_A -- false --> END_NODE
    CALL_UPDATE_A --> END_NODE
    COND_KEI -- false --> COND_SHOSA
    COND_SHOSA -- true --> CALL_C420
    CALL_C420 --> COND_FUNC1_B
    COND_FUNC1_B -- true --> CALL_UPDATE_B
    COND_FUNC1_B -- false --> END_NODE
    CALL_UPDATE_B --> END_NODE
    COND_SHOSA -- false --> ELSE_BRANCH
    ELSE_BRANCH --> CALL_C410
    CALL_C410 --> COND_FUNC1_C
    COND_FUNC1_C -- true --> CALL_UPDATE_C
    COND_FUNC1_C -- false --> END_NODE
    CALL_UPDATE_C --> END_NODE
```

**Block descriptions:**

1. **Data extraction phase**: Retrieves the `ccMsg` (component common message map) from the parameter data keyed by `dataMapKey`, fetches the `EKK0341A010` template message from `temporaryData`, and extracts three date strings — the service start date (`svcStrtYmd`), termination date (`keiTeiketuYmd`), and inspection date (`shosaYmd`) — normalizing nulls via `getNullToStr()`.

2. **Branch 1 — Service Start Date populated**: If `svcStrtYmd` is non-empty, invokes `execEKK0341C380` to process the equipment provision service contract recovery (standard post-activation contract return). No address update is performed in this branch.

3. **Branch 2 — Termination Date populated**: If `keiTeiketuYmd` is non-empty (service was terminated before being put into use), invokes `execEKK0341C390` for pre-service equipment provision contract recovery. If `func_code == "1"` (check & registration mode), additionally calls `isKktkSvcKeiJyushoUpdate()` to update the customer address.

4. **Branch 3 — Inspection Date populated**: If `shosaYmd` is non-empty (equipment was inspected after being put into service), invokes `execEKK0341C420` for post-inspection equipment contract cancellation. If `func_code == "1"`, additionally calls `isKktkSvcKeiJyushoUpdate()`.

5. **Branch 4 — No date populated (default)**: If none of the three dates is populated, invokes `execEKK0341C410` for pre-inspection equipment contract cancellation. If `func_code == "1"`, additionally calls `isKktkSvcKeiJyushoUpdate()`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle providing transaction context and database connectivity for executing CBS/SC calls and persisting changes |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component request invoker used to dispatch calls to downstream service components (CBS/SC) for data retrieval and persistence |
| 3 | `param` | `IRequestParameterReadWrite` | Request/response parameter object carrying screen input data; used to retrieve the `ccMsg` map via `getData(dataMapKey)` |
| 4 | `dataMapKey` | `String` | Key identifier used to access the component common message map (`ccMsg`) within the parameter object, correlating to the specific screen processing context |
| 5 | `temporaryData` | `HashMap<String, Object>` | Temporary data store carrying pre-fetched template messages across processing stages; contains the `EKK0341A010` (Equipment Provision Service Contract Consent Form) message object used to extract date fields |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `TEMPLATE_ID_EKK0341A010` | `String` (constant = `"EKK0341A010"`) | Template ID for the equipment provision service contract consent form, used to locate the message in `temporaryData` |
| `FUNC_CODE_1` | `String` (constant = `"1"`) | Function code indicating "check & registration" mode; when `func_code` in `ccMsg` equals `"1"`, an additional address update is performed |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKKikiIchiranKkKaifukuCC.getNullToStr` | - | - | Local utility method; retrieves a string value from a message, converting null to empty string |
| R | `JKKKikiIchiranKkKaifukuCC.getData` | - | - | Reads the `ccMsg` map from `param` using `dataMapKey` to access component common data |
| - | `JKKKikiIchiranKkKaifukuCC.execEKK0341C380` | EKK0341C380SC | - | Equipment provision service contract recovery — handles restoration of an already-active equipment provision service contract |
| - | `JKKKikiIchiranKkKaifukuCC.execEKK0341C390` | EKK0341C390SC | - | Pre-service equipment provision service contract recovery — handles contract return when the service was terminated before activation (before being put into use) |
| - | `JKKKikiIchiranKkKaifukuCC.execEKK0341C420` | EKK0341C420SC | - | Post-inspection equipment provision service contract cancellation — handles contract cancellation after equipment has been inspected (post-activation return) |
| - | `JKKKikiIchiranKkKaifukuCC.execEKK0341C410` | EKK0341C410SC | - | Pre-inspection equipment provision service contract cancellation — handles contract cancellation when equipment has not yet been inspected (pre-activation return) |
| U | `JKKKikiIchiranKkKaifukuCC.isKktkSvcKeiJyushoUpdate` | - | - | Address update processing — updates the customer's registered address when the function code indicates a check & registration operation |

**CRUD Classification Rationale:**

- **R (Read)**: `getNullToStr` and `getData` are data retrieval utilities — they read and transform existing data without side effects.
- **U (Update)**: `isKktkSvcKeiJyushoUpdate` modifies customer address data in the database.
- **C/R/U (Mixed)**: The `execEKK0341Cxxx` methods are contract lifecycle operations that likely perform read-verify-update cycles (querying existing records, validating state transitions, and writing updated contract status). The SC Code naming convention (`C380`, `C390`, `C410`, `C420`) follows the pattern where `C` codes are contract operation service components.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku` | `execKikiIchiranKikiKaifuku` -> `execKikiKaifuku` | `execEKK0341C380 [-]`, `execEKK0341C390 [-]`, `execEKK0341C410 [-]`, `execEKK0341C420 [-]`, `isKktkSvcKeiJyushoUpdate [U]`, `getNullToStr [R]` |

**Note**: No screen-level entry points (`KKSV*` classes) or batch entry points were found within 8 hops. The method is invoked exclusively from the sibling method `execKikiIchiranKikiKaifuku` within the same class, which itself is likely the direct screen handler for the equipment provision service inquiry/return screen.

**Terminal operations reached from this method (all paths):**

| Terminal Method | Type | Business Description |
|----------------|------|---------------------|
| `execEKK0341C380` | Contract Op. | Equipment provision service contract recovery (standard) |
| `execEKK0341C390` | Contract Op. | Pre-service equipment provision contract recovery |
| `execEKK0341C410` | Contract Op. | Pre-inspection equipment contract cancellation |
| `execEKK0341C420` | Contract Op. | Post-inspection equipment contract cancellation |
| `isKktkSvcKeiJyushoUpdate` | Update | Address update for customer registered address |
| `getNullToStr` | Read | Null-to-empty string conversion utility |

## 6. Per-Branch Detail Blocks

### Block 1 — EXEC (data extraction) (L316)

> Retrieves the component common message map and extracts the contract consent message from temporary data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ccMsg = (HashMap<String, Object>)param.getData(dataMapKey)` // Retrieves the component common message map from parameter |
| 2 | SET | `ekk0341a010Msg = (CAANMsg)temporaryData.get(TEMPLATE_ID_EKK0341A010)` // `[-> TEMPLATE_ID_EKK0341A010 = "EKK0341A010"]` Retrieves the equipment provision service contract consent form message |

### Block 2 — EXEC (date extraction) (L319–L324)

> Extracts three critical date fields from the contract consent message, converting null values to empty strings for safe comparison.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcStrtYmd = getNullToStr(ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.SVC_STA_YMD))` // Service start date (サービス開始年月日) — normalized to empty string if null |
| 2 | SET | `keiTeiketuYmd = getNullToStr(ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KEI_CNC_YMD))` // Termination date (締結日) — normalized to empty string if null |
| 3 | SET | `shosaYmd = getNullToStr(ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.SHOSA_YMD))` // Inspection date (照会年月日) — normalized to empty string if null |

### Block 3 — IF — Service Start Date Populated (L326)

> **Condition**: `!" ".equals(svcStrtYmd)` — The service start date is set, meaning the equipment provision service was activated. This is the standard contract recovery path.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0341C380(handle, scCall, param, dataMapKey, temporaryData)` // Equipment provision service contract recovery (機器提供サービス契約回復) — no address update performed |

### Block 4 — ELSE IF — Termination Date Populated (L330)

> **Condition**: `!" ".equals(keiTeiketuYmd)` — The service was terminated before being put into use (before inspection). This is the pre-service recovery path.

#### Block 4.1 — CALL (L332)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0341C390(handle, scCall, param, dataMapKey, temporaryData)` // Pre-service equipment provision contract recovery (サービス提供前機器提供サービス契約回復) |

#### Block 4.2 — IF — Function Code Check (L333)

> **Condition**: `FUNC_CODE_1.equals((String)ccMsg.get("func_code"))` — `[-> FUNC_CODE_1 = "1"]` Checks if the operation is in check & registration mode.

#### Block 4.2.1 — CALL (L335)

> **Business description**: 住所更新 (Address Update) — Updates the customer's registered address when performing a check & registration recovery operation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isKktkSvcKeiJyushoUpdate(handle, scCall, param, dataMapKey, temporaryData)` // 住所更新 (Address update) |

### Block 5 — ELSE IF — Inspection Date Populated (L339)

> **Condition**: `!" ".equals(shosaYmd)` — The equipment has been inspected after being put into service. This is the post-inspection cancellation path.

#### Block 5.1 — CALL (L341)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0341C420(handle, scCall, param, dataMapKey, temporaryData)` // Post-inspection equipment contract cancellation (照会後機器提供サービス契約キャンセル) |

#### Block 5.2 — IF — Function Code Check (L342)

> **Condition**: `FUNC_CODE_1.equals((String)ccMsg.get("func_code"))` — `[-> FUNC_CODE_1 = "1"]` Checks if the operation is in check & registration mode.

#### Block 5.2.1 — CALL (L344)

> **Business description**: 住所更新 (Address Update) — Updates the customer's registered address when performing a check & registration cancellation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isKktkSvcKeiJyushoUpdate(handle, scCall, param, dataMapKey, temporaryData)` // 住所更新 (Address update) |

### Block 6 — ELSE — No Date Populated (L348)

> **Condition**: None of `svcStrtYmd`, `keiTeiketuYmd`, or `shosaYmd` is populated. This is the default pre-inspection cancellation path, used when the service has not yet been inspected or activated.

#### Block 6.1 — CALL (L350)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `execEKK0341C410(handle, scCall, param, dataMapKey, temporaryData)` // Pre-inspection equipment contract cancellation (照会前機器提供サービス契約キャンセル) |

#### Block 6.2 — IF — Function Code Check (L351)

> **Condition**: `FUNC_CODE_1.equals((String)ccMsg.get("func_code"))` — `[-> FUNC_CODE_1 = "1"]` Checks if the operation is in check & registration mode.

#### Block 6.2.1 — CALL (L353)

> **Business description**: 住所更新 (Address Update) — Updates the customer's registered address when performing a check & registration cancellation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `isKktkSvcKeiJyushoUpdate(handle, scCall, param, dataMapKey, temporaryData)` // 住所更新 (Address update) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcStrtYmd` | Field | Service start date (`サービス開始年月日`) — The date when the equipment provision service contract was activated and service began |
| `keiTeiketuYmd` | Field | Termination date (`締結日`) — The date when the service was terminated, used to identify contracts ended before activation |
| `shosaYmd` | Field | Inspection date (`照会年月日`) — The date when equipment was inspected after service activation, used to identify post-activation returns |
| `func_code` | Field | Function code — Operation mode indicator; value `"1"` (defined by `FUNC_CODE_1`) indicates check & registration mode, triggering additional address synchronization |
| `ccMsg` | Field | Component Common Message map — A shared data map passed through the request parameter carrying screen-specific processing metadata |
| `dataMapKey` | Field | Data map key — Identifier used to locate the correct message map within the parameter object |
| `TEMPLATE_ID_EKK0341A010` | Constant | Template ID for the equipment provision service contract consent form (`機器提供サービス契約照会`) — used to retrieve the pre-fetched contract data from `temporaryData` |
| `TEMPLATE_ID_EKK0341C380` | Constant | Template ID for equipment provision service contract recovery (`機器提供サービス契約回復`) |
| `TEMPLATE_ID_EKK0341C390` | Constant | Template ID for pre-service equipment provision contract recovery (`サービス提供前機器提供サービス契約回復`) |
| `TEMPLATE_ID_EKK0341C410` | Constant | Template ID for pre-inspection equipment contract cancellation (`照会前機器提供サービス契約キャンセル`) |
| `TEMPLATE_ID_EKK0341C420` | Constant | Template ID for post-inspection equipment contract cancellation (`照会後機器提供サービス契約キャンセル`) |
| `FUNC_CODE_1` | Constant | Value `"1"` — Function code for check & registration (`機能コード（チェック＆登録）`) |
| `EKK0341A010` | SC Code | Equipment Provision Service Contract Inquiry Service Component — returns contract consent form data including the three date fields |
| `EKK0341C380SC` | SC Code | Equipment Provision Service Contract Recovery — processes standard post-activation contract returns |
| `EKK0341C390SC` | SC Code | Pre-Service Equipment Provision Contract Recovery — handles returns for terminated services not yet activated |
| `EKK0341C410SC` | SC Code | Pre-Inspection Equipment Contract Cancellation — handles cancellations for un-inspected equipment |
| `EKK0341C420SC` | SC Code | Post-Inspection Equipment Contract Cancellation — handles cancellations for inspected, active equipment |
| Equipment Provision Service | Business term | `機器提供サービス` — A telecom service where the provider leases terminal equipment (e.g., ONU, router) to customers as part of a broadband subscription |
| Contract Recovery | Business term | 契約回復 — The process of restoring/returning a service contract, typically triggered when a customer terminates service and returns leased equipment |
| Address Update | Business term | 住所更新 — Synchronization of the customer's registered address, performed after contract changes when the function code is set to check & registration mode |
| Check & Registration | Business term | チェック＆登録 — An operation mode (`func_code = "1"`) where data is validated before being persisted; triggers additional side-effect operations like address updates |
| CAANMsg | Technical type | Common message class used for CBS response data in the Fujitsu Futurity framework |
| `getNullToStr` | Method | Utility method that converts null values to empty strings, enabling safe `equals("")` comparisons on potentially null date strings |

---
