# FUW00156SF02DBean

## Purpose

`FUW00156SF02DBean` is a **data bean** (model object) for a survey/enquete feature within the K-Opticom web client application built on the Fujitsu Futurity X33/X31 framework. It holds the state, values, enabled flags, and display states for all survey-related form fields — including content text, checkbox types, content numbers, display order, radio button selections, and a dynamic list of survey answer items. It acts as the central data hub for its screen, bridging the JSP view (`FUW001560PJP.jsp`) with the underlying framework's model loading/storing mechanisms.

## Design

This class is a **plain data carrier / MVC model bean** generated by the K-Opticom Web Client tool. It follows the standard bean pattern for the Futurity X33 framework:

- **Implements `X33VDataTypeBeanInterface`** — the framework interface that defines the `loadModelData(String key, String subkey)`, `storeModelData(...)`, and `typeModelData(String key, String subkey)` methods. These enable the framework to read and write bean properties by string-based key names rather than hard-coded method calls, supporting dynamic form binding.

- **Implements `X33VListedBeanInterface`** — the framework interface for managing dynamic list data. This provides `addListDataInstance()`, `removeElementFromListData()`, and `clearListDataInstance()` for managing the `enquete_answer_list_list` — a list of nested `FUW00156SF06DBean` data beans.

- **Implements `Serializable`** — enabling the bean to be passed between layers (e.g., session scopes, remote calls) as needed by the web framework.

- **Uses the X31 base class pattern** — imports `X31CBaseBean` and `X31CWebComponent` from the older X31 framework, suggesting this bean may work in a hybrid X31/X33 environment.

The bean is **not** a facade, repository, or service. It is a tightly scoped view model whose sole responsibility is to hold screen state and delegate to the framework's model persistence mechanisms.

### Key architectural decisions

- Each simple property (e.g., `enquete_content_value`) is exposed through a **four-field pattern**: `_value`, `_enabled`, `_state`, and `_update`. This pattern appears to encode: the current value, whether the field is enabled for editing, its display state (e.g., error/success styling), and update flags for the framework to track changes.

- The `enquete_answer_list_list` field holds a list of `FUW00156SF06DBean` objects, which are themselves `X33VDataTypeBeanInterface` instances. This creates a recursive data structure: the parent bean can load/store/query its nested beans through a path-like key (e.g., `"アンケート回答リスト/0/プラン名"`), where `0` is the list index and `プラン名` is a sub-field of the nested bean.

## Key Methods

### Constructor

#### `FUW00156SF02DBean()`

- **Purpose**: Initializes the bean. The only non-trivial action is creating an empty `X33VDataTypeList` for `enquete_answer_list_list`.
- **Side effects**: `enquete_answer_list_list` is instantiated as a new `X33VDataTypeList()` at construction.

### Simple Property Getters/Setters

The bean exposes four fields for each logical property — `_value`, `_enabled`, `_state`, `_update`. These follow a uniform pattern:

| Property | Value Field | Enabled Field | State Field |
|---|---|---|---|
| `enquete_content` | `getEnquete_content_value()` / `setEnquete_content_value(String)` | `getEnquete_content_enabled()` / `setEnquete_content_enabled(Boolean)` | `getEnquete_content_state()` / `setEnquete_content_state(String)` |
| `enquete_chk_sbt` | `getEnquete_chk_sbt_value()` / `setEnquete_chk_sbt_value(String)` | `getEnquete_chk_sbt_enabled()` / `setEnquete_chk_sbt_enabled(Boolean)` | `getEnquete_chk_sbt_state()` / `setEnquete_chk_sbt_state(String)` |
| `enquete_content_no` | `getEnquete_content_no_value()` / `setEnquete_content_no_value(String)` | `getEnquete_content_no_enabled()` / `setEnquete_content_no_enabled(Boolean)` | `getEnquete_content_no_state()` / `setEnquete_content_no_state(String)` |
| `dsp_jun_content` | `getDsp_jun_content_value()` / `setDsp_jun_content_value(String)` | `getDsp_jun_content_enabled()` / `setDsp_jun_content_enabled(Boolean)` | `getDsp_jun_content_state()` / `setDsp_jun_content_state(String)` |
| `radio_value` | `getRadio_value_value()` / `setRadio_value_value(String)` | `getRadio_value_enabled()` / `setRadio_value_enabled(Boolean)` | `getRadio_value_state()` / `setRadio_value_state(String)` |

