# Business Logic — JSCSV002601CC.executeMain() [92 LOC]

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

## 1. Role

### JSCSV002601CC.executeMain()

This method is a **Common Component (CC)** that orchestrates the **telephone VLAN order new registration for a legal entity (法人)** within the K-Opticom e-Service customer base system. It acts as a **delegating orchestrator** — it receives incoming request data, extracts the relevant VLAN order parameters, constructs a service component (SC) invocation payload, dispatches the request to the underlying CBS service `ESC0021D010` (Telephone VLAN Order Reception), collects the execution results, and maps all output fields back into the request parameter object for the calling BPM (Business Process Management) layer.

The method handles **one primary business service type**: Telephone (phone) VLAN order registration for corporate/legal-entity customers (法人), as distinguished from individual customer orders. It prepares eight input parameters for the SC call (service contract number, requestor application subtype code, VLAN order code, request subtype code, VLAN server code, request submission document number, and request project case number), then extracts ten output fields from the SC response (order number, order status, order receipt datetime, SOD work linkage status, registration datetime, registration operator account, update datetime, update operator account, and invalidation flag).

If the underlying SC call fails, the method sets an error return code and logs an error message. Regardless of success or failure, it always performs post-mapping (setting control data and user result data on the parameter object). If the final return code is non-zero (indicating an error), it throws a `CCException` to the BPM layer. The `fixedText` parameter is accepted for interface compatibility but is not consumed within `executeMain` itself — it is passed through to `getInvokeCBS` for BP check configuration.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeMain handle, param, fixedText"])
    START --> GET_LOGGER["Get logger via BPMLogManager"]
    GET_LOGGER --> INIT_VARS["Initialize returnCd = '0', userResult, ccParam"]
    INIT_VARS --> BUILD_PARAM["Build paramTelVlanOrd map from ccParam"]
    BUILD_PARAM --> CALL_ORDER["executeTelVlanOrder handle, param, logger, paramTelVlanOrd"]
    CALL_ORDER --> CHECK_RESULT{isSuccess}
    CHECK_RESULT -->|True| EXTRACT_DATA["Extract 10 fields to userResult"]
    CHECK_RESULT -->|False| SET_ERROR["Set returnCd = '1', log ERROR"]
    EXTRACT_DATA --> SET_CTRL["setResultCtrlData param, result, SCSV002601CC"]
    SET_ERROR --> SET_CTRL
    EXTRACT_DATA --> SET_USER["setResultUserData SCSV002601CC, userResult"]
    SET_ERROR --> SET_USER
    SET_USER --> LOG_DEBUG["Log DEBUG: mapping complete"]
    LOG_DEBUG --> CHECK_CD{returnCd == 0?}
    CHECK_CD -->|False| THROW_ERROR["Throw CCException: VLAN order error"]
    CHECK_CD -->|True| RETURN_PARAM["Return param"]
    THROW_ERROR --> END_END(["End"])
    RETURN_PARAM --> END_END
