# Business Logic — KKW03201SFLogic.set050InfoBean() [74 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03201SF.KKW03201SFLogic` |
| Layer | Service Logic (Web View Logic Layer) |
| Module | `KKW03201SF` (Package: `eo.web.webview.KKW03201SF`) |

## 1. Role

### KKW03201SFLogic.set050InfoBean()

This method is a **data-initialization handler** that populates the service form DataBean with default and derived values required for the "operation settings" (option service) screen in the KKW03201SF module. It constructs and sets core business context fields including the service start date (assembled from separate year/month/day components), pricing code (B33), service plan code (PB3301), billing contract number (extracted from a nested contract list), parent contract type (03), and application type (based on whether the request is a new contract or a migration/option setting operation). It also determines the progress status by comparing the service start date against the current operation date — if they match, it flags the record as an "immediate application" (status 5102); otherwise, it flags it as a "pending application" (status 5101). This method implements the **builder/initializer pattern**: it is called early in the screen's setup flow to prepare the DataBean before any service component (SC) calls are made, ensuring all downstream processing has the correct operational context. Its role in the larger system is to serve as a shared preparation step invoked from `createOpSvcKei()`, which in turn is part of the service contract registration flow (KKSV0101).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["set050InfoBean method entry"])
    START --> A["Extract service start date components year/mon/day from paramBean[0]"]
    A --> B["Concatenate year + mon + day into single date string"]
    B --> C["Set concatenated date to DSP_USE_STAYMD field"]
    C --> D["Set pricing code field to B33"]
    D --> E["Set plan code field to PB3301"]
    E --> F["Get SEIKY_KEI_LIST child DataBean array from paramBean[0]"]
    F --> G{beanArray.getCount() > 0}
    G -- Yes --> H["Extract SEIKY_KEI_NO_07 from beanArray[0]"]
    G -- No --> I["Set seiky_kei_no to null"]
    H --> J["Set SEIKY_KEI_NO field to extracted value"]
    I --> J
    J --> K["Set OYA_KEI_SKBT_CD field to 03 (parent contract type)"]
    K --> L["Read IDO_DIV field from paramBean[0]"]
    L --> M{IDO_DIV comparison}
    M -- IDO_DIV equals --> N["Set MSKM_SBT_CD to 00026 (Application Type: Operation Settings)"]
    M -- Not equal --> O["Set MSKM_SBT_CD to 00001 (Application Type: New Contract)"]
    N --> P["Compare use_staymd with current operation date"]
    O --> P
    P -- Equal date --> Q["Set PRG_STAT to 5102 (Progress Status: Immediate Application)"]
    P -- Not equal --> R["Set PRG_STAT to 5101 (Progress Status: Pending Application)"]
    Q --> S["Set UNYO_YMD to current operation date"]
    R --> S
    S --> T["Set UNYO_DTM to operation date + 000000000"]
    T --> U["Dump DataBean state to log"]
    U --> END(["Return / Next"])
