# Business Logic — JKKKikiIchiranKkKaifukuCC.execEKK1551D010() [72 LOC]

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

## 1. Role

### JKKKikiIchiranKkKaifukuCC.execEKK1551D010()

This method implements the **Order Information Creation Work Registration** process (EKK1551D010: "Order Information Creation Work Registration"). It is a core business method within the SOD (Service Order Data) emission workflow, invoked by `execSodHakkoCreate()` to finalize the registration of order information into the work table. The method follows a **data aggregation and delegation** pattern: it gathers pre-fetched messages from `temporaryData`, performs a conditional lookup for service contract cancellation details (when applicable), assembles a comprehensive input array spanning 30 fields covering multiple service contract types (main, equipment-provided, option, sub-option, billing-optional, extra-information, and change-before fields), and delegates the actual CBS call to `callSC()`.

The method acts as the **final assembly step** before invoking the CBS (EKK1551D010), which registers order information into the order creation work table. It handles the full spectrum of telecom service contract lines: main service contracts (`svc_kei_no`), equipment-provided service contracts (`kktk_svc_kei_no`), and auxiliary contract types (option, sub-option, billing-optional, extra-information), all with their respective generation timestamps. When the equipment-provided service contract includes a cancellation work number (`svc_kei_kaisen_ucwk_no`), the method additionally fetches the cancellation agreement details to populate the `huka_inf_kei_gadtm` (extra-information contract registration timestamp) field.

The design pattern used is a **builder + delegator**: the method builds an `Object[][]` input array by extracting values from 5 different CAANMsg sources, applying null-safe defaults (`""` for fields without data), and then delegates to `callSC()` for the CBS invocation. This method is a private utility called exclusively by `execSodHakkoCreate()`, making it an internal coordinator within the SOD emission lifecycle.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execEKK1551D010(params)"])

    START --> S1["S1: Retrieve ccMsg from param.getData(dataMapKey)"]
    S1 --> S2["S2: Retrieve ekk1081d010Msg from temporaryData[TEMPLATE_ID_EKK1081D010]"]
    S2 --> S3["S3: Retrieve ekk0341a010Msg from temporaryData[TEMPLATE_ID_EKK0341A010_AF]"]
    S3 --> S4["S4: Retrieve ekk0081a010Msg from temporaryData[TEMPLATE_ID_EKK0081A010]"]
    S4 --> S5["S5: Retrieve ekk0161b004Msg from temporaryData[TEMPLATE_ID_EKK0161B004]"]
    S5 --> S6["S6: Get svc_kei_kaisen_ucwk_no from ekk0341a010Msg.getString(SVC_KEI_KAISEN_UCWK_NO)"]
    S6 --> S7["S7: Initialize svcKeiKaiseucwkGadtm = \"\""]

    S7 --> COND1{svc_kei_kaisen_ucwk_no is not empty?}

    COND1 -->|Yes| S8["S8: Call execEKK0251A010(handle, scCall, param, dataMapKey, svc_kei_kaisen_ucwk_no)"]
    S8 --> S9["S9: Get gene_add_dtm from ekk0251a010Msg.getString(GENE_ADD_DTM)"]
    S9 --> S10["S10: Set svcKeiKaiseucwkGadtm = gene_add_dtm"]

    COND1 -->|No| S10

    S10 --> S11["S11: Build ekk1551d010IN Object[][] array"]
    S11 --> S12["S12: Set fields: templateID=EKK1551D010, func_code, odr_hakko_joken_no, odr_naiyo_cd"]
    S12 --> S13["S13: Set fields: svc_kei_no, svkei_gadtm from ekk0081a010Msg"]
    S13 --> S14["S14: Set fields: svc_kei_ucwk_no, svkeiuw_gadtm from ekk0161b004Msg"]
    S14 --> S15["S15: Set fields: kktk_svc_kei_no, kktsvkei_gadtm from ekk0341a010Msg"]
    S15 --> S16["S16: Set empty defaults: op_svc_kei_no, opsvkei_gadtm, sbop_svc_kei_no, sbopsvkei_gadtm, seiopsvc_kei_no, seiopsvkei_gadtm"]
    S16 --> S17["S17: Set huka_inf_kei_no=svc_kei_kaisen_ucwk_no, huka_inf_kei_gadtm"]
    S17 --> S18["S18: Set remaining empty defaults: chbf_svkei_gadtm, chbf_svkeiuw_gadtm, chbf_kktsvkei_gadtm, chbf_opsvkei_gadtm, chbf_sbopsvkei_gadtm, chbf_seiopsvkei_gadtm, kkop_svc_kei_no_1/2, kkosvkei_gadtm_1/2, chbf_kkosvkei_gadtm_1/2"]
    S18 --> S19["S19: Call callSC(handle, scCall, param, dataMapKey, ekk1551d010IN)"]
    S19 --> END(["Return / Next"])
