# Business Logic — JKKGlobalIpAddCfmCC.setterWorkParam() [17 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKGlobalIpAddCfmCC` |
| Layer | Common Component (CC) — part of the Fujitsu Futurity business process framework |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKGlobalIpAddCfmCC.setterWorkParam()

This method serves as the parameter extraction and validation gate for the Global IP Addition Confirmation (JKKGlobalIpAddCfm) business process. Its responsibility is to retrieve a named parameter value from the internal `inMap` map (which holds incoming work parameters for the current service contract processing), and conditionally transfer it into the `ccWorkMap` (the common component work map used throughout the batch/CC lifecycle).

The method implements a dual-path validation policy: if the retrieved value is non-blank, it is considered valid and immediately promoted to the work map; if the value is null or blank, the method checks whether the key is a parameter whose name does NOT start with the `"key_"` prefix — such keys are treated as optional parameters, and even a null/blank value is accepted into the work map. However, if the key starts with `"key_"` AND the value is null/blank, the method treats this as a missing required parameter and throws a `CCException`, halting the processing chain.

The method follows the **gatekeeper pattern**: it ensures that every parameter the caller expects to be available in `ccWorkMap` is either present with a valid value or explicitly acknowledged as missing (via exception). This prevents downstream methods from encountering unexpected null values, enforcing the defensive programming discipline required in the enterprise batch processing pipeline.

Its role in the larger system is that of a shared infrastructure method within the CC layer, called by higher-level setup methods (e.g., `chkInMap`) that batch-extract all required parameters before delegating to specific business logic handlers. The Javadoc (processing summary) states: "key ni tsunuku hinusuu wo nai map e hoju" (retain/hold the arguments tied to the key in the internal map).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setterWorkParam(key)"])
    READ_OBJ["Get obj from this.inMap using key"]
    CHECK_NOT_NULL["JKKStringUtil.isNullBlank(obj) is false?"]
    LOG_NOT_NULL["printlnEjbLog(key + '=' + obj)"]
    PUT_NOT_NULL["ccWorkMap.put(key, obj)"]
    CHECK_SUBSTR["key.substring(0,4) equals 'key_'?"]
    NOT_KEY_BRANCH["Not a 'key_' prefixed parameter"]
    LOG_NOT_KEY["printlnEjbLog(key + '=' + obj)"]
    PUT_NOT_KEY["ccWorkMap.put(key, obj)"]
    ELSE_BRANCH["Key starts with 'key_' AND obj is null/blank"]
    LOG_NULL["printlnEjbLog(key + '=NULL')"]
    THROW["Throw CCException with message"]
    END_NODE(["Return"])

    START --> READ_OBJ
    READ_OBJ --> CHECK_NOT_NULL
    CHECK_NOT_NULL -->|false| LOG_NOT_NULL
    LOG_NOT_NULL --> PUT_NOT_NULL
    PUT_NOT_NULL --> END_NODE
    CHECK_NOT_NULL -->|true| CHECK_SUBSTR
    CHECK_SUBSTR -->|false| LOG_NOT_KEY
    LOG_NOT_KEY --> PUT_NOT_KEY
    PUT_NOT_KEY --> END_NODE
    CHECK_SUBSTR -->|true| ELSE_BRANCH
    ELSE_BRANCH --> LOG_NULL
    LOG_NULL --> THROW
    THROW --> END_NODE
```

**Processing Logic:**

1. **Retrieve**: Read the value associated with `key` from `this.inMap` (the incoming parameter map). Cast to `String`.
2. **Branch 1 — Non-blank value found**: If `JKKStringUtil.isNullBlank(obj)` returns `false` (i.e., the value exists and is non-blank), log the key=value pair and insert it into `ccWorkMap`. Processing completes.
3. **Branch 2 — Blank value, but key is not `"key_"` prefixed**: The value is null/blank, but the parameter key does NOT start with `"key_"` (i.e., it's an optional/auxiliary parameter). Log the key=value and still insert into `ccWorkMap`. Processing completes.
4. **Branch 3 — Blank value AND key starts with `"key_"`**: The value is null/blank AND the key starts with `"key_"` (i.e., it's a required parameter). Log `key=NULL` and throw a `CCException` to abort processing.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The map key identifying which work parameter to retrieve from `inMap`. Each key corresponds to a specific business field expected by the Global IP Addition Confirmation process — examples include function code (`KEY_FUNC_CD`), service contract number (`KEY_SVC_KEI_NO`), system ID (`KEY_SYSID`), reservation application date (`KEY_RSV_APLY_YMD`), application type code (`MSKM_SBT_CD`), operational date/time (`MSKM_UK_DTM`), consumption business operation status recognition code (`CONSMBSN_MSKM_STAT_SKBT_CD`), optional service code (`OP_SVC_CD`), optional service code (`PCRS_CD`), and price plan code (`PPLAN_CD`). |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `inMap` | `Map<String, Object>` | The incoming parameter map — populated earlier in the processing pipeline with raw input data for the current service contract line item. This method reads parameter values from this map by key. |

**Instance fields written:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ccWorkMap` | `Map<String, Object>` | The common component work map — validated parameters extracted from `inMap` are stored here for consumption by downstream business logic handlers in the CC lifecycle. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | - | - | Calls `isNullBlank` utility to check if the retrieved value is null or blank (whitespace-only). This is a string validation helper. |
| - | `JKKGlobalIpAddCfmCC.printlnEjbLog` | - | - | Calls internal logging method to write key=value or key=NULL to the EJB log for audit/traceability. |
| - | `Map.get` (java.util) | - | - | Reads a value from `inMap` by key — internal map retrieval, no external persistence. |
| - | `Map.put` (java.util) | - | - | Writes a validated parameter into `ccWorkMap` — internal map write, no external persistence. |
| - | `String.substring` (java.lang) | - | - | Extracts the first 4 characters of `key` to check the `"key_"` prefix — standard JDK method call. |

