# Business Logic — JBSbatKKSvkeiDelTgCst.execute() [66 LOC]

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

## 1. Role

### JBSbatKKSvkeiDelTgCst.execute()

This method is the **primary entry point for the service contract deletion target data preparation batch**. It acts as a dispatcher that determines which type of service contract is being processed, then delegates to a type-specific helper method to gather and prepare deletion target data. The method operates on two service categories: **Internet Services** (service code "01") and **Telephone Services** (service code "02"). For Internet Services, it further branches based on the **price group code** (`prcGrpCd`) to identify the specific broadband access type — "EO Light Net Home Type" (02), "EO Light Net Metro Type" (03), "EO Light Net Management Type" (04), or "EO ADSL (Flets)" (06) — routing each to the appropriate deletion data preparation routine. For Telephone Services, it routes directly to a single deletion handler. The method uses a **routing/dispatch pattern** combined with **delegation**, where all heavy data extraction logic is pushed into private helper methods. It is a shared batch utility invoked by the broader service deletion orchestration layer.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execute inMap"])
    START --> INIT["Initialize selectWhereParam, tempHakkoParam, outputBean"]
    INIT --> GET_DATA["Extract svkeiNo, geneAddDtm, svcCd, prcGrpCd from inMap"]

    GET_DATA --> COND_SVC{svcCd equals}

    COND_SVC -->|SVC_CD_IN_SVC| IN_BLOCK["Internet Service Branch"]
    COND_SVC -->|else| TEL_BLOCK["Telephone Service Branch"]

    IN_BLOCK --> SET_BATCH_DATE["Set selectWhereParam to super.opeDate"]
    SET_BATCH_DATE --> COND_PGRP{prcGrpCd check}

    COND_PGRP -->|PGRP_NET_02=02| CALL_IN["setDelTrgtDataIn"]
    COND_PGRP -->|PGRP_NET_03=03| CALL_IN
    COND_PGRP -->|PGRP_NET_04=04| CALL_IN
    COND_PGRP -->|PGRP_ADSL_06=06| CALL_ADSL["setDelTrgtDataADSL"]

    CALL_IN --> RETURN["Return outputBean"]
    CALL_ADSL --> RETURN

    TEL_BLOCK --> SET_DTM["Set selectWhereParam to geneAddDtm"]
    SET_DTM --> CALL_TEL["setDelTrgtDataTel"]
    CALL_TEL --> RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input command envelope carrying all business data for this deletion run. It contains the service contract number (`svc_kei_no`), service code (`svc_cd`), generation registration datetime (`gene_add_dtm`), and price group code (`prc_grp_cd`). This map is the single source of business parameters for determining which service contracts need deletion target data prepared. |
| - | `svkeiNo` | `String` | Service contract number — the internal identifier for a service agreement line item, retrieved from `JBSbatKK_T_OP_SVC_KEI.SVC_KEI_NO`. |
| - | `geneAddDtm` | `String` | Generation registration datetime — the timestamp when the service contract was registered in the system (used as a filter for telephone service deletions). Retrieved from `JBSbatKK_T_SVC_KEI.GENE_ADD_DTM`. |
| - | `svcCd` | `String` | Service code — classifies the service type. Values: "01" = Internet Service, "02" = Telephone Service. Retrieved from `JBSbatKK_T_SVC_KEI.SVC_CD`. |
| - | `prcGrpCd` | `String` | Price group code — identifies the billing/price category, which corresponds to a specific broadband access type. Values: "02" = EO Light Net Home Type, "03" = EO Light Net Metro Type, "04" = EO Light Net Management Type, "06" = EO ADSL (Flets). Retrieved from `JBSbatKK_T_SVC_KEI.PRC_GRP_CD`. |
| - | `super.opeDate` | `String` | Batch operation date — inherited from the parent `JBSbatBusinessService`. Represents the business date used for SQL filtering in deletion queries for Internet services. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `setDelTrgtDataIn` | (private method) | `KK_T_SVKEIUW_EOH_NET` (via `db_KK_T_SVKEIUW_EOH_NET.selectNext`) | Sets deletion target data for Internet services (EO Light Net Home/Metro/Management types). Queries the service contract detail table to identify records eligible for deletion. |
| C | `setDelTrgtDataADSL` | (private method) | (via `KK_T_SVKEIUW_EOH_NET` or ADSL-specific table) | Sets deletion target data for ADSL (Flets) services. Prepares deletion records for the ADSL price group. |
| C | `setDelTrgtDataTel` | (private method) | (telephone service contract table) | Sets deletion target data for Telephone services. Prepares deletion records for telephone service contracts. |
| R | `JBSbatKK_T_OP_SVC_KEI.getString` | JBSbatKK_T_OP_SVC_KEI | - | Reads `SVC_KEI_NO` (service contract number) from input map. |
| R | `JBSbatKK_T_SVC_KEI.getString` | JBSbatKK_T_SVC_KEI | - | Reads `GENE_ADD_DTM` (generation registration datetime) and `SVC_CD` (service code) from input map. |
| R | `JBSbatKK_T_SVC_KEI.getString` | JBSbatKK_T_SVC_KEI | - | Reads `PRC_GRP_CD` (price group code) from input map. |

