# KKW22301SF02DBean

## Purpose

`KKW22301SF02DBean` is a form-data backing bean that encapsulates all display and input fields for the Seat Discount Campaign configuration screen (process number KKW22301SF02). It serves as the data model that the JSP view binds to, holding values, UI enabled/disabled flags, update markers, and state information for eleven domain properties such as campaign codes, service dates, discount start/end dates, customer IDs, and target divisions.

It was generated by the Fujitsu Futurity Web Client tool and implements the framework's reflection-style data binding interfaces (`X33VDataTypeBeanInterface` and `X33VListedBeanInterface`), enabling the framework to introspect and hydrate the bean from request parameters or a database without explicit controller code.

## Design

The class follows the **Data Bean / Form Model** pattern within the Fujitsu Futurity X33/X31 web framework. It does not contain business logic; its sole responsibility is to hold state for a single form submission roundtrip.

Key design characteristics:

- **Field groups of four**: Every domain property is exposed through four synchronized fields: `_value` (the actual data), `_enabled` (whether the field is editable on screen), `_state` (additional UI state metadata), and `_update` (a marker indicating whether the field was modified during the current request). The `value` fields default to empty string `""` and `enabled` fields default to `false`.

- **Reflection-based binding**: The three `*ModelData` methods (`loadModelData`, `storeModelData`, `typeModelData`) let the framework read and write fields by string keys and subkeys (e.g., `key = "割引サービス名"`, `subkey = "value"`) instead of calling getters/setters directly. This is how the X33 framework populates the bean from JSP-bound request parameters.

- **No parent class**: The class does not extend any class directly but imports `X31CBaseBean` and `X33VViewBaseBean` (the latter being the likely superclass in the compiled hierarchy through the framework).

- **Java 5-style generics**: Uses `ArrayList<String>` and `Boolean` (wrapper type) rather than primitives, indicating it targets at minimum Java 5.

- **Serializable**: Implements `Serializable` for session/HTTP scope storage, and carries `@SuppressWarnings("serial")` because no explicit `serialVersionUID` is declared.

## Fields

Every domain property follows the same four-field pattern:

| Field Name | Type | Default | Purpose |
|---|---|---|---|
| `_value` | `String` | `""` | The actual data value bound to the form field |
| `_enabled` | `Boolean` | `false` | Whether the field is editable on the UI |
| `_state` | `String` | `""` | Additional state metadata (e.g., CSS class, validation state) |
| `_update` | `String` | `null` | Flag indicating the field was updated during the current request |

### Domain Properties

The bean manages 11 domain properties, each with 4 fields (44 data fields total) plus an `index` field:

| # | Property Key (Japanese) | Field ID Prefix | English Description |
|---|---|---|---|
| 1 | 表示用キャンペーンコード | `dsp_campaign_cd` | Display campaign code |
| 2 | 割引サービス名 | `wrib_svc_nm` | Discount service name |
| 3 | サービス開始年月日 | `svc_sta_ymd` | Service start date (year-month-day) |
| 4 | サービス終了年月日 | `svc_endymd` | Service end date (year-month-day) |
| 5 | 申込年月日 | `mskm_ymd` | Application date |
| 6 | 関連お客様ID | `knrn_svc_kei_no` | Related customer ID (added 2018-12-21, ANK-3521) |
| 7 | ステータス名 | `status_nm` | Status name (added 2022-01-26, ANK-4195) |
| 8 | 割引開始日 | `wrib_staymd` | Discount start date (added 2022-01-26, ANK-4195) |
| 9 | 割引終了日 | `wrib_endymd` | Discount end date (added 2022-01-26, ANK-4195) |
| 10 | セット割申請経路名 | `wrib_shin_route_nm` | Seat discount claim route name (added 2022-01-26, ANK-4195) |
| 11 | セット割対象区分 | `wrib_trgt_div` | Seat discount target division (added 2022-01-26, ANK-4195) |

Plus one additional field:

| Field | Type | Default | Purpose |
|---|---|---|---|
| `index` | `int` | `0` | Likely used for row indexing in a list/table view |

## Key Methods

### `loadModelData(String key, String subkey) -> Object`

This is the primary **data retrieval** method used by the X33 framework to fetch field values by string keys rather than direct property access.

**Parameters:**
- `key` - The Japanese property name (e.g., "表示用キャンペーンコード")
- `subkey` - One of `"value"`, `"enable"`, or `"state"` (case-insensitive)

**Returns:** The corresponding field value as `Object`, or `null` if `key`/`subkey` is null or no matching property exists.

**Behavior:** Performs a long chain of `if-else` comparisons matching the Japanese key names. For each matching key, it dispatches based on subkey:
- `"value"` (case-insensitive) -> calls the field's `getXXX_value()` method
- `"enable"` -> calls `getXXX_enabled()` returning `Boolean`
- `"state"` -> calls `getXXX_state()` returning `String`

