# Business Logic — KKW00816SFLogic.mappingDataBean() [79 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SFLogic` |
| Layer | Web View Logic (Service/Controller adapter layer — `eo.web.webview.*`) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SFLogic.mappingDataBean()

This method is responsible for preparing and populating view-side data beans that are not automatically mapped by the framework's default mapping mechanism. It serves as a data transformation bridge between the screen input layer and the subsequent processing logic, extracting user-entered service start date components (year, month, day) from the provided `X31SDataBeanAccess` parameter and composing them into a single date string. It then computes derived business values — specifically the operation service contract status, billing start date, and progress status — for the K-Opticom multi-selection service contract screen. The method follows a pure data-binder design pattern: it reads input, applies deterministic business rules (always sets "service in progress" status, computes next-month billing start, and marks progress as "operation info application pending"), and writes the results back to the data bean for downstream consumption. Notably, all conditional branching logic (including a future-date check for "disruption reservation → SOD registration") has been commented out, meaning this method currently operates in a single deterministic path. It also sets the parent contract service type code and a migration timestamp, making it a comprehensive data assembly point for the screen's state model.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["mappingDataBean(bean)"])

    START --> GET["Extract USE_STAYMD_YEAR, USE_STAYMD_MON, USE_STAYMD_DAY from bean"]
    GET --> COMPOSE["Compose staymd = year + mon + day (YYYYMMDD)"]
    COMPOSE --> INIT["Initialize jssi_op_svc_kei_stat = null, svc_chrg_staymd = null, prg_stat = null"]
    INIT --> SET_STAT["Set jssi_op_svc_kei_stat = JKKCommonConst.SVC_KEI_STAT_100"]
    SET_STAT --> SET_DATE["Set svc_chrg_staymd = JPCDateUtil.addMonth(staymd + '01', 1)"]
    SET_DATE --> SET_PRG["Set prg_stat = JKKCommonConst.PRG_STAT_CD_5101"]
    SET_PRG --> WRITE_STAYMD["Write staymd -> USE_STAYMD to bean"]
    WRITE_STAYMD --> WRITE_JSSI["Write jssi_op_svc_kei_stat -> JSI_OP_SVC_KEI_STAT to bean"]
    WRITE_JSSI --> WRITE_CHRG["Write svc_chrg_staymd -> SVC_CHRG_STAYMD to bean"]
    WRITE_CHRG --> WRITE_PRG["Write prg_stat -> PRG_STAT to bean"]
    WRITE_PRG --> WRITE_TKJK["Write PRG_TKJK_1_VAL_MLTSE_INFO_ADD -> PRG_TKJK_1 to bean"]
    WRITE_TKJK --> WRITE_SKBT["Write JKKCommonConst.OYA_KEI_SKBT_03 -> OYA_KEI_SKBT_CD to bean"]
    WRITE_SKBT --> WRITE_SYS["Write getSysDateTimeStamp() -> IDO_DTM to bean"]
    WRITE_SYS --> RET_TRUE(["Return true"])
```

**Processing summary:**
1. **Extract input** — Reads three date components (year, month, day) from the data bean using `sendMessageString` with `X31CWebConst.DATABEAN_GET_VALUE`.
2. **Compose date** — Concatenates the three components into a single `YYYYMMDD` string.
3. **Initialize variables** — Declares three local variables (`jssi_op_svc_kei_stat`, `svc_chrg_staymd`, `prg_stat`) set to `null` as placeholders.
4. **Set contract status** — Hardcodes the operation service contract status to `SVC_KEI_STAT_100` (Service in progress).
5. **Compute billing date** — Adds "01" to form a full date string, then increments by 1 month to determine the billing start date.
6. **Set progress status** — Hardcodes the progress status to `PRG_STAT_CD_5101` (Operation information application pending).
7. **Write to bean** — Writes all computed values back to the bean as view-bound data.
8. **Version-added fields** — Sets the parent contract service type code (v1.02.00 addition) and the migration date-time stamp (IT1-2013-0000035 addition).
9. **Return** — Always returns `true`.

> **Note:** The commented-out future-date branch (`isFuture` check) would have set different values: contract status `SVC_KEI_STAT_010` (Order received), progress status `PRG_STAT_CD_5102` (Operation settings complete), and an SOD registration flag `FLG_OFF`/`FLG_ON`. This logic is currently disabled.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The data access handle that carries screen input values into the logic layer and receives computed output values. It acts as the bidirectional conduit between the view (HTML/form fields) and the business logic. The method reads service start date components from it and writes back composed/derived values for display. |

**Instance fields / external state read:**
- None directly — all data flows through the `bean` parameter and static utility classes.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JPCDateUtil.addMonth` | JPCDate | - | Calls `addMonth` in `JPCDateUtil` to compute the billing start date by adding 1 month to the service start date |
| R | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads date components from the data bean via `sendMessageString` with `DATABEAN_GET_VALUE` |
| R | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Writes computed values back to the data bean via `sendMessageString` with `DATABEAN_SET_VALUE` |
| R | `JCCWebCommon.getSysDateTimeStamp` | JCCWebCommon | - | Calls `getSysDateTimeStamp()` to obtain the current system date-time stamp for the migration timestamp field |

