# Business Logic — JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataFixipad() [20 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKOpsvkeiDelTrgtChsht` |
| Layer | Service |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKOpsvkeiDelTrgtChsht.setDelTrgtDataFixipad()

This method is responsible for configuring deletion-target data settings for **Fixed IP Address** entities within the K-Opticom customer backbone system's option service contract cancellation workflow. In business terms, when a customer's internet service uses a static (fixed) public IP address, this method ensures that the IP address is properly flagged for removal/deletion during the service cancellation process. The method acts as a **data preparation handler** — it extracts the fixed IP address value from the incoming input message (`inMap`), validates that a value exists, and if so, constructs a structured output map carrying the deletion instructions. These instructions include the deletion processing type (`DEL_TRAN_SBT = "2"`, meaning "Aging Update" — i.e., scheduling a deferred deletion that will be processed by a background aging job), the deletion target type (`DEL_TRGT_SBT = "08"`, meaning "Fixed IP Address"), and the actual IP address value itself. The prepared deletion record is then appended to the output bean's list of maps via `addOutMapList`, making it available for downstream processing. If no fixed IP address is present in the input, the method performs a no-op (early return), respecting the principle that only service-relevant entities should be queued for deletion.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDelTrgtDataFixipad inMap outputBean"])
    START --> GET_FIXIPAD["Get fixipad from inMap KOTEI_IP_AD"]
    GET_FIXIPAD --> CHECK_FIXIPAD{fixipad null or empty?}
    CHECK_FIXIPAD -->|true| END_RETURN["Return no-op"]
    CHECK_FIXIPAD -->|false| INIT["initData inMap outMap"]
    INIT --> SET_DEAL_TYPE["Set DEL_TRAN_SBT to 2 Aging Update"]
    SET_DEAL_TYPE --> SET_TARGET_TYPE["Set DEL_TRGT_SBT to 08 Fixed IP Address"]
    SET_TARGET_TYPE --> SET_FIXIPAD["Set FIXIPAD to fixipad"]
    SET_FIXIPAD --> SET_OUTFLG["Set outMap setOutFlg true"]
    SET_OUTFLG --> ADD_MAP["outputBean addOutMapList outMap"]
    ADD_MAP --> END_RETURN
```

The method follows a **guarded-prepare-emit** pattern:

1. **Extract** — Reads the fixed IP address field (`KOTEI_IP_AD`) from the input map.
2. **Guard** — Validates that the extracted value is non-null and non-empty. If not, the method exits immediately (no deletion target is queued).
3. **Initialize** — Calls `initData(inMap)` to produce a fresh `outMap`, a standard pattern in this service class for creating an output message structure.
4. **Configure** — Sets three deletion-relevant fields:
   - `DEL_TRAN_SBT` = `2` (Aging Update) — signals this is a deferred deletion to be processed by a background aging job, not an immediate delete.
   - `DEL_TRGT_SBT` = `08` (Fixed IP Address) — identifies the entity type being deleted.
   - `FIXIPAD` — the actual IP address value extracted from input.
5. **Flag** — Sets `setOutFlg(true)` on the output map, marking it as an active deletion record.
6. **Emit** — Appends the configured `outMap` to the output bean's result collection via `addOutMapList`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The incoming batch message/map carrying all input fields for the cancellation processing flow. Specifically, it contains the fixed IP address under the key `JBSbatKK_T_OPSVKEI_ISP.KOTEI_IP_AD` ("KOTEI_IP_AD"). This map is the primary data source that drives the method's behavior. |
| 2 | `outputBean` | `JBSbatOutputItem` | The batch output accumulator that collects prepared deletion-target records. Each record is an `outMap` object with deletion-type metadata. The method appends its result here for downstream consumers. |

| No | Field | Type | Business Description |
|----|-------|------|---------------------|
| 1 | `DEL_TRAN_SBT_AGING_UPD` | `private static final String` | Deletion processing type code `"2"` — represents "Aging Update" (deferred deletion scheduled for background aging batch). |
| 2 | `DEL_TRGT_SBT_FIXIPAD` | `private static final String` | Deletion target type code `"08"` — represents "Fixed IP Address" as the entity category being targeted for deletion. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatServiceInterfaceMap.getString` | - | - | Reads the fixed IP address value from `inMap` using the key `KOTEI_IP_AD` |
| C | `JBSbatKKOpsvkeiDelTrgtChsht.initData` | - | - | Initializes a fresh `outMap` output structure from `inMap` (delegated map creation) |
| U | `JBSbatServiceInterfaceMap.setString` | - | - | Sets `DEL_TRAN_SBT` to `"2"` (Aging Update) in the output map |
| U | `JBSbatServiceInterfaceMap.setString` | - | - | Sets `DEL_TRGT_SBT` to `"08"` (Fixed IP Address) in the output map |
| U | `JBSbatServiceInterfaceMap.setString` | - | - | Sets `FIXIPAD` to the actual fixed IP address value in the output map |
| U | `JBSbatServiceInterfaceMap.setOutFlg` | - | - | Sets the output flag to `true`, marking this as an active deletion record |
| C | `JBSbatOutputItem.addOutMapList` | - | - | Appends the configured `outMap` to the output bean's result collection |