```

### Branch Details:

| Branch | Condition | Constant Value | Business Meaning |
|--------|-----------|---------------|-----------------|
| Application Type (Option) | `KKW03201SFConst.IDO_DIV.equals(ido_div)` | `IDO_DIV` (migration flag) | Application type 00026 — Operation Settings (option service configuration for existing contracts) |
| Application Type (New) | Else branch | — | Application type 00001 — New Contract (initial service registration) |
| Immediate Application | `JPCDateChecker.isEqualDate(use_staymd, JCCWebCommon.getOpeDate(this, null))` | `PRG_STAT_CD_5102 = "5102"` | Service starts today (or earlier) — immediate activation required |
| Pending Application | Else branch | `PRG_STAT_CD_5101 = "5101"` | Service starts in the future — scheduled activation |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | Array of service form DataBean objects representing the current screen's data context. The first element (`paramBean[0]`) is the main service form bean populated from the screen's input fields. It carries the service start date components, migration separation flag, billing contract list, and serves as the target for all output field assignments. |

### Instance Fields / External State Read:

| Field | Source | Business Description |
|-------|--------|---------------------|
| `this` | `KKW03201SFLogic` instance | Passed as context parameter to `JCCWebCommon.getOpeDate()` to retrieve the current operation date |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Reads the current operation date (system date) used for progress status comparison and operation timestamp fields |
| R | `JPCDateChecker.isEqualDate` | JPCDateChecker | - | Compares the service start date string with the operation date to determine if immediate activation is required |
| EXEC | `paramBean[0].sendMessageString` | - | X31SDataBean (paramBean) | Reads service start date components (year, month, day) from the input DataBean |
| EXEC | `paramBean[0].sendMessageString` (set) | - | X31SDataBean (paramBean) | Sets display date, pricing code, plan code, billing contract number, parent contract type, application type, progress status, and operation timestamps |
| R | `paramBean[0].getDataBeanArray` | - | X31SDataBean (paramBean) | Retrieves the nested billing contract list child DataBean array for contract number extraction |
| R | `beanArray.getCount()` | - | OneStopDataBeanAccessArray | Checks whether the billing contract list contains any items |
| R | `beanArray.getDataBean(0).sendMessageString` | - | OneStopDataBeanAccessArray | Extracts the billing contract number from the first item in the list |
| EXEC | `JSYwebLog.println` | - | Log output | Dumps the current DataBean state to the application log for debugging/audit |

**CRUD Classification:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Reads operation date for use date comparison and timestamp population |
| R | `JPCDateChecker.isEqualDate` | JPCDateChecker | - | Compares service start date with operation date for progress status branching |
| - | `paramBean[0].sendMessageString` (get) | - | paramBean (X31SDataBean) | Reads service start date components (year, month, day) and migration separation type from input DataBean |
| - | `paramBean[0].sendMessageString` (set) | - | paramBean (X31SDataBean) | Sets 10 output fields: display date, pricing code, plan code, billing contract number, parent contract type, application type, progress status, operation date, operation datetime |
| - | `paramBean[0].getDataBeanArray` | - | paramBean (X31SDataBean) | Retrieves nested billing contract list child DataBean array |
| - | `beanArray.getCount()` / `beanArray.getDataBean(0)` | - | OneStopDataBeanAccessArray | Reads billing contract number from the first contract list entry |

**Note:** This method performs **no database or SC-level CRUD operations**. It is purely a **DataBean initialization** method that prepares the request payload before downstream service component calls. All data reads/writes are in-memory operations against the DataBean structure.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Caller: `KKW03201SFLogic.createOpSvcKei()` | `createOpSvcKei()` -> `set050InfoBean(paramBean)` | Terminal: `sendMessageString` [W], `sendMessageString` [W], `getOpeDate` [R], `isEqualDate` [R] |

**Details:** `createOpSvcKei()` constructs a service parameter map and invokes `set050InfoBean()` to initialize the DataBean before calling the DB mapper and SC methods for service contract registration.

**Terminal operations from this method** (what this method ultimately calls):
- `sendMessageString` [-] — reads/writes DataBean fields (no SC boundary)
- `getOpeDate` [R] — JCCWebCommon (reads system operation date)
- `isEqualDate` [R] — JPCDateChecker (date comparison utility)

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] Extract service start date components (L1020-L1022)

> Business: Reads the year, month, and day components of the requested service start date from the input DataBean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `use_staymd_year = paramBean[0].sendMessageString(KKW03201SFConst.USE_STAYMD_YEAR, X31CWebConst.DATABEAN_GET_VALUE)` // Read service start date year |
| 2 | SET | `use_staymd_mon = paramBean[0].sendMessageString(KKW03201SFConst.USE_STAYMD_MON, X31CWebConst.DATABEAN_GET_VALUE)` // Read service start date month |
| 3 | SET | `use_staymd_day = paramBean[0].sendMessageString(KKW03201SFConst.USE_STAYMD_DAY, X31CWebConst.DATABEAN_GET_VALUE)` // Read service start date day |
| 4 | SET | `use_staymd = use_staymd_year + use_staymd_mon + use_staymd_day` // Concatenate to YYYYMMDD format |

**Block 2** — [EXEC] Set service start date display (L1024)

> Business: Stores the concatenated date string into the display field for the service start date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.DSP_USE_STAYMD, X31CWebConst.DATABEAN_SET_VALUE, use_staymd)` // Set display date |

**Block 3** — [EXEC] Set pricing code (L1027)

