# Business Logic — JBSbatKKBandWidthReleaseLmtUpd.execute() [40 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKBandWidthReleaseLmtUpd` |
| Layer | Service (Batch Service Component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKBandWidthReleaseLmtUpd.execute()

This method is the main processing entry point for **bandwidth limit release** operations within K-Opticom's customer core system. It handles the business scenario where a customer's contracted bandwidth restriction needs to be lifted (解除 = release/cancellation), and registers this change as a **Service Order Data (SOD)** dispatch request for downstream fulfillment. The method follows a **delegation pattern**: it extracts relevant parameters from the inbound message map, assembles an SOD parameter structure via `setSodParam()`, and then delegates the actual service invocation to the external ESb (Enterprise Service Bus) layer through `JCCBatchEsbInterface.invokeService()`. It serves as a **shared batch service component** — not a screen-bound method — meaning it is invoked by batch processing frameworks and BPM operations rather than direct user interactions. It is specifically wired to the **KKSV0572** use case (domain control release implementation). The method handles one conditional branch: if the invoked service returns a non-success return code, it logs a business error with the status code; regardless of the outcome, it emits a debug log confirming the SOD was dispatched, and then returns `null`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute(inMap)"])
    
    START --> GET_PARAMS["Extract parameters from inMap"]
    GET_PARAMS --> GET_SVC["String svcKeiNo = inMap.getString(SVC_KEI_NO)"]
    GET_PARAMS --> GET_SYSID["String sysId = inMap.getString(SYSID)"]
    
    GET_SVC --> CREATE_INPUT["Create inputMap HashMap"]
    GET_SYSID --> CREATE_INPUT
    
    CREATE_INPUT --> SET_SOD["setSodParam(svcKeiNo, sysId, inputMap)"]
    
    SET_SOD --> CREATE_PARAM["Create paramMap HashMap"]
    
    CREATE_PARAM --> PUT_USECASE["paramMap.put(TELEGRAM_INFO_USECASE_ID, KKSV0572)"]
    
    PUT_USECASE --> CREATE_OUTPUT["Create outputMap HashMap"]
    
    CREATE_OUTPUT --> INVOKE["JCCBatchEsbInterface.invokeService(commonItem, paramMap, inputMap, outputMap)"]
    
    INVOKE --> GET_RETURN["String returnCode = JCCBatchEsbInterface.getReturnCode(outputMap)"]
    
    GET_RETURN --> CHECK_RETURN{"RETURN_CODE_SUCCESS.equals(returnCode)?"}
    
    CHECK_RETURN -->|false| ERROR_LOG["Log business error with status code"]
    CHECK_RETURN -->|true| LOG_DEBUG
    
    ERROR_LOG --> LOG_DEBUG["Log debug: bandwidth release SOD issued"]
    
    LOG_DEBUG --> RETURN["Return null"]
    
    RETURN --> END_NODE(["End"])
```

**CRITICAL — Constant Resolution:**
- `RETURN_CODE_SUCCESS` resolves to `"0"` — the service IF return code indicating success. Any value other than `"0"` triggers error logging. [-> RETURN_CODE_SUCCESS="0" (JBSbatKKBandWidthReleaseLmtUpd.java:49)]
- `USECASE_ID_KKSV0572` resolves to `"KKSV0572"` — the usecase identifier for domain control release processing. [-> USECASE_ID_KKSV0572="KKSV0572" (JBSbatKKBandWidthReleaseLmtUpd.java:44)]
- `TELEGRAM_INFO_USECASE_ID` is a key constant defined on `JCCBatchEsbInterface`, used as the map key to store the usecase ID. [-> TELEGRAM_INFO_USECASE_ID (JCCBatchEsbInterface.java:48)]
- `JBSbatKK_T_FTTH_TSRCK_JSK.SVC_KEI_NO` — constant key for service contract number in the FTTH service contract reference join table. [-> SVC_KEI_NO (JBSbatKK_T_FTTH_TSRCK_JSK.java:29)]
- `JBSbatKK_T_SVC_KEI.SYSID` — constant key for SYSID in the service contract table. [-> SYSID (JBSbatKK_T_SVC_KEI.java:28)]

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The inbound message map carrying batch processing parameters. Contains the **Service Contract Number** (`SVC_KEI_NO`) identifying the specific service contract whose bandwidth restriction is being released, and the **SYSID** (system identifier) used to target the correct service record. |

**Instance fields / external state read by this method:**

| # | Field | Type | Business Description |
|---|-------|------|---------------------|
| 1 | `super.commonItem` | `JBSbatCommonItem` | Batch common parameters inherited from `JBSbatBusinessService`, carrying shared context such as logging handlers, database connections, and transaction state. |
| 2 | `super.logPrint` | `JBSbatCommonDBInterface` (logPrint) | Logging interface inherited from the parent service class, used to output business error logs. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `inMap.getString(JBSbatKK_T_FTTH_TSRCK_JSK.SVC_KEI_NO)` | JBSbatKK_T_FTTH_TSRCK_JSK | KK_T_FTTH_TSRCK_JSK | Reads the service contract number from the FTTH service contract reference join table key |
| R | `inMap.getString(JBSbatKK_T_SVC_KEI.SYSID)` | JBSbatKK_T_SVC_KEI | KK_T_SVC_KEI | Reads the SYSID from the service contract table |
| C | `setSodParam(svcKeiNo, sysId, inputMap)` | JKKHakkoSODCC | SOD (Service Order Data) | Builds and prepares SOD dispatch parameters with basic info (SYSID, processing division `012`) and service contract info (service contract number). Sets function code `1`. |
| C | `JCCBatchEsbInterface.invokeService()` | JCCBatchEsbInterface | External ESb Service | Invokes the external enterprise service bus to dispatch the SOD. Uses usecase ID `KKSV0572` (domain control release). This is a Create/Write operation — dispatching an SOD for bandwidth limit release. |
| R | `JCCBatchEsbInterface.getReturnCode()` | JCCBatchEsbInterface | - | Reads the return code from the service invocation output map to determine success or failure. |
| W | `super.logPrint.printBusinessErrorLog("EKKB0010CW", ...)` | EKKB0010CW | Error Log | Writes a business error log entry with message ID `EKKB0010CW` when the service returns a non-success code. Includes the status code and return code in the error message. |
| W | `commonItem.getLogPrint().printDebugLog(...)` | DebugLog | Debug Log | Writes a debug log message confirming the bandwidth restriction release SOD was issued for the given service contract number. |

**How classified:**
- **C** (Create): `setSodParam` constructs an SOD structure; `invokeService` dispatches it via the ESb — both are create/write operations.
- **R** (Read): Parameter extraction via `getString` and return code retrieval via `getReturnCode`.
- **W** (Write): Log output operations.

## 5. Dependency Trace

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: KKSV0572OPOperation | `KKSV0572OPOperation.run` -> `target3 (JKKHakkoSODCC.hakkoSOD)` -> `JCCBatchEsbInterface.invokeService` -> `JBSbatKKBandWidthReleaseLmtUpd.execute` | `setSodParam [C] SOD`, `invokeService [C] External ESb Service` |

**Notes on caller trace:**
- The method is invoked through the **KKSV0572 use case**, whose operation class is `KKSV0572OPOperation`.
- `KKSV0572OPOperation` is a **BPM-generated operation class** (template version 3.2.0.a, BPMXML version 2.6) for the **domain control release** scenario.
- The call chain goes through a `CCRequestBroker` targeting `com.fujitsu.futurity.bp.custom.common.JKKHakkoSODCC.hakkoSOD`, which internally invokes the batch service layer where `JBSbatKKBandWidthReleaseLmtUpd.execute()` resides.
- This is a **batch service entry point** — no screen directly invokes `execute()`; it is called programmatically by the BPM operation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract parameters from input map (L85–L88)

> Extracts the service contract number and SYSID from the inbound message map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String svcKeiNo = inMap.getString(JBSbatKK_T_FTTH_TSRCK_JSK.SVC_KEI_NO)` // Read service contract number [-> SVC_KEI_NO (JBSbatKK_T_FTTH_TSRCK_JSK.java:29)] |
| 2 | SET | `String sysId = inMap.getString(JBSbatKK_T_SVC_KEI.SYSID)` // Read SYSID [-> SYSID (JBSbatKK_T_SVC_KEI.java:28)] |

**Block 2** — [CALL] Set SOD parameters (L91)

> Calls `setSodParam()` to construct the SOD (Service Order Data) parameter structure. Internally creates nested maps: SOD basic info (SYSID + processing division `012`), service contract info (service contract number), wraps them into a target data list, and sets function code `1`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setSodParam(svcKeiNo, sysId, inputMap)` // Build SOD dispatch parameters |

**Block 2.1** — [SET] setSodParam internals (L142–L181, private method)

> Constructs the full SOD parameter structure:
> - `sod_kihon_info`: Contains `sysid` and `syori_div` = `012` (processing division for bandwidth limit release)
> - `svc_kei_info`: Contains `svc_kei_no` (service contract number)
> - `trgt_data_list`: A list containing the SOD map
> - `func_code`: Set to `1` (function code for SOD dispatch)

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> dataMap = new HashMap<>()` // Top-level data map |
| 2 | SET | `ArrayList<Map<String, Object>> dataList = new ArrayList<>()` // List to hold SOD entries |
| 3 | SET | `HashMap<String, Object> sodMap = new HashMap<>()` // SOD information map |
| 4 | SET | `HashMap<String, Object> sodKihonInfoMap = new HashMap<>()` // SOD basic info map |
| 5 | SET | `HashMap<String, Object> svcKeiInfoMap = new HashMap<>()` // Service contract info map |
| 6 | SET | `sodKihonInfoMap.put("sysid", sysId)` // Set SYSID [-> sysid] |
| 7 | SET | `sodKihonInfoMap.put("syori_div", SYORI_DIV_012)` // Set processing division [-> SYORI_DIV_012="012" (JBSbatKKBandWidthReleaseLmtUpd.java:47)] |
| 8 | SET | `sodMap.put("sod_kihon_info", sodKihonInfoMap)` // Set SOD basic info |
| 9 | SET | `svcKeiInfoMap.put("svc_kei_no", svcKeiNo)` // Set service contract number |
| 10 | SET | `sodMap.put("svc_kei_info", svcKeiInfoMap)` // Set service contract info |
| 11 | EXEC | `dataList.add(sodMap)` // Add SOD to list |
| 12 | SET | `dataMap.put("trgt_data_list", dataList)` // Set target data list |
| 13 | SET | `dataMap.put("func_code", "1")` // Set function code [-> "1"] |
| 14 | SET | `inputMap.put(CC_TITLE_JKKHAKKOSODCC, dataMap)` // Set CC title as key [-> CC_TITLE_JKKHAKKOSODCC="JKKHakkoSODCC" (JBSbatKKBandWidthReleaseLmtUpd.java:42)] |

**Block 3** — [SET] Create invocation maps (L94–L98)

> Sets up the parameter map with the usecase ID, and creates the output map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> paramMap = new HashMap<>()` // Parameter map for service invocation |
| 2 | SET | `paramMap.put(JCCBatchEsbInterface.TELEGRAM_INFO_USECASE_ID, USECASE_ID_KKSV0572)` // Set usecase ID [-> TELEGRAM_INFO_USECASE_ID (JCCBatchEsbInterface.java:48), USECASE_ID_KKSV0572="KKSV0572" (JBSbatKKBandWidthReleaseLmtUpd.java:44)] |
| 3 | SET | `HashMap<String, Object> outputMap = new HashMap<>()` // Output map for service response |

**Block 4** — [CALL] Invoke external service (L100)

> Dispatches the SOD to the external ESb service layer.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCBatchEsbInterface.invokeService(super.commonItem, paramMap, inputMap, outputMap)` // Invoke external service via ESb |

**Block 5** — [SET] Retrieve return code (L102)

> Reads the return code from the output map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String returnCode = JCCBatchEsbInterface.getReturnCode(outputMap)` // Get service return code |

**Block 6** — [IF/ELSE] Check return code (L103–L109)

> Condition: `!RETURN_CODE_SUCCESS.equals(returnCode)` — if the service did NOT return the success code `0`, log a business error.

| # | Type | Code |
|---|------|------|
| 1 | SET | `StringBuffer err_msg = new StringBuffer()` // Initialize error message buffer [-> RETURN_CODE_SUCCESS="0" (JBSbatKKBandWidthReleaseLmtUpd.java:49)] |
| 2 | EXEC | `err_msg.append("ステータスコード ：" + returnCode)` // Append status code label and value (Japanese: "Status Code :") |
| 3 | CALL | `super.logPrint.printBusinessErrorLog("EKKB0010CW", new String[]{ err_msg.toString() })` // Log business error with message ID EKKB0010CW |

**Block 7** — [SET] Log debug confirmation (L111–L114)

> Logs a debug message confirming the bandwidth restriction release SOD was issued for the service contract number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `StringBuilder sb = new StringBuilder()` // Initialize debug message builder |
| 2 | EXEC | `sb.append("サービス契約番号:").append(svcKeiNo).append("の帯域制御解除SODを発行しました。")` // Build debug message: "Issued bandwidth control release SOD for service contract: {svcKeiNo}" (Japanese: サービス契約番号 / 帯域制御解除) |
| 3 | CALL | `commonItem.getLogPrint().printDebugLog(sb.toString())` // Print debug log |

**Block 8** — [RETURN] Return (L116)

> Returns `null` — this method does not produce a structured output item; the result is communicated via logs and the ESb invocation side effect.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // No structured return; side effects handled by ESb dispatch and log output |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service Contract Number — the unique identifier for a customer's service contract line item. Used to identify which contract's bandwidth restriction is being released. |
| `sysid` | Field | System ID — a unique system-level identifier for a service record, used to target the correct database record in SOD operations. |
| `syori_div` | Field | Processing Division — a classification code for the type of processing. Value `012` is used here to denote bandwidth limit release operations. |
| `func_code` | Field | Function Code — a code specifying the type of SOD operation. Value `1` indicates SOD dispatch for service registration/release. |
| SOD | Acronym | Service Order Data — a telecom order fulfillment entity used to dispatch service change orders (registrations, releases, modifications) to downstream systems. |
| JKKHakkoSODCC | Component | SOD Dispatch CC (Command Component) — the shared component responsible for creating and dispatching SOD records. |
| ESb | Acronym | Enterprise Service Bus — the middleware layer that routes and invokes external services. |
| KKSV0572 | Use Case | Domain Control Release — the specific use case for releasing bandwidth restrictions on customer service contracts. |
| `TELEGRAM_INFO_USECASE_ID` | Constant | Map key used to store the usecase ID in the ESb invocation parameter map. |
| `RETURN_CODE_SUCCESS` | Constant | The return code value `0` that indicates a successful service invocation. |
| `EKKB0010CW` | Constant | Business error log message ID — when triggered, logs the status code and return code of a failed service invocation. |
| `JBSbatKK_T_FTTH_TSRCK_JSK` | Table/Entity | KK_T_FTTH_TSRCK_JSK — FTTH Service Contract Reference Join Table. Contains the service contract number for FTTH services. |
| `JBSbatKK_T_SVC_KEI` | Table/Entity | KK_T_SVC_KEI — Service Contract Table. Contains service contract records with SYSID and other service metadata. |
| Bandwidth Limit Release | Business term | The operation of removing or lifting a previously imposed bandwidth restriction on a customer's internet service contract. |
| 帯域制御解除 | Japanese term | Bandwidth control release — Japanese field/domain term for lifting bandwidth restrictions. |
| サービス契約番号 | Japanese term | Service contract number — the identifier for a customer's service contract. |
| 主処理 | Japanese term | Main processing — Japanese comment indicating this is the primary business logic method. |
| JBSbatBusinessService | Parent Class | Base class for batch business services, providing common infrastructure such as `setCommonInfo()`, `commonItem`, and `logPrint`. |
| `KKSV0572OPOperation` | Caller | BPM-generated operation class for the domain control release screen/operation. Calls SOD dispatch through the CC layer. |
