# Business Logic — KKW00191SFLogic.shosaNgCl() [36 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00191SF.KKW00191SFLogic` |
| Layer | Service Component (Logic layer within the Web Controller module) |
| Module | `KKW00191SF` (Package: `eo.web.webview.KKW00191SF`) |

## 1. Role

### KKW00191SFLogic.shosaNgCl()

The `shosaNgCl` method implements **Review NG Cancellation Processing** (照査NG取消処理). In K-Opticom's customer backbone system, certain service contracts undergo a mandatory review ("shosa" / 照査) before activation. When a contract fails this review, it receives an "NG" (fail) flag. This method orchestrates the cancellation of all service contracts that have been flagged as review-NG, ensuring that failed review records do not remain active in the system.

The method follows a **delegation / routing design pattern**. It does not perform the cancellation logic itself. Instead, it constructs a structured request payload containing the use case ID (`KKSV0742`), the operation ID (`KKSV0742OP`), and a target data list carrying the service contract number (`svc_kei_no`) extracted from the incoming parameter bean array. It then invokes the service framework (`invokeService`) which routes the request to the Common Component `JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl`.

The CC component further delegates to a family of mappers (`JKKSvkeiShosaNgClShokaiMapperCC`, `JKKSvkeiShosaNgClMapperCC`) that map the input to specific CBS (CBS = CBS business service) calls. Each CBS corresponds to a different service type, such as FTTH (Fiber To The Home), Mail (email service), ENUM, subscription detail review cancellation, and service contract EO Net review cancellation. This allows the method to handle **multiple service categories in a single coordinated cancellation pass**.

The method is called exclusively from `KKW00191SFLogic.actionInit()`, which is the initialization handler for the KKW00191SF screen. Its role in the larger system is to clean up or nullify service contracts that failed their pre-activation review, preventing erroneous service activations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["shosaNgCl params"])

    START --> N1["N1: Create paramMap, inputMap, outputMap"]

    N1 --> N2["N2: paramMap.put USECASE_ID = KKSV0742"]

    N2 --> N3["N3: paramMap.put OPERATION_ID = KKSV0742OP"]

    N3 --> N4["N4: Create parentMap, trgtDataList"]

    N4 --> N5["N5: parentMap.put func_code = FUNC_CD_1 = 1"]

    N5 --> N6["N6: paramBean[0].sendMessageString SVC_KEI_NO"]

    N6 --> N7["N7: trgtDataListElement put svc_kei_no"]

    N7 --> N8["N8: trgtDataList.add"]

    N8 --> N9["N9: trgt_data.put trgt_data_list"]

    N9 --> N10["N10: inputMap.put KKSV074201CC"]

    N10 --> N11["N11: invokeService paramMap inputMap outputMap"]

    N11 --> N12["N12: Route to KKSV074201CC, JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl"]

    N12 --> N13["N13: Mapper calls CBS for each service type"]

    N13 --> N14["N14: Execute cancellation for NG-flagged service contracts"]

    N14 --> END(["End void"])

    START --> N1
    N1 --> N2
    N2 --> N3
    N3 --> N4
    N4 --> N5
    N5 --> N6
    N6 --> N7
    N7 --> N8
    N8 --> N9
    N9 --> N10
    N10 --> N11
    N11 --> N12
    N12 --> N13
    N13 --> N14
