# Business Logic — KKW02501SFLogic.storeDataBeanInitsrv() [277 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02501SF.KKW02501SFLogic` |
| Layer | Service Component (Logic tier — WebWebView module) |
| Module | `KKW02501SF` (Package: `eo.web.webview.KKW02501SF`) |

## 1. Role

### KKW02501SFLogic.storeDataBeanInitsrv()

This method performs the **initial data storage processing** (初期表示Data保存処理) for the E-Mail Update screen (KKW02501SF), which is the screen used to modify, cancel, reactivate, or reserve-cancel E-Mail-related optional service settings. The E-Mail Update screen is accessed from the Optional Service Contract Inquiry screen (KKSV0043) and allows operators to manage E-Mail address, E-Mail alias, mailbox capacity, and antivirus (Virus Check) settings for customer contracts.

The method implements a **data accumulation and routing pattern**. First, it maps (accumulates) core screen data by invoking 12 sequential service calls via `KKSV0427_KKSV0427OPDBMapper` — each call retrieves a specific category of optional service information: E-Mail address (01), E-Mail alias (04), mailbox capacity (06), and Virus Check (08), among others. It then performs **screen data preparation** by parsing email addresses into account and domain components, determining whether the customer has an antivirus check subscription based on the existence of a sub service contract number, and preparing virus check and capacity dropdown display indices.

The method further implements a **processing-division-based routing pattern** by branching on the `TRAN_DIV` (processing division) field retrieved from the DataBean. For Cancellation (`04`), it splits the operation date into year/month/day fields. For Change (`03`), it populates pre-change values (email alias, capacity dropdown matching, virus check dropdown matching) for editing. For Inquiry (`00`), Reactivation (`05`), and Res-Cancel (`06`), it simply displays the service end date. Finally, it determines the **charge display flag** (`CHRG_UM_DSP_FLG`) by checking whether the contract status is not in a billing-exempt state and whether the service start post-price-calculation date falls within a chargeable period relative to the operation date.

The method serves as the **shared entry-point data initialization routine** called from both `actionClear()` (clear/reset flow) and `actionInit()` (normal initialization flow), making it the central orchestrator for all initial data population on the E-Mail Update screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeDataBeanInitsrv(paramBean, outputMap)"])
    CHECK_NULL["Check outputMap != null"]
    MAPPER["Create KKSV0427_KKSV0427OPDBMapper"]
    MAP_CALLS["Call getKKSV042701SC through getKKSV042714SC<br/>12 OPDBMapper service calls"]
    SET_SBOP["setSbopInf(paramBean)"]
    CALC_MAILBOX["calclulateMailBoxCapacities(paramBean[0])"]
    GET_MAIL_ADDR["Get mailAddress from DataBean"]
    GET_KIBO_ML["Get kibo_ml_account_1 from DataBean"]
    MAIL_EXIST["mailAddress not null and not empty?"]
    PARSE_EMAIL["Parse account and domain from mailAddress"]
    SET_NO_DISP["Set KIBO_ML_ACCOUNT_DISP_FLG = 0 (not displayed)"]
    SET_DISP["Set KIBO_ML_ACCOUNT_DISP_FLG = 1 (displayed)"]
    SET_ACCOUNT["Set MLAD_ACCOUNT and MLAD_DOMAIN"]
    GET_SBOP_CHK["Get sbop_svckei_no_d03<br/>(Sub service contract # for Virus Check)"]
    SBOP_NULL["sbop_svckei_no_vchk empty?"]
    SET_VIRUS_NO["Set CHGBF_VIRUS_CHK_FLG = OFF, VIRUS_CHK = No"]
    SET_VIRUS_YES["Set CHGBF_VIRUS_CHK_FLG = ON, VIRUS_CHK = Yes"]
    GET_TRAN_DIV["Get trans_div (Processing division)"]
    DIV_DSL["trans_div = 04 (Cancellation)"]
    GET_UNYO["Get unyo_ymd (Operation date)"]
    CHECK_LEN["unyo_ymd valid (8 chars)?"]
    SPLIT_DATE["Split unyo_ymd into year, month, day fields"]
    DIV_CHGE["trans_div = 03 (Change)"]
    SET_SVC_END["Set USE_ENDYMD from SVC_END_YMD"]
    SET_CHGAF_MLAD["Set CHGAF_MLAD_ACCOUNT_O (pre-change email display)"]
    SET_CHGAF_ALIAS["Set CHGAF_ALIAS_O (pre-change email alias)"]
    BUILD_CAPA_DD["Build capacity dropdown list<br/>from mlbox_op_list"]
    MATCH_CAPA["Select matching index for current capacity"]
    SET_VCHK_DD["Build virus check dropdown and set index"]
    DIV_OTHER["trans_div = 00/05/06<br/>(Inquiry/Reactivation/Res-Cancel)"]
    SET_END_YMD["Set USE_ENDYMD from SVC_END_YMD"]
    CHARGE_CHK["Determine CHRG_UM_DSP_FLG (charge display flag)"]
    FINE_CAPA["fineCapa(CAPA_BF) and format capacity"]
    END_NODE(["Return"])
    START --> CHECK_NULL
    CHECK_NULL -->|Yes| MAPPER
    CHECK_NULL -->|No| END_NODE
    MAPPER --> MAP_CALLS
    MAP_CALLS --> SET_SBOP
    SET_SBOP --> CALC_MAILBOX
    CALC_MAILBOX --> GET_MAIL_ADDR
    GET_MAIL_ADDR --> MAIL_EXIST
    MAIL_EXIST -->|True| PARSE_EMAIL
    MAIL_EXIST -->|False| SET_DISP
    PARSE_EMAIL --> SET_NO_DISP
    SET_NO_DISP --> SET_ACCOUNT
    SET_DISP --> SET_ACCOUNT
    SET_ACCOUNT --> GET_SBOP_CHK
    GET_SBOP_CHK --> SBOP_NULL
    SBOP_NULL -->|True| SET_VIRUS_NO
    SBOP_NULL -->|False| SET_VIRUS_YES
    SET_VIRUS_NO --> GET_TRAN_DIV
    SET_VIRUS_YES --> GET_TRAN_DIV
    GET_TRAN_DIV --> DIV_DSL
    DIV_DSL --> GET_UNYO
    GET_UNYO --> CHECK_LEN
    CHECK_LEN -->|True| SPLIT_DATE
    CHECK_LEN -->|False| DIV_CHGE
    SPLIT_DATE --> DIV_CHGE
    DIV_CHGE --> SET_SVC_END
    SET_SVC_END --> SET_CHGAF_MLAD
    SET_CHGAF_MLAD --> SET_CHGAF_ALIAS
    SET_CHGAF_ALIAS --> BUILD_CAPA_DD
    BUILD_CAPA_DD --> MATCH_CAPA
    MATCH_CAPA --> SET_VCHK_DD
    SET_VCHK_DD --> DIV_OTHER
    DIV_OTHER --> SET_END_YMD
    SET_END_YMD --> CHARGE_CHK
    CHARGE_CHK --> FINE_CAPA
    FINE_CAPA --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | Array of data bean access objects representing the E-Mail Update screen's form data. Contains all fields displayed/edited on the screen including email address, alias, mailbox capacity, virus check settings, service contract numbers, processing division, operation date, and service end date. The first element (`paramBean[0]`) is the primary data bean used for all getters/setters. |