> Business: Assigns the pricing classification code (B33) for the option service.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.PCRS_CD, X31CWebConst.DATABEAN_SET_VALUE, "B33")` // Pricing code for option service |

**Block 4** — [EXEC] Set service plan code (L1030)

> Business: Assigns the service plan code (PB3301) corresponding to the option service pricing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.PPLAN_CD, X31CWebConst.DATABEAN_SET_VALUE, "PB3301")` // Plan code PB3301 |

**Block 5** — [SET] Extract billing contract number (L1033-L1038)

> Business: Retrieves the billing contract number from the child contract list DataBean. If the list is empty, sets null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `seiky_kei_no = null` // Default to null |
| 2 | SET | `beanArray = paramBean[0].getDataBeanArray(KKW03201SFConst.SEIKY_KEI_LIST)` // Get billing contract list |
| 3 | IF | `0 < beanArray.getCount()` — Check if contract list has items |

**Block 5.1** — [IF] Contract list has items (L1034-L1036)

| # | Type | Code |
|---|------|------|
| 1 | SET | `seiky_kei_no = beanArray.getDataBean(0).sendMessageString(KKW03201SFConst.SEIKY_KEI_NO_07, X31CWebConst.DATABEAN_GET_VALUE)` // [-> "請求契約番号" = "Billing Contract Number"] |

**Block 5.2** — [EXEC] Set billing contract number field (L1038)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.SEIKY_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, seiky_kei_no)` // Set billing contract number (may be null) |

**Block 6** — [EXEC] Set parent contract type (L1041)

> Business: Sets the parent contract type code (03) for the option service relationship.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.OYA_KEI_SKBT_CD, X31CWebConst.DATABEAN_SET_VALUE, "03")` // Parent contract type: 03 |

**Block 7** — [IF/ELSE] Determine application type based on migration separation flag (L1044-L1058)

> Business: Reads the migration separation type (ido_div) from the input DataBean and determines whether this is an operation settings request (existing contract) or a new contract request. Sets the application type code accordingly.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ido_div = paramBean[0].sendMessageString(KKW03201SFConst.IDO_DIV, X31CWebConst.DATABEAN_GET_VALUE)` // Read migration separation type |
| 2 | IF | `KKW03201SFConst.IDO_DIV.equals(ido_div)` — [IDO_DIV constant comparison] |

**Block 7.1** — [IF-TRUE] Application type: Operation Settings (L1046-L1047)

> Business: When the migration flag matches IDO_DIV, this is an operation settings request (option service for existing contracts).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.MSKM_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, JKKCommonConst.MSKM_SBT_CD_VALUE_00026)` // [-> MSKM_SBT_CD_VALUE_00026 = "00026"] Application Type: Operation Settings |

**Block 7.2** — [IF-FALSE] Application type: New Contract (L1050-L1052)

> Business: When the migration flag does not match IDO_DIV, this is a new contract registration.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.MSKM_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, JKKCommonConst.MSKM_SBT_CD_VALUE_00001)` // [-> MSKM_SBT_CD_VALUE_00001 = "00001"] Application Type: New Contract |

**Block 8** — [IF/ELSE] Determine progress status based on service start date (L1055-L1069)

> Business: Compares the requested service start date with the current operation date. If they match, the service is activated immediately (progress status 5102). If the start date is in the future, it is a scheduled activation (progress status 5101).

| # | Type | Code |
|---|------|------|
| 1 | IF | `JPCDateChecker.isEqualDate(use_staymd, JCCWebCommon.getOpeDate(this, null))` — Compare use start date with operation date |

**Block 8.1** — [IF-TRUE] Immediate Application (L1057-L1060)

> Business: Service start date equals (or precedes) today — immediate service activation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.PRG_STAT, X31CWebConst.DATABEAN_SET_VALUE, JKKCommonConst.PRG_STAT_CD_5102)` // [-> PRG_STAT_CD_5102 = "5102"] Progress Status: Immediate Application |

**Block 8.2** — [IF-FALSE] Pending Application (L1063-L1066)

> Business: Service start date is in the future — scheduled/deferred activation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.PRG_STAT, X31CWebConst.DATABEAN_SET_VALUE, JKKCommonConst.PRG_STAT_CD_5101)` // [-> PRG_STAT_CD_5101 = "5101"] Progress Status: Pending Application |

**Block 9** — [EXEC] Set operation date and datetime fields (L1072-L1078)

> Business: Records the current operation date and operation datetime (with zero time component) into the DataBean for audit trail purposes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.UNYO_YMD, X31CWebConst.DATABEAN_SET_VALUE, JCCWebCommon.getOpeDate(this, null))` // Operation date |
| 2 | EXEC | `paramBean[0].sendMessageString(KKW03201SFConst.UNYO_DTM, X31CWebConst.DATABEAN_SET_VALUE, JCCWebCommon.getOpeDate(this, null) + "000000000")` // Operation datetime (date + zero time) |

