# Business Logic — KKW02504SFLogic.actionUpdMyHPInfo() [147 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02504SF.KKW02504SFLogic` |
| Layer | Controller (Web Logic) |
| Module | `KKW02504SF` (Package: `eo.web.webview.KKW02504SF`) |

## 1. Role

### KKW02504SFLogic.actionUpdMyHPInfo()

This method implements the **My Homepage information update confirmation processing** for the K-Opticom customer self-service portal. It is the central routing entry point for handling changes and cancellations to a customer's My Homepage (home page) settings — specifically the web access account, URL, capacity, and access analysis configurations. The method operates as a **dispatch/routing pattern** that inspects the `trandiv` (processing division) field to determine whether the request is for a **change** (`OP_TRAN_DIV_CHGE`) or a **cancellation** (`OP_TRAN_DIV_DSL`), then delegates to the appropriate service chain (KKSV0008 for changes, KKSV0009 for cancellations).

For change requests, the method enforces business rule constraints: it prevents deletion of an existing homepage access URL (i.e., URL existing before change but missing after change is rejected), and it mandates that a URL be set for active service contracts. It performs DataBean data setup, upper-level mapping between service items and DataBean fields (in check-only mode), invokes the target service, and conditionally copies the migration timestamp from the service output map when the migration type is "deployment" or "addition."