| 2 | `outputMap` | `HashMap<String, Object>` | Output information map from the service layer. Used as a source for the `KKSV0427_KKSV0427OPDBMapper` service calls that retrieve optional service contract data. If `null`, the method returns immediately without processing (guard clause). |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `CD00002_ON` / `CD00002_OFF` | `String` ("1" / "0") | Hardcoded on/off flag codes used to set the pre-change virus check flag. |
| `KIBO_ML_ACCOUNT_DISP_FLG_MI` / `KIBO_ML_ACCOUNT_DISP_FLG_DISP` | `String` ("0" / "1") | Hardcoded flags controlling whether the preferred email account is displayed (1) or hidden (0) on the screen. |
| `SLKSV0427_KKSV0427OPDBMapper` | Class | Mapper used to delegate to 12 OPDBMapper service methods for reading optional service data. |
| `setSbopInf()` / `calclulateMailBoxCapacities()` / `fineCapa()` | Methods | Instance helper methods called within this method to set sub optional service info, calculate mailbox capacities, and refine capacity values. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042701SC` | KKSV042701SC | - | Retrieves E-Mail address information for the optional service contract (initial screen data) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042704SC` | KKSV042704SC | - | Retrieves E-Mail alias information for the optional service contract (initial screen data) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042706SC` | KKSV042706SC | - | Retrieves mailbox capacity information for the optional service contract (initial screen data) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042708SC` | KKSV042708SC | - | Retrieves Virus Check information for the optional service contract (initial screen data) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042710SC` | KKSV042710SC | - | Retrieves additional optional service info (service start/post-fee calculation) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042711SC` | KKSV042711SC | - | Retrieves additional optional service info |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042712SC` | KKSV042712SC | - | Retrieves additional optional service info |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042713SC` | KKSV042713SC | - | Retrieves additional optional service info (added in v4.00, ANK-0364) |
| R | `KKSV0427_KKSV0427OPDBMapper.getKKSV042714SC` | KKSV042714SC | - | Retrieves Virus Check non-charge registration info (added in v4.00, ANK-0364) |
| - | `KKW02501SFLogic.setSbopInf` | - | - | Sets sub optional service information into the DataBean |
| - | `KKW02501SFLogic.calclulateMailBoxCapacities` | - | - | Calculates and returns a TreeMap of mailbox capacity options (value → label mapping) |
| - | `fineCapa` | - | - | Refines and formats the pre-change mailbox capacity value |
| - | `X31SDataBeanAccess.sendMessageString` (getter) | - | - | Reads DataBean field values (mailAddress, kibo_ml_account, sbop_svckei_no_vchk, trans_div, unyo_ymd, svc_end_ymd, chgbf_virus_chk_flg, op_svc_kei_stat, svc_sta_af_prc_calc_ymd, capa, capa_bf) |
| - | `X31SDataBeanAccess.sendMessageString` (setter) | - | - | Writes DataBean field values (account, domain, chgbf_virus_chk_flg, virus_chk, use_endymd fields, etc.) |
| - | `X31SDataBeanAccess.sendMessageBoolean` | - | - | Writes `chrg_um_dsp_flg` boolean to the DataBean |
| - | `X31SDataBeanAccess.getDataBeanArray` | - | - | Retrieves DataBean array instances for `MAIL_CAPA_INFO` and `VIRUS_CHK_INFO` |
| - | `X31SDataBeanAccessArray.getDataBean` | - | - | Retrieves the first element (index 0) from a DataBeanArray for dropdown population |
| - | `X31SDataBeanAccess.sendMessage` (clear) | - | - | Clears code list and code name list fields for dropdown reset |
| - | `X31SDataBeanAccess.sendMessageString` (addValue) | - | - | Appends values to dropdown code and label lists |
| - | `JPCDateUtil.subtractDay` | - | - | Calculates the difference in days between `svc_sta_af_prc_calc_ymd` and `unyo_ymd` |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic:KKW02501SFLogic.actionClear | `KKW02501SFLogic.actionClear()` → `KKW02501SFLogic.storeDataBeanInitsrv` | `getKKSV042701SC` [R] - , `setSbopInf` [-] , `sendMessageString` [-] , `fineCapa` [-] |
| 2 | Logic:KKW02501SFLogic.actionInit | `KKW02501SFLogic.actionInit()` → `KKW02501SFLogic.storeDataBeanInitsrv` | `getKKSV042701SC` [R] - , `setSbopInf` [-] , `sendMessageString` [-] , `fineCapa` [-] |