This method performs **no database CRUD operations** directly. It operates entirely on in-memory maps (`inMap` and `ccWorkMap`) and invokes utility/validation helpers. The actual CRUD (C/R/U/D) operations for the Global IP Addition Confirmation process are performed by downstream methods that consume the work map parameters populated here.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `printlnEjbLog` [-], `isNullBlank` [-], `substring` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `chkInMap` (JKKGlobalIpAddCfmCC) | `JKKGlobalIpAddCfmCC.chkInMap` -> `JKKGlobalIpAddCfmCC.setterWorkParam` | `printlnEjbLog [-]`, `isNullBlank [-]`, `substring [-]` |

**Caller Analysis:**

The sole direct caller is `chkInMap()` within the same class `JKKGlobalIpAddCfmCC`. This method is invoked as part of a batch-style parameter setup routine that extracts named parameters from `inMap` into `ccWorkMap`. The caller passes constant string keys such as `KEY_FUNC_CD`, `KEY_SVC_KEI_NO`, `KEY_SYSID`, `KEY_RSV_APLY_YMD`, `MSKM_SBT_CD`, `MSKM_UK_DTM`, `CONSMBSN_MSKM_STAT_SKBT_CD`, `OP_SVC_CD`, `PCRS_CD`, and `PPLAN_CD`.

No screen/batch entry points (`KKSV*` classes) are found within 8 hops. This method is a leaf-level infrastructure utility that does not expose a direct business transaction endpoint.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `!JKKStringUtil.isNullBlank(obj)` (L719)

The first conditional branch: the value retrieved from `inMap` is non-null and non-blank. This is the happy path — the parameter exists with valid data and should be promoted to the work map.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `obj = (String) this.inMap.get(key)` — Retrieve value from incoming parameter map [L718] |
| 2 | CHECK | `!JKKStringUtil.isNullBlank(obj)` — Is the value non-blank? [L719] |
| 3 | EXEC | `printlnEjbLog(key + "=" + obj)` — Log the key-value pair for audit trail [L720] |
| 4 | SET | `this.ccWorkMap.put(key, obj)` — Store validated parameter in work map [L721] |
| 5 | RETURN | Exit method — processing successful for this parameter |

**Block 2** — [ELSE-IF] `!key.substring(0,4).equals("key_")` (L723)

The second branch: the value is null/blank (first check failed), BUT the parameter key does NOT start with `"key_"`. This means the parameter is optional — even a missing value is acceptable, and it should be stored in the work map (with a null/blank value).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.substring(0,4)` — Extract first 4 characters to check prefix [L723] |
| 2 | CHECK | `!key.substring(0,4).equals("key_")` — Does key NOT start with "key_"? [L723] |
| 3 | EXEC | `printlnEjbLog(key + "=" + obj)` — Log the key-value pair (obj is null/blank) [L724] |
| 4 | SET | `this.ccWorkMap.put(key, obj)` — Store parameter (even if null/blank) in work map [L725] |
| 5 | RETURN | Exit method — optional parameter acknowledged, processing continues |

**Block 3** — [ELSE] (L728)

The final branch: the value is null/blank AND the key starts with `"key_"`. This indicates a required parameter is missing. The method logs this condition and throws a `CCException` to abort the current processing flow, preventing downstream methods from operating on invalid data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `printlnEjbLog(key + "=NULL")` — Log that the required parameter is null [L729] |
| 2 | RETURN | `throw new CCException(key + "=NULL", new Exception())` — Throw checked exception to halt processing [L730] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `inMap` | Field | Incoming parameter map — holds raw parameter values provided at the start of the Global IP Addition Confirmation batch processing |
| `ccWorkMap` | Field | Common Component work map — validated parameters are stored here for consumption by downstream CC/business logic methods |
| `KEY_FUNC_CD` | Field | Function code — identifies the specific function being executed within the system |
| `KEY_SVC_KEI_NO` | Field | Service contract number — the unique identifier for the service contract line item being processed |
| `KEY_SYSID` | Field | System ID — identifier for the originating or target system in the service contract |
| `KEY_RSV_APLY_YMD` | Field | Reservation application date — the date when the service reservation was applied |
| `MSKM_SBT_CD` | Field | Application type code — classifies the type of application (e.g., new, change, cancellation) |
| `MSKM_UK_DTM` | Field | Operational date/time — the date and time when the service operation takes effect |
| `CONSMBSN_MSKM_STAT_SKBT_CD` | Field | Consumption business operation status recognition code — identifies the status of consumption-related business operations |
| `OP_SVC_CD` | Field | Optional service code — code for an optional/add-on service associated with the contract |
| `PCRS_CD` | Field | Price plan code — the pricing plan associated with the service contract |
| `PPLAN_CD` | Field | Price plan code (alternative naming) — pricing plan identifier for the service |
| `key_` | Prefix | Naming convention prefix — parameter keys starting with "key_" are treated as required parameters; missing values trigger an exception |
| `CCException` | Exception | Common Component exception — the standard checked exception used in the CC layer to signal business rule violations or missing data |
| `isNullBlank` | Method | Validation utility — checks if a string is null, empty, or contains only whitespace |
| `printlnEjbLog` | Method | Internal logging — writes diagnostic messages to the EJB log for audit and troubleshooting purposes |
| Global IP Addition Confirmation | Business process | The overall business operation that confirms and processes the addition of a global IP address to a service contract |
| JKKGlobalIpAddCfmCC | Class | Global IP Addition Confirmation Common Component — the CC class responsible for parameter management and validation in the Global IP Addition Confirmation process |