**Block 10** — [EXEC] Log data bean state (L1081)

> Business: Outputs the complete DataBean state to the application log for debugging and audit purposes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null)` // Log full DataBean dump |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `set050InfoBean` | Method | Service component setting information storage process 6 — initializes the DataBean for the option service (No. 050) configuration screen |
| `paramBean` | Parameter | Service form DataBean array — the primary data carrier for the screen, containing all input/output fields for service contract configuration |
| `use_staymd` | Field | Service start date — concatenated YYYYMMDD string representing when the customer requests service activation |
| `DSP_USE_STAYMD` | Field | Display service start date — the formatted date shown on the screen |
| `PCRS_CD` | Field | Pricing code — classifies the pricing structure; "B33" for this option service |
| `PPLAN_CD` | Field | Service plan code — the specific service plan assigned; "PB3301" for this option |
| `SEIKY_KEI_LIST` | Field | Billing contract list — nested child DataBean array containing associated billing contract records |
| `SEIKY_KEI_NO` | Field | Billing contract number — the unique identifier for the billing contract |
| `SEIKY_KEI_NO_07` | Field | Billing contract number (child) — field key for reading from the nested contract list DataBean |
| `OYA_KEI_SKBT_CD` | Field | Parent contract type code — classifies the parent contract relationship; "03" indicates option service type |
| `IDO_DIV` | Field | Migration separation type — flag indicating whether this request is a migration/option setting (IDO_DIV match) or a new contract |
| `MSKM_SBT_CD` | Field | Application type code — classifies the request as either a new contract (00001) or operation settings (00026) |
| `MSKM_SBT_CD_VALUE_00001` | Constant | Application type: New Contract — initial service registration for a new customer |
| `MSKM_SBT_CD_VALUE_00026` | Constant | Application type: Operation Settings — option service configuration for an existing contract |
| `PRG_STAT` | Field | Progress status — indicates the activation timing: 5101 (pending/future start) or 5102 (immediate/today) |
| `PRG_STAT_CD_5101` | Constant | Progress status: Pending Application — service start date is in the future |
| `PRG_STAT_CD_5102` | Constant | Progress status: Immediate Application — service start date is today or earlier |
| `UNYO_YMD` | Field | Operation year/month/day — the current system date recorded for audit purposes |
| `UNYO_DTM` | Field | Operation datetime — the current system datetime (with zero time component) recorded for audit |
| `X31CWebConst.DATABEAN_GET_VALUE` | Constant | DataBean message type — request to read a field value from the DataBean |
| `X31CWebConst.DATABEAN_SET_VALUE` | Constant | DataBean message type — request to write a field value to the DataBean |
| `X31SDataBeanAccess` | Class | Service form DataBean access interface — the interface used to read/write screen data fields via message-based calls |
| `X31SDataBeanAccessArray` | Class | DataBean array wrapper — provides array-like access (getCount, getDataBean) over nested DataBean collections |
| `JPCDateChecker.isEqualDate` | Method | Date equality checker — compares a date string (YYYYMMDD) against the operation date, returns true if equal or if the date is in the past |
| `JCCWebCommon.getOpeDate` | Method | Operation date getter — retrieves the current system operation date for the given context |
| `JSYwebLog.println` | Method | Web application log writer — outputs structured log messages with category (DataBean_Dump), class, and message |
| `dumpDatabean()` | Method | DataBean state dumper — generates a string representation of the current DataBean contents for logging |
| `createOpSvcKei` | Method | Creates option service detail configuration — the caller that initializes DataBean then invokes downstream SC mappers |
| KKW03201SF | Module | K-Opticom Web Service — Option Service (No. 050) contract detail configuration screen module |
| KKSV0101 | Screen | Main service contract registration screen — the parent screen that invokes the option service (050) sub-flow |
| Option Service | Business term | An additional service (e.g., security, backup) added to an existing main contract, managed separately with its own contract number |
