---
# Business Logic — JKKBumpMdsCC.callEKK0161B013SC() [54 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKBumpMdsCC` |
| Layer | CC / Common Component — Shared service-component invocation helper |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKBumpMdsCC.callEKK0161B013SC()

This method is a **Service Interface (SIF) facade** that invokes the `EKK0161B013` service component, which implements the **Service Contract Sub-List Inquiry by Phone Number** screen function. In Japanese: "サービス契約内訳一覧照会（電話番号）" — it retrieves a list of service contract detail records associated with a given telephone number. The method follows the **SIF delegation pattern**, which is the standard architecture across the Fujitsu BP custom EJB layer: it constructs an inbound message template, populates it with search criteria, dispatches the request via `ServiceComponentRequestInvoker`, and then unmarshals the response into the caller's result hash.

Specifically, it performs the following business operations:

- **Message preparation**: It initializes the SIF request envelope via `editInMsgCmn`, maps the telephone number and service contract work number into the `EKK0161B013CBSMsg` request template via `mappingEKK0161B013InMsg`, and enriches the template with basic SIF metadata via `editBasicCmn`.
- **Service invocation**: It creates a `ServiceComponentRequestInvoker` and calls `run()` to dispatch the SIF request to the underlying CBS (Component-Based System) layer.
- **Response processing**: After the CBS call returns, it maps the result back to request parameters via `editResultRP`, runs error checks via `errChk`, retrieves the output message list from the SIF response, extracts the status code, and if the status is `0` (success), maps the outbound message data into `resultHash` under the key `"EKK0161B013"`.

This method acts as a **shared utility** called by higher-level business processing methods (notably `executeBumpMds`), which typically handle address-change business logic for telecom service contracts. The return value is an integer status code (`0` indicates success, non-zero indicates an error) that the caller uses to determine whether to proceed with downstream processing (e.g., iterating over the returned contract detail list).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callEKK0161B013SC params"])
    
    START --> INIT["Initialize variables sIFRequest, resultMsgs, template, scCall, sIFResult, status=0"]
    INIT --> EDITIN["editInMsgCmn param - Set common SIF information"]
    EDITIN --> CREATE_TEMPLATE["Create CAANMsg template EKK0161B013CBSMsg"]
    CREATE_TEMPLATE --> MAP_IN["mappingEKK0161B013InMsg template, inHash, svcKeiUcwkNo, telNo - Set null mapping, template ID, func code=1, key telNo"]
    MAP_IN --> EDIT_BASIC["editBasicCmn param, template - Set basic SIF common information"]
    EDIT_BASIC --> PUT_TEMPLATE["sIFRequest.put TEMPLATE_LIST_KEY new CAANMsg array containing template"]
    PUT_TEMPLATE --> CREATE_INVOKER["Create ServiceComponentRequestInvoker scCall"]
    CREATE_INVOKER --> SIF_CALL["scCall.run sIFRequest, handle - Call SIF EKK0161B013"]
    SIF_CALL --> EDIT_RESULT["editResultRP sIFResult, param - Error mapping process"]
    EDIT_RESULT --> ERR_CHK["errChk sIFResult - Error check"]
    ERR_CHK --> GET_MSGS["resultMsgs = sIFResult.get TEMPLATE_LIST_KEY - Get result messages"]
    GET_MSGS --> GET_STATUS["status = template.getInt STATUS_INT_KEY - Get status code"]
    GET_STATUS --> CHECK_STATUS{"status == 0"}
    
    CHECK_STATUS -->|"No"| RETURN_STATUS["Return status"]
    CHECK_STATUS -->|"Yes"| MAP_OUT["mappingEKK0161B013SCOutMsg resultMsgs - Map output message"]
    MAP_OUT --> PUT_RESULT["resultHash.put TEMPLATE_ID_EKK0161B013 mapping result"]
    PUT_RESULT --> RETURN_STATUS