The `KKW02501SFLogic` class represents the screen logic component for the E-Mail Update screen (KKW02501SF). Both `actionClear()` (for clear/reset flows) and `actionInit()` (for normal initialization) delegate to `storeDataBeanInitsrv()` as their primary data initialization routine. No independent batch or external screen entry points call this method directly — it is exclusively invoked from within the same logic class.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `outputMap != null` (L1016)

> Guard clause: all processing is skipped if `outputMap` is null. The mapper initialization and data mapping are only executed when the output map is present.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapper = new KKSV0427_KKSV0427OPDBMapper()` // Create OPDBMapper instance [-> KKSV0427_KKSV0427OPDBMapper] |
| 2 | CALL | `mapper.getKKSV042701SC(paramBean, outputMap)` // Retrieve E-Mail address info [KKSV042701SC] |
| 3 | CALL | `mapper.getKKSV042702SC(paramBean, outputMap)` // Retrieve optional service info [KKSV042702SC] |
| 4 | CALL | `mapper.getKKSV042703SC(paramBean, outputMap)` // Retrieve optional service info [KKSV042703SC] |
| 5 | CALL | `mapper.getKKSV042704SC(paramBean, outputMap)` // Retrieve E-Mail alias info [KKSV042704SC] |
| 6 | CALL | `mapper.getKKSV042705SC(paramBean, outputMap)` // Retrieve optional service info [KKSV042705SC] |
| 7 | CALL | `mapper.getKKSV042706SC(paramBean, outputMap)` // Retrieve mailbox capacity info [KKSV042706SC] |
| 8 | CALL | `mapper.getKKSV042708SC(paramBean, outputMap)` // Retrieve Virus Check info [KKSV042708SC] |
| 9 | CALL | `mapper.getKKSV042710SC(paramBean, outputMap)` // Retrieve service start/post-fee calc info [KKSV042710SC] |
| 10 | CALL | `mapper.getKKSV042711SC(paramBean, outputMap)` // Retrieve additional optional service info [KKSV042711SC] |
| 11 | CALL | `mapper.getKKSV042712SC(paramBean, outputMap)` // Retrieve additional optional service info [KKSV042712SC] |
| 12 | CALL | `mapper.getKKSV042713SC(paramBean, outputMap)` // Additional service info (v4.00 ANK-0364) [KKSV042713SC] |
| 13 | CALL | `mapper.getKKSV042714SC(paramBean, outputMap)` // Virus Check non-charge registration (v4.00 ANK-0364) [KKSV042714SC] |
| 14 | CALL | `setSbopInf(paramBean)` // Set sub optional service information [v6.03 ADD] |
| 15 | CALL | `calclulateMailBoxCapacities(paramBean[0])` // Calculate mailbox capacity options [-> TreeMap<Integer, String> mlbox_op_list] |
| 16 | SET | `mlboxMap = mlbox_op_list.entrySet()` // Extract entry set for iteration [-> Set<Entry<Integer, String>> mlboxMap] |
| 17 | EXEC | `mailAddress = paramBean[0].sendMessageString(KKW02501SFConst.MLAD, X31CWebConst.DATABEAN_GET_VALUE)` // Get current email address [-> MLAD="メールアドレス"] |
| 18 | EXEC | `kibo_ml_account = paramBean[0].sendMessageString(KKW02501SFConst.KIBO_ML_ACCOUNT_1, X31CWebConst.DATABEAN_GET_VALUE)` // Get preferred email account [-> KIBO_ML_ACCOUNT_1="希望メールアドレス1"] |
| 19 | SET | `account = ""` // Initialize account string |
| 20 | SET | `domain = ""` // Initialize domain string |
| 21 | EXEC | `sbop_svckei_no_vchk = paramBean[0].sendMessageString(KKW02501SFConst.SBOP_SVC_KEI_NO_D03, X31CWebConst.DATABEAN_GET_VALUE)` // Get sub service contract # for Virus Check [-> SBOP_SVC_KEI_NO_D03="サブオプションサービス契約番号（ウイルスチェック用）"] |

**Block 1.1** — [IF] `mailAddress != null && !("".equals(mailAddress))` (L1053)

> If the customer has an existing email address, parse it into account and domain components, and set the preferred email account display flag to "not displayed" (0). This means the operator sees the system-assigned email, not a user-preferred one.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `account = getEmailAccountStr(mailAddress)` // Extract the account portion from email address |
| 2 | EXEC | `domain = mailAddress.substring(account.length())` // Extract the domain portion (everything after the account) |
| 3 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.KIBO_ML_ACCOUNT_DISP_FLG, X31CWebConst.DATABEAN_SET_VALUE, KIBO_ML_ACCOUNT_DISP_FLG_MI)` // Set display flag to "not displayed" [-> KIBO_ML_ACCOUNT_DISP_FLG_MI="0"] |

