# Business Logic — KKW02504SFLogic.getUpd_kind_url() [65 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02504SF.KKW02504SFLogic` |
| Layer | Service Logic (Web Layer — Logic class under webview package) |
| Module | `KKW02504SF` (Package: `eo.web.webview.KKW02504SF`) |

## 1. Role

### KKW02504SFLogic.getUpd_kind_url()

This method performs a **change-kind determination for the URL display routing** on the My Home Page information update screen. It compares the account value displayed to the user before any modifications (`accont_bf`, retrieved from the pre-change account field) against the account value currently entered in the form (`accont_af`, retrieved from the change-information account field). Based on whether these two values differ, the method returns a URL routing code that dictates which update workflow the user should be directed to.

The method handles two service categories by comparing account-level data: **Home Page capacity** (HP — ホーページ容量) and the broader **My Home Page** (My HP — マイホームページ) service context. It implements a **conditional routing / dispatch pattern**, where the return value determines which downstream URL path the screen logic will follow — effectively deciding whether the user needs a standard update flow or a special-change flow.

The return codes map to two distinct business outcomes: `UPD_URL_U` (`"1"`) signals that a change **exists** and the user must follow an update-differentiated URL path, while `UPD_URL_M` (`"5"`) signals **no change**, meaning the user can remain on or be routed to the standard display URL. This method plays the role of a **pre-submit gatekeeper** within the My Home Page information change flow — it is called during data setup (`setDataUpd()`) to determine the correct URL to return to the screen, ensuring users are not directed down a change-processing path when they have not actually modified their account information.

