# Business Logic — KKW00816SFLogic.actionClear() [33 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SFLogic` |
| Layer | Service (WebLogic — business logic within the web layer) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SFLogic.actionClear()

The `actionClear` method performs session initialization for the **Multi-Session Information Registration** screen (KKW00816SF). When a user initiates the "clear" action on this screen — typically by pressing a reset or initial-entry button — the method resets the session-level form data to fresh, current-date values. Specifically, it retrieves the current **operating date** (system date via `JCCWebCommon.getOpeDate`), then populates the DataBean with that date broken down into year, month, and day components for the **start-of-use date** field, sets the session count to `1` (indicating a single new session), and configures the next-screen routing to `KKW00816`. The method follows a straight-line sequential processing pattern with no conditional branches — it always executes the same initialization flow regardless of prior session state. It implements the **delegation pattern**, offloading date retrieval to `JCCWebCommon` and all state mutations to `X31SDataBeanAccess.sendMessageString` calls. This method serves as the **entry-point clearing handler** for the multi-session information registration business screen, ensuring that every fresh session starts with a clean slate anchored to the current operating date.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionClear"])
    Bean["Get ServiceFormBean"]
    GetOpeDate["CALL JCCWebCommon.getOpeDate"]
    SetUnyoYmd["SET unyo_ymd from getOpeDate result"]
    SetSessionCnt["SET SESSION_CNT to 1"]
    SetYear["SET USE_STAYMD_YEAR from year substring"]
    SetMonth["SET USE_STAYMD_MON from month substring"]
    SetDay["SET USE_STAYMD_DAY from day substring"]
    GetCommonBean["Get CommonInfoBean"]
    SetNextScreen["SET NEXT_SCREEN_ID to KKW00816"]
    SetNextScreenName["SET NEXT_SCREEN_NAME to KKW00816"]
    DumpLog["EXEC JSYwebLog.println dumpDatabean"]
    Return["Return true"]

    START --> Bean
    Bean --> GetOpeDate
    GetOpeDate --> SetUnyoYmd
    SetUnyoYmd --> SetSessionCnt
    SetSessionCnt --> SetYear
    SetYear --> SetMonth
    SetMonth --> SetDay
    SetDay --> GetCommonBean
    GetCommonBean --> SetNextScreen
    SetNextScreen --> SetNextScreenName
    SetNextScreenName --> DumpLog
    DumpLog --> Return
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on internal session state. |
| 1 | `bean` (retrieved internally) | `X31SDataBeanAccess` | The service form DataBean holding the current session's form data. Represents the mutable state of the multi-session information registration screen's fields. |
| 2 | `commonBean` (retrieved internally) | `X31SDataBeanAccess` | The common-info DataBean holding cross-screen routing metadata. Controls which screen the user is navigated to next. |

**Instance / External State Read:**
| Source | Field / Method | Business Description |
|--------|---------------|---------------------|
| `super.getServiceFormBean()` | — | Retrieves the current session's form DataBean from the parent logic class |
| `super.getCommonInfoBean()` | — | Retrieves the common-info DataBean containing navigation metadata |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate(this, null)` | JCCWebCommon | - | Retrieves the current operating date (system date) used as the anchor for session start date initialization |
| W | `bean.sendMessageString(KKW00816SFConst.UNYO_YMD, ...)` | - | Session DataBean | Writes the operating year-month-day to the session DataBean field `UNYO_YMD` (Operating Date) |
| W | `bean.sendMessageString(KKW00816SFConst.SESSION_CNT, "1", ...)` | - | Session DataBean | Writes the session count value `"1"` to the session DataBean, indicating a single new session |
| W | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_YEAR, ..., unyo_ymd.substring(0, 4))` | - | Session DataBean | Writes the year portion (characters 0–3) of the operating date to the session DataBean field `USE_STAYMD_YEAR` (Start-of-Use Date Year) |
| W | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_MON, ..., unyo_ymd.substring(4, 6))` | - | Session DataBean | Writes the month portion (characters 4–5) of the operating date to the session DataBean field `USE_STAYMD_MON` (Start-of-Use Date Month) |
| W | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_DAY, ..., unyo_ymd.substring(6, 8))` | - | Session DataBean | Writes the day portion (characters 6–7) of the operating date to the session DataBean field `USE_STAYMD_DAY` (Start-of-Use Date Day) |
| W | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, ..., JKKScreenConst.SCREEN_ID_KKW00816)` | - | Session DataBean | Writes the next screen identifier `KKW00816` to the common-info bean for navigation routing |
| W | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, ..., JKKScreenConst.SCREEN_NAME_KKW00816)` | - | Session DataBean | Writes the next screen display name `KKW00816` to the common-info bean |
| L | `JSYwebLog.println(JSYwebLog.DataBean_Dump, ...)` | JSYwebLog | - | Logs a dump of all current DataBean field values for debugging/auditing purposes |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00816 (KKW00816SF) | Button "clear" action -> `KKW00816SFLogic.actionClear` | `getOpeDate [R] System Date (in-memory)` |

**Notes:** This method is not referenced by any other Java class's source code. It is invoked through the X31 web framework's button-to-logic dispatch mechanism — the screen KKW00816 maps its "clear" button action directly to this `actionClear()` method via the framework's action routing convention. The method performs no database operations; all state mutations are in-memory DataBean writes and a system date read.

## 6. Per-Branch Detail Blocks

