# Business Logic — KKW02701SFLogic.setKKSV0396() [42 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02701SF.KKW02701SFLogic` |
| Layer | Service / Web Logic (package `eo.web.webview.*` — sits between the presentation/web layer and the common component/SC data access layer) |
| Module | `KKW02701SF` (Package: `eo.web.webview.KKW02701SF`) |

## 1. Role

### KKW02701SFLogic.setKKSV0396()

This method is the **orchestration hub** for the Course History TV Reservation Cancellation Confirmation service (JKKSV0396). It coordinates a sequential pipeline of 19 service calls — spanning both SC (Service Component) and CC (Common Component) layers — to configure and populate the uplink (service-to-backend) parameters for a course history operation that involves TV reservation and cancellation confirmation logic.

The method follows a **delegation + pipeline** design pattern. It creates a dedicated `KKSV0396_KKSV0396OPDBMapper` instance and then invokes a fixed chain of component methods, each of which is responsible for a specific facet of the service data — such as service item registration (`setKKSV039601SC`), course-related work (`setKKSV0396WorkSC`), and course record deletion (`setCourseRkIcjknDelCC`).

This method **does not perform any conditional branching** — all 19 calls execute sequentially. Some components were introduced in versioned releases (e.g., `setKKSV039613SC` in v8.00.00, `setCourseRkIcjknDelCC` in v5.00.02) and remain permanently enabled. The method's only return value is a lightweight `HashMap` carrying a single key-value pair: the Telegram usecase ID `"KKSV0396"`, which enables downstream tracing and event correlation.

In the larger system, this method is invoked by `setInMsg()` within `KKW02701SFLogic` as part of the inbound message processing flow for the KKW02701SF web screen. It acts as the **central coordinator** that assembles the service uplink parameters needed by the course history / TV reservation cancellation confirmation workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setKKSV0396(svcFormBean, inputMap, funcCd)"])
    CREATE_MAP["Create paramMap"]
    CREATE_MAPPER["Create KKSV0396_KKSV0396OPDBMapper mapper"]
    WRAP_PARAM["Wrap svcFormBean into paramBean array"]
    SC01["mapper.setKKSV039601SC"]
    CC01["mapper.setKKSV039601CC"]
    SC02["mapper.setKKSV039602SC (FUNC_CODE_2)"]
    SC03["mapper.setKKSV039603SC (FUNC_CODE_2)"]
    SC04["mapper.setKKSV039604SC"]
    SC05["mapper.setKKSV039605SC"]
    CC02["mapper.setKKSV039602CC"]
    CC04["mapper.setKKSV039604CC"]
    SC13["mapper.setKKSV039613SC (FUNC_CODE_2) [v8.00.00]"]
    CC07["mapper.setKKSV039607CC"]
    SC15["mapper.setKKSV039615SC (FUNC_CODE_1)"]
    SC16["mapper.setKKSV039616SC"]
    DELCC["mapper.setCourseRkIcjknDelCC [v5.00.02]"]
    SC19["mapper.setKKSV039619SC"]
    SC20["mapper.setKKSV039620SC"]
    CC05["mapper.setKKSV039605CC"]
    CC06["mapper.setKKSV039606CC"]
    WORKSC["mapper.setKKSV0396WorkSC"]
    CC08["mapper.setKKSV039608CC [ANK-4592]"]
    SET_USECASE["paramMap.put(TELEGRAM_INFO_USECASE_ID, KKSV0396)"]
    RETURN_MAP["Return paramMap"]

    START --> CREATE_MAP --> CREATE_MAPPER --> WRAP_PARAM --> SC01 --> CC01 --> SC02 --> SC03 --> SC04 --> SC05 --> CC02 --> CC04 --> SC13 --> CC07 --> SC15 --> SC16 --> DELCC --> SC19 --> SC20 --> CC05 --> CC06 --> WORKSC --> CC08 --> SET_USECASE --> RETURN_MAP
    END_NODE(["End"])
    RETURN_MAP --> END_NODE