**Note:** The three private helper methods (`setDelTrgtDataIn`, `setDelTrgtDataADSL`, `setDelTrgtDataTel`) each perform internal SQL queries (e.g., `executeKK_T_SVKEIUW_EOH_NET_KK_SELECT_005` followed by `db_KK_T_SVKEIUW_EOH_NET.selectNext()`) to iterate over matching service contract detail records and extract them as deletion targets. These are classified as **C** (Create/prepare) because they gather and prepare data structures for deletion processing, not merely read.

## 5. Dependency Trace

This method is a batch business service that is invoked by the batch execution framework. No direct caller references to `JBSbatKKSvkeiDelTgCst.execute()` were found in the codebase — the method is instantiated and invoked through the batch orchestration layer (`JBSbatBusinessService` abstract class), which manages the batch execution lifecycle.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatBusinessService | `JBSbatBusinessService.invoke` -> `JBSbatKKSvkeiDelTgCst.execute(inMap)` | `setDelTrgtDataIn [C] KK_T_SVKEIUW_EOH_NET` |
| 2 | Batch: JBSbatBusinessService | `JBSbatBusinessService.invoke` -> `JBSbatKKSvKSvkeiDelTgCst.execute(inMap)` | `setDelTrgtDataADSL [C] KK_T_SVKEIUW_EOH_NET (ADSL)` |
| 3 | Batch: JBSbatBusinessService | `JBSbatBusinessService.invoke` -> `JBSbatKKSvkeiDelTgCst.execute(inMap)` | `setDelTrgtDataTel [C] KK_T_SVC_KEI (Telephone)` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Variable Initialization (L171)

> Initializes working data structures for the deletion process.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam = new Object[2]` // SQL parameter array for WHERE clause [-> array size 2] |
| 2 | SET | `tempHakkoParam = new HashMap<Integer, String>()` // Temporary parameter map for already-issued SOD confirmation [-> empty HashMap] |
| 3 | SET | `outputBean = new JBSbatOutputItem()` // Output information container [-> new empty output bean] |

**Block 2** — [EXEC] SQL Parameter Setup and Data Extraction (L177)

> Extracts service contract details from the input map for use in subsequent deletion processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svkeiNo = inMap.getString(JBSbatKK_T_OP_SVC_KEI.SVC_KEI_NO)` // Service contract number |
| 2 | SET | `selectWhereParam[0] = svkeiNo` // Service contract number as first WHERE parameter |
| 3 | SET | `geneAddDtm = inMap.getString(JBSbatKK_T_SVC_KEI.GENE_ADD_DTM)` // Generation registration datetime |
| 4 | SET | `svcCd = inMap.getString(JBSbatKK_T_SVC_KEI.SVC_CD)` // Service code |
| 5 | SET | `prcGrpCd = inMap.getString(JBSbatKK_T_SVC_KEI.PRC_GRP_CD)` // Price group code |

**Block 3** — [IF-ELSEIF-ELSE] Service Code Discrimination (L188)

> Primary routing decision: branches the processing flow based on the service code to identify whether this is an Internet service or a Telephone service.

**Block 3.1** — [IF] `svcCd equals SVC_CD_IN_SVC = "01"` (Internet Service) (L188)