The method has no conditional branches (no if/else, switch, loop). All processing is linear and sequential.

**Block 1** — [LINEAR] `(straight-line processing)` (L238)

> Retrieves the service form DataBean from the parent class and obtains the current operating date.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `X31SDataBeanAccess bean = super.getServiceFormBean()` // Retrieves the session's form DataBean |
| 2 | CALL | `JCCWebCommon.getOpeDate(this, null)` [-> Returns current system date as String `yyyyMMdd`] |
| 3 | SET | `unyo_ymd = bean.sendMessageString(KKW00816SFConst.UNYO_YMD, X31CWebConst.DATABEAN_SET_VALUE, JCCWebCommon.getOpeDate(this, null))` [-> `UNYO_YMD = "運用年月日"` (Operating Date: YYYYMMDD)] // Sets operating date in session and captures it into `unyo_ymd` variable |

**Block 2** — [LINEAR] `(session count initialization)` (L246)

> Sets the session count to 1, indicating this is a fresh single session.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW00816SFConst.SESSION_CNT, X31CWebConst.DATABEAN_SET_VALUE, "1")` [-> `SESSION_CNT = "セッション数"` (Session Count)] // Sets session count to 1 |

**Block 3** — [LINEAR] `(start-of-use date component extraction)` (L248)

> Extracts year, month, and day from the 8-character operating date string (`yyyyMMdd`) using `substring` and writes each component to the session DataBean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_YEAR, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(0, 4))` [-> `USE_STAYMD_YEAR = "利用開始日（年）"` (Start-of-Use Date Year)] // Extracts year (positions 0–3) from `unyo_ymd` |
| 2 | SET | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_MON, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(4, 6))` [-> `USE_STAYMD_MON = "利用開始日（月）"` (Start-of-Use Date Month)] // Extracts month (positions 4–5) from `unyo_ymd` |
| 3 | SET | `bean.sendMessageString(KKW00816SFConst.USE_STAYMD_DAY, X31CWebConst.DATABEAN_SET_VALUE, unyo_ymd.substring(6, 8))` [-> `USE_STAYMD_DAY = "利用開始日（日）"` (Start-of-Use Date Day)] // Extracts day (positions 6–7) from `unyo_ymd` |

**Block 4** — [LINEAR] `(next-screen routing setup)` (L258)

> Configures the common-info bean with the destination screen identity so the framework knows where to render next.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `X31SDataBeanAccess commonBean = super.getCommonInfoBean()` // Retrieves the common-info DataBean for cross-screen metadata |
| 2 | SET | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_ID_KKW00816)` [-> `NEXT_SCREEN_ID` set to `SCREEN_ID_KKW00816`] // Sets destination screen ID for framework routing |
| 3 | SET | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_NAME_KKW00816)` [-> `NEXT_SCREEN_NAME` set to `SCREEN_NAME_KKW00816`] // Sets destination screen name for framework routing |

**Block 5** — [LINEAR] `(debug logging and return)` (L267)

> Dumps the current DataBean state to the log for troubleshooting, then returns success.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null)` [-> Logs full DataBean field values] // Debug: prints all DataBean values to application log |
| 2 | RETURN | `return true` // Returns success — processing completed without errors |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `multi-session information registration` | Business term | The KKW00816SF screen module — allows registering multiple session information (e.g., multiple users, devices, or authentication identities) under a single service contract |
| `UNYO_YMD` | Field | Operating Date (YYYYMMDD format) — the current system date used as the anchor for all date calculations in the session |
| `SESSION_CNT` | Field | Session Count — the number of sessions in the current multi-session context; set to `"1"` on clear to indicate a single-session start |
| `USE_STAYMD_YEAR` | Field | Start-of-Use Date (Year) — the year component of the service start date, extracted from the operating date |
| `USE_STAYMD_MON` | Field | Start-of-Use Date (Month) — the month component of the service start date |
| `USE_STAYMD_DAY` | Field | Start-of-Use Date (Day) — the day component of the service start date |
| `NEXT_SCREEN_ID` | Field | Next Screen Identifier — framework field storing the screen ID to navigate to after the current action completes |
| `NEXT_SCREEN_NAME` | Field | Next Screen Display Name — human-readable screen name for the navigation target |
| `SERVICE_FORM_BEAN` | Internal | The session-scoped DataBean that holds all form fields for the current screen |
| `COMMON_INFO_BEAN` | Internal | The cross-screen DataBean that carries navigation metadata (next screen ID, etc.) between actions |
| `getOpeDate` | Method | Retrieves the operational/system date from the application's date service — ensures all date operations use the configured business date, which may differ from the server's system clock |
| `X31SDataBeanAccess` | Technical | Framework class providing the `sendMessageString` API for reading and writing session DataBean fields |
| `sendMessageString` | Method | DataBean field accessor — writes a value to a named field when given `DATABEAN_SET_VALUE`, reads when given `DATABEAN_GET_VALUE` |
| `KKW00816` | Screen ID | The multi-session information registration screen — the target screen that this clear action prepares |
| `JCCWebBusinessLogic` | Parent class | Base class for all web-layer business logic in the X31 framework; provides `getServiceFormBean()` and `getCommonInfoBean()` |
| `KKW00816SFChecker` | Related class | Validation/checker class for the KKW00816SF screen; implements `X31SGuiCheckBase` and delegates to KKW00816SFLogic |