```

**Processing Flow:**

1. **Data Structure Initialization (L432–434):** Creates three `HashMap<String, Object>` instances — `paramMap` for telegram routing info, `inputMap` for the service request payload, and `outputMap` to capture the response.

2. **Telegram Routing Configuration (L436–437):** Sets the use case ID to `UCID_KKSV0742 = "KKSV0742"` and the operation ID to `OPID_KKSV0742OP = "KKSV0742OP"` in the `paramMap`. These identifiers route the request through the BPE (Business Process Execution) engine to the correct operation.

3. **Parent Map Construction (L439–443):** Creates the hierarchical data structure:
   - `parentMap` with `func_code` set to `JPCModelConstant.FUNC_CD_1 = "1"` (the common information function code).
   - `trgtDataList` as an `ArrayList<HashMap<String, Object>>` to hold target data records.
   - `trgtDataListElement` as a single record HashMap.

4. **Service Contract Number Extraction (L446):** Extracts the `svc_kei_no` (service contract number) from `paramBean[0]` using `sendMessageString` with `DATABEAN_GET_VALUE`. This is the sole business data input — the specific service contract to cancel.

5. **Target Data Assembly (L447–449):** Adds the element to `trgtDataList`, then wraps the list inside `trgt_data` under the key `TRGT_DATA_LIST = "trgt_data_list"`.

6. **Input Map Population (L451):** Associates the key `"KKSV074201CC"` (the CC request key) with the `trgt_data` map in `inputMap`.

7. **Service Invocation (L454):** Calls `invokeService(paramMap, inputMap, outputMap)`, which triggers the entire downstream cancellation chain.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | Array of service form beans containing the request data. The first element (`paramBean[0]`) carries the **service contract number** (`svc_kei_no`) — the unique identifier of the service contract that was flagged as review-NG and needs to be cancelled. |

**External State / Instance Fields:**
- None directly read. The method is self-contained and receives all data through `paramBean`.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Calls `sendMessageString` on `paramBean[0]` to extract `svc_kei_no` (Service Contract Number) |
| - | `KKW00191SFLogic.invokeService` | KKW00191SFLogic | - | Invokes the service framework to route request to `KKSV074201CC` |
| C | `JKKSvkeiShosaNgClShokaiMapperCC.editInMsgEKK0081A010` | EKK0081A010CBS | `KK_T_SVKEI_ISP` | Creates FTTH cancellation template — cancels FTTH (Fiber To The Home) service contract |
| C | `JKKSvkeiShosaNgClShokaiMapperCC.editInMsgEKK0091A010` | EKK0091A010CBS | `KK_T_SVKEI_MAIL` | Creates Mail service cancellation template — cancels email (mail alias) service |
| C | `JKKSvkeiShosaNgClShokaiMapperCC.editInMsgEKK0101A010` | EKK0101A010CBS | `KK_T_SVKEI_ENUM` | Creates ENUM service cancellation template — cancels ENUM (phone-to-IP mapping) service |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK0021C110` | EKK0021C110CBS | `KK_T_MSKM_DTL` | Creates subscription detail review cancellation template — cancels order detail review entries |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK0091C070` | EKK0091C070CBS | `KK_T_SVKEI_EO_NET` | Creates service contract EO Net review cancellation template |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK0431C080` | EKK0431C080CBS | `KK_T_*` | Additional service type cancellation (various service contract records) |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK1091B001` | EKK1091B001CBS | `KK_T_*` | Additional service type cancellation |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK1091D010` | EKK1091D010CBS | `KK_T_*` | Additional service type cancellation |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK2811A010` | EKK2811A010CBS | `KK_T_*` | Additional service type cancellation |
| C | `JKKSvkeiShosaNgClMapperCC.editInMsgEKK2811C060` | EKK2811C060CBS | `KK_T_*` | Additional service type cancellation |

### How this method triggers CRUD:

| # | Call Chain | Operation |
|---|-----------|-----------|
| 1 | `shosaNgCl` → `invokeService` → `KKSV074201CC` → `JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl` | Service delegation |
| 2 | `runSvkeiShosaNgCl` → `shokaiMapper` (JKKSvkeiShosaNgClShokaiMapperCC) | Mappers for initial services (FTTH, Mail, ENUM) |
| 3 | `runSvkeiShosaNgCl` → `shosaClMapper` (JKKSvkeiShosaNgClMapperCC) | Mappers for detail review cancellations and other service types |
| 4 | Mappers → `EKK0081A010CBS / EKK0091A010CBS / EKK0101A010CBS` | CBS calls that issue INSERT/UPDATE to service contract tables to mark them as cancelled |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `KKW00191SFLogic.actionInit()` | `actionInit()` → `shosaNgCl(paramBean)` | `invokeService` → `KKSV074201CC` → `JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl` → CBS cancel operations (EKK0081A010, EKK0091A010, EKK0101A010, EKK0021C110, EKK0091C070, EKK0431C080, EKK1091B001, EKK1091D010, EKK2811A010, EKK2811C060) |

**Call Chain Detail:**
- `KKW00191SFLogic.actionInit()` (line 110) calls `shosaNgCl(paramBean)` as part of the screen initialization flow for the `KKW00191SF` screen.
- `shosaNgCl()` calls `invokeService(paramMap, inputMap, outputMap)` which routes to `KKSV074201CC`.
- `KKSV0742OPOperation` registers `JKKSvkeiShosaNgClCC` as the CC target with request key `KKSV074201CC`.
- `JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl` iterates over the `trgt_data_list` and calls mappers which invoke CBS for each service type.

## 6. Per-Branch Detail Blocks

### Block 1 — SET (Variable Initialization) (L432–434)

> Initializes the three core HashMap data structures used throughout the method.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // HashMap for telegram (routing) info |
| 2 | SET | `inputMap = new HashMap<String, Object>()` // HashMap for mapping results |
| 3 | SET | `outputMap = new HashMap<String, Object>()` // HashMap for service call results |

### Block 2 — EXEC (Telegram Routing Configuration) (L436–437)

> Sets up the BPE routing information. `UCID_KKSV0742 = "KKSV0742"` identifies the use case, and `OPID_KKSV0742OP = "KKSV0742OP"` identifies the specific operation within that use case.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(TELEGRAM_INFO_USECASE_ID, JKKCommonConst.UCID_KKSV0742)` // [-> UCID_KKSV0742 = "KKSV0742"] |
| 2 | SET | `paramMap.put(TELEGRAM_INFO_OPERATION_ID, JKKCommonConst.OPID_KKSV0742OP)` // [-> OPID_KKSV0742OP = "KKSV0742OP"] |