- **Default values**: `enquete_content_value` starts as `""`, `radio_value_value` starts as `"1"`, all `_enabled` booleans default to `false` except `radio_value_enabled` which defaults to `true`. All `_update` fields start as `null`.

### List Data Properties

#### `getEnquete_answer_list_list()` / `setEnquete_answer_list_list(X33VDataTypeList)`

- Returns or sets the list of nested survey answer beans. The list is initialized to a new `X33VDataTypeList()` in the constructor, so callers rarely need to call the setter.

#### `getJsflist_typelist_enquete_answer_list()`

- **Purpose**: Converts the `enquete_answer_list_list` into a list of `javax.faces.model.SelectItem` objects suitable for JSF dropdown menus.
- **Mechanism**: Iterates the list, calls `loadModelData("アンケ-クト回答リスト", "value")` on each nested bean to get its display text, and creates a `SelectItem` with the index as the value and the loaded text as the label.
- **Return**: `ArrayList<SelectItem>` — ready for JSF `<h:selectOneMenu>` or similar components.

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

- A simple integer index field, likely used to track the position of this bean within a collection or the current row in a table.

### Framework Interface Methods

These three methods are the core of the bean's integration with the Futurity X33 framework. They enable property-based data access through string keys.

#### `loadModelData(String key, String subkey) → Object`

- **Purpose**: Retrieves data from the bean by property key and sub-key. This is the read half of the framework's dynamic data binding.
- **Key routing**: The method uses `if/else` chains matching Japanese property names:
  - `"アンケート内容"` → delegates to `enquete_content_*` getters (for `subkey` of `value`, `enable`, or `state`)
  - `"アンケートチェック種類"` → delegates to `enquete_chk_sbt_*` getters
  - `"アンケート番号"` → delegates to `enquete_content_no_*` getters
  - `"表示順序（アンケート内容）"` → delegates to `dsp_jun_content_*` getters
  - `"ラジオボタン選択値"` → delegates to `radio_value_*` getters
  - `"アンケート回答リスト"` → parses a path-like key (e.g., `"アンケート回答リスト/0/プラン名"`) to access nested list items
- **List item handling**: When the key is `"アンケート回答リスト"`:
  - Extracts the path after the first `/`. If it is `"*"`, returns the list size as an `Integer`.
  - Otherwise, parses the index (e.g., `0` from `"0/プラン名"`), validates it's in bounds, then delegates to the nested bean's `loadModelData(key, subkey)`.
- **Returns**: The property value as `Object` (typically `String`, `Boolean`, or `Integer`), or `null` if the key is unrecognized, `key`/`subkey` is null, or the list index is out of bounds.

#### `storeModelData(String key, String subkey, Object in_value)` and overloads

- **Three overloads exist**:
  1. `storeModelData(String gamenId, String key, String subkey, Object in_value)` — ignores `gamenId` (reserved/future use) and delegates to overload 2.
  2. `storeModelData(String key, String subkey, Object in_value)` — delegates to overload 3 with `isSetAsString = false`.
  3. `storeModelData(String key, String subkey, Object in_value, boolean isSetAsString)` — the main implementation.