The method has four control-flow branches covering all combinations of null/empty pre-change and post-change values: (1) pre-change is populated and matches post-change → no change, (2) pre-change is populated and differs from post-change → change detected, (3) pre-change is null and post-change is null/empty → no change, (4) pre-change is null and post-change is populated → change detected. A commented-out legacy version from revision v4.06 (OT-2013-0000144) reveals that the current null-handling logic was introduced to properly condition URL routing when the pre-change account value is absent.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getUpd_kind_url"])

    getBean["Get X31SDataBeanAccess bean from super"]
    getBf["accont_bf = bean.sendMessageString(HPAD_ACCOUNT, DATABEAN_GET_VALUE)"]
    getAf["accont_af = bean.sendMessageString(CHG_HPAD_ACCOUNT, DATABEAN_GET_VALUE)"]

    cond1{"accont_bf is not null
and not empty"}
    cond2{"accont_bf equals accont_af"}
    cond3{"accont_af is null or empty"}

    retNoChange["Return UPD_URL_M = 5
No Change"]
    retChange["Return UPD_URL_U = 1
Change Exists"]
    retNoChange2["Return UPD_URL_M = 5
No Change"]
    retChange2["Return UPD_URL_U = 1
Change Exists"]

    END(["End"])

    START --> getBean
    getBean --> getBf
    getBf --> getAf
    getAf --> cond1
    cond1 -->|true| cond2
    cond2 -->|true| retNoChange
    cond2 -->|false| retChange
    cond1 -->|false| cond3
    cond3 -->|true| retNoChange2
    cond3 -->|false| retChange2
    retNoChange --> END
    retChange --> END
    retNoChange2 --> END
    retChange2 --> END
```

**Constant Resolution:**
- `KKW02504SFConst.HPAD_ACCOUNT` = `"ホームページアクセスアカウント"` (Home Page Access Account) — the key used to retrieve the account value as it existed before any modifications on the screen.
- `KKW02504SFConst.CHG_HPAD_ACCOUNT` = `"変更情報アクセスアカウント"` (Change Information Access Account) — the key used to retrieve the account value currently entered by the user.
- `X31CWebConst.DATABEAN_GET_VALUE` = standard data bean accessor constant for reading field values from the form bean.
- `UPD_URL_U` = `"1"` (Change Exists / 変更あり) — returned when the account value has been modified.
- `UPD_URL_M` = `"5"` (No Change / 変更なし) — returned when the account value is unchanged from its original state.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on the server-side form bean state, which is accessed via the inherited `super.getServiceFormBean()` method. |

**Instance Fields / External State Read:**
| Source | Description |
|--------|-------------|
| `super.getServiceFormBean()` (from `JCCWebBusinessLogic`) | Returns the `X31SDataBeanAccess` form bean containing all screen field values for the My Home Page information update screen. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `OneStopDataBeanAccess.sendMessageString` | - | - | Reads field values from the server-side form data bean. Retrieves `accont_bf` (pre-change account) and `accont_af` (post-change account) by key. |

**Detailed Analysis:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `X31SDataBeanAccess.sendMessageString` | - | Form Bean (in-memory) | Reads the pre-change Home Page access account value from the data bean using key `HPAD_ACCOUNT` ("ホームページアクセスアカウント"). This retrieves the original value as stored before the user made any edits on the update screen. |
| R | `X31SDataBeanAccess.sendMessageString` | - | Form Bean (in-memory) | Reads the current (post-change) Home Page access account value from the data bean using key `CHG_HPAD_ACCOUNT` ("変更情報アクセスアカウント"). This retrieves what the user has typed/entered in the form field. |

**Classification Rationale:**
Both operations are classified as **Read (R)** because `sendMessageString` with `DATABEAN_GET_VALUE` is a getter pattern — it extracts string values from the in-memory form bean without persisting anything to the database. No SC/CBS service components or database tables are directly invoked by this method.

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: `KKW02504SFLogic.setDataUpd()` | `setDataUpd()` -> `getUpd_kind_url()` | `sendMessageString` [R] Form Bean (in-memory data bean) |

**Caller Analysis:**
The sole caller is `KKW02504SFLogic.setDataUpd()`, a same-class method within the same logic class. This indicates `getUpd_kind_url()` is an internal utility method used during the data setup phase of the My Home Page information update screen. It is not called from a screen entry point directly (no `KKSV*` class) nor from a batch process.

## 6. Per-Branch Detail Blocks

**Block 1** — SET (Initialize bean) (L1331)

> Obtain the server-side form data bean access object to read screen field values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get X31SDataBeanAccess from parent class // -> SUPER.getMethod |

**Block 2** — SET (Retrieve pre-change account) (L1334)

> Read the account value as it existed before the user made any modifications. Japanese comment: サフォームBeanのデータBeanアクセスを取得。 (Get the Service Form Bean's Data Bean access.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `accont_bf = bean.sendMessageString(KKW02504SFConst.HPAD_ACCOUNT, X31CWebConst.DATABEAN_GET_VALUE)` // -> KKW02504SFConst.HPAD_ACCOUNT = "ホームページアクセスアカウント" (Home Page Access Account) // -> X31CWebConst.DATABEAN_GET_VALUE |
| 2 | EXEC | `bean.sendMessageString(...)` // Read from form bean in-memory data store |

**Block 3** — SET (Retrieve post-change account) (L1336)

> Read the account value currently entered by the user in the update form. Japanese comment: 変更情報アカウント (Change Information Account).

| # | Type | Code |
|---|------|------|
| 1 | SET | `accont_af = bean.sendMessageString(KKW02504SFConst.CHG_HPAD_ACCOUNT, X31CWebConst.DATABEAN_GET_VALUE)` // -> KKW02504SFConst.CHG_HPAD_ACCOUNT = "変更情報アクセスアカウント" (Change Information Access Account) |
| 2 | EXEC | `bean.sendMessageString(...)` // Read from form bean in-memory data store |

**Block 4** — IF (Pre-change account is non-null and non-empty) (L1339)

> Japanese comment: 変更前アカウントと変更情報アカウントを比較 (Compare pre-change account and change information account). OT-2013-0000144 branch — revised URL condition logic.

| # | Type | Code |
|---|------|------|
| 1 | IF | `null != accont_bf && !"".equals(accont_bf)` // Pre-change account is populated (not null and not empty string) |

**Block 4.1** — IF-THEN (Accounts match) (L1341)

> Japanese comment: 変更前アカウントが NULL でなく、変更情報アカウントが変更前アカウントと同じ (Pre-change account is not NULL, and change information account is the same as pre-change account).

| # | Type | Code |
|---|------|------|
| 1 | IF | `accont_bf.equals(accont_af)` // Compare the two account strings for equality |
| 2 | RETURN | `return UPD_URL_M` // -> UPD_URL_M = "5" // Japanese: 変更なし (No Change) |

**Block 4.2** — IF-ELSE (Accounts differ) (L1347)

> Japanese comment: 変更前アカウントが NULL でなく、変更情報アカウントが変更前アカウントと異なる (Pre-change account is not NULL, and change information account differs from pre-change account).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return UPD_URL_U` // -> UPD_URL_U = "1" // Japanese: 変更あり (Change Exists) |

**Block 5** — ELSE (Pre-change account is null or empty) (L1354)

> The pre-change account value is absent — the user is either viewing the form for the first time or the original value was not set.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | `// accont_bf is null or empty` |

**Block 5.1** — IF-THEN (Post-change account is also null/empty) (L1356)

> Japanese comment: 変更前アカウントが NULL で、変更情報アカウントが NULL (Pre-change account is NULL, and change information account is NULL).

| # | Type | Code |
|---|------|------|
| 1 | IF | `null == accont_af || "".equals(accont_af)` // Both pre and post are null/empty |
| 2 | RETURN | `return UPD_URL_M` // -> UPD_URL_M = "5" // Japanese: 変更なし (No Change) |

**Block 5.2** — IF-ELSE (Post-change account is populated) (L1361)

> Japanese comment: 変更前アカウントが NULL で、変更情報アカウントが NULL でない (Pre-change account is NULL, and change information account is not NULL).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return UPD_URL_U` // -> UPD_URL_U = "1" // Japanese: 変更あり (Change Exists) |

**Block 6** — COMMENTED LEGACY CODE (L1371–L1392)

> Japanese comment markers: OT-2013-0000144 DS/AE (old logic before revision v4.06). Commented out code that used a different null-check order (`accont_bf != null` first, then a nested check for `accont_bf == null` inside the else). The current implementation (Blocks 4-5) is the revised logic that correctly handles all four combinations of null/empty pre-change and post-change account values.

| # | Type | Code |
|---|------|------|
| 1 | COMMENT | `// OT-2013-0000144 DS` — Legacy code block, commented out since v4.06 |
| 2 | COMMENT | Commented IF/ELSE branches with original null-check ordering |
| 3 | COMMENT | `// OT-2013-0000144 DE` — End of legacy block |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `accont_bf` | Field | Pre-change account value — the account string as it existed before the user made any edits on the update screen |
| `accont_af` | Field | Post-change (after) account value — the account string currently entered by the user in the form |
| `UPD_URL_U` | Constant | Update-URL code "1" — signals "Change Exists" (変更あり); directs user to a URL for processing a change |
| `UPD_URL_M` | Constant | Update-URL code "5" — signals "No Change" (変更なし); directs user to a standard display URL |
| `HPAD_ACCOUNT` | Constant | "ホームページアクセスアカウント" (Home Page Access Account) — the data bean key for the original account value |
| `CHG_HPAD_ACCOUNT` | Constant | "変更情報アクセスアカウント" (Change Information Access Account) — the data bean key for the user-entered account value |
| `DATABEAN_GET_VALUE` | Constant | Standard X31CWebConst for reading field values from the server-side data bean |
| `X31SDataBeanAccess` | Class | Fujuno (Fujitsu) X31 framework class providing access to the server-side form data bean |
| `JCCWebBusinessLogic` | Class | Parent class of KKW02504SFLogic; provides inherited methods like `getServiceFormBean()` |
| My Home Page (My HP) | Business term | マイホームページ — K-Opticom's self-service portal where customers manage their home page settings, capacity, and access account |
| Home Page (HP) | Business term | ホームページ — The customer-facing web page managed through the My Home Page service; includes capacity and access settings |
| HP Capacity | Business term | ホームページ容量 — The storage/data allocation limit for a customer's Home Page |
| Access Analysis | Business term | アクセス分析 — A service that provides web traffic/statistics analysis for the customer's Home Page |
| `sendMessageString` | Method | OneStopDataBeanAccess method to send a command string to the data bean and retrieve a String value by key |
| v4.06 (OT-2013-0000144) | Version | The software revision (v4.06) that introduced the current null-safe URL routing logic, replacing the commented-out legacy code |
| `setDataUpd()` | Method | A same-class caller method that sets up update data; calls `getUpd_kind_url()` to determine the correct URL routing |
| `KKW02504SF` | Module | My Home Page Information Change — the screen module for updating My Home Page settings |