For cancellation requests, the method similarly performs data setup, mapping, service invocation, and a read-back of the service contract DSL status via the mapper. After service processing, it inspects the return message ID to either display a business message to the user or set the next screen (KKW02505) for the confirmation screen transition. This method is always called after the user has pressed the update confirmation button on a preceding screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionUpdMyHPInfo()"])
    START --> INIT["Initialize: result=true, get beans, clear RTN_MSG_ID, read trandiv"]

    INIT --> COND_DIV{"Is trandiv = OP_TRAN_DIV_CHGE?"}

    COND_DIV -->|"Yes (Change)"| CHANGE_VALID["Validate: URL presence, URL after change required if service is active"]
    CHANGE_VALID --> CHANGE_DATA["setDataUpd()"]
    CHANGE_DATA --> CHANGE_RC{"setDataUpd() returns true?"}
    CHANGE_RC -->|"Yes"| CHANGE_MAP["setMappedKKSV0008(FUNC_CD_2)"]
    CHANGE_MAP --> CHANGE_INV["invokeService(KKSV0008, KKSV0008OP)"]
    CHANGE_INV --> CHANGE_IDO{"Is IDO_DIV = SINKI or TSUIKA?"}
    CHANGE_IDO -->|"Yes"| CHANGE_IDO_SET["Extract ido_dtm from outputMap KKSV000827SC, set to bean"]
    CHANGE_IDO_SET --> CHANGE_MSG["msgInfo[0] = MSGSTRING[0] (My Homepage Info Change)"]
    CHANGE_IDO -->|"No"| CHANGE_MSG
    CHANGE_RC -->|"No"| CHANGE_FAIL["setMessageInfo(EKB5370_NW), return true"]
    CHANGE_FAIL --> CHECK_MSG_ID

    COND_DIV -->|"No"| DSL_DIV{"Is trandiv = OP_TRAN_DIV_DSL?"}

    DSL_DIV -->|"Yes"| DSL_DATA["setDataDsl()"]
    DSL_DATA --> DSL_MAP["setMappedKKSV0009(FUNC_CD_2)"]
    DSL_MAP --> DSL_INV["invokeService(KKSV0009, KKSV0009OP)"]
    DSL_INV --> DSL_MAP2["KKSV0009_KKSV0009OPDBMapper.getOpsvckeiDslCC(paramBean, outputMap)"]
    DSL_MAP2 --> DSL_MSG["msgInfo[0] = MSGSTRING[1] (My Homepage Info Cancellation)"]
    DSL_MSG --> CHECK_MSG_ID

    DSL_DIV -->|"No"| UNKNOWN_DIV["Unknown trandiv"]
    UNKNOWN_DIV --> CHECK_MSG_ID

    CHECK_MSG_ID{"Is RTN_MSG_ID set?"}
    CHANGE_MSG --> CHECK_MSG_ID
    CHANGE_FAIL --> CHECK_MSG_ID

    CHECK_MSG_ID -->|"Yes"| MSG_GET["getMsgRep(trandiv, rtn_msg_id)"]
    MSG_GET --> MSG_NULL{"getMsgRep returns null?"}
    MSG_NULL -->|"Yes"| MSG_SET_ID["setMessageInfo(rtn_msg_id)"]
    MSG_NULL -->|"No"| MSG_SET_STR["setMessageInfo(rtn_msg_id, str)"]
    MSG_SET_ID --> END_LOG
    MSG_SET_STR --> END_LOG

    CHECK_MSG_ID -->|"No"| NEXT_SCREEN["Set next screen to KKW02505, setMessageInfo(EKB0370__I, msgInfo)"]
    NEXT_SCREEN --> END_LOG

    END_LOG["dumpDatabean() to log"] --> RETURN["Return result (true)"]
    RETURN --> END(["End"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no explicit parameters. It operates on instance-level state: the service form DataBean (`X31SDataBeanAccess`) retrieved via `super.getServiceFormBean()`, the common form DataBean via `super.getCommonInfoBean()`, and the class-level `outputMap` used for service communication. |
| - | `trandiv` (internal) | `String` | Processing division — extracted from the DataBean via `KKW02504SFConst.TRANDIV`. Determines whether the operation is a **change** (`OP_TRAN_DIV_CHGE`), **cancellation** (`OP_TRAN_DIV_DSL`), or unknown. Controls the entire branching flow. |
| - | `commoninfoBean` (internal) | `X31SDataBeanAccess` | Shared form DataBean used to set the next screen ID and screen name for navigation to KKW02505 (My Homepage update confirmation screen). |
| - | `bean` / `paramBean` (internal) | `X31SDataBeanAccess` | Service form DataBean containing user input for the My Homepage update, including account, URL, capacity, and operational service contract status fields. |
| - | `outputMap` (instance field) | `HashMap` | Class-level map used to receive output from invoked services (e.g., KKSV0008 service output for migration timestamp). |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAddSupportCC.setMessageInfo` | JKKAddSupportCC | - | Calls `setMessageInfo` to display an error when homepage access URL is removed during change |
| - | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Displays error/success messages on the screen across multiple error and success paths |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Gets/sets DataBean values throughout the method |
| R | `KKSV0009_KKSV0009OPDBMapper.getOpsvckeiDslCC` | KKSV0009_KKSV0009OPDBMapper | - | Reads back the operational service contract DSL status after cancellation service invocation |
| - | `KKW02504SFLogic.setDataUpd` | KKW02504SFLogic | - | Sets up DataBean fields for change processing (homepage account, URL, capacity, access analysis) |
| - | `KKW02504SFLogic.setDataDsl` | KKW02504SFLogic | - | Sets up DataBean fields for cancellation processing |
| - | `KKW02504SFLogic.setMappedKKSV0008` | KKW02504SFLogic | - | Maps service items to DataBean fields for KKSV0008 (change), check-only mode |
| - | `KKW02504SFLogic.setMappedKKSV0009` | KKW02504SFLogic | - | Maps service items to DataBean fields for KKSV0009 (cancellation), check-only mode |
| - | `KKW02504SFLogic.invokeService` | KKW02504SFLogic | - | Invokes the underlying service for KKSV0008 (change) or KKSV0009 (cancellation) |
| - | `KKW02504SFLogic.getMsgRep` | KKW02504SFLogic | - | Retrieves message representation for a given return message ID |
| - | `KKW02504SFLogic.dumpDatabean` | KKW02504SFLogic | - | Dumps DataBean state for logging |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKA14201SF | `actionUpdMyHPInfo` (button press handler for update confirmation) | `invokeService(KKSV0008, KKSV0008OP)` [U] My Homepage change; `invokeService(KKSV0009, KKSV0009OP)` [U] My Homepage cancellation; `getOpsvckeiDslCC` [R] Service contract DSL status |

**Caller details:** `KKA14201SFLogic.actionUpdMyHPInfo()` is called from the KKA14201SF screen logic after the user presses the update confirmation button. The caller first overwrites the DataBean with the updated values (`overwriteDataBeanForUpdCfm()`), then delegates to this method for change/cancellation confirmation processing. The method navigates to the confirmation screen KKW02505 or displays error messages depending on validation and service results.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialization (L499)

| # | Type | Code |
|---|------|------|
| 1 | SET | `result = true` // Initialize return flag |
| 2 | SET | `commoninfoBean = super.getCommonInfoBean()` // [SET] Acquire shared form DataBean access |
| 3 | SET | `bean = super.getServiceFormBean()` // [SET] Acquire service form DataBean access |
| 4 | SET | `paramBean = {bean}` // [SET] Wrap bean in array for service delegation |
| 5 | EXEC | `paramBean[0].sendMessageString(RTN_MSG_ID, DATABEAN_SET_VALUE, "")` // [CALL] Clear return message ID |
| 6 | SET | `trandiv = bean.sendMessageString(TRANDIV, DATABEAN_GET_VALUE)` // [CALL] Read processing division |
| 7 | SET | `msgInfo = new String[1]` // [SET] Message display buffer |

**Block 2** — [IF] `OP_TRAN_DIV_CHGE` (Processing division = Change) `(JKKCommonConst.OP_TRAN_DIV_CHGE.equals(trandiv))` (L514)

> If the processing division indicates a **change** operation, validate business rules before processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `accont_bf = bean.sendMessageString(HPAD_ACCOUNT, DATABEAN_GET_VALUE)` // [CALL] Get homepage access account before change |
| 2 | SET | `accont_af = bean.sendMessageString(CHG_HPAD_ACCOUNT, DATABEAN_GET_VALUE)` // [CALL] Get homepage access account after change |

**Block 2.1** — [IF] [Nested] URL exists before but not after (L520)

> OT-2013-0000144: Reject change if the homepage access URL exists before but is missing after.

| # | Type | Code |
|---|------|------|
| 1 | COND | `accont_bf != null && !"".equals(accont_bf)` // [SET] URL existed before change |
| 2 | COND | `accont_af == null || "".equals(accont_af)` // [SET] URL is missing after change |
| 3 | SET | `str = {"ホームページアドレス"}` // [SET] Placeholder text: "Homepage address" |
| 4 | CALL | `JCCWebCommon.setMessageInfo(this, EKB0010_TW, str)` // [SET] Display error: URL removal is not permitted |
| 5 | RETURN | `return true` // [RETURN] Exit with error displayed |

**Block 2.2** — [IF] [Nested] Active service requires URL set (L533)

> LT-2013-0000002: If the operational service contract status is NOT "active" (010), and no URL is set after change, reject the update.

| # | Type | Code |
|---|------|------|
| 1 | SET | `op_svc_kei_stat = bean.sendMessageString(OP_SVC_KEI_STAT, DATABEAN_GET_VALUE)` // [CALL] Read operational service contract status |
| 2 | COND | `!SVC_KEI_STAT_010.equals(op_svc_kei_stat) && (accont_af == null || "".equals(accont_af))` // [SET] Status is not 010 (active) AND URL not set |
| 3 | SET | `str = {"URL", "未設定", "変更"}` // [SET] Placeholder text: "URL", "Not set", "Change" |
| 4 | CALL | `JCCWebCommon.setMessageInfo(this, EKB1040_JW, str)` // [SET] Display error: URL is required after change |
| 5 | RETURN | `return true` // [RETURN] Exit with error displayed |

**Block 2.3** — [SET] DataBean setup for change (L541)

| # | Type | Code |
|---|------|------|
| 1 | SET | `rc = setDataUpd()` // [CALL] Set up DataBean fields for change processing |

**Block 2.4** — [IF] `setDataUpd()` succeeds (L543)

| # | Type | Code |
|---|------|------|
| 1 | COND | `rc` // [COND] DataBean setup returned true |
| 2 | CALL | `setMappedKKSV0008(FUNC_CD_2)` // [CALL] Map service items to DataBean fields (FUNC_CD_2 = check-only mode) |
| 3 | CALL | `invokeService("KKSV0008", "KKSV0008OP")` // [CALL] Invoke the change service |

**Block 2.5** — [IF] [Nested] Migration timestamp handling (L553, LT-2013-0000012)

> Migration timestamp synchronization for deployment (SINKI = "00001") or addition (TSUIKA = "00002") operations.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ido_div = paramBean[0].sendMessageString(IDO_DIV, DATABEAN_GET_VALUE)` // [CALL] Read migration division |
| 2 | COND | `IDO_DIV_SINKI.equals(ido_div) || IDO_DIV_TSUIKA.equals(ido_div)` // [COND] Migration = "00001" (Deployment) or "00002" (Addition) |
| 3 | SET | `parentMap = (HashMap) outputMap.get("KKSV000827SC")` // [SET] Retrieve service output map |
| 4 | EXEC | `paramBean[0].sendMessageString(IDO_DTM, DATABEAN_SET_VALUE, parentMap.get("ido_dtm"))` // [CALL] Set migration timestamp into bean |

| # | Type | Code |
|---|------|------|
| 5 | SET | `msgInfo[0] = MSGSTRING[0]` // ["My Homepage Info Change"] |

**Block 2.6** — [ELSE] `setDataUpd()` fails (L563)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, EKB5370_NW)` // [SET] Display error: data setup failed |
| 2 | RETURN | `return true` // [RETURN] Exit with error displayed |

**Block 3** — [ELSE-IF] `OP_TRAN_DIV_DSL` (Processing division = Cancellation) `(JKKCommonConst.OP_TRAN_DIV_DSL.equals(trandiv))` (L571)

> If the processing division indicates a **cancellation** operation, process the cancellation request.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setDataDsl()` // [CALL] Set up DataBean fields for cancellation processing |
| 2 | CALL | `setMappedKKSV0009(FUNC_CD_2)` // [CALL] Map service items to DataBean fields (FUNC_CD_2 = check-only mode) |
| 3 | CALL | `invokeService("KKSV0009", "KKSV0009OP")` // [CALL] Invoke the cancellation service |
| 4 | SET | `mapper9 = new KKSV0009_KKSV0009OPDBMapper()` // [SET] Create mapper for read-back |
| 5 | CALL | `mapper9.getOpsvckeiDslCC(paramBean, outputMap)` // [CALL] Read back operational service contract DSL status |
| 6 | SET | `msgInfo[0] = MSGSTRING[1]` // ["My Homepage Info Cancellation"] |

**Block 4** — [IF] Return message ID handling (L587)

> After all service processing branches, inspect the return message ID to decide whether to display a message or proceed to the next screen.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtn_msg_id = paramBean[0].sendMessageString(RTN_MSG_ID, DATABEAN_GET_VALUE)` // [CALL] Read return message ID set by service |
| 2 | COND | `rtn_msg_id != null && !"".equals(rtn_msg_id)` // [COND] Return message ID is set |

**Block 4.1** — [IF] [Nested] Message retrieval (L591)

| # | Type | Code |
|---|------|------|
| 1 | SET | `str = getMsgRep(trandiv, rtn_msg_id)` // [CALL] Get message representation with placeholder text |
| 2 | COND | `str == null` // [COND] No placeholder text needed |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, rtn_msg_id)` // [SET] Display message by ID only |

**Block 4.2** — [ELSE] [Nested] Message with placeholders (L597)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, rtn_msg_id, str)` // [SET] Display message with placeholder text |

**Block 4.3** — [ELSE] No return message ID — proceed to next screen (L602)

> If no message ID was returned, set the next screen to KKW02505 (the confirmation screen) and display a success message.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `commoninfoBean.sendMessageString(NEXT_SCREEN_ID, DATABEAN_SET_VALUE, SCREEN_ID_KKW02505)` // [SET] Set next screen ID |
| 2 | EXEC | `commoninfoBean.sendMessageString(NEXT_SCREEN_NAME, DATABEAN_SET_VALUE, SCREEN_NAME_KKW02505)` // [SET] Set next screen name |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, EKB0370__I, msgInfo)` // [SET] Display info message: "Change completed successfully" |