**Block 1.2** — [ELSE] (L1064)

> If the customer has no existing email address, the preferred email account should be displayed. Set the display flag to "displayed" (1) and use the preferred account as the account value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `account = kibo_ml_account` // Use preferred email account as the account |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.KIBO_ML_ACCOUNT_DISP_FLG, X31CWebConst.DATABEAN_SET_VALUE, KIBO_ML_ACCOUNT_DISP_FLG_DISP)` // Set display flag to "displayed" [-> KIBO_ML_ACCOUNT_DISP_FLG_DISP="1"] |

**Block 1.3** — Processing after email branch (L1071)

> Write the parsed account and domain to the DataBean fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.MLAD_ACCOUNT, X31CWebConst.DATABEAN_SET_VALUE, account)` // Set email address account [-> MLAD_ACCOUNT="メールアドレスアカウント"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.MLAD_DOMAIN, X31CWebConst.DATABEAN_SET_VALUE, domain)` // Set email address domain [-> MLAD_DOMAIN="メールアドレスドメイン"] |

**Block 1.4** — [IF] `sbop_svckei_no_vchk == null || "".equals(sbop_svckei_no_vchk)` (L1079)

> If no sub service contract number exists for Virus Check, the customer does NOT have Virus Check. Set the pre-change virus check flag to OFF and display "No" for virus check.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_VIRUS_CHK_FLG, X31CWebConst.DATABEAN_SET_VALUE, CD00002_OFF)` // Set virus check flag to OFF [-> CD00002_OFF="0"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.VIRUS_CHK, X31CWebConst.DATABEAN_SET_VALUE, "無")` // Display "No" for virus check [-> VIRUS_CHK="ウイルスチェック"] |

**Block 1.5** — [ELSE] (L1086)

> The sub service contract number exists, so the customer HAS Virus Check. Set the flag to ON and display "Yes".

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_VIRUS_CHK_FLG, X31CWebConst.DATABEAN_SET_VALUE, CD00002_ON)` // Set virus check flag to ON [-> CD00002_ON="1"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.VIRUS_CHK, X31CWebConst.DATABEAN_SET_VALUE, "有")` // Display "Yes" for virus check |

**Block 1.6** — Get processing division and branch (L1108)

> Read the `TRAN_DIV` field to determine the type of operation being performed, then branch accordingly.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `trans_div = paramBean[0].sendMessageString(KKW02501SFConst.TRAN_DIV, X31CWebConst.DATABEAN_GET_VALUE)` // Get processing division [-> TRAN_DIV="処理区分"] |

**Block 1.6.1** — [IF] `JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div)` (L1111)