```

**Processing Summary:**

This is a **linear sequential pipeline** with no conditional branches. Each step delegates to the `KKSV0396_KKSV0396OPDBMapper`, which in turn calls deeper SC and CC components. The method is entirely data-forward: the `paramBean` array (wrapping `svcFormBean`) and `inputMap` are mutated in-place across all calls, with the final result returned as `paramMap`.

Key constant values used:
- `JKKCommonConst.FUNC_CODE_1` — used for course work and recording-related service calls
- `JKKCommonConst.FUNC_CODE_2` — used for general service and course item calls

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcFormBean` | `X31SDataBeanAccess` | The primary service form data bean containing the TV reservation cancellation confirmation context — holds the business data (e.g., service numbers, course IDs, customer identifiers) that flows through all 19 downstream components. |
| 2 | `inputMap` | `HashMap<String, Object>` | A mutable map carrying input data keys and values extracted from the web request or previous processing steps. This is the primary vehicle through which per-key data (e.g., course history entries, reservation details) is passed and mutated across all called SC/CC methods. |
| 3 | `funcCd` | `String` | The function code that identifies the calling operation context. It is passed directly to most SC/CC methods (e.g., `setKKSV039601SC`, `setKKSV039604SC`) to identify which functional mode or screen invoked this service. Some components use fixed function codes (`FUNC_CODE_1`, `FUNC_CODE_2`) instead. |

**External state accessed:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `JKKCommonConst.FUNC_CODE_1` | `String` constant | Fixed function code used for course work and recording-related service calls |
| `JKKCommonConst.FUNC_CODE_2` | `String` constant | Fixed function code used for general service and course item calls |
| `X31CWebConst.TELEGRAM_INFO_USECASE_ID` | `String` constant | Key name used to store the Telegram usecase ID for downstream event tracing |

## 4. CRUD Operations / Called Services

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

All 19 service calls are coordinated through the `KKSV0396_KKSV0396OPDBMapper` instance. Each call passes the shared `paramBean` array and `inputMap`, with some using the incoming `funcCd` and others using fixed function codes.

| # | SC / CBS Method | SC Code | Operation Type | Business Description |
|---|----------------|---------|----------------|---------------------|
| 1 | `setKKSV039601SC` | KKSV039601SC | Read/Process | Initialize / load primary service item data — the first SC called, establishing the base data for the course history cancellation confirmation workflow |
| 2 | `setKKSV039601CC` | KKSV039601CC | Common | Common component processing — post-SC validation or data enrichment after initial service load |
| 3 | `setKKSV039602SC` | KKSV039602SC | Read/Process | Secondary service processing with `FUNC_CODE_2` — handles course or service item detail loading |
| 4 | `setKKSV039603SC` | KKSV039603SC | Read/Process | Tertiary service processing with `FUNC_CODE_2` — further course history data preparation |
| 5 | `setKKSV039604SC` | KKSV039604SC | Read/Process | Service processing with incoming `funcCd` — processes specific course history record details |
| 6 | `setKKSV039605SC` | KKSV039605SC | Read/Process | Service processing with `funcCd` — processes service-related data for the cancellation confirmation |
| 7 | `setKKSV039602CC` | KKSV039602CC | Common | Common component processing — secondary CC step (runs after `setKKSV039602SC`) |
| 8 | `setKKSV039604CC` | KKSV039604CC | Common | Common component processing — secondary CC step (runs after `setKKSV039604SC`) |
| 9 | `setKKSV039613SC` | KKSV039613SC | Read/Process | Added in v8.00.00 (OM-2014-0002633). Service processing with `FUNC_CODE_2` — additional course data handling |
| 10 | `setKKSV039607CC` | KKSV039607CC | Common | Common component processing after v8.00.00 addition |
| 11 | `setKKSV039615SC` | KKSV039615SC | Read/Process | Service processing with `FUNC_CODE_1` — course work / recording-related service call |
| 12 | `setKKSV039616SC` | KKSV039616SC | Read/Process | Service processing with `funcCd` — further course history data processing |
| 13 | `setCourseRkIcjknDelCC` | CourseRkIcjknDelCC | Delete | Added in v5.00.02. Deletes course record cancellation entries — removes stale or cancelled course history records |
| 14 | `setKKSV039619SC` | KKSV039619SC | Read/Process | Service processing — continues the data pipeline |
| 15 | `setKKSV039620SC` | KKSV039620SC | Read/Process | Service processing — final SC in the sequence |
| 16 | `setKKSV039605CC` | KKSV039605CC | Common | Common component processing — secondary CC for the 05 service step |
| 17 | `setKKSV039606CC` | KKSV039606CC | Common | Common component processing — additional CC step |
| 18 | `setKKSV0396WorkSC` | KKSV0396WorkSC | Read/Process | Course work service — core course history processing with `FUNC_CODE_1` |
| 19 | `setKKSV039608CC` | KKSV039608CC | Common | Added by ANK-4592-00-00. Common component processing — additional validation or enrichment |

