# Business Logic — JBSbatKKSodUpdInfCst.isSyudo() [16 LOC]

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

## 1. Role

### JBSbatKKSodUpdInfCst.isSyudo()

This method determines whether a **address change (shocho henkou)** record is flagged as **manual processing**. In the K-Opticom customer core system, address changes trigger service contract updates that can be either automated (provisioned by the system) or manually operated (requiring human intervention). The method performs a primary-key lookup on the `KK_T_ADCHG` (Address Change Master) table using the provided address change number, retrieves the switch method code (`AD_SWITCH_WAY_CD`), and checks if it equals `"1"`, which indicates **manual** execution. If so, it returns `true`; otherwise it returns `false`. This method acts as a **guard/dispatch** utility within the service order update flow, allowing downstream processing to branch between automated and manual address change handling paths.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isSyudo inAdchgNo"])
    START --> CALL_PK["CALL executeKK_T_ADCHG_PKSELECT inAdchgNo"]
    CALL_PK --> NULL_CHECK{adchg null?}
    NULL_CHECK -->|"No found"| GET_STR["adSwitchWayCd = adchg.getString AD_SWITCH_WAY_CD"]
    NULL_CHECK -->|"Yes not found"| RETURN_FALSE(["return false"])
    GET_STR --> COND1{adSwitchWayCd equals 1?}
    COND1 -->|"Yes Manual"| RETURN_TRUE(["return true"])
    COND1 -->|"No Other"| RETURN_FALSE
    RETURN_TRUE --> END_NODE(["Return Next"])
    RETURN_FALSE --> END_NODE
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `JBSbatKK_T_ADCHG.AD_SWITCH_WAY_CD` | `"AD_SWITCH_WAY_CD"` | Address switch method code — column name for the address change routing classification |
| String literal `"1"` | `"1"` | Manual address change flag — indicates the address change requires manual operator intervention |

The processing flow:
1. **Primary Key Select**: Query the `KK_T_ADCHG` table by primary key (`ADCHG_NO`) using `executeKK_T_ADCHG_PKSELECT`.
2. **Null Check**: If the record is not found (null), return `false` — absence of an address change record implies no manual flag.
3. **String Extraction**: If found, retrieve the `AD_SWITCH_WAY_CD` field value from the result.
4. **Manual Flag Check**: If the code equals `"1"`, the address change is marked as manual — return `true`. For any other value, return `false`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inAdchgNo` | `String` | **Address Change Number** — the unique identifier for an address change record in the `KK_T_ADCHG` table. This number is assigned when an address change request is registered in the system and is used to look up the corresponding address change master record. |

**External State Read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_ADCHG` | `JBSbatCommonDBInterface` | Database access interface for the `KK_T_ADCHG` (Address Change Master) table. Used by this method's helper `executeKK_T_ADCHG_PKSELECT` to perform a primary key select query. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_ADCHG_PKSELECT` | - | `KK_T_ADCHG` | Queries the Address Change Master table by primary key (`ADCHG_NO`) to retrieve the address change record |
| R | `JBSbatCommonDBInterface.getString` | JBSbatCommonDBInterface | - | Extracts the `AD_SWITCH_WAY_CD` field value from the retrieved address change record |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `JBSbatKKSodUpdInfCst` | `JBSbatKKSodUpdInfCst.execute()` -> `JBSbatKKSodUpdInfCst.isSyudo(inAdchgNo)` | `executeKK_T_ADCHG_PKSELECT [R] KK_T_ADCHG` |

**Trace Notes:**
- The `executeKK_T_ADCHG_PKSELECT` method performs a `selectByPrimaryKeys` query on the `KK_T_ADCHG` table using `db_KK_T_ADCHG.selectByPrimaryKeys(whereMap)`, where `whereMap` contains the `ADCHG_NO` parameter.
- Terminal operations from this method: `executeKK_T_ADCHG_PKSELECT [R] KK_T_ADCHG`, `JBSbatCommonDBInterface.getString [R] AD_SWITCH_WAY_CD`.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `executeKK_T_ADCHG_PKSELECT()` (L667)

> Perform primary key lookup on the Address Change Master table by the given address change number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adchg = executeKK_T_ADCHG_PKSELECT(new String[]{inAdchgNo})` // Primary key select on KK_T_ADCHG by ADCHG_NO [-> KK_T_ADCHG.TABLE_NAME="KK_T_ADCHG"] |

**Block 2** — [IF] `adchg != null` (L668)

> Check if the address change record was found. Only proceed if the record exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adSwitchWayCd = adchg.getString(JBSbatKK_T_ADCHG.AD_SWITCH_WAY_CD)` // Extract the address switch method code [-> JBSbatKK_T_ADCHG.AD_SWITCH_WAY_CD="AD_SWITCH_WAY_CD"] |

**Block 3** — [IF] `"1".equals(adSwitchWayCd)` (L672)

> Check if the address switch method code equals "1", which indicates **manual** address change processing.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // adSwitchWayCd = "1" indicates manual processing [-> "1"=Manual] |

**Block 4** — [ELSE-IMPLICIT] `adchg != null` (L668)

> The address change record was found but the switch method code is not "1". Fall through to the final return.

| # | Type | Code |
|---|------|------|
| 1 | (implicit fall-through) | No manual flag set — the address change uses an automated routing method |

**Block 5** — [ELSE-IMPLICIT] `adchg == null` (L668)

> No address change record found for the given address change number. This means there is no manual address change to flag.

| # | Type | Code |
|---|------|------|
| 1 | (implicit fall-through) | No record exists — return default false |

**Block 6** — [RETURN] (L678)

> Default return for all non-manual or non-existent address change cases.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // Default: not manual |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `adchg_no` | Field | Address Change Number — unique identifier for an address change record |
| `ad_switch_way_cd` | Field | Address Switch Method Code — classification code indicating how the address change is routed (automated vs manual) |
| `KK_T_ADCHG` | Table | Address Change Master Table — stores master data for address change requests, including the switch method code |
| Manual | Business term | Address changes requiring manual operator intervention rather than automated system processing |
| `executeKK_T_ADCHG_PKSELECT` | Method | Primary Key Select helper — queries `KK_T_ADCHG` by `ADCHG_NO` using `selectByPrimaryKeys` |
| `db_KK_T_ADCHG` | Field | Database access interface for the Address Change Master table |
| JBSbatKK_T_ADCHG | Class | Address Change constant class — defines column names and metadata for the `KK_T_ADCHG` table fields |
| SOD | Acronym | Service Order Data — the broader service order processing domain this method operates within |