> Processing division = "04" (Cancellation / 解約). Parse the operation date (`UNYO_YMD`) into separate year, month, and day fields. The date must be exactly 8 characters (YYYYMMDD format).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `unyo_ymd = paramBean[0].sendMessageString(KKW02501SFConst.UNYO_YMD, X31CWebConst.DATABEAN_GET_VALUE)` // Get operation date [-> UNYO_YMD="運用年月日"] |
| 2 | EXEC | (condition check below) |

**Block 1.6.1.1** — [IF] `unyo_ymd != null && !("".equals(unyo_ymd)) && 8 == unyo_ymd.length()` (L1118)

> The operation date is valid (non-null, non-empty, and exactly 8 characters). Extract year, month, and day substrings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.USE_ENDYMD_YEAR, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(0, 4))` // Year [-> USE_ENDYMD_YEAR="利用終了日（年）"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.USE_ENDYMD_MON, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(4, 6))` // Month [-> USE_ENDYMD_MON="利用終了日（月）"] |
| 3 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.USE_ENDYMD_DAY, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(6, 8))` // Day [-> USE_ENDYMD_DAY="利用終了日（日）"] |

**Block 1.6.2** — [ELSE IF] `JKKCommonConst.OP_TRAN_DIV_CHGE.equals(trans_div)` (L1137)

> Processing division = "03" (Change / 更新). This is the most complex branch: it prepares the screen for editing by setting pre-change values and populating dropdown lists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.USE_ENDYMD, X31CWebConst.DATABEAN_SET_VALUE, paramBean[0].sendMessageString(KKW02501SFConst.SVC_END_YMD, X31CWebConst.DATABEAN_GET_VALUE))` // Set service end date [-> USE_ENDYMD="利用終了日", SVC_END_YMD="サービス終了年月日"] |
| 2 | SET | `subDatabean = null` // Initialize sub data bean reference |
| 3 | SET | `pulldown_list = null` // Initialize pulldown list reference |
| 4 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGAF_MLAD_ACCOUNT_O, X31CWebConst.DATABEAN_SET_VALUE, account)` // Set pre-change email account for display [-> CHGAF_MLAD_ACCOUNT_O="変更後メールアドレスアカウント（画面表示用）"] |
| 5 | EXEC | `alias_bf = paramBean[0].sendMessageString(KKW02501SFConst.ALIAS, X31CWebConst.DATABEAN_GET_VALUE)` // Get current email alias [-> ALIAS="メールエイリアス"] |
| 6 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGAF_ALIAS_O, X31CWebConst.DATABEAN_SET_VALUE, alias_bf)` // Set pre-change email alias for display [-> CHGAF_ALIAS_O="変更後メールエイリアス（画面表示用）"] |
| 7 | SET | `selectedInd = null` // Initialize selected index |
| 8 | EXEC | `pulldown_list = paramBean[0].getDataBeanArray(KKW02501SFConst.MAIL_CAPA_INFO)` // Get mailbox capacity DataBeanArray [-> MAIL_CAPA_INFO="メールBOX容量情報"] |
| 9 | EXEC | `subDatabean = pulldown_list.getDataBean(0)` // Get first DataBean element |
| 10 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_CAPA_IDX, X31CWebConst.DATABEAN_SET_VALUE, subDatabean.sendMessageString(KKW02501SFConst.INDEX_04, X31CWebConst.DATABEAN_GET_VALUE))` // Set capacity dropdown index [-> CHGBF_CAPA_IDX="変更前メールBOX容量インデックス"] |
| 11 | EXEC | `capa = paramBean[0].sendMessageString(KKW02501SFConst.CAPA, X31CWebConst.DATABEAN_GET_VALUE)` // Get current capacity [-> CAPA="メールBOX容量"] |
| 12 | IF | `capa == null || "".equals(capa)` → Set `capa = "0"` [Default to "0MB" if unset] |
| 13 | EXEC | `subDatabean.sendMessage(KKW02501SFConst.CD_DIV_LIST_04, X31CWebConst.DATABEAN_CLEAR)` // Clear code list for dropdown [-> CD_DIV_LIST_04="コードリスト"] |
| 14 | EXEC | `subDatabean.sendMessage(KKW02501SFConst.CD_DIV_NM_LIST_04, X31CWebConst.DATABEAN_CLEAR)` // Clear code name list for dropdown [-> CD_DIV_NM_LIST_04="コード名リスト"] |
| 15 | SET | `subDatabean.sendMessageString(KKW02501SFConst.CD_DIV_NM_LIST_04, X31CWebConst.DATABEAN_ADD_VALUE, "")` // Add empty label |
| 16 | SET | `subDatabean.sendMessageString(KKW02501SFConst.CD_DIV_LIST_04, X31CWebConst.DATABEAN_ADD_VALUE, "")` // Add empty code |
| 17 | SET | `cnt1 = 1` // Initialize loop counter for dropdown items |
| 18 | FOR | `for (Entry<Integer, String> entr : mlboxMap)` → Iterate over mailbox capacity options |

**Block 1.6.2.1** — [FOR] loop body over `mlboxMap` (L1176)

> For each mailbox capacity option, add it to the dropdown list and find the best matching index for the current capacity.

| # | Type | Code |
|---|------|------|
| 1 | SET | `buf = Integer.toString(cnt1)` // Convert counter to string |
| 2 | SET | `mbVal = String.valueOf(entr.getKey())` // Get capacity value key |
| 3 | SET | `strBuf = new StringBuilder(buf).append(". ").append(entr.getValue())` // Format: "1. 10MB" label |
| 4 | SET | `subDatabean.sendMessageString(KKW02501SFConst.CD_DIV_NM_LIST_04, X31CWebConst.DATABEAN_ADD_VALUE, strBuf.toString())` // Add formatted label to dropdown |
| 5 | SET | `subDatabean.sendMessageString(KKW02501SFConst.CD_DIV_LIST_04, X31CWebConst.DATABEAN_ADD_VALUE, mbVal)` // Add capacity value to dropdown code |
| 6 | IF | `entr.getKey().intValue() <= Integer.parseInt(capa)` → Set `selectedInd = String.valueOf(cnt1)` // If this option ≤ current capacity, it becomes the selected index |
| 7 | SET | `cnt1++` // Increment counter |

**Block 1.6.2.2** — Post-loop dropdown index setting (L1195)

> After iterating all capacity options, set the final selected index in both the sub data bean and the main DataBean (for JS visibility).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `subDatabean = pulldown_list.getDataBean(0)` // Refresh sub data bean reference |
| 2 | SET | `subDatabean.sendMessageString(KKW02501SFConst.INDEX_04, X31CWebConst.DATABEAN_SET_VALUE, selectedInd)` // Set capacity dropdown selected index [-> INDEX_04="添え字"] |
| 3 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_CAPA_IDX, X31CWebConst.DATABEAN_SET_VALUE, selectedInd)` // Set in main DataBean for JS visibility |

