# (DD47) Business Logic — JDKCommon08CC.insertOdrHakkoJoken() [33 LOC]

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

## 1. Role

### JDKCommon08CC.insertOdrHakkoJoken()

This method implements the **Order Release Condition Registration Processing** (オーダ発行条件登録処理), a core business operation in K-Opticom's telecom order fulfillment system responsible for inserting condition records into the order release (SOD) pipeline. When a service contract change triggers the creation of a Service Order Data (SOD), this method registers the conditions that govern how and when that order should be released to downstream fulfillment systems. It handles multiple service categories including telecom line cancellation (V0/V0a), fiber optic contract line cancellation, and router termination — each with distinct condition codes that determine what actions the SOD workflow must take.

The method acts as a **delegation layer** in a **routing/dispatch pattern**: it first inspects a function code to determine whether registration is needed (early-exit for function code "2", which indicates a read-only/retrieval mode), then populates the parameter map via `setValueOdrHakkoJoken`, and finally delegates to the backend CBS (EKK1081D010CBS) through a service component invocation. The method implements **error propagation** by checking the result for errors and translating them into domain-specific `SCCallException` messages with a return code.

Its role in the larger system is that of a **shared utility** called by multiple screen operations (DKSV0081 and DKSV0050) during service contract modification flows. It is invoked after a same-transaction-number is obtained and the appropriate device category (V0a, V0, or UST) is identified, ensuring that the correct cancellation/termination conditions are registered against the order being created.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertOdrHakkoJoken(params)"])
    
    START --> GET_DATA["Get inMap from param.getData(DKSV008101CC)"]
    
    GET_DATA --> CHECK_FUNC{"FUNC_CODE equals '2'?"}
    
    CHECK_FUNC -->|"Yes: FUNC_CODE = '2'"| EARLY_RETURN(["Return - Skip registration (function code 2)"])
    
    CHECK_FUNC -->|"No: FUNC_CODE != '2'"| SET_VALUES["setValueOdrHakkoJoken(approvalMap, kikiInfoMap, orderSbtCd, svcOrderCd, yokyuSbtCd, sameTrnNo, param)"]
    
    SET_VALUES --> EDIT_IN_MSG["EKK1081D010BSMapper.editInMsg(param)"]
    
    EDIT_IN_MSG --> DEBUG_LOG["JSYejbLog.println('Order release condition registration processing execution')"]
    
    DEBUG_LOG --> RUN_SC["scCall.run(ekk1081D010Map, handle)"]
    
    RUN_SC --> EDIT_RESULT["EKK1081D010BSMapper.editResultRP(result, param)"]
    
    EDIT_RESULT --> CHECK_ERROR{"JDKBPCommon.hasError(param)?"}
    
    CHECK_ERROR -->|"Yes"| THROW_ERROR["Throw SCCallException('Order release condition registration processing failure', returnCode)"]
    
    CHECK_ERROR -->|"No"| END_NODE(["Return / Next"])
    
    THROW_ERROR --> END_NODE
    EARLY_RETURN --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `approvalMap` | `Map` | Approval information map containing authorized decision data. Added in IT1-2014-0000348 to support approval-based flows; carries approval status and authorization details for the order release conditions being registered. |
| 2 | `kikiInfoMap` | `Map` | Return device information map (返品機器情報) containing details about the equipment being returned/replaced during the service contract modification. |
| 3 | `orderSbtCd` | `String` | Order subtype code (オーダ種別コード) — classifies the type of order being released. Values observed: `"1"` (standard order), `"2"` (telecom line order), `"3"` (another order subtype). Determines the order category in the SOD system. |
| 4 | `svcOrderCd` | `String` | Service order code (サービスオーダコード) — identifies the specific service order within the fulfillment pipeline. Values observed: `"20"` (FTTH/telecom service), `"0A"` (broadband/router service), `"02"` (another service type), `"26"` (additional service). |
| 5 | `yokyuSbtCd` | `String` | Request subtype code (要求種別コード) — specifies the type of request being made. Values observed: `"03"` (registration/cancellation), `"08"` (deletion/cancellation removal). Differentiates between new condition registration and condition deletion. |
| 6 | `sameTrnNo` | `String` | Same transaction number (同一処理番号) — a shared transaction identifier obtained from a prior step, used to correlate all operations within the same service contract modification transaction. |
| 7 | `handle` | `SessionHandle` | Session handle providing the database connection and session context for the CBS invocation. Carries transaction and security context. |
| 8 | `param` | `IRequestParameterReadWrite` | Request/response parameter object used to pass data into and read results from the CBS invocation. Acts as the data carrier for the service component call. |
| 9 | `scCall` | `ServiceComponentRequestInvoker` | Service component request invoker that executes the actual CBS call (EKK1081D010CBS) against the backend. Handles the remote method invocation. |

