# (DD50) Business Logic — JDKCommon08CC.insertOdrInfSksiWk() [26 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JDKCommon08CC` |
| Layer | CC / Common Component — shared utility class within the BPM flow execution layer |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JDKCommon08CC.insertOdrInfSksiWk()

This method performs **Order Information Creation Work Registration** (オーダ情報作成ワーク登録処理) — it prepares and submits order-related data to a downstream Business Component Service (CBS) for registration into the order creation work table. It serves as the central orchestration point within the DKSV0081 operation flow, acting as a gateway that conditionally either bypasses registration (for functional code 2, which represents a different processing path) or proceeds to populate, dispatch, and capture order work data.

The method implements a **conditional dispatch pattern**: it first inspects the `FUNC_CODE` field from the user data map to determine whether registration should be skipped entirely. When registration proceeds, it follows a four-step sequence — (1) set work registration values via `setValueOdrInfSksiWk`, (2) build the CBS input message via `EKK1551D010BSMapper.editInMsg`, (3) execute the CBS call via `scCall.run`, and (4) map the CBS response back to the parameter object via `EKK1551D010BSMapper.editResultRP`. It enforces error handling by checking for errors after the CBS call and throwing an `SCallException` if registration fails.

As a private method within a shared common component class (`JDKCommon08CC`), it is a **reusable utility** used by multiple BPM screens in the telecom service order fulfillment domain — particularly those handling return equipment acceptance (返品機器承認) and order information workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["insertOdrInfSksiWk(odrNaiyoCd, handle, param, scCall)"])

    START --> GET_DATA["Get inMap from param.getData(DKSV008101CC)"]

    GET_DATA --> CHECK_FUNC{"Check FUNC_CODE == \"2\""}

    CHECK_FUNC -->|"Yes (FUNC_CODE = \"2\")"| SKIP_RETURN["Return early — skip registration processing"]

    CHECK_FUNC -->|"No (FUNC_CODE != \"2\")"| SET_WK["setValueOdrInfSksiWk(odrNaiyoCd, param)"]

    SET_WK --> EDIT_IN["EKK1551D010BSMapper.editInMsg(param)"]

    EDIT_IN --> LOG_DEBUG["JSYejbLog.println(DEBUG, 'Order info creation work registration execution')"]

    LOG_DEBUG --> SC_RUN["scCall.run(ekk1551D010Map, handle) — EKK1551D010 CBS"]

    SC_RUN --> EDIT_RESULT["EKK1551D010BSMapper.editResultRP(result, param)"]

    EDIT_RESULT --> HAS_ERROR{"JDKBPCommon.hasError(param)"}

    HAS_ERROR -->|"Yes"| THROW["Throw SCCallException — Order info creation work registration failed"]

    HAS_ERROR -->|"No"| END_NODE["End — normal return"]

    SKIP_RETURN --> END_NODE