### Block 3 — SET (Parent Map Data Structure) (L439–443)

> Creates the hierarchical structure for the target data. This is a 3-level nesting: `parentMap` → `trgt_data_list` (ArrayList) → `trgtDataListElement` (HashMap).

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap = new HashMap<String, Object>()` // Parent mapping HashMap |
| 2 | SET | `trgt_data = new HashMap<String, Object>()` // Target data HashMap |
| 3 | SET | `trgtDataList = new ArrayList<HashMap<String, Object>>()` // ArrayList for target data records |
| 4 | SET | `trgtDataListElement = new HashMap<String, Object>()` // Single element in the list |

### Block 4 — EXEC (Common Information Mapping) (L445)

> Sets the function code to `"1"` (FUNC_CD_1) in `parentMap` under the key `"func_code"`. This is the common information block that is passed through to downstream CBS calls.

| # | Type | Code |
|---|------|------|
| 1 | SET | `parentMap.put("func_code", JPCModelConstant.FUNC_CD_1)` // [-> FUNC_CD_1 = "1"] // Common information mapping |

### Block 5 — EXEC (Service Contract Number Extraction) (L446)

> Extracts the `svc_kei_no` (service contract number) from the first element of `paramBean`. This is the key business identifier — the specific service contract that needs cancellation. `KKW00191SFConst.SVC_KEI_NO = "サービス契約番号"` is the field name key used to access the bean value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `trgtDataListElement.put("svc_kei_no", paramBean[0].sendMessageString(KKW00191SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_GET_VALUE))` // Extract service contract number from paramBean[0] |

### Block 6 — EXEC (Add to Target List) (L447–449)

> Adds the single-element record into the target data list, then wraps the list under the key `TRGT_DATA_LIST = "trgt_data_list"`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `trgtDataList.add(trgtDataListElement)` // Add element to target data list |
| 2 | SET | `trgt_data.put("trgt_data_list", trgtDataList)` // [-> TRGT_DATA_LIST = "trgt_data_list"] // Review cancellation list elements |

### Block 7 — SET (Input Map Population) (L451)

> Associates the CC request key `"KKSV074201CC"` with the `trgt_data` map. This tells the service framework which Common Component and request key to invoke.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap.put("KKSV074201CC", trgt_data)` // Input map keyed by CC request identifier |