## 5. Dependency Trace

### Callers:

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW02701SFLogic.setInMsg()` | `setInMsg()` -> `setKKSV0396()` | `setKKSV039608CC`, `setKKSV0396WorkSC`, `setKKSV039606CC`, `setKKSV039605CC`, `setKKSV039620SC`, `setKKSV039619SC`, `setCourseRkIcjknDelCC`, `setKKSV039616SC`, `setKKSV039615SC`, `setKKSV039607CC`, `setKKSV039613SC`, `setKKSV039604CC`, `setKKSV039602CC`, `setKKSV039605SC`, `setKKSV039604SC`, `setKKSV039603SC`, `setKKSV039602SC`, `setKKSV039601CC`, `setKKSV039601SC` |

No screen/batch entry points were found within 8 hops. The only direct caller is `KKW02701SFLogic.setInMsg()` within the same class. The terminal operations from this method include all 19 SC/CC component calls listed above, which ultimately cascade to CBS (Common Business Service) calls and database operations within the `KKSV0396_KKSV0396OPDBMapper` layer.

## 6. Per-Branch Detail Blocks

This method has **no conditional branches** (no if/else, no switch, no loops, no try-catch). It is a pure sequential pipeline. Each line is documented below as a standalone block.

**Block 1** — [PROCESSING] (L796)

> Initialize local result map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, String> paramMap = new HashMap<String, String>();` // Local result map for return value |

**Block 2** — [PROCESSING] (L797)

> Instantiate the dedicated mapper for the KKSV0396 service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `KKSV0396_KKSV0396OPDBMapper mapper = new KKSV0396_KKSV0396OPDBMapper();` // Dedicated mapper for KKSV0396 service |

**Block 3** — [PROCESSING] (L800)

> Wrap the input service form bean into a single-element array for the component interface convention.

| # | Type | Code |
|---|------|------|
| 1 | SET | `X31SDataBeanAccess[] paramBean = {svcFormBean};` // Component calls expect an array of beans |

**Block 4** — [CALL] (L801)

> Initial service component — loads base service item data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039601SC(paramBean, inputMap, funcCd);` // Load primary service item data |

**Block 5** — [CALL] (L802)

> Common component — post-SC processing for the primary service item.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039601CC(paramBean, inputMap, funcCd);` // Common processing after SC01 |

**Block 6** — [CALL] (L803)

> Secondary service component with fixed `FUNC_CODE_2`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039602SC(paramBean, inputMap, JKKCommonConst.FUNC_CODE_2);` // Fixed function code 2 |

**Block 7** — [CALL] (L804)

> Tertiary service component with fixed `FUNC_CODE_2`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039603SC(paramBean, inputMap, JKKCommonConst.FUNC_CODE_2);` // Fixed function code 2 |

**Block 8** — [CALL] (L805)

> Service component using the incoming function code.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039604SC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 9** — [CALL] (L806)

> Service component using the incoming function code.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039605SC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 10** — [CALL] (L807)

> Common component — secondary processing step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039602CC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 11** — [CALL] (L808)

> Common component — secondary processing step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039604CC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 12** — [CALL - v8.00.00 Added] (L811)

> Added in v8.00.00 per ticket OM-2014-0002633 (2014-08-18, Tanaka). Additional service component with fixed `FUNC_CODE_2`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039613SC(paramBean, inputMap, JKKCommonConst.FUNC_CODE_2);` // OM-2014-0002633 added |

**Block 13** — [CALL] (L814)

> Common component after v8.00.00 addition.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039607CC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 14** — [CALL] (L816)

> Service component with fixed `FUNC_CODE_1` — course work / recording-related processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039615SC(paramBean, inputMap, JKKCommonConst.FUNC_CODE_1);` // Fixed function code 1 |