- **Purpose**: Sets data on the bean by property key and sub-key. This is the write half of the framework's dynamic data binding.
- **Key routing**: Mirrors `loadModelData` exactly — same property names, same `if/else` chains, same sub-key handling (`value`, `enable`, `state`). Each branch performs a cast of `in_value` and calls the corresponding setter.
- **List item handling**: When the key is `"アンケート回答リスト"`:
  - Parses the index from the path (e.g., `"0"` from `"0/プラン名"`).
  - Validates the index is in bounds.
  - Delegates to the nested bean's `storeModelData(key, subkey, in_value, isSetAsString)`.
- **Side effects**: Mutates the bean's internal fields. No validation beyond null-key checks and list index bounds.
- **The `isSetAsString` parameter**: This boolean flag (currently unused in the implementation body) appears to be a hook for type coercion — when `true`, Long-type properties would receive string values. In the current code, all properties are `String` or `Boolean`, so this parameter has no effect on this bean's behavior.

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

- **Purpose**: Returns the Java type of a property, enabling the framework to perform type-safe operations.
- **Key routing**: Identical structure to `loadModelData` and `storeModelData`.
- **Returns**:
  - For `subkey` of `"value"` or `"state"` → `String.class`
  - For `subkey` of `"enable"` → `Boolean.class`
  - For `"アンケート回答リスト"` with `"*"` as the index portion → `Integer.class` (list size)
  - For nested list items → delegates to the nested bean's `typeModelData()`.
  - For unrecognized keys → `null`.

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

- **Purpose**: Returns a static list of all valid property keys (項目名 — "koumoku" in Japanese) defined by this bean.
- **Returns**: An `ArrayList<String>` containing all 6 property names:
  1. `"アンケート内容"` (survey content)
  2. `"アンケートチェック種類"` (survey check type)
  3. `"アンケート番号"` (survey number)
  4. `"表示順序（アンケート内容）"` (display order for survey content)
  5. `"ラジオボタン選択値"` (radio button selection value)
  6. `"アンケート回答リスト"` (survey answer list)
- **Use**: Likely used by the framework or validation logic to enumerate available properties, iterate over fields, or build configuration tables.

### List Management Methods

These methods are defined by `X33VListedBeanInterface` for managing dynamic list data.

#### `addListDataInstance(String key) → int`