No direct database or SC-level read/write operations occur within this method — it is a pure **data preparation** method. All data flows through the interface maps (`inMap` / `outMap`) and the output bean.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKOpsvkeiDelTrgtChsht.execute()` | `execute()` → `setDelTrgtDataFixipad()` | `addOutMapList [C]`, `setOutFlg [U]`, `setString [U]`, `setString [U]`, `setString [U]`, `initData [C]` |

The method is called directly by the class's own `execute()` method, which serves as the batch entry point for the "Option Service Contract Deletion Target Extraction" process. No external screens or CBS entry points route through this method.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(fixipad != null && !"".equals(fixipad))` (L342)

> The method guards against null or empty fixed IP address values. Only when a valid fixed IP address is present does it proceed to configure the deletion target record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String fixipad = inMap.getString(JBSbatKK_T_OPSVKEI_ISP.KOTEI_IP_AD)` // Extract fixed IP address from input map [-> KOTEI_IP_AD="KOTEI_IP_AD"] |
| 2 | COND | `if(fixipad != null && ! "".equals(fixipad))` // Validate non-null and non-empty [-> DEL_TRAN_SBT_AGING_UPD="2", DEL_TRGT_SBT_FIXIPAD="08"] |

**Block 1.1** — [IF-TRUE] `(fixipad is valid)` (L344)

> When a valid fixed IP address exists, initialize the output map, configure deletion metadata, flag the record as active, and emit it to the output bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatServiceInterfaceMap outMap = initData(inMap)` // Create fresh output map structure from input [CALL to initData] |
| 2 | EXEC | `outMap.setString(JBSbatKKIFM160.DEL_TRAN_SBT, DEL_TRAN_SBT_AGING_UPD)` // Set deletion processing type to "2" (Aging Update) [-> DEL_TRAN_SBT_AGING_UPD="2"] |
| 3 | EXEC | `outMap.setString(JBSbatKKIFM160.DEL_TRGT_SBT, DEL_TRGT_SBT_FIXIPAD)` // Set deletion target type to "08" (Fixed IP Address) [-> DEL_TRGT_SBT_FIXIPAD="08"] |
| 4 | EXEC | `outMap.setString(JBSbatKKIFM160.FIXIPAD, fixipad)` // Set the actual fixed IP address value [FIXIPAD="FIXIPAD"] |
| 5 | EXEC | `outMap.setOutFlg(true)` // Flag this as an active deletion record |
| 6 | EXEC | `outputBean.addOutMapList(outMap)` // Append the deletion record to output collection |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KOTEI_IP_AD` | Field | Fixed IP Address — the static public IP address assigned to a customer's internet service. Extracted from the `JBSbatKK_T_OPSVKEI_ISP` table field. |
| `DEL_TRAN_SBT` | Field | Deletion Processing Type — classifies how a deletion should be executed. Value `"2"` = "Aging Update" (deferred deletion via background aging batch). |
| `DEL_TRGT_SBT` | Field | Deletion Target Type — classifies the entity category being deleted. Value `"08"` = "Fixed IP Address". |
| `FIXIPAD` | Field | Fixed IP Address — the actual IP address string carried in the deletion target record. |
| `DEL_TRAN_SBT_AGING_UPD` | Constant | Deletion processing type code `"2"` — Aging Update (scheduled deferred deletion). |
| `DEL_TRGT_SBT_FIXIPAD` | Constant | Deletion target type code `"08"` — Fixed IP Address. |
| `outMap` | Field | Output Service Interface Map — a message structure carrying deletion configuration data prepared for downstream batch processing. |
| `setOutFlg` | Method | Set output flag — marks an `outMap` record as an active/valid deletion target. |
| `initData` | Method | Initialize data — creates a fresh output map by copying relevant data from the input map (standard map-initialization pattern in this service class). |
| Aging Update | Business term | A deletion mode where the deletion is not executed immediately but is instead scheduled for processing by a background aging batch job. Allows the system to batch-delete records during off-peak hours. |
| Fixed IP Address | Business term | A static (non-dynamic) public IP address assigned to a customer's internet service connection. In K-Opticom's service catalog, this corresponds to option service contracts that include a permanent IP assignment. |
| `JBSbatKK_T_OPSVKEI_ISP` | Table | Option Service ISP entity table — stores ISP-related option service contract data including fixed IP address assignments. |
| `JBSbatKKIFM160` | Class | IF (Interface) mapping class — defines the field keys used in the `outMap` for deletion target data messages (e.g., `DEL_TRAN_SBT`, `DEL_TRGT_SBT`, `FIXIPAD`). |
| `JBSbatServiceInterfaceMap` | Class | The shared data exchange container (key-value map) used across batch service methods for passing structured input and output data. |
| `JBSbatOutputItem` | Class | The batch output accumulator that collects prepared records (as a list of maps) for downstream processing or reporting. |