This enables JSP bindings like: `${bean.loadModelData("割引サービス名", "value")}` to dynamically access any field.

### `storeModelData(String key, String subkey, Object in_value, boolean isSetAsString) -> void`

The primary **data assignment** method, inverse of `loadModelData`. This is the most complex method in the class (spanning lines 669-824).

**Parameters:**
- `key` - The Japanese property name (same format as `loadModelData`)
- `subkey` - One of `"value"`, `"enable"`, or `"state"` (case-insensitive)
- `in_value` - The value to set, cast to the appropriate type (`String` or `Boolean`)
- `isSetAsString` - When `true`, forces String-type assignment even for Long-type fields (documented in Japanese comments as "Long型項目ValueプロパティへString型値の設定を行う場合true")

**Behavior:** Mirrors `loadModelData`'s if-else chain. For each matching key/subkey combination, it calls the corresponding `setXXX_value()`, `setXXX_enabled()`, or `setXXX_state()` method with a cast of `in_value`.

**Note:** The `isSetAsString` parameter is declared but does not appear to be used in the method body shown in the source - the logic simply casts and sets directly. This may be a leftover from a future extension or a framework requirement.

### `storeModelData(String key, String subkey, Object in_value) -> void` (overload)

Convenience overload that calls the 4-parameter version with `isSetAsString = false`.

### `storeModelData(String gamenId, String key, String subkey, Object in_value) -> void` (overload)

Framework-imposed overload that delegates to the 3-parameter `storeModelData(key, subkey, in_value)`. The `gamenId` (screen ID) parameter is marked as "reserved" (予備) in the Japanese documentation and is currently ignored.

### `typeModelData(String key, String subkey) -> Class<?>`

Returns the Java `Class` type for a given key/subkey pair, enabling type-safe casting on the framework side.

**Behavior:** Mirrors the same if-else chain. Returns:
- `String.class` for `"value"` and `"state"` subkeys
- `Boolean.class` for `"enable"` subkey
- `null` for unknown key/subkey combinations

### `listKoumokuIds() -> ArrayList<String>` (static)

Returns a list of all 11 Japanese property keys in definition order. This is used by the framework to enumerate available fields, likely for dynamic form rendering or validation sweeps.

### Getter/Setter Methods

Each of the 11 properties has 4 standard getters and setters:
- `getXXX_update()` / `setXXX_update(String)` - Returns/sets the update marker
- `getXXX_value()` / `setXXX_value(String)` - Returns/sets the value
- `getXXX_enabled()` / `setXXX_enabled(Boolean)` - Returns/sets the enabled state
- `getXXX_state()` / `setXXX_state(String)` - Returns/sets the state metadata

These are simple pass-through methods with no validation, transformation, or side effects.

### `getIndex() / setIndex(int)`

Standard getter/setter for the `index` field. This is likely populated by the framework when the bean holds a list of rows.

## Relationships

```mermaid
flowchart TD
    subgraph KKW22301SF02DBean["KKW22301SF02DBean - Seat Discount Campaign Form Data"]
        direction TB
        subgraph Properties["11 Domain Properties x 4 Fields Each"]
            F1["Campaign Code<br/>dsp_campaign_cd"]
            F2["Service Name<br/>wrib_svc_nm"]
            F3["Service Start<br/>svc_sta_ymd"]
            F4["Service End<br/>svc_endymd"]
            F5["Application Date<br/>mskm_ymd"]
            F6["Related Customer<br/>knrn_svc_kei_no"]
            F7["Status Name<br/>status_nm"]
            F8["Discount Start<br/>wrib_staymd"]
            F9["Discount End<br/>wrib_endymd"]
            F10["Claim Route<br/>wrib_shin_route_nm"]
            F11["Target Div<br/>wrib_trgt_div"]
        end
        M1["loadModelData<br/>get by key/subkey"]
        M2["storeModelData<br/>set by key/subkey"]
        M3["typeModelData<br/>resolve field type"]
        M4["listKoumokuIds<br/>list all keys"]
    end

    JSP["KKW223010PJP.jsp<br/>View Page"] -->|"binds to"| KKW22301SF02DBean

    Intf1["X33VDataTypeBeanInterface<br/>framework data type contract"]
    Intf2["X33VListedBeanInterface<br/>framework listed bean contract"]
    Serial["Serializable"]

    KKW22301SF02DBean -->|"implements"| Intf1
    KKW22301SF02DBean -->|"implements"| Intf2
    KKW22301SF02DBean -->|"implements"| Serial
```

### Dependency Summary

