# Business Logic — JKKKapKeiInfoCancelCC.editInHaisoUketsuke() [102 LOC]

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

## 1. Role

### JKKKapKeiInfoCancelCC.editInHaisoUketsuke()

This method constructs and populates a CAANMsg-based message template for **delivery acceptance (配送受注)** processing within the service order cancellation workflow. It serves as a **message assembly** step: it takes raw delivery parameter maps (the header-level `inHaisoMap` and two list-level child maps `inList1` and `inList2`), enriches them with operational metadata (transaction ID, user case ID, client hostname, client IP, screen ID, operator ID, operating date/time, and call type), and produces a structured `paramMap` containing the fully assembled CAANMsg template array ready for downstream CBS (Core Business Service) invocation.

The method follows a **delegation + templating** design pattern: it does not perform business logic such as validation, persistence, or state transitions. Instead, it maps input parameters into a standardized messaging format (`CAANMsg`) using a message template class name derived from the delivery template ID, and nests up to two child arrays (`inList1` and `inList2`) under configurable field names (`inListMsgName[0]` and `inListMsgName[1]`). Empty-string values are explicitly converted to null entries via `setNull()`, ensuring that downstream services can distinguish between absent data and explicitly blank values.

Its role in the larger system is as a **common-component utility** called by `callHaisoUketsuke()` within `JKKKapKeiInfoCancelCC`. It is the bridge between the controller's raw input data and the CBS message pipeline — transforming a flat parameter map into a structured, hierarchical CAANMsg payload.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> P1["Create paramMap HashMap"]

    P1 --> META["Populate paramMap with metadata from param
TRANZACTION_ID_KEY, USECASE_ID_KEY, OPERATION_ID_KEY, CALL_TYPE_KEY"]

    META --> CLIENT["Populate paramMap with client info from control map
CLIENT_HOST_NAME_KEY, CLIENT_IP_ADDRESS_KEY, INVOKE_GAMEN_ID_KEY, OPERATOR_ID_KEY"]

    CLIENT --> TEMPLATEID["Get TEMPLATEID from inHaisoMap
via EDK0011D020CBSMsg.TEMPLATEID"]

    TEMPLATEID --> TEMPLATE["Create CAANMsg template
eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg"]

    TEMPLATE --> SETINFO["Set operator, operate date, operate datetime on template
OPERATOR_ID_KEY, OPERATE_DATE_KEY, OPERATE_DATETIME_KEY"]

    SETINFO --> HAILOOP["Loop: inHaisoMap.keySet()"]

    HAILOOP --> HAIEMPTY{"inHaisoMap.get(key) equals empty string?"}

    HAIEMPTY -->|true| HAINULL["template.setNull(key)"]
    HAIEMPTY -->|false| HAISET["template.set(key, inHaisoMap.get(key))"]

    HAINULL --> HAILOOP
    HAISET --> HAILOOP

    HAILOOP --> GETLIST1["template.getCAANMsgList(inListMsgName[0])"]

    GETLIST1 --> LIST1NULL{"templateArray == null?"}

    LIST1NULL -->|true| LIST1CREATE["templateArray = new CAANMsg[inList1.size()]"]
    LIST1NULL -->|false| LIST1SET

    LIST1CREATE --> LIST1SET["templateArray[i] = childTemplate"]

    LIST1SET --> LOOP1{"for i from 0 to inList1.size()-1"}

    LOOP1 --> LIST1CHECK{"childTemplate == null?"}

    LIST1CHECK -->|true| LIST1NEW["childTemplate = new CAANMsg(eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg1List)"]
    LIST1CHECK -->|false| LIST1POP

    LIST1NEW --> CHILDLOOP["Loop: childMap.keySet()"]

    CHILDLOOP --> CHILDEMP{"childMap.get(key) equals empty string?"}

    CHILDEMP -->|true| CHILDEMPSET["childTemplate.setNull(key)"]
    CHILDEMP -->|false| CHILDEMPSET2["childTemplate.set(key, childMap.get(key))"]

    CHILDEMPSET --> CHILDLOOP
    CHILDEMPSET2 --> CHILDLOOP

    CHILDLOOP --> LIST1FINAL["templateArray[i] = childTemplate; i++"]

    LIST1FINAL --> LOOP1

    LOOP1 --> SETLIST1["template.set(inListMsgName[0], templateArray)"]

    SETLIST1 --> GETLIST2["template.getCAANMsgList(inListMsgName[1])"]

    GETLIST2 --> LIST2NULL{"templateArray2 == null?"}

    LIST2NULL -->|true| LIST2CREATE["templateArray2 = new CAANMsg[inList2.size()]"]
    LIST2NULL -->|false| SETLIST2

    LIST2CREATE --> SETLIST2["template.set(inListMsgName[1], templateArray2)"]

    SETLIST2 --> FINAL["Create templates[0] = template
paramMap.put(TEMPLATE_LIST_KEY, templates)"]

    FINAL --> RETURN(["Return paramMap"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter container carrying operational metadata: transaction ID, user case ID, operation ID, call type, and control map data (hostname, client IP, screen ID, operator ID). This is the primary I/O object for all common-component methods in the framework. |
| 2 | `inHaisoMap` | `HashMap<String, String>` | The delivery header parameter map — key-value pairs representing the header-level fields of the delivery (配送) message template. Keys are template field names; values are field values, where an empty string (`""`) signifies a null value. The `TEMPLATEID` key (constant: `EDK0011D020CBSMsg.TEMPLATEID`) determines the CBS message class name for template instantiation. |
| 3 | `inListMsgName` | `String[]` | An array of two strings specifying the field names under which the two child message lists should be nested within the CAANMsg template. `inListMsgName[0]` is the key for the first child list (derived from `inList1`), and `inListMsgName[1]` is the key for the second child list (derived from `inList2`). |
| 4 | `inList1` | `ArrayList<HashMap<String, String>>` | The first delivery detail list — a list of child parameter maps. Each map represents one line item or child record in the delivery acceptance message. Its size determines the size of the first CAANMsg array nested into the template. |
| 5 | `inList2` | `ArrayList<HashMap<String, String>>` | The second delivery detail list — analogous to `inList1` but for a different child dimension (e.g., supplementary delivery records, alternative address entries, or secondary item lists). Its size determines the size of the second CAANMsg array. |

**External state read:** None. This method is stateless — it does not access any instance fields of `JKKKapKeiInfoCancelCC`. All data flows through parameters.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CAANMsg` (constructor) | - | - | Creates a CAANMsg template object with class name `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg` |
| S | `CAANMsg.set` | - | - | Sets a field value on the CAANMsg template (child key-value pairs from `inHaisoMap`) |
| S | `CAANMsg.setNull` | - | - | Sets a field to null on the CAANMsg template when the input value is empty string |
| S | `CAANMsg.set` (operator/date) | - | - | Sets operator ID, operate date, and operate datetime on the template |
| S | `CAANMsg.set` (list) | - | - | Sets the child CAANMsg arrays onto the parent template under list field names |
| R | `CAANMsg.getCAANMsgList` | - | - | Retrieves pre-existing CAANMsg array from template for merge-on-update semantics |

**How to classify:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| S (Set) | `CAANMsg.set(key, value)` | - | In-memory CAANMsg | Sets a field value on the delivery template from `inHaisoMap` key-value pairs. Represents writing header-level message fields. |
| S (Set) | `CAANMsg.setNull(key)` | - | In-memory CAANMsg | Explicitly marks a header-level field as null when the input value is an empty string. Preserves semantic distinction between absent and blank. |
| S (Set) | `CAANMsg.set(OPERATOR_ID_KEY, ...)` | - | In-memory CAANMsg | Sets the operator ID on the delivery template from the control map. |
| S (Set) | `CAANMsg.set(OPERATE_DATE_KEY, ...)` | - | In-memory CAANMsg | Sets the operating date on the delivery template. |
| S (Set) | `CAANMsg.set(OPERATE_DATETIME_KEY, ...)` | - | In-memory CAANMsg | Sets the operating date/time on the delivery template. |
| S (Set) | `CAANMsg.set(inListMsgName[0], templateArray)` | - | In-memory CAANMsg | Nests the first child CAANMsg array under the field name specified by `inListMsgName[0]`. |
| S (Set) | `CAANMsg.set(inListMsgName[1], templateArray2)` | - | In-memory CAANMsg | Nests the second child CAANMsg array under the field name specified by `inListMsgName[1]`. |
| S (Set) | `CAANMsg.set(key, value)` (child loop) | - | In-memory CAANMsg | Populates each child CAANMsg entry from its corresponding `childMap` key-value pairs. |
| S (Set) | `CAANMsg.setNull(key)` (child loop) | - | In-memory CAANMsg | Sets child entry fields to null when the source value is an empty string. |
| R | `CAANMsg.getCAANMsgList(field)` | - | In-memory CAANMsg | Retrieves an existing CAANMsg array for a given field. Used for merge-on-update: if the template already has a pre-populated array, it is reused rather than overwritten. |

**Note:** This method performs **no database operations** (no C/R/U/D on persistent entities). It operates entirely on in-memory objects, constructing a message payload. All SC Codes are absent because this method is a pure message assembly layer — it creates CAANMsg objects but does not invoke service components. The downstream `callHaisoUketsuke()` caller (not this method itself) is responsible for invoking the actual CBS.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `setNull` [-], `set` [-], `set` [-], `set` [-], `set` [-], `getCAANMsgList` [R], `getCAANMsgList` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JKKKapKeiInfoCancelCC.callHaisoUketsuke()` | `callHaisoUketsuke()` -> `JKKKapKeiInfoCancelCC.editInHaisoUketsuke(param, inHaisoMap, inListMsgName, inList1, inList2)` | `setNull` [-], `set` [-], `getCAANMsgList` [R] |

**Call chain analysis:**

1. **`JKKKapKeiInfoCancelCC.callHaisoUketsuke()`** — The sole known caller. This is an intra-class call within the same common component. `callHaisoUketsuke()` orchestrates the delivery acceptance workflow: it prepares parameters, calls `editInHaisoUketsuke()` to build the CAANMsg template, and then dispatches it to the appropriate CBS for execution. The terminal operations reachable through this method are all in-memory CAANMsg operations — `set()`, `setNull()`, and `getCAANMsgList()`.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `paramMap` initialization (L2571)

> Creates the return parameter map that will hold the assembled template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` |

**Block 2** — [EXEC] Metadata population from `param` (L2574–L2579)

> Populates `paramMap` with operational metadata extracted from the request parameter. Each key is a JCMConstants field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(TRANZACTION_ID_KEY, param.getTelegramID())` // Transaction ID from request [-> JCMConstants.TRANZACTION_ID_KEY] |
| 2 | SET | `paramMap.put(USECASE_ID_KEY, param.getUsecaseID())` // User case ID [-> JCMConstants.USECASE_ID_KEY] |
| 3 | SET | `paramMap.put(OPERATION_ID_KEY, param.getOperationID())` // Operation ID [-> JCMConstants.OPERATION_ID_KEY] |
| 4 | SET | `paramMap.put(CALL_TYPE_KEY, param.getCallType())` // Service call type discriminator [-> JCMConstants.CALL_TYPE_KEY] |

**Block 3** — [EXEC] Client control map population (L2582–L2589)

> Populates `paramMap` with client-side routing metadata extracted from the control map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(CLIENT_HOST_NAME_KEY, param.getControlMapData(REQ_HOSTNAME))` // Requested host name [-> JCMConstants.CLIENT_HOST_NAME_KEY, -> SCControlMapKeys.REQ_HOSTNAME] |
| 2 | SET | `paramMap.put(CLIENT_IP_ADDRESS_KEY, param.getControlMapData(REQ_HOSTIP))` // Request source IP address [-> JCMConstants.CLIENT_IP_ADDRESS_KEY, -> SCControlMapKeys.REQ_HOSTIP] |
| 3 | SET | `paramMap.put(INVOKE_GAMEN_ID_KEY, param.getControlMapData(REQ_VIEWID))` // Invoking screen ID [-> JCMConstants.INVOKE_GAMEN_ID_KEY, -> SCControlMapKeys.REQ_VIEWID] |
| 4 | SET | `paramMap.put(OPERATOR_ID_KEY, param.getControlMapData(OPERATOR_ID))` // Operator ID [-> JCMConstants.OPERATOR_ID_KEY, -> SCControlMapKeys.OPERATOR_ID] |

**Block 4** — [SET] Template ID extraction (L2591)

> Retrieves the delivery template ID from `inHaisoMap`. This ID determines the CBS message class name.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String)inHaisoMap.get(TEMPLATEID)` // Template ID [-> EDK0011D020CBSMsg.TEMPLATEID] |

**Block 5** — [SET] CAANMsg template creation (L2593)

> Instantiates the parent CAANMsg template using a class name pattern: `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` |

**Block 6** — [EXEC] Template operational fields (L2596–L2602)

> Sets the operator ID, operating date, and operating date/time onto the CAANMsg template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(OPERATOR_ID_KEY, param.getControlMapData(OPERATOR_ID))` // Operator ID [-> JCMConstants.OPERATOR_ID_KEY] |
| 2 | SET | `template.set(OPERATE_DATE_KEY, param.getControlMapData(OPE_DATE))` // Operating date [-> JCMConstants.OPERATE_DATE_KEY, -> SCControlMapKeys.OPE_DATE] |
| 3 | SET | `template.set(OPERATE_DATETIME_KEY, param.getControlMapData(OPE_TIME))` // Operating date/time [-> JCMConstants.OPERATE_DATETIME_KEY, -> SCControlMapKeys.OPE_TIME] |

**Block 7** — [FOR/WHILE] Delivery header field population loop (L2604–L2616)

> Iterates over all keys in `inHaisoMap` and populates the CAANMsg template. Empty-string values are set as null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `haisoIt = inHaisoMap.keySet().iterator()` |
| 2 | WHILE | `haisoIt.hasNext()` |
| 3 | SET | `key = (String)haisoIt.next()` |

**Block 7.1** — [IF] Empty string check in header (L2608)

> Determines whether the field value is empty string (meaning null) or an actual value.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"".equals(inHaisoMap.get(key))` |

**Block 7.1.1** — [EXEC] setNull when empty (L2610)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull(key)` |

**Block 7.1.2** — [EXEC] set when populated (L2613)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(key, (String)inHaisoMap.get(key))` |

**Block 8** — [SET] Retrieve first child list template array (L2618)

> Attempts to retrieve an existing CAANMsg array for the first child list. If null, a new array will be allocated.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray = template.getCAANMsgList(inListMsgName[0])` |

**Block 9** — [IF] First child array allocation (L2620–L2622)

> Allocates the child CAANMsg array if no pre-existing array was found.

| # | Type | Code |
|---|------|------|
| 1 | IF | `templateArray == null` |

**Block 9.1** — [SET] Allocate new array (L2621)

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray = new CAANMsg[inList1.size()]` |

**Block 10** — [FOR] Populate first child list (L2624–L2642)

> Iterates over `inList1` entries, populating each child CAANMsg template with field values.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `i` from 0 to `inList1.size()-1` |
| 2 | SET | `childMap = (HashMap)inList1.get(i)` |
| 3 | SET | `childTemplate = templateArray[i]` |

**Block 10.1** — [IF] Child template null check (L2626)

> If no pre-existing child template, create a new one using the `CBSMsg1List` class name pattern.

| # | Type | Code |
|---|------|------|
| 1 | IF | `childTemplate == null` |

**Block 10.1.1** — [SET] Create new child template (L2628)

| # | Type | Code |
|---|------|------|
| 1 | SET | `childTemplate = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg1List", svcIf))` |

**Block 11** — [WHILE] Populate child field values (L2632–L2640)

> Iterates over all keys in the current child map and sets values on the child CAANMsg template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `it = childMap.keySet().iterator()` |
| 2 | WHILE | `it.hasNext()` |
| 3 | SET | `key = (String)it.next()` |

**Block 11.1** — [IF] Empty string check in child (L2636)

> Determines whether the child field value is empty string (null) or actual value.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"".equals(childMap.get(key))` |

**Block 11.1.1** — [EXEC] setNull for child (L2638)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `childTemplate.setNull(key)` |

**Block 11.1.2** — [EXEC] set for child (L2641)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `childTemplate.set(key, (String)childMap.get(key))` |

**Block 12** — [SET] Store first child template array back (L2644)

> Stores the populated child template into the parent template under the first list field name.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray[i] = childTemplate` |
| 2 | SET | `template.set(inListMsgName[0], templateArray)` |

**Block 13** — [SET] Retrieve second child list template array (L2646)

> Attempts to retrieve an existing CAANMsg array for the second child list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray2 = template.getCAANMsgList(inListMsgName[1])` |

**Block 14** — [IF] Second child array allocation (L2648–L2650)

> Allocates the second child CAANMsg array if no pre-existing array was found.

| # | Type | Code |
|---|------|------|
| 1 | IF | `templateArray2 == null` |

**Block 14.1** — [SET] Allocate new array (L2649)

| # | Type | Code |
|---|------|------|
| 1 | SET | `templateArray2 = new CAANMsg[inList2.size()]` |

**Block 15** — [SET] Set second child template array (L2652)

> Sets the second child array onto the parent template under the second list field name.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(inListMsgName[1], templateArray2)` |

**Block 16** — [SET] Create template list and finalize paramMap (L2654–L2657)

> Wraps the single template in a `CAANMsg[]` array and stores it in `paramMap` under the template list key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` |
| 2 | SET | `templates[0] = template` |
| 3 | SET | `paramMap.put(TEMPLATE_LIST_KEY, templates)` // Template list [-> JCMConstants.TEMPLATE_LIST_KEY] |

**Block 17** — [RETURN] Return assembled paramMap (L2659)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `inHaisoMap` | Field | Delivery header parameter map — key-value pairs representing header-level fields of the delivery (配送) acceptance message |
| `inList1` | Field | First delivery detail child list — list of child record parameter maps for the primary delivery line items |
| `inList2` | Field | Second delivery detail child list — list of child record parameter maps for the secondary delivery dimension (e.g., supplementary records) |
| `inListMsgName` | Field | Message name array — specifies the field names under which the two child CAANMsg arrays are nested in the parent template |
| `svcIf` | Variable | Service interface template ID — extracted from `inHaisoMap`, used to construct the CAANMsg class name |
| `haiso` | Japanese term | Delivery (配送) — refers to shipment/delivery acceptance in the order fulfillment domain |
| CAANMsg | Acronym | Common Application ANswer Message — Fujitsu's message envelope format used for CBS (Core Business Service) communication |
| CBS | Acronym | Core Business Service — the backend service layer that processes business transactions |
| CAANMsg class name pattern | Naming convention | `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg` — the Java class name for the message template; `{svcIf}` is substituted with the template ID |
| CBSMsg1List | Naming convention | Suffix appended to the class name for child list messages: `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg1List` |
| JCMConstants | Class | Framework constant class defining message key names: TRANZACTION_ID_KEY, USECASE_ID_KEY, OPERATION_ID_KEY, CALL_TYPE_KEY, CLIENT_HOST_NAME_KEY, CLIENT_IP_ADDRESS_KEY, INVOKE_GAMEN_ID_KEY, OPERATOR_ID_KEY, OPERATE_DATE_KEY, OPERATE_DATETIME_KEY, TEMPLATE_LIST_KEY |
| SCControlMapKeys | Class | Framework constant class defining control map data keys: REQ_HOSTNAME, REQ_HOSTIP, REQ_VIEWID, OPERATOR_ID, OPE_DATE, OPE_TIME |
| JKKKapKeiInfoCancelCC | Class | Common Component for Service Contract Line Item (契約情報) Cancellation — handles the cancellation workflow for service contract line items |
| editInHaisoUketsuke | Method name | Edit for delivery acceptance — constructs the CAANMsg template for delivery acceptance processing |
| callHaisoUketsuke | Method name | Call for delivery acceptance — orchestrator method that calls editInHaisoUketsuke and dispatches the result to CBS |
| TRANZACTION_ID_KEY | Constant | Transaction ID key — unique identifier for the transaction session (note: misspelled as "TRANZACTION" in code) |
| USECASE_ID_KEY | Constant | User case ID key — identifies the business use case context |
| CALL_TYPE_KEY | Constant | Call type key — discriminator for service invocation type |
| TEMPLATEID | Constant | Template ID field name — the key used to extract the CBS message template ID from `inHaisoMap` (defined in `EDK0011D020CBSMsg`) |
| EDK0011D020CBSMsg | Class | CBS message constant class — defines field name constants for EDK0011D020 service interface |

---

*Document generated from source: `JKKKapKeiInfoCancelCC.java` lines 2569–2670*