```

**CRITICAL -- Constant Resolution:**
- `TEMPLATE_ID_EKK1551D010 = "EKK1551D010"` -- Template ID for Order Information Creation Work Registration CBS
- `TEMPLATE_ID_EKK1081D010 = "EKK1081D010"` -- Template ID for Order Release Condition Registration CBS
- `TEMPLATE_ID_EKK0341A010_AF = "EKK0341A010_AF"` -- Template ID for Equipment-Provided Service Contract (post-recovery)
- `TEMPLATE_ID_EKK0081A010 = "EKK0081A010"` -- Template ID for Service Contract retrieval
- `TEMPLATE_ID_EKK0161B004 = "EKK0161B004"` -- Template ID for Service Contract Details retrieval
- `FUNC_CODE_1 = "1"` -- Function code for inquiry/registration operations
- `FUNC_CODE_2 = "2"` -- Function code used within `execEKK0251A010` for agreement lookup

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for the current transaction context; used to maintain connection state during CBS invocations and the `callSC()` delegation. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service Component request invoker; the dispatch mechanism that routes the assembled input array to the CBS (EKK1551D010) for persistence. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter read-write interface; provides access to the functional message map (`ccMsg`) via `getData(dataMapKey)` and carries request-scoped data through the call chain. |
| 4 | `dataMapKey` | `String` | Key used to retrieve the `ccMsg` (functional message) HashMap from the request parameter; identifies which data map within `param` contains the `func_code` attribute. |
| 5 | `temporaryData` | `HashMap<String, Object>` | Pre-populated message cache containing CAANMsg objects retrieved by prior processing steps. Holds `ekk1081d010Msg`, `ekk0341a010Msg`, `ekk0081a010Msg`, and `ekk0161b004Msg` keyed by their respective TEMPLATE_ID constants. Represents the shared state across the SOD emission workflow. |
| 6 | `ekk1551d010Map` | `HashMap<String, String>` | Map carrying the order content code (`odr_naiyo_cd`) specific to this order creation request; derived from the calling context's `ekk1551d010Map` (populated by `execSodHakkoCreate()` with the `ODR_NAIYO_CD` key). |

**Instance fields / external state read:**
- `TEMPLATE_ID_EKK1551D010` (constant): Template ID for the CBS invocation
- `TEMPLATE_ID_EKK1081D010` (constant): Template ID key to fetch order release condition data from `temporaryData`
- `TEMPLATE_ID_EKK0341A010_AF` (constant): Template ID key to fetch equipment-provided service contract data from `temporaryData`
- `TEMPLATE_ID_EKK0081A010` (constant): Template ID key to fetch service contract data from `temporaryData`
- `TEMPLATE_ID_EKK0161B004` (constant): Template ID key to fetch service contract details from `temporaryData`

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getNullToStr` | - | - | Null-safe string conversion utility; wraps `ekk0341a010Msg.getString(SVC_KEI_KAISEN_UCWK_NO)` to return `""` for null values. |
| C | `execEKK0251A010` | EKK0251A010 | KOSVC_KEI_KAISEN_UCWK_NO (Service Contract Cancellation Work Details Agreement) | Calls within this method to fetch cancellation details agreement for a service contract when `svc_kei_kaisen_ucwk_no` is set. Executes CBS EKK0251A010 (Service Contract Cancellation Details Agreement) with function code "2" to retrieve agreement data by `svc_kei_kaisen_ucwk_no`. Returns a CAANMsg containing `gene_add_dtm`. |
| R | `callSC` (EKK1551D010) | EKK1551D010 | KK_T_ODR_WK (Order Work Table) | Executes the EKK1551D010 CBS which registers order information creation work data. The `callSC` method internally invokes the CBS with the assembled `ekk1551d010IN` input array containing 30 fields: order release condition number, order content code, service contract numbers and timestamps for main contract, equipment-provided contract, option, sub-option, billing-optional, extra-information, change-before, and equipment-operation contract types. |

