# Business Logic — JKKPopPwdShkkaRnkAddCC.callEKK0081A010SC() [50 LOC]

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

## 1. Role

### JKKPopPwdShkkaRnkAddCC.callEKK0081A010SC()

This method serves as the **service interface caller** for the EKK0081A010SC service, which is the "service contract uniqueness inquiry SIF" (サービス契約一意照会SIF). In the broader POP password initial linkage system, this method is responsible for querying the backend to verify whether a given service contract number already exists, ensuring data integrity before any POP password initialization operations proceed. The method implements the **delegation pattern**: it prepares a CAANMsg template with the inquiry parameters, assembles the SIF request by combining common metadata and service-specific data, invokes the `ServiceComponentRequestInvoker` to execute the service interface, and then processes the response through error mapping and error checking routines. It is a private utility method, meaning it is an internal helper invoked exclusively by the `mainProc()` method of `JKKPopPwdShkkaRnkAddCC`, acting as a single-branch bridge between the screen's controller logic and the EKK0081A010SC service interface.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callEKK0081A010SC(params)"])
    INIT(["Initialize locals: sIFRequest, template, scCall, sIFResult, status"])
    STEP1["editInMsgCmn(param)
Build SIF request"]
    STEP2["Create CAANMsg template
EKK0081A010CBSMsg"]
    STEP3["mappingEKK0081A010InMsg(template, svcKeiNo)
Map service contract parameters"]
    STEP4["editBasicCmn(param, template)
Set basic common fields"]
    STEP5["sIFRequest.put(TEMPLATE_LIST_KEY, template)
Set request cluster"]
    STEP6["scCall = new ServiceComponentRequestInvoker()"]
    STEP7["scCall.run(sIFRequest, handle)
Execute SIF service call"]
    STEP8["editResultRP(sIFResult, param)
Error mapping processing"]
    STEP9["errChk(sIFResult)
Error checking"]
    STEP10["status = template.getInt(STATUS_INT_KEY)
Get status code"]
    COND{"status == 0?"}
    STEP11["resultHash.putAll(getWorkCAANMsg(sIFResult))
Set SIF execution result"]
    RET(["return status"])
    END_END(["End"])

    START --> INIT
    INIT --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> COND
    COND -- Yes --> STEP11
    COND -- No --> RET
    STEP11 --> END_END
    RET --> END_END
```

**Processing flow:**
1. **SIF request assembly** — The method first builds a common SIF request via `editInMsgCmn`, then creates a `CAANMsg` template bound to `EKK0081A010CBSMsg`. It populates this template with the service contract number (`svcKeiNo`) and basic common fields.
2. **Service invocation** — The request cluster is set into the SIF request map, a `ServiceComponentRequestInvoker` is instantiated and called to execute the SIF.
3. **Response processing** — After the SIF completes, error mapping (`editResultRP`) and error checking (`errChk`) are applied. The method extracts a status code from the template; only when the status is `0` (success) does it copy the work result into `resultHash`.
4. **Status return** — Regardless of outcome, the status code is returned to the caller.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The read-write request parameter object carrying screen input data. It provides the raw user-facing values that are extracted and transformed into the SIF request structure during `editInMsgCmn` and `editBasicCmn`. |
| 2 | `handle` | `SessionHandle` | The database session handle used by the `ServiceComponentRequestInvoker.run()` method to execute the SIF call with proper transactional context. |
| 3 | `resultHash` | `HashMap<String, Object>` | The result hash map that receives the SIF execution result. When the service returns status `0` (success), the work message from `sIFResult` is merged into this map via `resultHash.putAll()`. |
| 4 | `svcKeiNo` | `String` | The service contract number (サービス契約番号) — the primary inquiry key sent to the EKK0081A010SC service to check uniqueness. |

**Instance fields / external state:**
- None directly read by this method (all state is passed via parameters or created locally).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKPopPwdShkkaRnkAddCC.editInMsgCmn` | EKK0081A010SC | - | Reads request parameters to build the SIF input message |
| - | `JKKPopPwdShkkaRnkAddCC.mappingEKK0081A010InMsg` | EKK0081A010SC | - | Maps service contract number into the SIF template |
| - | `JKKPopPwdShkkaRnkAddCC.editBasicCmn` | EKK0081A010SC | - | Sets basic common fields (e.g., operation type, screen ID) into the template |
| R | `scCall.run` (ServiceComponentRequestInvoker) | EKK0081A010SC | - | Executes the SIF service call — uniqueness inquiry of service contract |
| U | `JKKPopPwdShkkaRnkAddCC.editResultRP` | EKK0081A010SC | - | Maps SIF response errors back to request parameter error fields |
| - | `JKKPopPwdShkkaRnkAddCC.errChk` | EKK0081A010SC | - | Performs error checking on the SIF result map |
| R | `JKKPopPwdShkkaRnkAddCC.getWorkCAANMsg` | EKK0081A010SC | - | Reads the work message from the SIF result for returning to the caller |
| U | `resultHash.putAll` | EKK0081A010SC | - | Updates the result hash with SIF execution result when status is 0 |

**Detailed analysis of each call:**

- **`editInMsgCmn(param)`** — Extracts request parameters and assembles the SIF request map. Classified as **Read** because it reads input data from `param`.
- **`mappingEKK0081A010InMsg(template, svcKeiNo)`** — Populates the `CAANMsg` template with service contract-specific fields including the inquiry key `svcKeiNo`. Classified as internal parameter mapping (**No CRUD**).
- **`editBasicCmn(param, template)`** — Sets basic common SIF fields (e.g., operation type, transaction metadata) into the template. Classified as internal field setup (**No CRUD**).
- **`scCall.run(sIFRequest, handle)`** — The core SIF invocation. The `ServiceComponentRequestInvoker` routes the request to the EKK0081A010SC service component, which performs a uniqueness check on the service contract. Classified as **Read** since it queries the service contract data.
- **`editResultRP(sIFResult, param)`** — Maps the SIF response errors to the request parameter's error fields. Classified as **Update** because it modifies `param` with error information.
- **`errChk(sIFResult)`** — Validates the SIF result and throws exceptions on error conditions. Classified as internal processing (**No CRUD**).
- **`getWorkCAANMsg(sIFResult)`** — Extracts the work message data from the SIF result map. Classified as **Read**.
- **`resultHash.putAll(...)`** — Merges the SIF result into the caller's result hash. Classified as **Update** because it modifies `resultHash`.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `editInMsgCmn` [-], `mappingEKK0081A010InMsg` [-], `editBasicCmn` [-], `run` [R], `editResultRP` [U], `errChk` [-], `getWorkCAANMsg` [R], `resultHash.putAll` [U]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKPopPwdShkkaRnkAddCC.mainProc() | `JKKPopPwdShkkaRnkAddCC.mainProc()` -> `callEKK0081A010SC(param, handle, resultHash, svcKeiNo)` | `scCall.run [R] EKK0081A010SC`, `editResultRP [U] EKK0081A010SC`, `getWorkCAANMsg [R] EKK0081A010SC` |

**Notes:**
- The sole direct caller is `mainProc()` within the same class `JKKPopPwdShkkaRnkAddCC`, which is the POP password initial linkage controller.
- No screen (KKSV*) or batch entry points were found within 8 hops. The call chain originates from the `mainProc()` method, which is itself invoked by the POP password initial linkage screen.
- The terminal operations include a service interface read (EKK0081A010SC SC Code), an error mapping update, and a work result read.

## 6. Per-Branch Detail Blocks

**Block 1** — [VARIABLE DECLARATION] `(local variables initialization)` (L785)

> Declares and initializes local variables used throughout the method.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sIFRequest = null` // SIF request map |
| 2 | SET | `template = null` // CAANMsg template for EKK0081A010CBSMsg |
| 3 | SET | `scCall = null` // Service component request invoker |
| 4 | SET | `sIFResult = null` // SIF result map |
| 5 | SET | `status = 0` // Default status code |

**Block 2** — [EXEC] `(Build SIF request via editInMsgCmn)` (L791)

> Calls `editInMsgCmn` to extract common information from the request parameter and assemble the SIF request map.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `sIFRequest = editInMsgCmn(param)` // Build SIF request from param |

**Block 3** — [EXEC] `(Create EKK0081A010CBSMsg template)` (L794)

> Creates a `CAANMsg` instance bound to the EKK0081A010CBSMsg template class, which defines the structure of the service contract uniqueness inquiry request.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template = new CAANMsg(EKK0081A010CBSMsg.class.getName())` // Instantiate CBS msg template |

**Block 4** — [EXEC] `(Map service contract parameters into template)` (L795)

> Populates the template with the service contract number and other inquiry conditions specific to EKK0081A010.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `mappingEKK0081A010InMsg(template, svcKeiNo)` // Map svcKeiNo and conditions into template |

**Block 5** — [EXEC] `(Set basic common fields)` (L796)

> Sets basic common SIF fields such as operation type, screen ID, and transaction metadata into the template.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `editBasicCmn(param, template)` // Set basic common fields |

**Block 6** — [EXEC] `(Set request cluster)` (L798)

> Puts the template array into the SIF request map under the `TEMPLATE_LIST_KEY` constant key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sIFRequest.put(JCMConstants.TEMPLATE_LIST_KEY, new CAANMsg[]{template})` // Set request cluster |

**Block 7** — [EXEC] `(Instantiate ServiceComponentRequestInvoker)` (L801)

> Creates the invoker that will route the SIF request to the actual service component.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `scCall = new ServiceComponentRequestInvoker()` // SC invoker |

**Block 8** — [EXEC] `(Execute SIF service call)` (L804)

> Invokes the service interface. The `ServiceComponentRequestInvoker.run()` method routes the request to the EKK0081A010SC service component, performing the service contract uniqueness lookup. This is the only external system interaction (CRUD: **Read**).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `sIFResult = scCall.run(sIFRequest, handle)` // Execute SIF call |

**Block 9** — [EXEC] `(Error mapping processing)` (L806)

> Maps the SIF response errors back to the request parameter's error fields so that screen-level error display works correctly.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `editResultRP(sIFResult, param)` // Error mapping processing |

**Block 10** — [EXEC] `(Error checking)` (L808)

> Checks the SIF result for error conditions. May throw exceptions if an error is detected.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `errChk(sIFResult)` // Error checking processing |

**Block 11** — [EXEC] `(Get status code from template)` (L811)

> Extracts the status code from the template using the `STATUS_INT_KEY` constant. A value of `0` indicates success.

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

**Block 12** — [IF] `(status == 0)` [JCMConstants.STATUS_INT_KEY = `"status"`] (L814)

> Conditional branch: when the SIF status code is `0` (success), the method copies the work message from the SIF result into the `resultHash`. When the status is non-zero (error), the branch is skipped and the error status is returned as-is.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `resultHash.putAll(getWorkCAANMsg(sIFResult))` // Set SIF execution result |

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

> When the SIF returns a non-zero status, the method does not populate `resultHash` and proceeds directly to return the error status code.

| # | Type | Code |
|---|------|------|
| 1 | (implicit) | (resultHash remains unchanged) |

**Block 14** — [RETURN] `(return status)` (L820)

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return status` // SIF return code |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service contract number (サービス契約番号) — the unique identifier for a service contract line item, used as the primary inquiry key for uniqueness checks |
| SIF | Acronym | Service Interface — the communication layer between application components and backend service components (SC/CBS) |
| SC | Acronym | Service Component — a backend service module that handles specific business operations (e.g., EKK0081A010SC) |
| CBS | Acronym | Component-Based Service — the message definition class format (e.g., EKK0081A010CBSMsg) used for data exchange between SIF layers |
| CAANMsg | Type | Fujitsu's messaging object used to carry structured data across SIF boundaries. Acts as both request and response container. |
| `SERVICE_COMPONENT_REQUEST_INVOKER` | Type | Runtime class that routes SIF requests to the appropriate service component based on the template type |
| `TEMPLATE_LIST_KEY` | Constant | Map key used to store the CAANMsg template array within the SIF request map |
| `STATUS_INT_KEY` | Constant | Map key used to store and retrieve the integer status code from the template after SIF execution |
| POPPW | Business term | POP Password — a customer authentication credential managed in the K-Opticom system |
| POPPW初期化連携 | Business term | POP Password Initial Linkage — the business process of initializing a POP password and linking it to the customer's service contract |
| サービス契約一意照会 | Business term | Service Contract Uniqueness Inquiry — the business operation of verifying that a service contract number does not already exist in the system before proceeding with initialization |
| `editInMsgCmn` | Method | Sets common SIF request information from the parameter object |
| `mappingEKK0081A010InMsg` | Method | Maps EKK0081A010-specific inquiry conditions into the CAANMsg template |
| `editBasicCmn` | Method | Sets basic common fields (operation type, metadata) into the SIF template |
| `editResultRP` | Method | Maps SIF response errors back to request parameter error fields |
| `errChk` | Method | Performs error checking on the SIF result and throws exceptions on error |
| `getWorkCAANMsg` | Method | Extracts the work message data from the SIF result map |