**Block 1.6.2.3** — Virus check dropdown (L1199)

> Build and populate the virus check dropdown list similarly.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `pulldown_list = paramBean[0].getDataBeanArray(KKW02501SFConst.VIRUS_CHK_INFO)` // Get virus check DataBeanArray [-> VIRUS_CHK_INFO="ウイルスチェック情報"] |
| 2 | EXEC | `vchek = paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_VIRUS_CHK_FLG, X31CWebConst.DATABEAN_GET_VALUE)` // Get pre-change virus check flag |
| 3 | CALL | `setPullDownIdx(pulldown_list, vchek)` // Set dropdown index for virus check |
| 4 | EXEC | `subDatabean = pulldown_list.getDataBean(0)` // Refresh sub data bean reference |
| 5 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_VCHK_IDX, X31CWebConst.DATABEAN_SET_VALUE, subDatabean.sendMessageString(KKW02501SFConst.INDEX_04, X31CWebConst.DATABEAN_GET_VALUE))` // Set virus check dropdown index [-> CHGBF_VCHK_IDX="変更前ウイルスチェックインデックス"] |

**Block 1.6.3** — [ELSE IF] `JKKCommonConst.OP_TRAN_DIV_SHOKAI.equals(trans_div) || JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div) || JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div)` (L1226)

> Processing division = "00" (Inquiry / 照会), "05" (Reactivation / 回復), or "06" (Res-Cancel / 予約取消). These modes only need to display the service end date — no complex dropdown population is required.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.USE_ENDYMD, X31CWebConst.DATABEAN_SET_VALUE, paramBean[0].sendMessageString(KKW02501SFConst.SVC_END_YMD, X31CWebConst.DATABEAN_GET_VALUE))` // Set service end date [-> USE_ENDYMD="利用終了日"] |

**Block 1.7** — Charge display flag determination (L1235)

> Determine whether the charge availability should be displayed. This logic is applied regardless of `TRAN_DIV`. The charge is displayed when the contract status is NOT one of the exempt statuses (010: Received, 020: Under Investigation, 030: Completed) AND the Virus Check flag is ON AND the service start post-price-calculation date is set.