### Method call detail:

- **`getNullToStr(...)`** (L1776): Null-safe wrapper around `ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO)`. Returns empty string if the source value is null.
- **`execEKK0251A010(handle, scCall, param, dataMapKey, svc_kei_kaisen_ucwk_no)`** (L1780): Conditional branch -- only executed when `svc_kei_kaisen_ucwk_no` is non-empty. Invokes CBS EKK0251A010 with input: `templateID=EKK0251A010`, `func_code=2`, `key_svc_kei_kaisen_ucwk_no=svc_kei_kaisen_ucwk_no`, `key_gene_add_dtm=""`. Retrieves `gene_add_dtm` from the response.
- **`callSC(handle, scCall, param, dataMapKey, ekk1551d010IN)`** (L1821): Final CBS invocation. Passes a 30-element `Object[][]` array to the CBS handler for EKK1551D010.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `execSodHakkoCreate` | `execSodHakkoCreate` -> `execEKK1551D010` | `callSC [C] KK_T_ODR_WK` |

**Notes:**
- No screen/batch entry points (KKSV*) were found within 8 hops. The direct caller `execSodHakkoCreate` is itself a CBS-level method within the same class.
- `execSodHakkoCreate` (L1893-L1937) is the "Registered SOD Emission Method" -- it coordinates the full SOD (Service Order Data) emission workflow by calling: `execEKK1081C011` (Unified Processing Number Issuance), then builds `ekk1081d010Map` with order-related codes (`ORDER_SBT_CD`, `SVC_ORDER_CD`, `YOKYU_SBT_CD`, `ODR_HAKKO_JOKEN_CD`), calls `execEKK1081D010` (Order Release Condition Registration), and finally calls this method `execEKK1551D010` (Order Information Creation Work Registration).

## 6. Per-Branch Detail Blocks

**Block 1** -- IF `(svc_kei_kaisen_ucwk_no is not empty)` (L1778)

> Business description: When the equipment-provided service contract includes a cancellation work number (svc_kei_kaisen_ucwk_no), retrieve the cancellation agreement details to populate the registration timestamp.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ekk0251a010Msg = execEKK0251A010(handle, scCall, param, dataMapKey, svcKeiKaiseucwkNo)` // Service Contract Cancellation Details Agreement lookup |
| 2 | SET | `svcKeiKaiseucwkGadtm = ekk0251a010Msg.getString(EKK0251A010CBSMsg1List.GENE_ADD_DTM)` // Cancellation agreement . generation registration date |

**Block 2** -- ELSE (svc_kei_kaisen_ucwk_no is empty) (L1778)

> Business description: When no cancellation work number is set, `svcKeiKaiseucwkGadtm` remains as the default empty string.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcKeiKaiseucwkGadtm = ""` // No cancellation timestamp set; will default to empty string for CBS input |

**Block 3** -- Array Building (EKK1551D010 input assembly) (L1791)

> Business description: Build the complete input array for the EKK1551D010 CBS with 30 fields, aggregating data from 5 message sources and applying empty-string defaults for unused service contract types.