**Instance fields / external state read:** None directly. All state is passed through parameters or retrieved from the `param` object.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JDKCommon08CC.setValueOdrHakkoJoken` | - | - | Calls `setValueOdrHakkoJoken` to populate the parameter map with order release condition data (approvalMap, kikiInfoMap, orderSbtCd, svcOrderCd, yokyuSbtCd, sameTrnNo, param) |
| R | `EKK1081D010BSMapper.editInMsg` | EKK1081D010CBS | - | Calls `editInMsg` to build the input message map from the param object for the CBS invocation |
| C | `EKK1081D010CBS.run` (via scCall) | EKK1081D010SC | EKK1081_D_HAKKO_JOKEN (Order Release Condition Table) | Executes the CBS to register order release condition records into the database |
| R | `EKK1081D010BSMapper.editResultRP` | EKK1081D010CBS | - | Calls `editResultRP` to extract the result from the CBS response back into the param object |
| R | `JDKBPCommon.hasError` | - | - | Calls `hasError` to check if the CBS invocation resulted in an error condition |

**Analysis of each call:**

- **`setValueOdrHakkoJoken` (R)** — Populates the param object with order release condition data derived from the approvalMap, device info map, and various codes. This is an internal mapping step that prepares data for the CBS call.
- **`EKK1081D010BSMapper.editInMsg` (R)** — Transforms the param object into a HashMap formatted for the CBS input message. This is a data transformation/mapping step.
- **`scCall.run` (C)** — The primary create operation. Invokes the EKK1081D010CBS (Order Release Condition Registration CBS) which writes condition records to the `EKK1081_D_HAKKO_JOKEN` table (オーダ発行条件管理テーブル / Order Release Condition Management Table).
- **`EKK1081D010BSMapper.editResultRP` (R)** — Extracts the CBS response into the param object for downstream error checking.
- **`JDKBPCommon.hasError` (R)** — Checks the error flag in the parameter object to determine if the CBS call succeeded.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `hasError` [-], `editResultRP` [U], `run` [-], `editInMsg` [R], `setValueOdrHakkoJoken` [-], `getData` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:DKSV0081 | `DKSV0081OPOperation.process` -> `JDKCommon08CC` (caller in JDKCommon08CC.java L1430) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 2 | Screen:DKSV0081 | `DKSV0081OPOperation.process` -> `JDKCommon08CC` (caller in JDKCommon08CC.java L1437) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 3 | Screen:DKSV0081 | `DKSV0081OPOperation.process` -> `JDKCommon08CC` (caller in JDKCommon08CC.java L1448) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 4 | Screen:DKSV0081 | `DKSV0081OPOperation.process` -> `JDKCommon08CC` (caller in JDKCommon08CC.java L1455) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 5 | Screen:DKSV0081 | `DKSV0081OPOperation.process` -> `JDKCommon08CC` (caller in JDKCommon08CC.java L1486) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 6 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L609) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 7 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L613) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 8 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L621) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 9 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L625) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 10 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L653) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 11 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L720) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |
| 12 | Screen:DKSV0050 | `DKSV0050OPOperation.process` -> `JDKCommon48CC` (caller in JDKCommon48CC.java L724) -> `insertOdrHakkoJoken` | `EKK1081D010BSMapper.editResultRP [U]`, `EKK1081D010CBS.run [C] EKK1081_D_HAKKO_JOKEN` |

**Key observation:** All callers invoke this method through two screen operations — **DKSV0081** (Return Device Approval Operation) and **DKSV0050** (another screen operation). The callers are internal methods within JDKCommon08CC and JDKCommon48CC that act as adapters between the screen layer and this common component method.

## 6. Per-Branch Detail Blocks

**Block 1** — [GET] `(param.getData(DKSV008101CC))` (L2410)

> Retrieves the user data HashMap from the param object using the DKSV008101CC key constant.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `HashMap inMap = (HashMap)param.getData(DKSV008101CC)` // Get user data HashMap from param [-> DKSV008101CC] |

**Block 2** — [IF] `(condition: FUNC_CODE equals "2")` [FUNC_CODE="2"] (L2413)

> Checks if the function code is "2". If so, the method exits early without performing any registration — this is because function code "2" indicates a read-only/retrieval mode where condition registration should be skipped.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if ("2".equals(inMap.get(EKK1081D010CBSMsg.FUNC_CODE)))` // Check if function code is "2" (read-only mode) |
| 2 | SET | `inMap.get(EKK1081D010CBSMsg.FUNC_CODE)` // Retrieve FUNC_CODE value from inMap [-> FUNC_CODE] |
| 3 | RETURN | `return;` // Skip registration processing (登録処理を行わない) |

