# Business Logic — JBSBatKKKkOpDlRvChsht.getAdChgTakikiDefFlg() [11 LOC]

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

## 1. Role

### JBSBatKKKkOpDlRvChsht.getAdChgTakikiDefFlg()

This method determines whether the **equipment deletion flag** for a residence change (address change) target device should be set to ON. In the broader batch process for equipment/option service cancellation pre-registration (`JBSBatKKKkOpDlRvChsht`), this flag signals downstream systems that the customer's equipment associated with a residence change request needs to be deleted from its current record. The method implements a simple presence-check pattern: if the customer account number (`KOJIAK_NO`) is present in the input record, the deletion flag is set to `"1"` (ON), indicating the equipment is a deletion target. If the customer account number is absent or blank, the flag remains an empty string (OFF), meaning no deletion is required. This method plays the role of a domain-specific predicate — it does not transform or write data; instead, it evaluates a single business condition and returns a flag that controls subsequent processing behavior in the batch flow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getAdChgTakikiDefFlg inMap"])
    STEP1["flg equals empty string"]
    CALL1["getCsv KOJIAK_NO inMap
Retrieve and trim KOJIAK_NO value"]
    COND1{"Is KOJIAK_NO
not blank"}
    SET_ON["flg equals FLG_ON value 1
Set deletion flag ON"]
    RETURN_FLG["Return flg"]
    END(["Return"])

    START --> STEP1
    STEP1 --> CALL1
    CALL1 --> COND1
    COND1 -->|Yes| SET_ON
    COND1 -->|No| RETURN_FLG
    SET_ON --> RETURN_FLG
    RETURN_FLG --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `FLG_ON` | `"1"` | Flag ON — indicates the equipment is a deletion target |
| `BLANK` | `""` | Empty string — used as the neutral/off flag value |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input record map carrying batch processing data for a single service contract line. Contains fields such as `KOJIAK_NO` (customer account number), `HAISO_NO` (delivery number), `HAISO_STAT` (delivery status), `KKTK_SVC_KEI_STAT` (service status), and others used throughout the batch processing flow. The `KOJIAK_NO` key is specifically queried by this method to determine if the residence change target device should be marked for deletion. |

| No | Field / External State | Type | Business Description |
|----|----------------------|------|---------------------|
| 1 | `FLG_ON` (static final) | `String = "1"` | Flag ON constant — set on the return value when the equipment deletion condition is satisfied |
| 2 | `BLANK` (static final) | `String = ""` | Empty string constant — initial value for the flag when no deletion is needed |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSBatKKKkOpDlRvChsht.getCsv` | - | - (in-memory map read) | Calls `getCsv` to retrieve the `KOJIAK_NO` (customer account number) value from the input map and trims trailing whitespace |

The method `getCsv` internally performs `JBSbatStringUtil.Rtrim(inMap.getString(key))`, which is an in-memory map read with string trimming — no database or external service interaction occurs.

## 5. Dependency Trace

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

Direct callers found: 1 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSBatKKKkOpDlRvChsht | `execute()` → `getAdChgTakikiDefFlg(inMap)` | `getCsv [R] inMap(KOJIAK_NO)` |

The method is called exclusively from within the same class's `execute()` method (line 188), where its return value is set into the output map:

```java
outMap.setString(JBSbatKKIFM554.AD_CHG_TAIKIKI_DEL_FLG, getAdChgTakikiDefFlg(inMap));
```

The output field `AD_CHG_TAIKIKI_DEL_FLG` (住所変更対象機器削除フラグ — residence change target device deletion flag) is then added to the output bean for downstream processing.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L313)

Initialize the return flag to an empty string (OFF state).

| # | Type | Code |
|---|------|------|
| 1 | SET | `flg = BLANK` // [-> BLANK=""] Initialize deletion flag as empty (OFF) |

**Block 2** — [IF] `!BLANK.equals(getCsv(JBSbatKKIFM553.KOJIAK_NO, inMap))` (L314)

Check whether the customer account number (`KOJIAK_NO`) is present and non-blank in the input record. The `getCsv` helper retrieves the value from `inMap` under the key `KOJIAK_NO` and trims trailing whitespace. If the trimmed result is not equal to `BLANK`, the condition is true — the equipment is a residence change target and should be marked for deletion.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getCsv(JBSbatKKIFM553.KOJIAK_NO, inMap)` // Retrieve and trim KOJIAK_NO (customer account number) from input map |
| 2 | COND | `!BLANK.equals(...)` // [-> BLANK=""] Check if customer account number exists |

**Block 2.1** — [IF-BRANCH: condition true — KOJIAK_NO present] (L316)

The customer account number is present, so set the deletion flag to ON. This indicates the equipment at this address should be deleted as part of the residence change processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `flg = FLG_ON` // [-> FLG_ON="1"] Set deletion flag ON — equipment is a deletion target |

**Block 3** — [RETURN] (L319)

Return the flag value. If the KOJIAK_NO was present, `flg = "1"` (deletion required). If absent, `flg = ""` (no deletion).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return flg` // Return deletion flag: "1" if deletion required, "" otherwise |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KOJIAK_NO` | Field | Customer account number — unique identifier for a customer's account in the service contract system |
| `AD_CHG_TAIKIKI_DEL_FLG` | Field | Residence change target device deletion flag — output field indicating whether the equipment at the changed address should be deleted (value "1" = delete, "" = keep) |
| `AD_CHG` | Abbreviation | Address change / Residence change (住所変更) — a business operation where a customer moves their service to a different address |
| `TAIKIKI` | Abbreviation | Target equipment (対象機器) — the physical device/equipment associated with a service contract that may need to be deleted or relocated |
| `FLG_ON` | Constant | Flag ON — value "1", indicates an affirmative/action-required state |
| `FLG_OFF` / `BLANK` | Constant | Flag OFF — empty string "", indicates no action is required |
| `JBSbatServiceInterfaceMap` | Type | Service interface map — a key-value container used to pass input/output data between batch processing stages |
| `getCsv` | Method | CSV value retrieval helper — reads a string value from a map by key and trims trailing whitespace |
| `JBSbatKKIFM553` | Class | Input map key definitions — contains constants for input record field keys such as `KOJIAK_NO` |
| `JBSbatKKIFM554` | Class | Output map key definitions — contains constants for output record field keys such as `AD_CHG_TAIKIKI_DEL_FLG` |
| Equipment/Option Service Cancellation Pre-registration | Business process | Batch operation that pre-registers cancellation of equipment and option services, retrieves service contract information, and updates delivery status |