- **Purpose**: Adds a new element to the list identified by `key`.
- **Key**: Only `"アンケート回答リスト"` is supported. Passing any other key (or `null`) returns `-1`.
- **Behavior**: If `enquete_answer_list_list` is null (shouldn't happen — constructor initializes it), creates a new list. Instantiates a new `FUW00156SF06DBean`, adds it to the list, and returns the index of the newly added element.
- **Throws**: `X33SException` (declared but not actively thrown in this implementation).

#### `removeElementFromListData(String key, int index) → void`

- **Purpose**: Removes the element at the given index from the list identified by `key`.
- **Validation**: Bounds-checks the index against `enquete_answer_list_list.size()`. Silent no-op if index is out of range.
- **Key**: Only `"アンケート回答リスト"` is supported.

#### `clearListDataInstance(String key) → void`

- **Purpose**: Clears all elements from the list identified by `key`.
- **Behavior**: Calls `enquete_answer_list_list.clear()`. Does not nullify the list reference, so the list remains ready for new additions.
- **Key**: Only `"アンケート回答リスト"` is supported.

## Relationships

```mermaid
classDiagram
  class FUW00156SF02DBean {
    - String enquete_content_value
    - Boolean enquete_content_enabled
    - String enquete_content_state
    - String enquete_chk_sbt_value
    - Boolean enquete_chk_sbt_enabled
    - String enquete_chk_sbt_state
    - String enquete_content_no_value
    - Boolean enquete_content_no_enabled
    - String enquete_content_no_state
    - String dsp_jun_content_value
    - Boolean dsp_jun_content_enabled
    - String dsp_jun_content_state
    - String radio_value_value
    - Boolean radio_value_enabled
    - String radio_value_state
    - X33VDataTypeList enquete_answer_list_list
    - int index
    + String getEnquete_content_value()
    + void setEnquete_content_value(String)
    + Boolean getEnquete_content_enabled()
    + void setEnquete_content_enabled(Boolean)
    + String getEnquete_content_state()
    + void setEnquete_content_state(String)
    + String getEnquete_chk_sbt_value()
    + Boolean getEnquete_chk_sbt_enabled()
    + String getEnquete_chk_sbt_state()
    + String getEnquete_content_no_value()
    + Boolean getEnquete_content_no_enabled()
    + String getEnquete_content_no_state()
    + String getDsp_jun_content_value()
    + Boolean getDsp_jun_content_enabled()
    + String getDsp_jun_content_state()
    + String getRadio_value_value()
    + Boolean getRadio_value_enabled()
    + String getRadio_value_state()
    + X33VDataTypeList getEnquete_answer_list_list()
    + ArrayList~SelectItem~ getJsflist_typelist_enquete_answer_list()
    + int getIndex()
    + void setIndex(int)
    + Object loadModelData(String, String)
    + void storeModelData(String, String, Object)
    + void storeModelData(String, String, Object, boolean)
    + Class~?~ typeModelData(String, String)
    + static ArrayList~String~ listKoumokuIds()
    + int addListDataInstance(String)
    + void removeElementFromListData(String, int)
    + void clearListDataInstance(String)
  }
  FUW00156SF02DBean --> X33VDataTypeBeanInterface : implements
  FUW00156SF02DBean --> X33VListedBeanInterface : implements
  FUW00156SF02DBean --> Serializable : implements
  FUW00156SF02DBean --> X33VDataTypeList : manages
  FUW00156SF02DBean --> FUW00156SF06DBean : creates list items
  FUW00156SF02DBean --> SelectItem : uses for JSF dropdown
  FUW001560PJP.jsp --> FUW00156SF02DBean : uses
```

### Who uses this class

| Consumer | Relationship |
|---|---|
| **`FUW001560PJP.jsp`** | The JSP page that renders the survey screen. It instantiates or receives a `FUW00156SF02DBean` instance (likely from a parent bean or controller) and binds form fields to its properties. |

### What this class depends on

| Dependency | Usage |
|---|---|
| **`X33VDataTypeBeanInterface`** | Framework interface requiring `loadModelData`, `storeModelData`, `typeModelData` implementations. |
| **`X33VListedBeanInterface`** | Framework interface requiring `addListDataInstance`, `removeElementFromListData`, `clearListDataInstance` implementations. |
| **`X33VDataTypeList`** | Collection type used for `enquete_answer_list_list`. Imported from `com.fujitsu.futurity.web.x33.beans`. |
| **`FUW00156SF06DBean`** | Nested bean type for individual list items in the answer list. |
| **`SelectItem` (JSF)** | Used by `getJsflist_typelist_enquete_answer_list()` to produce dropdown options. |
| **`X33SException`** | Declared in throws clauses for list management methods. |

## Usage Example

### Typical calling pattern

```java
// 1. Instantiate the bean (typically done by the framework or controller)
FUW00156SF02DBean bean = new FUW00156SF02DBean();

// 2. Set initial property values directly
bean.setEnquete_content_value("Enter survey answer here");
bean.setEnquete_content_enabled(true);
bean.setRadio_value_value("0");

// 3. Add a dynamic list item
int newIndex = bean.addListDataInstance("アンケート回答リスト");
// This creates a new FUW00156SF06DBean and returns its index

// 4. Use the framework's dynamic access pattern
Object val = bean.loadModelData("アンケート内容", "value");
// Returns the enquete_content_value

bean.storeModelData("ラジオボタン選択値", "enable", true);
// Sets enquete_content_enabled to true (via the "enable" subkey routing)

// 5. Convert list to JSF dropdown options
ArrayList<SelectItem> dropdownItems = bean.getJsflist_typelist_enquete_answer_list();

// 6. Remove or clear list items
bean.removeElementFromListData("アンケート回答リスト", 0);
bean.clearListDataInstance("アンケート回答リスト");
```

### Dynamic data binding (framework side)

The Futurity X33 framework likely uses these methods to bind form data automatically:

```java
// The framework resolves the type before loading
Class<?> type = bean.typeModelData("アンケート内容", "value");
// Returns String.class

// Then loads the value
Object value = bean.loadModelData("アンケート内容", "value");
// Returns (String) bean.getEnquete_content_value()

// On form submission, the framework stores the value back
bean.storeModelData("アンケート内容", "value", "New answer text");
// Internally calls bean.setEnquete_content_value("New answer text")
```

For nested list items, the framework uses a path-style key:

```java
// Load from the first answer item's "プラン名" field
Object planName = bean.loadModelData("アンケート回答リスト/0/プラン名", "value");

// Store to the same field
bean.storeModelData("アンケート回答リスト/0/プラン名", "value", "Plan Alpha");

// Get the list size
Object listSize = bean.loadModelData("アンケート回答リスト/*", "value");
// Returns Integer.valueOf(bean.enquete_answer_list_list.size())
```

## Notes for Developers

### Thread safety
This bean is **not thread-safe**. It holds mutable state (fields, the answer list) and has no synchronization. It is intended to be used within a single request/session scope per the web framework's conventions.

### Null handling
- `loadModelData` and `storeModelData` check for `key == null || subkey == null` and return early (null or no-op).
- `storeModelData`'s `isSetAsString` parameter is accepted but has no effect on any field in this bean — all properties are `String` or `Boolean`, neither of which requires string coercion. This suggests future-proofing or a shared implementation inherited from a parent class.
- List index parsing silently returns `null` on `NumberFormatException` during load, and silently ignores out-of-bounds indices during store — no exceptions are thrown.

### Property name immutability
The Japanese property names used in the `if/else` chains of `loadModelData`, `storeModelData`, and `typeModelData` are **hard-coded string literals**. Any change to the field naming convention or property names requires updating all three methods consistently. There is no central constant or enum defining these names — `listKoumokuIds()` is the only source of truth, but it is not referenced by the three routing methods.

### Default values matter
- `radio_value_value` defaults to `"1"` (not `""`). This means a radio button is always pre-selected by default.
- `radio_value_enabled` defaults to `true` while all other `_enabled` booleans default to `false`. This suggests radio buttons are interactive by default while other fields are not — possibly controlled by the business logic that populates the bean before view rendering.

### The `_update` fields
Each property group has a corresponding `_update` field (`enquete_content_update`, `enquete_chk_sbt_update`, etc.) that is initialized to `null` and exposed via getters/setters. The bean's own code never reads these fields — they are likely written by the framework's change-tracking mechanism to detect which fields the user modified on the form.

### No validation logic
This bean contains **no validation logic**. It stores values, enables/disables fields, and tracks state — but it does not validate content, enforce business rules, or check constraints. Validation is presumably handled by the controller layer or the framework's validation annotations/pipeline.

### `getIndex()` is unused internally
The `index` field has a getter and setter but is never read or written by any method in this class. It is likely set by the parent JSP or controller to track which row/instance this bean represents within a list display.

### Generated code
The class header indicates it was generated by "Web Client tool V01/L01" (the K-Opticom Web Client tool). This explains the rigid structure, the hard-coded property names, and the consistent boilerplate pattern. Modifications to the bean's schema should be made through the code generator rather than by hand-editing, to avoid drift.

### `X33VDataTypeList` behavior
The `enquete_answer_list_list` is initialized in the constructor, so callers of `addListDataInstance()` do not need to null-check before adding items. However, `clearListDataInstance()` does not null the list — it merely calls `clear()`. This means the list is always in a valid (possibly empty) state after any operation.