**Block 5** — [EXEC] Logging (L611)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JSYwebLog.println(DataBean_Dump, getClass(), dumpDatabean(), ...)` // [CALL] Dump DataBean state to log |

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return result` // [RETURN] Always returns `true` (the method never signals failure via return value; errors are communicated via displayed messages) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| My Homepage (ホームページ) | Business term | The customer's personal web page within the K-Opticom portal, including access account, URL, capacity, and access analysis settings |
| trandiv (処理区分) | Field | Processing division — classifies the type of operation: change (`OP_TRAN_DIV_CHGE`) or cancellation (`OP_TRAN_DIV_DSL`) |
| HPAD_ACCOUNT (ホームページアクセスアカウント) | Field | Homepage access account — the username/ID used to access the customer's homepage |
| CHG_HPAD_ACCOUNT (変更情報アカウント) | Field | Changed account — the new homepage access account after the update |
| OP_SVC_KEI_STAT (オプションサービス契約ステータス) | Field | Option service contract status — indicates whether the service is active (010) or otherwise |
| SVC_KEI_STAT_010 | Constant | Service contract status code "010" = Active service |
| IDO_DIV (異動区分) | Field | Migration division — classifies the type of migration/change: SINKI (deployment/downgrade) or TSUIKA (addition) |
| IDO_DIV_SINKI | Constant | Migration type "00001" = Deployment (service deployment or downgrade) |
| IDO_DIV_TSUIKA | Constant | Migration type "00002" = Addition (service addition) |
| IDO_DTM (異動年月日時刻分秒) | Field | Migration timestamp — date/time of the migration operation (year, month, day, hour, minute, second) |
| RTN_MSG_ID (返戻メッセージID) | Field | Return message ID — set by the service layer to communicate the result of processing to the screen |
| FUNC_CD_2 | Constant | Function code "2" = Check-only mode (validation without actual database commit) |
| KKW02505 | Screen constant | Next screen ID — the My Homepage update confirmation screen |
| KKSV0008 | Screen/Service | My Homepage change service — handles changes to homepage settings |
| KKSV0009 | Screen/Service | My Homepage cancellation service — handles cancellation of homepage settings |
| EKB0010_TW | Message constant | Error message: "Homepage address" removal is not permitted |
| EKB1040_JW | Message constant | Error message: URL is required (not set) for change |
| EKB5370_NW | Message constant | Error message: data setup failed |
| EKB0370__I | Message constant | Information message: operation completed successfully |
| MSGSTRING[0] | Constant | "My Homepage Info Change" — success message for change operations |
| MSGSTRING[1] | Constant | "My Homepage Info Cancellation" — success message for cancellation operations |
| setDataUpd() | Method | Sets up DataBean fields for change processing (account, URL, capacity, access analysis, pricing, etc.) |
| setDataDsl() | Method | Sets up DataBean fields for cancellation processing |
| setMappedKKSV0008() | Method | Maps service items to DataBean fields for KKSV0008 (change), check-only mode |
| setMappedKKSV0009() | Method | Maps service items to DataBean fields for KKSV0009 (cancellation), check-only mode |
| invokeService() | Method | Delegates to the underlying service layer (KKSV0008 or KKSV0009) for business processing |
| getOpsvckeiDslCC() | Method | Reads back the operational service contract DSL (cancellation) status from the database via mapper |
| OneStopDataBeanAccess | Class | Shared DataBean access class for the OneStop customer portal framework |
| X31SDataBeanAccess | Class | Service form DataBean access class carrying user input between screen and logic |
| JCCWebCommon | Class | Web common utility class for displaying messages on screen |
| JKKAddSupportCC | Class | Common component for adding support messages (e.g., error message display) |
| JSYwebLog | Class | Web logging utility for DataBean dump output |
| outputMap | Instance field | HashMap receiving output from invoked services (e.g., migration timestamp from KKSV0008) |