This method performs **zero direct CRUD database operations**. It is a pure data transformation/assembly method — it extracts input, computes derived values, and writes output to the bean without touching any service components (SC) or database tables.

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKW00816SFLogic | `KKW00816SFLogic.actionAddMltise()` → `mappingDataBean(bean)` | `sendMessageString [-]`, `addMonth [C]`, `getSysDateTimeStamp [R]` |

**Trace analysis:**
- This method is called by `KKW00816SFLogic.actionAddMltise()`, which is another method within the same logic class. This suggests it is a helper method invoked during the multi-selection add action flow.
- The method is `private`, meaning it is not exposed as a public API and can only be called internally within `KKW00816SFLogic`.
- It has no database endpoints or SC calls — its terminal operations are all local bean message sends (`sendMessageString`) and utility calls (`addMonth`, `getSysDateTimeStamp`).
- As a private helper, it is not an entry point itself but an internal data preparation step within a larger screen action workflow.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Data extraction from bean (L679–L683)

> Extract the service start date components (year, month, day) from the screen input bean, then compose them into a single YYYYMMDD string.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `use_staymd_year = bean.sendMessageString(KKW00816SFConst.USE_STAYMD_YEAR, X31CWebConst.DATABEAN_GET_VALUE)` // Get service start date (year) [-> KKW00816SFConst.USE_STAYMD_YEAR="利用開始日（年）"] |
| 2 | EXEC | `use_staymd_mon = bean.sendMessageString(KKW00816SFConst.USE_STAYMD_MON, X31CWebConst.DATABEAN_GET_VALUE)` // Get service start date (month) [-> KKW00816SFConst.USE_STAYMD_MON="利用開始日（月）"] |
| 3 | EXEC | `use_staymd_day = bean.sendMessageString(KKW00816SFConst.USE_STAYMD_DAY, X31CWebConst.DATABEAN_GET_VALUE)` // Get service start date (day) [-> KKW00816SFConst.USE_STAYMD_DAY="利用開始日（日）"] |
| 4 | SET | `staymd = use_staymd_year + use_staymd_mon + use_staymd_day` // Compose YYYYMMDD string |

**Block 2** — [SET] Variable initialization (L689–L693)

> Initialize three local variables that will hold the computed business values. All are set to `null` as placeholders.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jssi_op_svc_kei_stat = null` // Operation service contract status [-> Placeholder] |
| 2 | SET | `svc_chrg_staymd = null` // Billing start year-month-day [-> Placeholder] |
| 3 | SET | `prg_stat = null` // Progress status [-> Placeholder] |

**Block 3** — [SET] Set business values (L698–L703)

> Compute and assign the three core business values. All assignments are hardcoded — no conditional branching is active.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jssi_op_svc_kei_stat = JKKCommonConst.SVC_KEI_STAT_100` // Operation service contract status (Service in progress) [-> JKKCommonConst.SVC_KEI_STAT_100] |
| 2 | SET | `svc_chrg_staymd = JPCDateUtil.addMonth(use_staymd_year + use_staymd_mon + "01", 1)` // Billing start = service start month + 1 month |
| 3 | SET | `prg_stat = JKKCommonConst.PRG_STAT_CD_5101` // Progress status (Operation info application pending) [-> JKKCommonConst.PRG_STAT_CD_5101] |

**Block 4** — [EXEC] Write values to data bean (L708–L714)

> Write all computed values back to the data bean so they are available for the view layer to render.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD, X31CWebConst.DATABEAN_SET_VALUE, staymd)` // Write composed date [-> KKW00816SFConst.USE_STAYMD="利用開始日"] |
| 2 | EXEC | `bean.sendMessageString(KKW00816SFConst.JSSI_OP_SVC_KEI_STAT, X31CWebConst.DATABEAN_SET_VALUE, jssi_op_svc_kei_stat)` // Write contract status [-> KKW00816SFConst.JSSI_OP_SVC_KEI_STAT="実施オプションサービス契約ステータス"] |
| 3 | EXEC | `bean.sendMessageString(KKW00816SFConst.SVC_CHRG_STAYMD, X31CWebConst.DATABEAN_SET_VALUE, svc_chrg_staymd)` // Write billing start date [-> KKW00816SFConst.SVC_CHRG_STAYMD="サービス課金開始年月日"] |
| 4 | EXEC | `bean.sendMessageString(KKW00816SFConst.PRG_STAT, X31CWebConst.DATABEAN_SET_VALUE, prg_stat)` // Write progress status [-> KKW00816SFConst.PRG_STAT="進捗ステータス"] |
| 5 | EXEC | `bean.sendMessageString(KKW00816SFConst.PRG_TKJK_1, X31CWebConst.DATABEAN_SET_VALUE, PRG_TKJK_1_VAL_MLTSE_INFO_ADD)` // Write progress supplement item [-> KKW00816SFConst.PRG_TKJK_1="進捗特記事項1"] |

**Block 5** — [EXEC] Version 1.02.00 addition — Parent contract service type (L717)

> Sets the parent contract service type code to `OYA_KEI_SKBT_03`, indicating this is a multi-selection service contract. This was added in version 1.02.00.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW00816SFConst.OYA_KEI_SKBT_CD, X31CWebConst.DATABEAN_SET_VALUE, JKKCommonConst.OYA_KEI_SKBT_03)` // Write parent contract service type [-> KKW00816SFConst.OYA_KEI_SKBT_CD="親契約識別コード", JKKCommonConst.OYA_KEI_SKBT_03] |