```

**Flow summary:**

1. **Initialization**: Local variables are declared and `status` is set to `0`.
2. **Inbound message preparation**: `editInMsgCmn` prepares the common SIF request envelope.
3. **Template creation**: A new `CAANMsg` of type `EKK0161B013CBSMsg` is instantiated as the request template.
4. **Input mapping**: `mappingEKK0161B013InMsg` populates the template with null-mapped fields, the template ID `"EKK0161B013"`, function code `"1"` (service contract detail list inquiry), and the key telephone number from the `telNo` parameter.
5. **Basic SIF enrichment**: `editBasicCmn` adds standard SIF metadata (session info, operator date, etc.) to the template.
6. **Request assembly**: The template is placed into the `sIFRequest` under the key `JCMConstants.TEMPLATE_LIST_KEY`.
7. **Invoker creation**: A `ServiceComponentRequestInvoker` instance is created.
8. **SIF dispatch**: `scCall.run()` sends the request to the CBS layer with the session handle.
9. **Response error mapping**: `editResultRP` maps the SIF response fields back to the request parameters.
10. **Error check**: `errChk` validates the SIF result for business errors.
11. **Result extraction**: The result message array is extracted from the SIF response, and the status code is read from the template.
12. **Conditional branching**: If `status == 0` (success), the outbound message is mapped via `mappingEKK0161B013SCOutMsg` and stored in `resultHash` under key `"EKK0161B013"`. Otherwise, the result hash is not populated and the non-zero status is returned directly.
13. **Return**: The status code is returned to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter object that carries the application-specific data map. Used by `editInMsgCmn` to set up the common SIF request envelope, by `editResultRP` to map SIF response data back to the application layer, and by `errChk` to propagate error information. |
| 2 | `handle` | `SessionHandle` | Session handle representing the current user session. Passed to `ServiceComponentRequestInvoker.run()` so the CBS layer can validate session context, authorization, and transaction boundaries. |
| 3 | `inHash` | `HashMap<String, Object>` | Condition hash containing search criteria used for the SIF query. Passed to `mappingEKK0161B013InMsg` for populating the request template fields. |
| 4 | `resultHash` | `HashMap<String, Object>` | Output hash where the method stores the mapped result message array under the key `TEMPLATE_ID_EKK0161B013` (value: `"EKK0161B013"`) when the SIF call succeeds. The caller (e.g., `executeBumpMds`) retrieves this to iterate over the returned contract detail records. |
| 5 | `svcKeiUcwkNo` | `String` | Service contract detail work number — the internal tracking ID for a specific line item within a service contract. Passed to `mappingEKK0161B013InMsg` for mapping, though the actual SIF query key is the telephone number. |
| 6 | `telNo` | `String` | Telephone number — the primary search key for this inquiry. The CBS component `EKK0161B013` retrieves all service contract detail records associated with this phone number. |

**External/Instance fields read:** None directly accessed by this method. The method is stateless with respect to instance fields — all state is passed through parameters and local variables.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `SCW00701SFLogic.getName` | (framework) | — | Called during SIF execution to retrieve system/business information (e.g., operator date) |
| U | `JKKBumpMdsCC.editBasicCmn` | JKKBumpMdsCC | — | Sets basic SIF common fields (session info, operation date, etc.) on the request template |
| U | `JKKBumpMdsCC.editInMsgCmn` | JKKBumpMdsCC | — | Initializes the common SIF request message envelope and returns the request map |
| U | `JKKBumpMdsCC.editResultRP` | JKKBumpMdsCC | — | Maps the SIF response fields back into the request parameter object for downstream use |
| - | `JKKBumpMdsCC.errChk` | JKKBumpMdsCC | — | Validates the SIF result and throws exceptions on error conditions |
| - | `JKKBumpMdsCC.mappingEKK0161B013InMsg` | JKKBumpMdsCC | — | Populates the inbound request template with search criteria (null-mapping, template ID, function code, telephone number key) |
| - | `JKKBumpMdsCC.mappingEKK0161B013SCOutMsg` | JKKBumpMdsCC | — | Maps the outbound SIF result messages into a `CAANMsg[]` array for the caller |
| R | `ServiceComponentRequestInvoker.run` | EKK0161B013SC | EKK0161B013 | Invokes the EKK0161B013 CBS (Service Contract Sub-List Inquiry by Phone Number) |

**CRUD classification rationale:**

- The primary operation is an **R (Read)**: The `EKK0161B013` CBS queries the service contract detail table for records matching the given telephone number.
- `editBasicCmn`, `editInMsgCmn`, `editResultRP` are classified as **U (Update)** because they modify the request/response data structures in-place.
- `errChk`, `mappingEKK0161B013InMsg`, `mappingEKK0161B013SCOutMsg` are classification **(-)** as they are mapping/validation helpers without direct data access.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JKKBumpMdsCC.executeBumpMds` | `executeBumpMds(handle, param, fixedText)` -> `callEKK0161B013SC(param, handle, requestParam, resultHash, svcKeiUcwkNo, telNo)` | `mappingEKK0161B013SCOutMsg [-]`, `errChk [-]`, `editResultRP [U]`, `scCall.run [R]`, `editBasicCmn [U]`, `mappingEKK0161B013InMsg [-]`, `editInMsgCmn [U]`, `getName [R]`, `editInMsgCmn [U]` |