| # | Type | Code |
|---|------|------|
| 1 | SET | `chrg_um_dsp_flg = false` // Default: no charge display |
| 2 | EXEC | `chgbf_virus_chk_flg = paramBean[0].sendMessageString(KKW02501SFConst.CHGBF_VIRUS_CHK_FLG, X31CWebConst.DATABEAN_GET_VALUE)` // Get pre-change virus check flag |
| 3 | EXEC | `op_svc_kei_stat = paramBean[0].sendMessageString(KKW02501SFConst.OP_SVC_KEI_STAT, X31CWebConst.DATABEAN_GET_VALUE)` // Get optional service contract status [-> OP_SVC_KEI_STAT="オプションサービス契約ステータス"] |
| 4 | EXEC | `svc_sta_af_prc_calc_ymd = paramBean[0].sendMessageString(KKW02501SFConst.SVC_STA_AF_PRC_CALC_YMD, X31CWebConst.DATABEAN_GET_VALUE)` // Get service start post-price-calc date [-> SVC_STA_AF_PRC_CALC_YMD="サービス開始後料金計算日"] |
| 5 | EXEC | `unyo_ymd = paramBean[0].sendMessageString(KKW02501SFConst.UNYO_YMD, X31CWebConst.DATABEAN_GET_VALUE)` // Get operation date |

**Block 1.7.1** — [IF] `JKKCommonConst.OP_TRAN_DIV_CHGE.equals(trans_div)` (L1243)

> Charge determination logic only applies during Change operations.

**Block 1.7.1.1** — [IF] Contract status NOT exempt (L1244)

> If the service contract status is NOT "010" (Received / 受付済), NOT "020" (Under Investigation / 照会済), and NOT "030" (Completed / 締結済), evaluate the charge timing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `CD00002_ON.equals(chgbf_virus_chk_flg) && null != svc_sta_af_prc_calc_ymd && !("".equals(svc_sta_af_prc_calc_ymd))` → Evaluate charge date condition |
| 2 | CALL | `JPCDateUtil.subtractDay(svc_sta_af_prc_calc_ymd, unyo_ymd)` // Compute day difference [v5.00 ANK-1173-00-00: changed `< 0` to `<= 0`] |
| 3 | IF | `0 <= subtractDay result` → Charge is applicable |
| 4 | SET | `chrg_um_dsp_flg = true` // Show charge availability |
| 5 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CHRG_UM, X31CWebConst.DATABEAN_SET_VALUE, "0")` // Set charge field to "0" [-> CHRG_UM="課金有無"] |

**Block 1.7.2** — Post-charge determination (L1260)

> Write the charge display flag to the DataBean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean[0].sendMessageBoolean(KKW02501SFConst.CHRG_UM_DSP_FLG, X31CWebConst.DATABEAN_SET_VALUE, chrg_um_dsp_flg)` // Set charge display flag [-> CHRG_UM_DSP_FLG="課金有無表示フラグ"] |

**Block 1.8** — Capacity refinement (L1264)