```

**Execution flow description:**

1. **Logger initialization** — Creates a debug logger via `BPMLogManager` using the session handle ID and the current class type.
2. **Variable initialization** — Sets `returnCd` to `"0"` (normal completion code), initializes an empty `HashMap` for `userResult`.
3. **Input extraction** — Extracts the CC parameter map (`ccParam`) from `param.getData("SCSV002601CC")`.
4. **Parameter construction** — Builds `paramTelVlanOrd` map with eight key-value pairs populated from `ccParam` using `ESC0021D010CBSMsg` constants as keys. This maps internal BPM data to the SC's expected input schema.
5. **SC invocation** — Calls the private `executeTelVlanOrder` method, which internally creates a parameter map via `JSCTelSvcScParamHenshu.createScParam` with template ID `"ESC0051D010"`, instantiates a `ServiceComponentRequestInvoker`, and runs the CBS call.
6. **Result processing (success branch)** — If `JSCTelSvcScParamHenshu.isSuccess(result)` returns true, extracts ten output fields into `userResult` using `getResultString` for each field key.
7. **Result processing (failure branch)** — If the SC call failed, sets `returnCd = "1"` (data-no-error code) and logs an error message.
8. **Post-mapping** — Always executed regardless of success/failure. Sets control data and user result data on the parameter object via `setResultCtrlData` and `setResultUserData`.
9. **Final check** — If `returnCd` is not `"0"`, throws a `CCException` with a Japanese error message.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | The active BPM session handle containing the user's authentication context, DB connection info, and handle ID used for logging. It carries the operational session state for the current request flow. |
| 2 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying all incoming BPM data, control map data, and metadata. It contains the CC-specific parameter map under key `"SCSV002601CC"` which holds input fields such as the corporate EO substitute service contract number, VLAN order code, request subtype code, and other order context. On return, the method populates this object with control data and user result data via `setResultCtrlData` and `setResultUserData`. |
| 3 | `fixedText` | `String` | A user-defined string literal used for custom text in validation and error messages. In `executeMain`, it is accepted for interface compliance but is not directly consumed. It is passed through to `getInvokeCBS` for BP (Business Process) check configuration. |

**Instance fields / external state read by the method:**
- None directly — this method is stateless. All state flows through parameters and the underlying SC call.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| I | `ESC0021D010CBS` (via ServiceComponentRequestInvoker) | ESC0021D010 | `KK_T_VLAN_ORDER` (inferred from ESC0021 template) | Invokes Telephone VLAN Order Reception SC — creates a new VLAN order record for a legal entity, setting service contract number, order codes, and request metadata |
| - | `JSCTelSvcScParamHenshu.createScParam` | JSCTelSvcScParamHenshu | - | Creates SC parameter map from BPM param using template ESC0051D010 |
| - | `JSCTelSvcScParamHenshu.isSuccess` | JSCTelSvcScParamHenshu | - | Checks SC execution status flag |
| - | `JSCTelSvcScParamHenshu.getResultString` | JSCTelSvcScParamHenshu | - | Extracts a string value from SC result map by key |
| - | `JSCTelSvcScParamHenshu.setResultCtrlData` | JSCTelSvcScParamHenshu | - | Maps SC error/result control data into the BPM request param |
| - | `JSCTelSvcScParamHenshu.setResultUserData` | JSCTelSvcScParamHenshu | - | Maps user result data (order number, status, timestamps, etc.) into the BPM request param |
| - | `ServiceComponentRequestInvoker.run` | - | - | Low-level CBS invocation bridge that dispatches the SC request and returns the result |

**Operation description:**
The primary data operation is an **Insert (I)** into the telephone VLAN order data (SC ESC0021D010), which registers a new telephone VLAN order for a corporate legal entity. The SC receives eight input parameters including the service contract number, VLAN order code, request subtype, VLAN server code, and request submission/project reference numbers. It returns ten output fields including the generated order number, order status, receipt datetime, SOD (Service Order Data) work linkage status, registration/update timestamps and operator accounts, and an invalidation flag.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | BPM:SCSV0026OP (Operation) | `SCSV0026OPOperation.run` → `CCRequestBroker.execute` → `JSCSV002601CC.executeMain` | `ESC0021D010CBS [I] VLAN Order (Telephone)` |
| 2 | BPCheck:SCSV0026OP | `SCSV0026_SCSV0026OPBPCheck.invokeCheck` → `JSCSV002601CC.getInvokeCBS` (BP check param only, no executeMain) | — |

**Caller details:**

1. **SCSV0026OPOperation** — This is the BPM operation class for flow SCSV0026. It calls `executeMain` via a `CCRequestBroker` (`target3`) that handles the CC invocation with exception judgment classes `DefaultSCExceptionJudge` and `DefaultCCExceptionJudge`. The BPM operation sets up DB connection info (`FUDB` connection) and dispatches the call through the BPM operator framework.

2. **SCSV0026_SCSV0026OPBPCheck** — This is the BP (Business Process) validation check class. It instantiates `JSCSV002601CC` and calls `getInvokeCBS` (not `executeMain`) to prepare BP check parameters. The `getInvokeCBS` method returns an empty parameter map (no BP checks are performed), and `editErrorInfo` simply returns the param unchanged. This means the BP check layer is effectively a no-op for this flow — validation is handled entirely by the underlying SC.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L54)

> Initialize the execution environment: logger, return code, and parameter extraction.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ILogger logger = BPMLogManager.getLogger(handle.getHandleID(), this.getClass())` // Create debug logger |
| 2 | SET | `String returnCd = "0"` // Return code (0: normal completion, 1: data-no error, 9: system error) |
| 3 | SET | `Map userResult = new HashMap()` // Container for extracted result data |
| 4 | EXEC | `Map<String, Object> ccParam = (Map<String, Object>)param.getData("SCSV002601CC")` // Extract CC parameter map from request |

**Block 2** — [PARAMETER_CONSTRUCTION] (L60)