**Block 15** — [CALL] (L817)

> Service component using incoming function code.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039616SC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 16** — [CALL - v5.00.02 Added] (L820)

> Added in v5.00.02. Course record cancellation delete common component — removes stale or cancelled course history records.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setCourseRkIcjknDelCC(paramBean, inputMap, funcCd);` // Course record deletion |

**Block 17** — [CALL] (L822)

> Service component using incoming function code.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039619SC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 18** — [CALL] (L823)

> Final service component in the SC sequence.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039620SC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 19** — [CALL] (L824)

> Common component — secondary processing step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039605CC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 20** — [CALL] (L825)

> Common component — additional processing step.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039606CC(paramBean, inputMap, funcCd);` // Uses incoming funcCd |

**Block 21** — [CALL] (L826)

> Course work service — core course history processing with fixed `FUNC_CODE_1`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV0396WorkSC(paramBean, inputMap);` // Course work service, no funcCd |

**Block 22** — [CALL - ANK-4592 Added] (L828)

> Added by ANK-4592-00-00. Common component for additional validation or enrichment.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV039608CC(paramBean, inputMap, funcCd);` // ANK-4592-00-00 added |

**Block 23** — [SET] (L830)

> Tag the result map with the Telegram usecase ID for downstream tracing and event correlation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, "KKSV0396");` // Sets Telegram usecase ID |

**Block 24** — [RETURN] (L832)

> Return the result map (contains only the usecase ID; all service data is mutated in-place in `inputMap` and `svcFormBean`).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap;` // Returns HashMap with TELEGRAM_INFO_USECASE_ID only |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KKSV0396` | Service ID | Course History TV Reservation Cancellation Confirmation service — handles course history recording and TV reservation cancellation confirmation operations |
| `KKW02701SF` | Module | Web screen module — the source screen or interface that invokes this service |
| `KKW02701SFLogic` | Class | Logic class for the KKW02701SF screen — contains business logic methods for screen processing |
| `KKSV0396_KKSV0396OPDBMapper` | Mapper | Object-to-Database Mapper for the KKSV0396 service — orchestrates calls to SC (Service Components) and CC (Common Components) |
| `SC` | Acronym | Service Component — a data access component that directly interfaces with CBS (Common Business Services) or the database layer |
| `CC` | Acronym | Common Component — a shared utility component for cross-cutting concerns (validation, enrichment, cleanup) used across multiple services |
| `paramBean` | Field | Service form bean array — the standard array wrapper convention used by KK service component calls (`X31SDataBeanAccess[]`) |
| `inputMap` | Field | Input parameter map — mutable `HashMap<String, Object>` carrying request data that is mutated in-place across all SC/CC calls |
| `funcCd` | Field | Function code — identifies the calling operation context; routes component behavior based on the calling screen or batch mode |
| `FUNC_CODE_1` | Constant | Fixed function code used for course work and recording-related operations |
| `FUNC_CODE_2` | Constant | Fixed function code used for general service and course item processing operations |
| `TELEGRAM_INFO_USECASE_ID` | Constant | Key name for Telegram tracing — stores the usecase ID (`"KKSV0396"`) for downstream event tracking |
| Course History | Business term | Record of a customer's service subscriptions and changes — the primary data entity being processed in this service |
| TV Reservation | Business term | Scheduled TV recording reservation — the specific type of service item being cancelled/confirmed |
| Cancellation Confirmation | Business term | The verification and finalization step for cancelling a TV recording reservation |
| v8.00.00 | Version tag | Software version that added `setKKSV039613SC` and `setKKSV039607CC` per ticket OM-2014-0002633 |
| v5.00.02 | Version tag | Software version that added `setCourseRkIcjknDelCC` for course record deletion |
| OM-2014-0002633 | Ticket ID | Change request ticket (2014-08-18, Tanaka) that added `setKKSV039613SC` |
| ANK-4592-00-00 | Ticket ID | Change request ticket that added `setKKSV039608CC` |
| `X31SDataBeanAccess` | Class | Standard data bean access class used across KK services for passing service form data |
| `KKSV` | Prefix | Course History / Service-related service identifier prefix (as opposed to `KKW` for web screens, `KKR` for other modules) |