| # | Type | Code |
|---|------|------|
| 1 | SET | `e1551d010IN[0] = {TEMPLATEID, "EKK1551D010"}` // Template ID for CBS [-> TEMPLATE_ID_EKK1551D010="EKK1551D010"] |
| 2 | SET | `e1551d010IN[1] = {FUNC_CODE, ccMsg.get("func_code")}` // Function code from request context |
| 3 | SET | `e1551d010IN[2] = {ODR_HAKKO_JOKEN_NO, ekk1081d010Msg.getString(ODR_HAKKO_JOKEN_NO)}` // Order release condition number from Order Release Condition Registration msg |
| 4 | SET | `e1551d010IN[3] = {ODR_NAIYO_CD, ekk1551d010Map.get(EKK1551D010CBSMsg.ODR_NAIYO_CD)}` // Order content code from caller's map |
| 5 | SET | `e1551d010IN[4] = {SVC_KEI_NO, ekk0081a010Msg.getString(EKK0341A010CBSMsg1List.SVC_KEI_NO)}` // Service contract number from Service Contract msg |
| 6 | SET | `e1551d010IN[5] = {SVKEI_GADTM, ekk0081a010Msg.getString(EKK0081A010CBSMsg1List.GENE_ADD_DTM)}` // Service contract generation registration datetime |
| 7 | SET | `e1551d010IN[6] = {SVC_KEI_UCWK_NO, ekk0161b004Msg.getString(EKK0161B004CBSMsg1List.SVC_KEI_UCWK_NO)}` // Service contract details number from Service Contract Details msg |
| 8 | SET | `e1551d010IN[7] = {SVKEIUW_GADTM, ekk0161b004Msg.getString(EKK0161B004CBSMsg1List.GENE_ADD_DTM)}` // Service contract details generation registration datetime |
| 9 | SET | `e1551d010IN[8] = {KKTK_SVC_KEI_NO, ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO)}` // Equipment-provided service contract number from Equipment-Provided Contract msg |
| 10 | SET | `e1551d010IN[9] = {KKTSVKEI_GADTM, ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.GENE_ADD_DTM)}` // Equipment-provided service contract generation registration datetime |
| 11 | SET | `e1551d010IN[10] = {OP_SVC_KEI_NO, ""}` // Option service contract number -- empty (not applicable) |
| 12 | SET | `e1551d010IN[11] = {OPSVKEI_GADTM, ""}` // Option service contract generation registration datetime -- empty |
| 13 | SET | `e1551d010IN[12] = {SBOP_SVC_KEI_NO, ""}` // Sub-option service contract number -- empty |
| 14 | SET | `e1551d010IN[13] = {SBOPSVKEI_GADTM, ""}` // Sub-option service contract generation registration datetime -- empty |
| 15 | SET | `e1551d010IN[14] = {SEIOPSVC_KEI_NO, ""}` // Billing-optional service contract number -- empty |
| 16 | SET | `e1551d010IN[15] = {SEIOPSVKEI_GADTM, ""}` // Billing-optional service contract generation registration datetime -- empty |
| 17 | SET | `e1551d010IN[16] = {HUKA_INF_KEI_NO, ekk0341a010Msg.getString(EKK0341A010CBSMsg1List.SVC_KEI_KAISEN_UCWK_NO)}` // Extra-information contract number = cancellation work number |
| 18 | SET | `e1551d010IN[17] = {HUKA_INF_KEI_GADTM, svcKeiKaiseucwkGadtm}` // Extra-information contract generation registration datetime (conditional: from cancellation agreement or "") |
| 19 | SET | `e1551d010IN[18] = {CHBF_SVKEI_GADTM, ""}` // Change-before service contract generation registration datetime -- empty |
| 20 | SET | `e1551d010IN[19] = {CHBF_SVKEIUW_GADTM, ""}` // Change-before service contract details generation registration datetime -- empty |
| 21 | SET | `e1551d010IN[20] = {CHBF_KKTSVKEI_GADTM, ""}` // Change-before equipment-provided service contract generation registration datetime -- empty |
| 22 | SET | `e1551d010IN[21] = {CHBF_OPSVKEI_GADTM, ""}` // Change-before option service contract generation registration datetime -- empty |
| 23 | SET | `e1551d010IN[22] = {CHBF_SBOPSVKEI_GADTM, ""}` // Change-before sub-option service contract generation registration datetime -- empty |
| 24 | SET | `e1551d010IN[23] = {CHBF_SEIOPSVKEI_GADTM, ""}` // Change-before billing-optional service contract generation registration datetime -- empty |
| 25 | SET | `e1551d010IN[24] = {KKOP_SVC_KEI_NO_1, ""}` // Equipment option service contract number 1 -- empty |
| 26 | SET | `e1551d010IN[25] = {KKOSVKEI_GADTM_1, ""}` // Equipment option service contract generation registration datetime 1 -- empty |
| 27 | SET | `e1551d010IN[26] = {CHBF_KKOSVKEI_GADTM_1, ""}` // Change-before equipment option contract generation registration datetime 1 -- empty |
| 28 | SET | `e1551d010IN[27] = {KKOP_SVC_KEI_NO_2, ""}` // Equipment option service contract number 2 -- empty |
| 29 | SET | `e1551d010IN[28] = {KKOSVKEI_GADTM_2, ""}` // Equipment option service contract generation registration datetime 2 -- empty |
| 30 | SET | `e1551d010IN[29] = {CHBF_KKOSVKEI_GADTM_2, ""}` // Change-before equipment option contract generation registration datetime 2 -- empty |