### Block 8 — CALL (Service Invocation) (L454)

> Invokes the service framework. This is the terminal call in this method — all downstream processing (CC invocation, mapper mapping, CBS execution) is triggered from here.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `invokeService(paramMap, inputMap, outputMap)` // Service call to KKSV074201CC |

### Block 9 — RETURN (Implicit void return) (L456)

> The method ends after `invokeService` returns. No explicit return statement (void method).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Implicit — end of method |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `shosaNgCl` | Method | Review NG Cancellation — cancels service contracts that failed the mandatory pre-activation review ("shosa") |
| `svc_kei_no` | Field | Service Contract Number — unique identifier for a service contract line item (e.g., FTTH, Mail, ENUM) |
| UCID | Acronym | Use Case ID — identifies the business use case in the BPE routing system (`KKSV0742`) |
| OPID | Acronym | Operation ID — identifies the specific operation within a use case (`KKSV0742OP`) |
| FUNC_CD_1 | Constant | Function Code "1" — represents common/general function classification used across CBS calls |
| KKSV0742 | Screen/Use Case | The customer screen/use case for review-NG cancellation processing (KK = K-Opticom customer, SV = Service, 0742 = sequence number) |
| KKSV074201CC | CC Key | Common Component request key — routes to `JKKSvkeiShosaNgClCC.runSvkeiShosaNgCl` |
| KKSV0742OP | Operation | Operation broker configuration for the KKSV0742 use case |
| JKKSvkeiShosaNgClCC | Component | Service Contract Review NG Cancellation Common Component — executes the actual cancellation logic |
| JKKSvkeiShosaNgClShokaiMapperCC | Mapper | Initial service mapper — maps input for FTTH, Mail, ENUM initial service cancellations |
| JKKSvkeiShosaNgClMapperCC | Mapper | Detail review cancellation mapper — maps input for subscription detail and EO Net review cancellations |
| EKK0081A010CBS | CBS | FTTH (Fiber To The Home) service cancellation CBS — cancels FTTH service contracts |
| EKK0091A010CBS | CBS | Mail service cancellation CBS — cancels email service subscriptions |
| EKK0101A010CBS | CBS | ENUM service cancellation CBS — cancels ENUM (phone-to-IP mapping) service |
| EKK0021C110CBS | CBS | Subscription detail review cancellation CBS — cancels order detail review entries |
| EKK0091C070CBS | CBS | Service contract EO Net review cancellation CBS — cancels EO Net service contract review entries |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| Mail | Business term | Email service — includes mail alias, mail box capacity, and related email account settings |
| ENUM | Business term | Enumeration — maps telephone numbers to IP-based addresses for VoIP calling |
| EO Net | Business term | Enterprise Office Network — Fujitsu's enterprise network service platform |
| 照査 (Shosa) | Japanese term | Review / screening — mandatory pre-activation validation process for service contracts |
| NG | Japanese term | Fail / No Good — indicates a review failure status |
| 取消 (Torikeshi) | Japanese term | Cancellation |
| `X31SDataBeanAccess` | Class | Service Data Bean Access — framework class for accessing service form bean data |
| `sendMessageString` | Method | Framework method to get/set string values on a data bean |
| `KKW00191SF` | Module | Web screen module for KKW (K-Opticom Web) screen series 00191, SF = Screen Form |
| `TRGT_DATA_LIST` | Constant | Target data list key — `"trgt_data_list"` in the CC request payload |