**Block 6** — [EXEC] IT1-2013-0000035 addition — Migration date-time stamp (L721–L723)

> Gets the current system date-time stamp and sets it as the migration date-time for the "disruption year-month-day" field. Added per change ticket IT1-2013-0000035.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysDateDtms = JCCWebCommon.getSysDateTimeStamp()` // Get system date-time stamp |
| 2 | EXEC | `bean.sendMessageString(KKW00816SFConst.IDO_DTM, X31CWebConst.DATABEAN_SET_VALUE, sysDateDtms)` // Write migration timestamp [-> KKW00816SFConst.IDO_DTM] |

**Block 7** — [RETURN] Return success (L725)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Normal end: true, Abnormal end: false |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `staymd` | Field | Service start date (年月日) — Composed YYYYMMDD string representing when the customer's service begins |
| `use_staymd_year` | Field | Service start date (year 年) — 4-digit year extracted from the screen form input |
| `use_staymd_mon` | Field | Service start date (month 月) — 2-digit month extracted from the screen form input |
| `use_staymd_day` | Field | Service start date (day 日) — 2-digit day extracted from the screen form input |
| `jssi_op_svc_kei_stat` | Field | Implementation option service contract status (実施オプションサービス契約ステータス) — Indicates the current state of the optional service contract for implementation |
| `SVC_KEI_STAT_100` | Constant | Service in progress (サービス提供中) — Contract status code indicating the service is actively being provided |
| `SVC_KEI_STAT_010` | Constant | Order received (受注済) — Commented-out path: contract status for orders already received (future-date path) |
| `svc_chrg_staymd` | Field | Billing start year-month-day (サービス課金開始年月日) — The date when billing for the service begins, calculated as service start month + 1 |
| `prg_stat` | Field | Progress status (進捗ステータス) — Tracks the current stage of the order/contract processing workflow |
| `PRG_STAT_CD_5101` | Constant | Operation information application pending (オプション情報申請中) — Progress status code indicating the order information is waiting for application processing |
| `PRG_STAT_CD_5102` | Constant | Operation settings complete (オプション設定完了) — Commented-out path: progress status when operation settings have been completed |
| `PRG_TKJK_1` | Field | Progress supplement item 1 (進捗特記事項1) — An auxiliary field for additional progress-related information |
| `PRG_TKJK_1_VAL_MLTSE_INFO_ADD` | Constant | Multi-selection information add value — The constant value assigned to the progress supplement item for multi-selection scenarios (added per ANK-1223-00-00) |
| `OYA_KEI_SKBT_CD` | Field | Parent contract service type code (親契約識別コード) — Identifies the type of the parent contract in a multi-level contract hierarchy |
| `OYA_KEI_SKBT_03` | Constant | Parent contract service type code value 03 — Indicates this is a multi-selection service contract |
| `IDO_DTM` | Field | Migration date-time (異動年月日时分秒) — The timestamp of when the contract change/migration was processed |
| `SOD` | Acronym | Service Order Data — Telecom order fulfillment entity used in service order registration workflows |
| `JKKCommonConst` | Class | Common constants class for the JKK (system integration options) module — Shared constants for status codes and flags |
| `JPCDateUtil` | Class | Date utility class for date arithmetic operations — Provides methods like `addMonth` for calculating future dates |
| `JCCWebCommon` | Class | Web common utility class — Provides web-layer shared methods including `getSysDateTimeStamp()` for system timestamps |
| `X31SDataBeanAccess` | Class | Data bean access handle — The interface through which the logic layer reads and writes screen-bound data values |
| `KKW00816SF` | Module | Multi-selection service contract screen module — The web screen module for configuring multi-service contracts |
| `actionAddMltise` | Method | Add multi-selection action — The screen action that invokes this data preparation method |
| `DATABEAN_GET_VALUE` | Constant | Data bean operation code — Indicates a read (get) operation on a data bean field |
| `DATABEAN_SET_VALUE` | Constant | Data bean operation code — Indicates a write (set) operation on a data bean field |