**Caller context:** `executeBumpMds` is the **Address Change Execution** method that processes address changes for telecom service contracts. Within its execution flow, it performs various checks including a pre-existing SOD issue dependency check (`callEKK1081B001SC`), and then calls `callEKK0161B013SC` to retrieve the list of service contract details associated with the target telephone number. After this call returns, the caller iterates over the `CAANMsg[]` result (stored under `TEMPLATE_ID_EKK0161B013` in `resultHash`) to examine each contract detail's status (`SVC_KEI_UCWK_STAT`) and work number (`SVC_KEI_UCWK_NO`) to determine subsequent address-change processing actions.

## 6. Per-Branch Detail Blocks

**Block 1** — VARIABLE DECLARATION `(local variable initialization)` (L1212–L1223)

> Initializes all local variables. `status` is defaulted to `0` (success), which will be overwritten by the SIF response status code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sIFRequest = null` // SIF request message envelope |
| 2 | SET | `resultMsgs = null` // Array of result CAANMsg from SIF |
| 3 | SET | `template = null` // Request template for EKK0161B013CBSMsg |
| 4 | SET | `scCall = null` // Service component request invoker |
| 5 | SET | `sIFResult = null` // SIF response result map |
| 6 | SET | `status = 0` // Default return status (0 = success) [-> SUC=0] |

**Block 2** — SET `[editInMsgCmn: Set common SIF request information]` (L1226)

> Prepares the common SIF request message envelope. This is a standard first step in every SIF call in this codebase.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editInMsgCmn(param)` // Sets common SIF information, returns the request HashMap |
| 2 | SET | `sIFRequest = editInMsgCmn(param)` |

**Block 3** — SET `[EKK0161B013: Service Contract Sub-List Inquiry by Phone Number]` (L1229–L1230)

> Creates the CAANMsg template and maps input parameters into it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg(EKK0161B013CBSMsg.class.getName())` // Creates request template |
| 2 | CALL | `mappingEKK0161B013InMsg(template, inHash, svcKeiUcwkNo, telNo)` |

**Block 3.1** — SUB-BLOCK `[mappingEKK0161B013InMsg: Map EKK0161B013 input parameters]` (internal to Block 3)

> Populates the request template with the SIF search criteria.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `fillCAANMSGNullMapping(template, new EKK0161B013CBSMsg().getContents())` // Null-maps all fields |
| 2 | SET | `template.set(EKK0161B013CBSMsg.TEMPLATEID, "EKK0161B013")` // [-> TEMPLATE_ID_EKK0161B013="EKK0161B013"] |
| 3 | SET | `template.set(EKK0161B013CBSMsg.FUNC_CODE, "1")` // Function code: Service contract detail list inquiry [-> FUNC_CD_1="1"] |
| 4 | SET | `template.set(EKK0161B013CBSMsg.KEY_TELNO, telNo)` // Key telephone number for the inquiry |

**Block 4** — SET `[editBasicCmn: Set basic SIF common fields]` (L1230)

> Enriches the template with standard SIF metadata (session details, operation date, etc.).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editBasicCmn(param, template)` |

**Block 5** — SET `[Put template into request envelope]` (L1233)

> Assembles the SIF request by placing the template into the request map's template list.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `sIFRequest.put(JCMConstants.TEMPLATE_LIST_KEY, new CAANMsg[]{template})` // Adds template to request envelope |

**Block 6** — SET `[Create SC invoker]` (L1236–L1237)

> Instantiates the service component request invoker used to dispatch the SIF call.

| # | Type | Code |
|---|------|------|
| 1 | SET | `scCall = new ServiceComponentRequestInvoker()` // Creates invoker instance |

**Block 7** — EXEC `[SIF dispatch: Call service component EKK0161B013]` (L1240)