> Handles Internet services (fiber/broadband access). Extracts the service contract number for deletion queries.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam[1] = super.opeDate` // Set batch operation date as second WHERE parameter |

**Block 3.1.1** — [IF-ELSEIF] Price Group Code Check (L193)

> Secondary routing within Internet services: determines the specific broadband access type to select the correct deletion data preparation method.

| # | Type | Code |
|---|------|------|
| 1 | COND | `PGRP_NET_02.equals(prcGrpCd)` [-> `PGRP_NET_02 = "02"` (EO Light Net Home Type)] |
| 2 | COND | `\|\| PGRP_NET_03.equals(prcGrpCd)` [-> `PGRP_NET_03 = "03"` (EO Light Net Metro Type)] |
| 3 | COND | `\|\| PGRP_NET_04.equals(prcGrpCd)` [-> `PGRP_NET_04 = "04"` (EO Light Net Management Type)] |

**Block 3.1.1.1** — [IF] Price Group Home/Metro/Management (L196)

> For EO Light Net Home, Metro, or Management types, prepare deletion target data via the Internet-specific handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDelTrgtDataIn(inMap, outputBean, selectWhereParam, tempHakkoParam)` // Delete target data setup (Internet service) |

**Block 3.1.1.2** — [ELSEIF] Price Group ADSL Flets (L207)

> For EO ADSL (Flets) type, prepare deletion target data via the ADSL-specific handler.

| # | Type | Code |
|---|------|------|
| 1 | COND | `PGRP_ADSL_06.equals(prcGrpCd)` [-> `PGRP_ADSL_06 = "06"` (EO ADSL Flets)] |
| 2 | CALL | `setDelTrgtDataADSL(inMap, outputBean, selectWhereParam, tempHakkoParam)` // Delete target data setup (ADSL/Flets) |

**Block 3.2** — [ELSEIF] `svcCd equals SVC_CD_TEL_SVC = "02"` (Telephone Service) (L212)

> Handles Telephone services. Unlike Internet services, Telephone services use the generation registration datetime (`geneAddDtm`) instead of the batch operation date as a filter for deletion queries.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam[1] = geneAddDtm` // Set generation registration datetime as second WHERE parameter |
| 2 | CALL | `setDelTrgtDataTel(inMap, outputBean, selectWhereParam, tempHakkoParam)` // Delete target data setup (Telephone service) |

**Block 4** — [RETURN] Return output (L218)

> Returns the prepared output bean containing deletion target data.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return outputBean;` // Return output information to batch framework |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svkeiNo` | Field | Service contract number — internal tracking identifier for a service agreement line item |
| `svcCd` | Field | Service code — classifies the type of service: "01" = Internet Service, "02" = Telephone Service |
| `prcGrpCd` | Field | Price group code — identifies the billing category and broadband access type (Home, Metro, Management, or ADSL) |
| `geneAddDtm` | Field | Generation registration datetime — timestamp when the service contract was registered in the system |
| `opeDate` | Field | Batch operation date — the business date used for batch processing date filters |
| `selectWhereParam` | Field | SQL WHERE clause parameter array — used to build query filters for deletion target data extraction |
| `outputBean` | Field | Output information container — holds the result data produced by the deletion preparation process |
| `tempHakkoParam` | Field | Temporary parameter map for already-issued SOD confirmation — used to track SOD (Service Order Data) that has already been issued to avoid duplicate processing |
| SVC_CD_IN_SVC | Constant | Service code for Internet Service — value "01" |
| SVC_CD_TEL_SVC | Constant | Service code for Telephone Service — value "02" |
| PGRP_NET_02 | Constant | Price group code "EO Light Net Home Type" — value "02" |
| PGRP_NET_03 | Constant | Price group code "EO Light Net Metro Type" — value "03" |
| PGRP_NET_04 | Constant | Price group code "EO Light Net Management Type" — value "04" |
| PGRP_ADSL_06 | Constant | Price group code "EO ADSL (Flets)" — value "06" |
| EO Light Net | Business term | Fiber-optic broadband service offered by K-Opticom (home, metro, and management variants) |
| Flets | Business term | NTT West ADSL broadband service brand (referred to as "EO ADSL" in the system) |
| SOD | Acronym | Service Order Data — the entity representing a service order to be issued |
| KK_T_SVKEIUW_EOH_NET | Table | EO Net service contract detail table — stores Internet service contract line item records |
| KK_T_SVC_KEI | Table | Service contract header table — stores service contract master records |
| KK_T_OP_SVC_KEI | Table | Open service contract detail table — stores open/operational service contract line items |