```

**Processing Flow Summary:**

1. **Retrieve user data**: Extracts the work registration HashMap from the parameter map using the key `DKSV008101CC`.
2. **Conditional skip check**: Inspects the `FUNC_CODE` field from the retrieved map. If the function code equals `"2"`, the method returns immediately without performing any registration — this is because functional code 2 represents a different processing path (likely a non-registration screen or read-only view) that does not require order work table insertion.
3. **Set work data**: Calls `setValueOdrInfSksiWk(odrNaiyoCd, param)` to populate the parameter map with order information creation work registration values.
4. **Build CBS input**: Calls `EKK1551D010BSMapper.editInMsg(param)` to construct the CBS input message map from the parameter data.
5. **Log execution**: Logs a debug message indicating that order information creation work registration processing is executing.
6. **Execute CBS**: Invokes the EKK1551D010 Business Component Service via `scCall.run()` with the input map and session handle.
7. **Map CBS output**: Calls `EKK1551D010BSMapper.editResultRP()` to map the CBS response back to the parameter object.
8. **Error check**: Checks whether the parameter contains an error via `JDKBPCommon.hasError()`. If errors are present, throws an `SCallException` with a failure message and the return code extracted from the parameter's control map data.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `odrNaiyoCd` | `String` | **Order Content Code** — a classification code that determines the type of order being processed (e.g., FTTH registration, service change, equipment exchange). This code is passed to `setValueOdrInfSksiWk` to determine what work registration data should be set into the parameter map. It governs which business rules and data fields are applied during work preparation. |
| 2 | `handle` | `SessionHandle` | **Database session handle** — carries the database connection context, transaction state, and system identification for the CBS invocation. It is passed through to `scCall.run()` so the EKK1551D010 CBS executes within the same database session/transaction. |
| 3 | `param` | `IRequestParameterReadWrite` | **Business data carrier** — the primary request/response parameter object that holds user data, control data, and CBS input/output maps. It contains the work registration HashMap (keyed by `DKSV008101CC`), the order content code, and is mutated during processing to carry CBS result data back to the calling BPM flow. |
| 4 | `scCall` | `ServiceComponentRequestInvoker` | **CBS invocation proxy** — the service component call executor that dispatches the prepared CBS input map to the actual EKK1551D010 CBS bean and returns the result map. It encapsulates the EJB remote/local invocation logic. |

**Referenced constants/fields:**

| No | Constant/Field | Type | Business Description |
|----|---------------|------|---------------------|
| 5 | `DKSV008101CC` | `String` constant | Work registration data key — the map key used to retrieve the user data HashMap from `param.getData()`. Represents the DKSV0081 OP screen's work registration data area. |
| 6 | `EKK1081D010CBSMsg.FUNC_CODE` | `String` constant | Function code field identifier — the key used to extract the functional operation code from the work registration HashMap. When equal to `"2"`, indicates a non-registration processing path that skips order work table insertion. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `setValueOdrInfSksiWk` | JDKCommon08CC | - | Internal method call — sets order info creation work registration data into the parameter map based on `odrNaiyoCd` |
| - | `EKK1551D010BSMapper.editInMsg` | - | - | Maps parameter data into CBS input message map for EKK1551D010 |
| C | `EKK1551D010` CBS | EKK1551D010 | Order creation work table | Executes the CBS to register/create order information creation work data. The CBS receives the mapped input map and persists the work record. |
| - | `EKK1551D010BSMapper.editResultRP` | - | - | Maps CBS response data back into the parameter object for downstream BPM flow consumption |
| - | `JDKBPCommon.hasError` | - | - | Checks whether error data exists in the parameter's control/error map after CBS execution |

**How to classify:**
- **C** (Create): The `EKK1551D010` CBS is invoked to create/register order information creation work data. The CBS name pattern `EKK1551D010` suggests an order (Odr) creation service component, consistent with the method name `insertOdrInfSksiWk` (Order Info Sksi = Setup/Registration Work).
- **-** (Non-CRUD): `setValueOdrInfSksiWk`, `editInMsg`, `editResultRP`, and `hasError` are data transformation and validation operations — they do not directly perform database CRUD.

**SC Code for CBS:** `EKK1551D010` — follows the pattern `EKK + 5 digits + CBS suffix`, consistent with order creation service components in the telecom fulfillment system.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | BPM Flow: DKSV0081 (DKSV0081OPOperation) | `DKSV0081OPOperation.run` -> `target4.run` -> `JDKCommon08CC.insertOdrInfSksiWk` | `EKK1551D010 [C] Order Creation Work Data` |

**Notes on caller analysis:**
- The method `insertOdrInfSksiWk` is declared as **`private`**, meaning it can only be called from within the same class (`JDKCommon08CC`) or through reflection.
- Within `JDKCommon08CC`, it is called by other common component methods that handle order information creation work processing flows.
- The upstream entry point is the **DKSV0081 BPM flow** (Order Information Creation Work screen), as evidenced by the `DKSV008101CC` data key used to retrieve the user data HashMap.
- Terminal operations from this method: `hasError` [-], `editResultRP` [U], `run` [C-EKK1551D010], `editInMsg` [-], `setValueOdrInfSksiWk` [-], `getData` [R].

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(condition)` `[FUNC_CODE = "2"]` (L2454)

> Conditional early-exit: If the function code in the work registration map equals "2", skip registration entirely. Functional code 2 represents a different processing path (likely a read-only or non-registration screen) where order work table insertion is not required.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `HashMap inMap = (HashMap) param.getData(DKSV008101CC)` // Retrieve work registration user data map [-> DKSV008101CC] |
| 2 | IF | `if ("2".equals(inMap.get(EKK1081D010CBSMsg.FUNC_CODE)))` [-> FUNC_CODE key] — Check if function code indicates skip path |
| 3 | EXEC | `return;` // Early return — do not execute registration processing [コメント: 登録処理を行わない] |
| 4 | ELSE-NONE | Method continues to processing when FUNC_CODE is not "2" |

**Block 2** — SEQUENTIAL PROCESSING (L2460–2470)