> Dispatches the SIF request to the CBS layer. This is the core data-access operation that queries service contract details by telephone number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `scCall.run(sIFRequest, handle)` // Dispatches SIF request to CBS layer |
| 2 | SET | `sIFResult = scCall.run(sIFRequest, handle)` // Receives SIF response |

**Block 8** — SET `[editResultRP: Error mapping process]` (L1243)

> Maps the SIF response fields back to the request parameter for downstream processing.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editResultRP(sIFResult, param)` |

**Block 9** — EXEC `[errChk: Error check]` (L1246)

> Validates the SIF result. Throws exceptions on business errors.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `errChk(sIFResult)` |

**Block 10** — SET `[Get result messages from SIF response]` (L1249)

> Extracts the array of result CAANMsg objects from the SIF response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `resultMsgs = (CAANMsg[])sIFResult.get(JCMConstants.TEMPLATE_LIST_KEY)` // Cast and extract result array |

**Block 11** — SET `[Get status code from template]` (L1252)

> Retrieves the status code from the template to determine success or failure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `status = template.getInt(JCMConstants.STATUS_INT_KEY)` // Gets SIF return status code |

**Block 12** — IF `[status == 0 (Success)]` (L1255–L1257)

> Branch: The SIF call succeeded. Map the outbound message data into the result hash for the caller.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mappingEKK0161B013SCOutMsg(resultMsgs)` // Maps SIF output messages to CAANMsg[] |
| 2 | SET | `resultHash.put(TEMPLATE_ID_EKK0161B013, mappingEKK0161B013SCOutMsg(resultMsgs))` // [-> Key="EKK0161B013"] |

**Block 12.1** — SUB-BLOCK `[mappingEKK0161B013SCOutMsg: Map EKK0161B013 output message]` (internal to Block 12)

> (Details not visible in this method — delegates to a mapper that transforms the SIF response CAANMsg list into the expected output structure for callers.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mappingEKK0161B013SCOutMsg(resultMsgs)` |

**Block 13** — ELSE `[status != 0 (Error)]` (implicit)

> Branch: The SIF call returned an error status. The result hash is **not** populated, and the method returns the non-zero status code immediately without mapping any output data.

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | No resultHash.put — caller receives null/empty result array |
| 2 | RETURN | `return status` |

**Block 14** — RETURN (L1259)

> Returns the status code to the caller. Value `0` means success; any non-zero value indicates an error condition.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return status` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiUcwkNo` | Field | Service contract detail work number — internal tracking ID for a specific line item within a service contract |
| `telNo` | Field | Telephone number — the primary search key for querying service contract details |
| `inHash` | Field | Condition hash — a HashMap carrying search criteria parameters for the SIF query |
| `resultHash` | Field | Result hash — output container where the method stores the mapped query results under key `"EKK0161B013"` |
| `param` | Field | Request parameter object — carries application-specific data between the screen layer and business logic layer |
| `handle` | Field | Session handle — represents the current user's session for the CBS layer |
| SIF | Acronym | System Interface — the enterprise service interface layer that delegates calls to CBS (Component-Based System) |
| SC | Acronym | Service Component — the service component that implements a specific business function |
| CBS | Acronym | Component-Based System — the core business system layer that performs data access |
| EKK0161B013 | Service ID | Service Contract Sub-List Inquiry by Phone Number — screen/component ID for querying service contract details associated with a telephone number |
| CAANMsg | Technical | Common Application ANd Messaging — the message wrapper class used throughout the SIF layer for request/response serialization |
| SERVICE_COMPONENT_REQUEST_INVOKER | Technical | Framework class that dispatches SIF requests to the CBS layer and returns results |
| TEMPLATE_ID_EKK0161B013 | Constant | Template identifier `"EKK0161B013"` — used as the key to store and retrieve results in the result hash |
| FUNC_CODE "1" | Constant | Function code `"1"` — indicates "Service Contract Detail List Inquiry by Phone Number" mode |
| STATUS_INT_KEY | Constant | Status integer key — standard SIF response key for the return status code |
| TEMPLATE_LIST_KEY | Constant | Template list key — standard SIF request/response key holding the array of CAANMsg templates |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity (referenced in caller context) |
| `executeBumpMds` | Method | Address Change Execution — the parent business method that calls this method to retrieve contract details before processing an address change |
| JCCBPCommon | Class | Fujitsu Common Component for BP (Business Process) — provides utility methods such as `getOpeDate` for operator date retrieval |