> Build the input parameter map for the SC invocation. Eight fields are extracted from `ccParam` and mapped to `ESC0021D010CBSMsg` keys.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Map<Object, Object> paramTelVlanOrd = new HashMap<Object, Object>()` // Initialize SC input map |
| 2 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.HJIN_EO_YKAE_SVKEI_NO, ccParam.get("hjin_eo_ykae_svkei_no"))` // Legal entity EO substitute service contract number |
| 3 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.SVC_KEI_NO, ccParam.get("hjin_eo_ykae_svkei_no"))` // Service contract number (same as above) |
| 4 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.YOKYU_MT_APL_SBT_CD, ccParam.get("yokyu_mt_apl_sbt_cd"))` // Requestor application subtype code |
| 5 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.VLAN_ORDER_CD, ccParam.get("vlan_order_cd"))` // VLAN order code |
| 6 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.YOKYU_SBT_CD, ccParam.get("yokyu_sbt_cd"))` // Request subtype code |
| 7 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.VLAN_SERVER_CD, ccParam.get("vlan_server_cd"))` // VLAN server code |
| 8 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.REQ_JI_MSKMSHO_NO, ccParam.get("req_ji_mskmsho_no"))` // Request submission document number |
| 9 | EXEC | `paramTelVlanOrd.put(ESC0021D010CBSMsg.REQ_JI_KJAK_NO, ccParam.get("req_ji_kjak_no"))` // Request project case number |
| 10 | EXEC (commented) | `// paramTelVlanOrd.put(ESC0021D010CBSMsg.TEL_VLAN_ID, ccParam.get("tel_vlan_id"))` // Telephone VLAN-ID (disabled) |
| 11 | EXEC (commented) | `// paramTelVlanOrd.put(ESC0021D010CBSMsg.BAS_HOST_ID, ccParam.get("bas_host_id"))` // RAS-Host ID (disabled) |

**Block 3** — [SC_INVOCATION] (L90)

> Execute the telephone VLAN order new registration SC.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `Map<?, ?> result = executeTelVlanOrder(handle, param, logger, paramTelVlanOrd)` // Telephone VLAN order new registration SC dispatch |

**Block 3.1** — [executeTelVlanOrder private method] (L156)

> Internally creates the SC parameter map using template `ESC0051D010`, invokes the CBS via `ServiceComponentRequestInvoker`, and returns the result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String templateId = "ESC0051D010"` // Service IF template ID |
| 2 | EXEC | `HashMap<String, Object> paramMap = JSCTelSvcScParamHenshu.createScParam(param, templateId, ESC0021D010CBSMsg.class, paramTelVlanOrd, "1")` // Create SC param map |
| 3 | SET | `ServiceComponentRequestInvoker scCall = new ServiceComponentRequestInvoker()` // CBS invocation bridge |
| 4 | EXEC | `Map<?, ?> result = scCall.run(paramMap, handle)` // Execute SC |
| 5 | EXEC | `logger.log(BasicLevel.DEBUG, ...)` // Log completion |
| 6 | RETURN | `return result` |

**Block 4** — [IF] `JSCTelSvcScParamHenshu.isSuccess(result)` (L92)

> Success branch: Extract the 10 result fields from the SC response into `userResult`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `userResult.put("tel_vlan_order_no", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.TEL_VLAN_ORDER_NO))` // Telephone VLAN order number |
| 2 | EXEC | `userResult.put("tel_vlan_order_stat", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.TEL_VLAN_ORDER_STAT))` // Telephone VLAN order status |
| 3 | EXEC | `userResult.put("tel_vlan_order_uk_dtm", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.TEL_VLAN_ORDER_UK_DTM))` // Telephone VLAN order receipt datetime |
| 4 | EXEC | `userResult.put("sod_work_rnki_stat", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.SOD_WORK_RNKI_STAT))` // SOD work linkage status |
| 5 | EXEC | `userResult.put("add_dtm", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.ADD_DTM))` // Registration datetime |
| 6 | EXEC | `userResult.put("add_opeacnt", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.ADD_OPEACNT))` // Registration operator account |
| 7 | EXEC | `userResult.put("upd_dtm", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.UPD_DTM))` // Update datetime |
| 8 | EXEC | `userResult.put("upd_opeacnt", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.UPD_OPEACNT))` // Update operator account |
| 9 | EXEC | `userResult.put("mkFlg", JSCTelSvcScParamHenshu.getResultString(result, ESC0021D010CBSMsg.MK_FLG))` // Invalidation flag |

**Block 5** — [ELSE] (L121)

> Failure branch: Set error return code and log an error message.

| # | Type | Code |
|---|------|------|
| 1 | SET | `returnCd = "1"` // Set return code: data-no error (データなしエラー) |
| 2 | EXEC | `logger.log(BasicLevel.ERROR, "VLAN依存受信法人でエラーが発生しました。")` // Log: "Error occurred in VLAN reception legal entity" |

**Block 6** — [POST_MAPPING] (L128)

> Always executed regardless of success or failure. Maps SC results back to the BPM parameter object.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSCTelSvcScParamHenshu.setResultCtrlData(param, result, "SCSV002601CC")` // Set control data mapping |
| 2 | EXEC | `JSCTelSvcScParamHenshu.setResultUserData(param, "SCSV002601CC", userResult)` // Set user data mapping; result notification via return code |
| 3 | EXEC | `logger.log(BasicLevel.DEBUG, "VLAN依存受信法人 下半マッピング完了" + param)` // Log: "VLAN reception legal entity post-mapping complete" |