**Block 4** -- CALL `callSC` (L1821)

> Business description: Execute the EKK1551D010 CBS (Order Information Creation Work Registration) by passing the assembled input array. The CBS persists the order work record to the database.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callSC(handle, scCall, param, dataMapKey, ekk1551d010IN)` // Order Information Creation Work Registration CBS execution. This is the terminal operation of this method. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `odr_hakko_joken_no` | Field | Order release condition number -- the primary key for an order release condition, linking to the order record being processed |
| `odr_naiyo_cd` | Field | Order content code -- classifies the type of order (e.g., new registration, change, cancellation); determines the business rule path |
| `svc_kei_no` | Field | Service contract number -- the unique identifier for a service contract line item |
| `svc_kei_ucwk_no` | Field | Service contract details number -- internal work number for service contract detail records |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract cancellation work number -- identifies a service contract line that has been canceled; used to fetch cancellation agreement data |
| `kktk_svc_kei_no` | Field | Equipment-provided service contract number -- service contract line associated with equipment provided by the carrier |
| `op_svc_kei_no` | Field | Option service contract number -- service contract line for optional service add-ons |
| `sbop_svc_kei_no` | Field | Sub-option service contract number -- secondary level option service contract |
| `seiopsvc_kei_no` | Field | Billing-optional service contract number -- service contract line for billing-optional services |
| `huka_inf_kei_no` | Field | Extra-information contract number -- supplementary information contract associated with the order |
| `kkop_svc_kei_no_1` / `_2` | Field | Equipment option service contract number 1 / 2 -- up to two equipment option contract lines |
| `svkei_gadtm` | Field | Service contract generation registration datetime -- timestamp when the service contract record was generated/registered |
| `svkeiuw_gadtm` | Field | Service contract details generation registration datetime -- timestamp when the service contract detail record was generated |
| `kktsvkei_gadtm` | Field | Equipment-provided service contract generation registration datetime |
| `huka_inf_kei_gadtm` | Field | Extra-information contract generation registration datetime -- populated from the cancellation agreement if applicable |
| `chbf_svkei_gadtm` | Field | Change-before service contract generation registration datetime -- timestamp snapshot taken before a change operation (empty in this flow) |
| `gene_add_dtm` | Field | Generation registration datetime -- generic timestamp field for record creation across multiple contract types |
| SOD | Acronym | Service Order Data -- the telecom order fulfillment entity processed during order emission |
| EKK1551D010 | CBS ID | Order Information Creation Work Registration -- CBS that registers order data into the work table for further processing |
| EKK0251A010 | CBS ID | Service Contract Cancellation Details Agreement -- CBS that retrieves cancellation agreement data for a given cancellation work number |
| EKK1081D010 | CBS ID | Order Release Condition Registration -- CBS that registers order release conditions; its result is consumed as input here |
| EKK0341A010 | CBS ID | Equipment-Provided Service Contract -- CBS handling equipment-provided service contract data (post-recovery variant: `_AF`) |
| EKK0081A010 | CBS ID | Service Contract -- CBS retrieving main service contract data |
| EKK0161B004 | CBS ID | Service Contract Details -- CBS retrieving service contract detail data |
| TEMPLATE_ID | Constant | Template identifier string used to key CAANMsg objects in `temporaryData` HashMaps; matches CBS service IDs |
| `callSC` | Method | Service Component invocation helper; assembles and dispatches an `Object[][]` input array to the target CBS |
| `execEKK0251A010` | Method | Internal wrapper around EKK0251A010 CBS execution; retrieves service contract cancellation details by cancellation work number |
| `getNullToStr` | Method | Null-safe utility that converts null String values to empty strings |
| `ccMsg` | Variable | Command/Controller message HashMap extracted from request parameters; contains `func_code` and other functional attributes |
| `temporaryData` | Variable | Shared state HashMap carrying CAANMsg objects between sequential processing steps in the SOD emission workflow |