> Format the pre-change mailbox capacity value using the `fineCapa` helper method. This was added in v6.02 (IT1-2013-0001648) to improve capacity value computation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `capaStr = fineCapa(Integer.valueOf(paramBean[0].sendMessageString(KKW02501SFConst.CAPA_BF, X31CWebConst.DATABEAN_GET_VALUE)))` // Refine pre-change capacity [-> CAPA_BF="変更前メールBOX容量"] |
| 2 | SET | `paramBean[0].sendMessageString(KKW02501SFConst.CAPA_BF, X31CWebConst.DATABEAN_SET_VALUE, capaStr)` // Write refined capacity back |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `MLAD` | Field | Mail Address — the customer's configured E-Mail address for the optional service |
| `MLAD_ACCOUNT` | Field | Mail Address Account — the local-part (username) of the email address, extracted from the full email |
| `MLAD_DOMAIN` | Field | Mail Address Domain — the domain part of the email address (e.g., "@k-opt.co.jp") |
| `KIBO_ML_ACCOUNT_1` | Field | Preferred Email Account 1 — the customer's desired email address choice (option 1) |
| `KIBO_ML_ACCOUNT_DISP_FLG` | Field | Preferred Email Account Display Flag — controls whether the preferred email is shown on screen; "0" = not displayed, "1" = displayed |
| `KIBO_ML_ACCOUNT_DISP_FLG_MI` | Field | Preferred Email Display Flag "Not Displayed" — hardcoded value "0" |
| `KIBO_ML_ACCOUNT_DISP_FLG_DISP` | Field | Preferred Email Display Flag "Displayed" — hardcoded value "1" |
| `TRAN_DIV` | Field | Processing Division — classifies the operation type being performed |
| `OP_TRAN_DIV_DSL` | Constant | Processing division = "04" (Cancellation / 解約) |
| `OP_TRAN_DIV_CHGE` | Constant | Processing division = "03" (Change / 更新) |
| `OP_TRAN_DIV_SHOKAI` | Constant | Processing division = "00" (Inquiry / 照会) |
| `OP_TRAN_DIV_KAIHK` | Constant | Processing division = "05" (Reactivation / 回復) |
| `OP_TRAN_DIV_RSV_CL` | Constant | Processing division = "06" (Reservation Cancellation / 予約取消) |
| `UNYO_YMD` | Field | Operation Date — the date the operation is performed, formatted as YYYYMMDD |
| `USE_ENDYMD` | Field | Service End Date — the date the service ends/ended |
| `USE_ENDYMD_YEAR` | Field | Service End Date (Year) — year portion of the service end date |
| `USE_ENDYMD_MON` | Field | Service End Date (Month) — month portion of the service end date |
| `USE_ENDYMD_DAY` | Field | Service End Date (Day) — day portion of the service end date |
| `SVC_END_YMD` | Field | Service End Date and Time — the service termination date |
| `CHGBF_VIRUS_CHK_FLG` | Field | Pre-Change Virus Check Flag — whether Virus Check was enabled before the operation |
| `VIRUS_CHK` | Field | Virus Check — displays "有" (Yes) or "無" (No) for virus check status |
| `SBOP_SVC_KEI_NO_D03` | Field | Sub Optional Service Contract Number (Virus Check) — the contract number associated with Virus Check optional service |
| `CD00002_ON` | Constant | On/Off flag code = "1" (presence/yes/active) |
| `CD00002_OFF` | Constant | On/Off flag code = "0" (absence/no/inactive) |
| `SVC_KEI_STAT_010` | Constant | Service Contract Status "010" — Received (受付済) |
| `SVC_KEI_STAT_020` | Constant | Service Contract Status "020" — Under Investigation (照会済) |
| `SVC_KEI_STAT_030` | Constant | Service Contract Status "030" — Completed (締結済) |
| `OP_SVC_KEI_STAT` | Field | Optional Service Contract Status — the current status of the optional service contract |
| `SVC_STA_AF_PRC_CALC_YMD` | Field | Service Start Post-Price-Calculation Date — the date when billing calculation begins after service start |
| `CHRG_UM_DSP_FLG` | Field | Charge Availability Display Flag — whether to display charge information on the screen |
| `CHRG_UM` | Field | Charge Availability — whether charges apply |
| `CAPA` | Field | Mail Box Capacity — the current mailbox size setting |
| `CAPA_BF` | Field | Pre-Change Mail Box Capacity — the mailbox capacity before the current operation |
| `MAIL_CAPA_INFO` | Field | Mail Box Capacity Information — DataBean array for the capacity dropdown |
| `VIRUS_CHK_INFO` | Field | Virus Check Information — DataBean array for the virus check dropdown |
| `CD_DIV_LIST_04` | Field | Code List — dropdown code values list |
| `CD_DIV_NM_LIST_04` | Field | Code Name List — dropdown label values list |
| `INDEX_04` | Field | Index — the selected index for dropdowns |
| `CHGBF_CAPA_IDX` | Field | Pre-Change Mail Box Capacity Index — the dropdown index before change, set for JS visibility |
| `CHGBF_VCHK_IDX` | Field | Pre-Change Virus Check Index — the dropdown index before change for virus check |
| `CHGAF_MLAD_ACCOUNT_O` | Field | Post-Change Mail Address Account (Screen Display) — the pre-change email account value displayed for editing |
| `CHGAF_ALIAS_O` | Field | Post-Change Mail Alias (Screen Display) — the pre-change email alias value displayed for editing |
| `ALIAS` | Field | Mail Alias — the E-Mail alias configured for the optional service |
| `SBOP_SVC_CD_ALIAS` | Constant | Sub Optional Service Code (Email Alias) = "D01" |
| `SBOP_SVC_CD_MAIL_CAPA` | Constant | Sub Optional Service Code (Mail Capacity) = "D02" |
| `SBOP_SVC_CD_VCHK` | Constant | Sub Optional Service Code (Virus Check) = "D03" |
| ` Aging_SBT_CD_MLAD` | Constant | Aging Type Code (Email Address) = "009" |
| `AGING_SBT_CD_ALIAS` | Constant | Aging Type Code (Email Alias) = "008" |
| `KKSV042701SC` | SC Code | Service Component for E-Mail address data retrieval |
| `KKSV042704SC` | SC Code | Service Component for E-Mail alias data retrieval |
| `KKSV042706SC` | SC Code | Service Component for mailbox capacity data retrieval |
| `KKSV042708SC` | SC Code | Service Component for Virus Check data retrieval |
| `KKSV0427` | Module | Optional Service Inquiry OP screen batch — the screen accessed from the Optional Service Contract Inquiry screen |
| `E-Mail Update` | Screen | KKW02501SF screen — for modifying, cancelling, reactivating, or reserving cancellation of E-Mail optional service settings |
| `Optional Service` | Business term | Add-on services available to K-Opticom customers (e.g., E-Mail, Virus Check, mailbox capacity) |
| `Sub Optional Service` | Business term | Secondary add-on services within the optional service bundle (e.g., E-Mail alias, mailbox capacity, Virus Check under a parent optional service) |
| `OPDBMapper` | Pattern | Object-to-DataBean mapping pattern — a mapper class that delegates service calls to populate DataBean fields from backend data |