---

# Business Logic — JKKTicktUseSisakListUkCC.callSC() [41 LOC]

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

## 1. Role

### JKKTicktUseSisakListUkCC.callSC()

This method serves as the unified service call entry point for invoking backend SC (Service Component) operations within the K-Opticom customer base system (eo kokyaku kihan shisutemu). It encapsulates the entire request-response lifecycle of an SC invocation: building the input parameter map from request data and mapping definitions, delegating to the `ServiceComponentRequestInvoker.run()` to execute the remote service, and processing the response for error codes, status indicators, and error information extraction. The method implements a **delegation pattern** — it abstracts away the mechanical details of parameter construction, response parsing, and error aggregation so that caller methods (such as `searchTicktUseSisakList` and `sisakReturnJudge`) can invoke SC operations with a single, clean method call. It acts as the **shared utility** for all SC invocations within this common component class, handling multiple service types generically through the `mappingData[0][1]` field which specifies the service interface class name (e.g., `EKK0081A010SC`).

The method has no conditional branches by service type — it is a linear, deterministic pipeline: build params, call SC, extract and validate results, propagate errors. However, it does contain a critical error-handling branch that validates the SC return code (`return_code`) and status field, throwing an `SCCallException` when the SC reports an error condition instead of a success (`"0"` for return code and `0` for status).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["callSC params"])
    STEP1["editInMsg param, mappingData
Build paramMap from mapping data"]
    STEP2["scCall.run paramMap, handle
Invoke SC service"]
    STEP3["result.get TEMPLATE_LIST_KEY
Extract CAANMsg templates"]
    STEP4["msg = templates[0]
Get first response message"]
    STEP5["result.get RET_CD_INT_KEY
Obtain return_code"]
    STEP6["msg.getInt STATUS_INT_KEY
Obtain status code"]
    STEP7["editErrorInfoCom param, templates, return_code, dataMapKey, mappingData, contents
Process error info on response"]
    STEP8["param.getControlMapData ERROR_INFO
Get existing error list"]
    STEP9{"errList null?"}
    STEP10["errList = new ArrayList<Object>()
Initialize empty list"]
    STEP11["param.setControlMapData ERROR_INFO
Set error info in control map"]
    STEP12{"return_code = 0 and status = 0?"}
    STEP13["return msg
Return success CAANMsg"]
    STEP14["throw new SCCallException
return value invalid"]

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 -- true --> STEP10
    STEP10 --> STEP11
    STEP9 -- false --> STEP11
    STEP11 --> STEP12
    STEP12 -- true --> STEP13
    STEP12 -- false --> STEP14
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session context — carries the active database connection, transaction scope, and user authentication context for the SC invocation. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service invocation dispatcher — the object responsible for routing the parameter map to the correct backend SC service and returning the response. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter container — holds the request-level data including telegram ID, usecase ID, operator ID, hostname, and IP address. It is both read (for building paramMap) and written (for setting ERROR_INFO control map data). |
| 4 | `dataMapKey` | `String` | Data map key — used as a reference key within the response processing to correlate mapped data with specific response content blocks. |
| 5 | `mappingData` | `Object[][]` | Parameter mapping definition — a 2D array where `mappingData[0][1]` contains the service interface name (e.g., `EKK0081A010SC`) that determines which SC class is called. Each row defines a field mapping between the request parameter and the SC input. |
| 6 | `contents` | `Object[][]` | CAANMsg content definition — describes the structure of response message content to be extracted and mapped back to the caller. Used during error info aggregation. |

**Related instance fields:** None directly referenced — this method is self-contained and stateless, relying entirely on its parameters and local variables.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C/R/U | `scCall.run(paramMap, handle)` | Inferred from `mappingData[0][1]` (e.g., `EKK0081A010SC`) | Varies by SC — determined by the service interface name in `mappingData[0][1]` | Invokes a backend SC service component. The actual service class name is dynamically determined from `mappingData[0][1]` formatted as `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`. This method performs the service dispatch — its CRUD nature depends on the called SC (could be read, create, update, or delete). |
| U | `editErrorInfoCom(param, templates, return_code, dataMapKey, mappingData, contents)` | JKKTicktUseSisakListUkCC | - | Processes error information from the SC response and writes aggregated error data back to `param`. Updates the response error state. |
| R | `editInMsg(param, mappingData)` | JKKTicktUseSisakListUkCC | - | Reads request parameters (telegram ID, usecase ID, operation ID, call type, hostname, IP, operator ID, view ID) and builds the input parameter map for the SC call. |
| R | `TemplateErrorUtil.getErrorInfo(result, errList)` | TemplateErrorUtil | - | Reads error information from the SC response result map, aggregating it into the error list. |
| U | `param.setControlMapData(ERROR_INFO, ...)` | - | ControlMap (in-memory) | Writes aggregated error info into the request parameter's control map data store. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `searchTicktUseSisakList()` | `JKKTicktUseSisakListUkCC.searchTicktUseSisakList()` -> `callSC()` | `scCall.run [C/R/U] Varies by SC` |
| 2 | `sisakReturnJudge()` | `JKKTicktUseSisakListUkCC.sisakReturnJudge()` -> `callSC()` | `scCall.run [C/R/U] Varies by SC` |

**Terminal operations from this method:** `scCall.run` [-] (service dispatch), `editErrorInfoCom` [U] (error info aggregation), `editInMsg` [R] (parameter building), `TemplateErrorUtil.getErrorInfo` [R] (error extraction), `param.setControlMapData` [U] (error info write), `param.getControlMapData` [R] (error info read).

## 6. Per-Branch Detail Blocks

**Block 1** — EXEC `(paramMap initialization)` (L429)

> Call `editInMsg()` to build the parameter map for the SC invocation. This method extracts request metadata (telegram ID, usecase ID, operation ID, call type, hostname, IP address, operator ID, view ID) from the `param` object and the service interface name from `mappingData[0][1]`, then constructs a `HashMap<String, Object>` for the SC call.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap = editInMsg(param, mappingData)` // Builds paramMap from request metadata and mapping definition [-> JCMConstants.TRANZACTION_ID_KEY, JCMConstants.USECASE_ID_KEY, JCMConstants.OPERATION_ID_KEY, JCMConstants.CALL_TYPE_KEY, JCMConstants.CLIENT_HOST_NAME_KEY, JCMConstants.CLIENT_IP_ADDRESS_KEY, JCMConstants.INVOKE_GAMEN_ID_KEY, JCMConstants.OPERATOR_ID_KEY] |

**Block 2** — EXEC `(SC service invocation)` (L431)

> Delegate to the service component request invoker to execute the backend SC service.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `result = scCall.run(paramMap, handle)` // Invoke SC service with built params and session handle |

**Block 3** — SET `(Extract response templates)` (L433)

> Extract the CAANMsg template array from the SC response result map using the framework constant for the template list key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = (CAANMsg[]) result.get(JCMConstants.TEMPLATE_LIST_KEY)` // Extract response template array [-> JCMConstants.TEMPLATE_LIST_KEY] |

**Block 4** — SET `(Get first response message)` (L435)

> Retrieve the first CAANMsg from the template array as the primary response message.

| # | Type | Code |
|---|------|------|
| 1 | SET | `msg = templates[0]` // Get the first (primary) response CAANMsg |

**Block 5** — SET `(Obtain return code)` (L438)

> Extract the return code (return_code) from the SC response result map. This is a String representation of the service's error/success code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `return_code = result.get(JCMConstants.RET_CD_INT_KEY)` // Obtain return code from result [-> JCMConstants.RET_CD_INT_KEY] |

**Block 6** — SET `(Obtain status)` (L440)

> Extract the status integer from the primary response message. This represents the business logic status of the SC response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `status = msg.getInt(JCMConstants.STATUS_INT_KEY)` // Get status from message [-> JCMConstants.STATUS_INT_KEY] |

**Block 7** — EXEC `(Process error info)` (L442)

> Call `editErrorInfoCom()` to process and extract error information from the SC response templates, populating error data structures for downstream use.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `editErrorInfoCom(param, templates, return_code, dataMapKey, mappingData, contents)` // Process error info from response |

**Block 8** — SET `(Get existing error list)` (L445)

> Retrieve any existing error information list from the request parameter's control map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `errList = (ArrayList<Object>) param.getControlMapData(SCControlMapKeys.ERROR_INFO)` // Get existing error list [-> SCControlMapKeys.ERROR_INFO] |

**Block 9** — IF/ELSE `(Initialize empty list if null)` (L447–L449)

> If no previous error list exists in the control map, create a new empty list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `null == errList` [Condition: existing error info not present] |

**Block 9.1** — SET `(Initialize)` (L448)

| # | Type | Code |
|---|------|------|
| 1 | SET | `errList = new ArrayList<Object>()` // Create new empty error list |

**Block 10** — EXEC `(Set error info in control map)` (L452)

> Aggregates error information from the SC response using `TemplateErrorUtil.getErrorInfo()` and writes it to the control map.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.setControlMapData(SCControlMapKeys.ERROR_INFO, TemplateErrorUtil.getErrorInfo(result, errList))` // Set error info in control map [-> SCControlMapKeys.ERROR_INFO] |

**Block 11** — IF/ELSE `(Error validation)` (L456–L458)

> Validate the SC response by checking that the return code equals `"0"` (success) and the status equals `0` (success). If either condition fails, throw an `SCCallException` with the message "return value invalid" (Japanese: "戻値不適", meaning "invalid return value"). This is the **only conditional branch** in this method.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!("0".equals(return_code.toString()) && 0 == status)` [Condition: NOT (return_code = "0" AND status = 0)] |

**Block 11.1** — EXEC `(Throw exception — error path)` (L457)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `throw new SCCallException("戻値不適" (English: "invalid return value"), return_code.toString(), status)` // Propagate SC error to caller |

**Block 11.2** — RETURN `(Success path)` (L459)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return msg` // Return the primary CAANMsg response to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| SC | Acronym | Service Component — a backend service layer component that handles specific business operations in the K-Opticom system. SC codes follow the pattern `EKK\d{4}[A-Z]\d{3}SC`. |
| CAANMsg | Acronym | CAAN message object — the standard message format used for request/response exchange with SC services in the Fujitsu Futurity framework. |
| SessionHandle | Type | Database session handle — carries the active DB connection, transaction context, and authentication information for service invocations. |
| ServiceComponentRequestInvoker | Type | SC invocation dispatcher — the runtime object that routes parameter maps to specific SC services and returns response maps. |
| IRequestParameterReadWrite | Type | Request parameter interface — the contract for reading and writing request-level data including telegram ID, usecase ID, operator ID, and control map data. |
| editInMsg | Method | "Create common item messages" (Japanese: 共通項目のメッセージを作成します) — builds the input parameter map for SC calls by extracting request metadata and service interface name. |
| editErrorInfoCom | Method | "Create common item error messages" — processes and aggregates error information from SC responses. |
| TEMPLATE_LIST_KEY | Constant | Framework constant key to extract the CAANMsg[] template array from the SC response result map (defined in `JCMConstants`). |
| RET_CD_INT_KEY | Constant | Framework constant key to extract the return code from the SC response result map (defined in `JCMConstants`). |
| STATUS_INT_KEY | Constant | Framework constant key to extract the status integer from the CAANMsg response (defined in `JCMConstants`). |
| ERROR_INFO | Constant | Control map key (`SCControlMapKeys.ERROR_INFO`) used to store and retrieve aggregated error information lists. |
| MappingData[0][1] | Field | The first row, second column of the mapping data array — contains the SC service interface name (e.g., `EKK0081A010SC`) used to construct the response message class name. |
| 戻値不適 | Japanese term | "Invalid return value" — the error message thrown when the SC returns a non-zero return code or non-zero status. |
| プレミアムサポート施策 | Japanese term | Premium support measures — business context for this component, related to premium customer service contract management. |
| ポイント利用申請対象施策一覧照会受付 | Japanese term | Point usage application target measure list inquiry reception — the screen/business process that uses this common component for displaying and handling point usage application data. |
| eo kokyaku kihan shisutemu | Japanese term | eo customer base system — the K-Opticom customer information management system platform. |

---