| Direction | Class/Component | Relationship |
|---|---|---|
| **Uses** | `X33VViewBaseBean` (imported) | Framework base class (not directly extended in source) |
| **Uses** | `X33VDataTypeBeanInterface` | Implements - reflection data type contract |
| **Uses** | `X33VListedBeanInterface` | Implements - listed bean contract |
| **Uses** | `X31CBaseBean` | Framework bean base (imported, not extended) |
| **Uses** | `X33VDataTypeList`, `X33VDataTypeBooleanBean`, `X33VDataTypeStringBean`, `X33VDataTypeLongBean` | Framework data type wrappers (imported but not directly referenced in source) |
| **Uses** | `X33VLoadModelException` | Framework exception (imported but not thrown) |
| **Uses** | `X31CWebComponent` | Framework component (imported but not directly referenced) |
| **Uses** | `X33SException` | Exception for error handling |
| **Uses** | `SelectItem` (JSF) | For dropdown/select options |
| **Used By** | `KKW223010PJP.jsp` | View page binds to this bean |

**No outbound references** were found beyond imports. The bean is a terminal data object - it depends on framework interfaces but holds no references to other application classes.

## Usage Example

### Direct getter/setter usage

```java
KKW22301SF02DBean bean = new KKW22301SF02DBean();

// Set a field value and enable it
bean.setWrib_svc_nm_value("NTT docomo");
bean.setWrib_svc_nm_enabled(true);
bean.setWrib_svc_nm_state("primary");
bean.setWrib_svc_nm_update("Y");

// Read back
String value = bean.getWrib_svc_nm_value(); // "NTT docomo"
Boolean enabled = bean.getWrib_svc_nm_enabled(); // true
```

### Reflection-style binding (framework usage)

```java
KKW22301SF02DBean bean = new KKW22301SF02DBean();

// Framework reads all fields by key/subkey
Object value = bean.loadModelData("割引サービス名", "value");
Object enabled = bean.loadModelData("割引サービス名", "enable");
Class<?> type = bean.typeModelData("割引サービス名", "value"); // String.class

// Framework sets fields by key/subkey
bean.storeModelData("割引サービス名", "value", "au by KDDI");
bean.storeModelData("割引サービス名", "enable", true);
```

### Listing all available keys

```java
ArrayList<String> keys = KKW22301SF02DBean.listKoumokuIds();
// Returns:
// ["表示用キャンペーンコード", "割引サービス名", "サービス開始年月日",
//  "サービス終了年月日", "申込年月日", "関連お客様ID",
//  "ステータス名", "割引開始日", "割引終了日",
//  "セット割申請経路名", "セット割対象区分"]
```

## Notes for Developers

### Thread Safety

This bean is **not thread-safe**. It holds mutable state (`_value`, `_enabled`, `_state`, `_update` fields) that is modified by getters/setters without synchronization. It is designed to be instantiated per-request and discarded after the form submission completes. Do not share a single instance across concurrent requests.

### Framework Binding

The X33 framework expects the `_update`, `_enabled`, and `_state` fields to follow a specific convention. Do not rename or remove these fields - the framework likely scans for them by naming pattern. Similarly, the `loadModelData`, `storeModelData`, and `typeModelData` methods are contractually required by `X33VDataTypeBeanInterface` and must match the key names exactly.

### Adding New Properties

To add a new domain property:

1. Add four fields: `_update`, `_value` (default `""`), `_enabled` (default `false`), `_state` (default `""`).
2. Add standard getters and setters for each.
3. Add the `loadModelData` case with the Japanese key name and three subkey branches (`value`, `enable`, `state`).
4. Add the same three branches to `storeModelData` (both overloads).
5. Add the same three branches to `typeModelData`.
6. Add the Japanese key to `listKoumokuIds()`.

The Japanese key names must match exactly between all four methods - there is no enum or constant to guard against typos.

### Null Handling

- `loadModelData` returns `null` for null `key`/`subkey` or unmatched keys.
- `storeModelData` silently returns (does nothing) for null `key`/`subkey`.
- `typeModelData` returns `null` for null/unsupported keys.
- The `value` fields default to empty strings (`""`), not `null`.
- The `enabled` fields default to `false` (not `null`), preventing NPEs from unboxing.

### Version History (from source comments)

| Rev | Date | Change | Issue |
|---|---|---|---|
| 01 | 2018-07-10 | Initial generation by Web Client tool V2.0.39 | - |
| 02 | 2018-12-21 | Added `knrn_svc_kei_no` (Related Customer ID) fields | ANK-3521-00-00 |
| 03 | 2022-01-26 | Added `status_nm`, `wrib_staymd`, `wrib_endymd`, `wrib_shin_route_nm`, `wrib_trgt_div` fields for eo光ネッツ x mineo seat discount rollout | ANK-4195-00-00 |

### Known Gaps

- The `_update` fields are declared but the bean does not contain logic to set them. They are likely set by the framework during form processing based on request parameter changes.
- The `isSetAsString` parameter in the 4-parameter `storeModelData` overload is documented but unused in the current code.
- No `serialVersionUID` is declared, which can cause deserialization issues if the class is serialized across different application versions.
- The `index` field exists but its purpose is inferred only - it is not documented in source comments.
- The `SeparaterPoint` variable is computed in `loadModelData`, `storeModelData`, and `typeModelData` but never used. It appears to be a leftover from code generation.