**Block 3** — [ELSE/ELSE-IF] `(condition: FUNC_CODE does not equal "2")` (L2421)

> When function code is not "2", the method proceeds with the full order release condition registration flow: (1) populate the parameter map, (2) build the CBS input message, (3) invoke the CBS, (4) handle the result.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.setValueOdrHakkoJoken(approvalMap, kikiInfoMap, orderSbtCd, svcOrderCd, yokyuSbtCd, sameTrnNo, param)` // Set order release condition data in param [IT1-2014-0000348 MOD START] |
| 2 | CALL | `EKK1081D010BSMapper.editInMsg(param)` // Build CBS input message map |
| 3 | EXEC | `JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "オーダ発行条件登録処理の実行")` // Log: "Order release condition registration processing execution" |
| 4 | CALL | `scCall.run(ekk1081D010Map, handle)` // Invoke EKK1081D010CBS to register order release conditions |
| 5 | CALL | `EKK1081D010BSMapper.editResultRP(ekk1081D010Result, param)` // Extract CBS result into param |
| 6 | IF | `if (JDKBPCommon.hasError(param))` // Check if CBS invocation resulted in error |
| 7 | SET | `Integer.parseInt(param.getControlMapData("returnCode").toString())` // Parse return code for exception |
| 8 | THROW | `throw new SCCallException("オーダ発行条件登録処理失敗", "0", returnCode)` // Throw: "Order release condition registration processing failure" |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `insertOdrHakkoJoken` | Method | Order Release Condition Registration — the process of inserting condition records that govern when and how a Service Order Data (SOD) should be released to downstream fulfillment systems |
| `オーダ発行条件` | Field | Order Release Condition — conditions that determine SOD release timing and behavior in the telecom order fulfillment pipeline |
| `返品機器情報` | Field | Return Device Information — details about equipment being returned or replaced during a service contract modification |
| `オーダ種別コード` | Field | Order Subtype Code — classifies the type of order (e.g., "1" = standard, "2" = telecom line, "3" = other) |
| `サービスオーダコード` | Field | Service Order Code — identifies the specific service order in the fulfillment system (e.g., "20" = FTTH/telecom, "0A" = broadband/router) |
| `要求種別コード` | Field | Request Subtype Code — specifies the type of request operation (e.g., "03" = registration/cancellation, "08" = deletion) |
| `同一処理番号` | Field | Same Transaction Number — a shared transaction identifier that correlates all operations within a single service contract modification flow |
| `EKK1081D010CBS` | CBS | Order Release Condition Registration CBS — the backend callable business service that performs the actual database insertion of order release condition records |
| `EKK1081D010CBSMsg.FUNC_CODE` | Constant | Function Code — a flag in the EKK1081D010CBS message indicating the operation mode; value "2" means read-only/retrieval mode |
| `DKSV008101CC` | Constant | DKSV0081 Return Device Approval Operation Constant — the key used to retrieve user data HashMap from the param object |
| `SOD` | Acronym | Service Order Data — the core entity in K-Opticom's telecom order fulfillment system representing an order to be executed |
| `CBS` | Acronym | Callable Business Service — the backend service component in K-Opticom's SOA architecture that performs database operations |
| `SC` | Acronym | Service Component — a middleware component that invokes CBS services |
| `V0` (V0a) | Business term | Telecom Line — a traditional telephone line service in K-Opticom's portfolio (宅内機器種別コード "50") |
| `V0` (V0) | Business term | V0 Line — another telecom line variant (宅内機器種別コード "F0"), often associated with router services |
| `UST` | Business term | Unified Service Terminal — a combined telecom/internet device (宅内機器種別コード "J0") |
| `DKSV0081` | Screen | Return Device Approval Operation Screen — the screen operation that processes return device approval workflows |
| `DKSV0050` | Screen | Service Contract Modification Screen — the screen operation handling broader service contract modification flows |
| `IT1-2014-0000348` | Change ID | Enhancement ticket that added `approvalMap` parameter to support approval-based flows in the order release condition registration |
| `EKK1081_D_HAKKO_JOKEN` | Table | Order Release Condition Management Table — the database table where order release condition records are stored |