**Block 7** — [IF] `!"0".equals(returnCd)` (L138)

> Final error check: if the return code is not normal completion, throw an exception to the caller.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `throw new CCException("VLAN依存受信法人CCの実行でエラーが発生しました。", new Exception("VLAN依存受信法人CCの実行でエラーが発生しました。"))` // Throw CCException: "Error occurred during VLAN reception legal entity CC execution" |

**Block 8** — [RETURN] (L143)

> Normal completion: return the modified parameter object to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hjin_eo_ykae_svkei_no` | Field | Legal entity EO substitute service contract number — the service contract number used when a legal entity's EO (Entity Owner) is substituted by another party |
| `svc_kei_no` | Field | Service contract number — the primary identifier for a telecom service contract line item |
| `yokyu_mt_apl_sbt_cd` | Field | Requestor application subtype code — classifies the type of requestor application (e.g., new order, change, cancellation) |
| `vlan_order_cd` | Field | VLAN order code — identifies the specific type of VLAN order being processed |
| `yokyu_sbt_cd` | Field | Request subtype code — classifies the subtype of the service request |
| `vlan_server_cd` | Field | VLAN server code — identifies the VLAN server assigned to the order |
| `req_ji_mskmsho_no` | Field | Request submission document number — the reference document number for the submitted request |
| `req_ji_kjak_no` | Field | Request project case number — the project/case number associated with the request |
| `tel_vlan_order_no` | Field | Telephone VLAN order number — the unique order number generated by the SC for the VLAN order |
| `tel_vlan_order_stat` | Field | Telephone VLAN order status — the current processing status of the VLAN order |
| `tel_vlan_order_uk_dtm` | Field | Telephone VLAN order receipt datetime — the timestamp when the order was received/processed |
| `sod_work_rnki_stat` | Field | SOD work linkage status — indicates the synchronization status between the Service Order Data (SOD) and this order |
| `add_dtm` | Field | Registration datetime — timestamp of when the record was first created |
| `add_opeacnt` | Field | Registration operator account — the operator account that created the record |
| `upd_dtm` | Field | Update datetime — timestamp of the last modification |
| `upd_opeacnt` | Field | Update operator account — the operator account that last modified the record |
| `mkFlg` | Field | Invalidation flag — indicates whether this order/record is invalidated (cancelled/deactivated) |
| `returnCd` | Field | Return code — internal status code ("0" = normal, "1" = data-no error, "9" = system error) |
| CC | Acronym | Common Component — a reusable business logic component in the BPM framework that encapsulates specific service operations |
| SC | Acronym | Service Component — a lower-level service that performs specific data operations, typically invoking CBS (Central Business System) |
| CBS | Acronym | Central Business System — the core backend system handling data persistence and business rules |
| BPM | Acronym | Business Process Management — the workflow framework that orchestrates CC and SC calls across screens and processes |
| SCSV0026 | Code | K-Opticom flow identifier — the telephone VLAN order reception for legal entities (法人) process flow |
| ESC0021D010CBS | CBS ID | Telephone VLAN Order Reception CBS — the backend CBS that processes telephone VLAN order registration for legal entities |
| ESC0051D010 | Template ID | Service IF template identifier used by `JSCTelSvcScParamHenshu.createScParam` to build SC parameter maps |
| ServiceComponentRequestInvoker | Class | Low-level bridge class that dispatches SC requests to the CBS layer and returns results |
| CCException | Exception | Custom exception thrown by CC components to signal business-level errors to the BPM framework |
| JP: 法人 | Japanese term | Legal entity / corporation — a business customer entity (as opposed to individual consumers) |
| JP: 電話用VLAN | Japanese term | Telephone VLAN — a virtual LAN dedicated to telephone/VoIP service delivery |
| JP: オーダ発行為 | Japanese term | Order issuance / registration — the act of creating a new service order record |
| JP: 下半マッピング | Japanese term | Post-mapping / downward mapping — the process of mapping SC results back to the BPM request parameter object |
| JP: 要求元アプリ種別 | Japanese term | Requestor application subtype — identifies which application/system originated the request |
| JP: 依存受信法人 | Japanese term | Dependent reception legal entity — refers to the legal entity that receives dependent (linked) VLAN services |