> When FUNC_CODE is not "2", proceed with full order information creation work registration: set work data, build CBS input, execute CBS, map result, and check for errors.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.setValueOdrInfSksiWk(odrNaiyoCd, param)` // Set order info creation work registration values into parameter map based on order content code |
| 2 | CALL | `HashMap ekk1551D010Map = EKK1551D010BSMapper.editInMsg(param)` // Map parameter data into CBS input message |
| 3 | EXEC | `JSYejbLog.println(JSYejbLog.DEBUG, this.getClass(), "オーダ情報作成ワーク登録処理の実行")` // Debug log: "Order info creation work registration execution" [コメント: オーダ情報作成ワーク登録処理の実行] |
| 4 | CALL | `Map ekk1551D010Result = scCall.run(ekk1551D010Map, handle)` // Invoke EKK1551D010 CBS to create/register order work data |
| 5 | CALL | `param = EKK1551D010BSMapper.editResultRP(ekk1551D010Result, param)` // Map CBS response back to parameter for downstream flow |

**Block 3** — IF-ERROR-HANDLING (L2471–2472)

> After CBS execution, check for errors and throw an exception if registration failed.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (JDKBPCommon.hasError(param))` — Check for CBS execution errors in parameter |
| 2 | THROW | `throw new SCCallException("オーダ情報作成ワーク登録処理失敗", "0", Integer.parseInt(param.getControlMapData("returnCode").toString()))` // Raise exception with failure message [コメント: オーダ情報作成ワーク登録処理失敗] and extracted return code |
| 3 | ELSE-NONE | If no errors, method returns normally (void) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `odr_naiyo_cd` | Field | Order Content Code — a classification code that determines the type of order being processed (FTTH registration, service change, equipment exchange, etc.). Drives which business rules and data fields are applied during work preparation. |
| `func_code` | Field | Function Code — an operational mode identifier that determines which processing path the screen should take. Value "2" indicates a non-registration path that bypasses order work table insertion. |
| `DKSV008101CC` | Constant | Screen work registration data key — the map identifier used to retrieve user data for the DKSV0081 (Order Information Creation Work) screen's common component processing area. |
| `EKK1551D010` | CBS Code | Order Information Creation CBS — a Business Component Service responsible for creating/registering order information work records into the work table. Invoked via `scCall.run()`. |
| `EKK1081D010CBSMsg` | CBS Message | Order information CBS message class — defines field identifiers (e.g., `FUNC_CODE`, `SVC_KEI_NO`) used for CBS input/output message mapping. |
| `EKK1551D010BSMapper` | Mapper Class | EKK1551D010 Business Service Mapper — a data mapping class that converts between BPM parameter objects and CBS input/output message maps. Provides `editInMsg()` and `editResultRP()` methods. |
| `JDKBPCommon.hasError` | Utility Method | Error detection utility — checks whether the parameter object contains error data (error flags, return codes) after a CBS execution. Returns `true` if the CBS call produced errors. |
| `SCallException` | Exception Class | Service Component Call Exception — a runtime exception thrown when a CBS invocation fails. Carries a Japanese error message, an error category code, and a numeric return code. |
| `param` | Parameter | RequestParameterReadWrite — the primary data carrier between BPM screens, common component methods, and CBS invocations. Contains user data maps, control data, error data, and CBS input/output maps. |
| `handle` | Parameter | SessionHandle — the database session and transaction context used when invoking CBS beans. Ensures CBS calls execute within the correct DB connection. |
| `scCall` | Parameter | ServiceComponentRequestInvoker — the EJB invocation proxy used to call CBS beans. Encapsulates the remote/local EJB lookup and method dispatch logic. |
| `inMap` | Variable | Input HashMap — the user data work registration map extracted from `param.getData(DKSV008101CC)`. Contains screen-specific user-entered and system-computed data. |
| `ekk1551D010Map` | Variable | CBS Input Map — the mapped CBS input message prepared from parameter data, passed to `scCall.run()`. |
| `ekk1551D010Result` | Variable | CBS Result Map — the response data returned from the EKK1551D010 CBS execution, containing result fields, error indicators, and return codes. |
| BPM | Acronym | Business Process Management — the framework used to orchestrate multi-step business workflows in this system. |
| CBS | Acronym | Business Component Service — an enterprise JBean service component that implements core business logic (data creation, update, query, deletion) and is invoked by BPM flows. |
| CC | Acronym | Common Component — a shared utility class (often in `com.fujitsu.futurity.bp.custom.common`) providing reusable business methods across multiple BPM screens. |
| BSMapper | Acronym | Business Service Mapper — a data mapping class that converts between BPM parameter objects and CBS message objects (input and output). |
| SOD | Acronym | Service Order Data — the telecom service order entity that this system manages. The broader order fulfillment data model. |
