# Business Logic — SCW00401SFLogic.chkItemValue1() [13 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.SCW00401SF.SCW00401SFLogic` |
| Layer | Controller / Web Logic (Package: `eo.web.webview.SCW00401SF`) |
| Module | `SCW00401SF` (Package: `eo.web.webview.SCW00401SF`) |

## 1. Role

### SCW00401SFLogic.chkItemValue1()

This method performs **input validation** for the Service Contract Number (サービス契約番号) field on the VLAN-ID registration screen (SCW00401SF). It is the first in a chain of item-level validation checks (chkItemValue1 through chkItemValue3+) that gate the processing flow of the screen's search operation. The VLAN-ID registration module (SCW00401SF) handles telephone-specified VLAN-ID registration for K-Opticom broadband customers — a telecom service where fiber-to-the-home (FTTH) customers have a specific VLAN identifier provisioned on their line.

The method follows a **guard clause pattern**: it extracts the Service Contract Number from the service form bean, validates that it is not null or empty using the shared `JSCCommonUtil.isValidParameter()` utility, and if invalid, records a standardized user-facing error message (EKB0010-TW) identifying which field failed validation. It returns `true` if the value is valid (allowing the search flow to proceed) or `false` if the value is missing (halting further processing for this screen). As a private method called from `search()`, it acts as a **validation gate** within the screen's entry-point processing, ensuring mandatory fields are present before any business logic or database access occurs.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkItemValue1 bean"])
    INIT["Set sValue equals null"]
    GET["Get sValue from bean.sendMessageString KEY_SVC_KEI_NO"]
    CHECK{isValidParameter check}
    SET_MSG["Set error message EKB0010-TW with サービス契約番号"]
    RET_FAIL["Return false"]
    RET_OK["Return true"]
    END(["END"])

    START --> INIT
    INIT --> GET
    GET --> CHECK
    CHECK -->|false| SET_MSG
    SET_MSG --> RET_FAIL
    RET_FAIL --> END
    CHECK -->|true| RET_OK
    RET_OK --> END
```

**Constant Resolution:**
- `KEY_SVC_KEI_NO` = `"KEYサービス契約番号"` — The form bean key used to retrieve the Service Contract Number from the service form data bean.
- `X31CWebConst.DATABEAN_GET_VALUE` — Standard X31 framework constant instructing `sendMessageString` to read (GET) a value from the data bean.
- `EKB0010_TW` = `"EKB0010-TW"` — Error message template key meaning "Please enter [field name]" (required field missing).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The service form data bean carrying the user's input data for the VLAN-ID registration screen. It contains the Service Contract Number (サービス契約番号), which is a mandatory field identifying the customer's service contract line. This bean is populated from the HTTP request parameters during screen initialization. |

**Instance fields read:** None. This method is self-contained and does not read any instance fields of `SCW00401SFLogic`.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JSCCommonUtil.isValidParameter` | JSCCommonUtil | - | Shared utility validation — checks if a String parameter is non-null and non-empty |
| - | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets an error message (EKB0010-TW) on the screen to display to the user |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Retrieves the Service Contract Number value from the form bean using the key `KEY_SVC_KEI_NO` |

**Analysis:** This method performs **no CRUD operations** against any database or entity. It is a pure validation layer that: (1) reads the Service Contract Number from the web form bean (in-memory data bean access, not a DB query), and (2) sets an error message on the screen if validation fails. All called methods are presentation-layer utilities — no SC Codes, CBS codes, or database tables are involved.

## 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: `setMessageInfo` [-], `sendMessageString` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 | `KKSV0004.search` -> `SCW00401SFLogic.search` -> `SCW00401SFLogic.chkItemValue1` | `isValidParameter [R] in-memory validation`, `setMessageInfo [N/A] EKB0010-TW screen error` |

**Notes:**
- The caller `SCW00401SFLogic.search()` is the screen's search handler. It is invoked when the user submits the VLAN-ID registration search form on Screen KKSV0004.
- `chkItemValue1()` is a private validation method, so no external screens call it directly — it is invoked as part of the search processing pipeline.
- The terminal operations from this method are entirely presentation-layer: setting an error message for display or performing in-memory validation against the form bean.

## 6. Per-Branch Detail Blocks

**Block 1** — [LOCAL VAR DECLARATION] (L265)

> Initialize a local string variable to hold the Service Contract Number value retrieved from the form bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String sValue = null;` // Local variable for service contract number |

**Block 2** — [METHOD CALL] (L268)

> Retrieve the Service Contract Number (サービス契約番号) from the service form bean using the key defined in `SCW00401SFConst.KEY_SVC_KEI_NO`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `sValue = bean.sendMessageString(KEY_SVC_KEI_NO, X31CWebConst.DATABEAN_GET_VALUE);` // KEY_SVC_KEI_NO = "KEYサービス契約番号" [-> Get service contract number from form bean] |

**Block 3** — [IF] (`!JSCCommonUtil.isValidParameter(sValue)`) (L269)

> Validation check: if the Service Contract Number is null, empty, or otherwise invalid, enter the error-handling branch.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(!JSCCommonUtil.isValidParameter(sValue))` // Check if service contract number is valid |

**Block 3.1** — [ELSE-BRANCH: INVALID VALUE] (L270-272)

> The Service Contract Number is missing or invalid. Set a user-facing error message (EKB0010-TW — "Please enter [field name]") indicating the "サービス契約番号" (Service Contract Number) field is required, then halt processing by returning `false`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0010_TW, new String[]{"サービス契約番号"});` // [-> EKB0010_TW = "EKB0010-TW"] Set error message for missing required field |
| 2 | RETURN | `return false;` // Validation failed — stop further processing |

**Block 4** — [DEFAULT: VALID VALUE] (L274)

> The Service Contract Number passed validation. Allow the search flow to proceed by returning `true`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Validation passed — continue with search processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service Contract Number (サービス契約番号) — A unique identifier for a customer's broadband service contract line in K-Opticom's telecommunications system |
| `KEY_SVC_KEI_NO` | Constant | Form bean key `"KEYサービス契約番号"` — The data bean lookup key used to retrieve the Service Contract Number value from the user's form input |
| SCW00401SF | Module | VLAN-ID Registration Screen — A K-Opticom web screen for registering telephone-specified VLAN IDs for FTTH broadband customers |
| VLAN-ID | Technical term | Virtual LAN Identifier — A 12-bit network segment identifier (1-4094) assigned to a customer's fiber connection for traffic segmentation |
| FTTH | Business term | Fiber To The Home — K-Opticom's fiber-optic broadband internet service |
| X31SDataBeanAccess | Technical term | Fujitsu X31 framework data bean accessor — The standard web framework class used to read/write form data between the HTTP request and business logic |
| JSCCommonUtil | Component | Shared Java utility class — Provides common validation methods including `isValidParameter()` for null/empty checks |
| JCCWebCommon | Component | Shared web common utility class — Provides screen-level methods including `setMessageInfo()` for displaying error/success messages to users |
| EKB0010-TW | Constant | Error message template key — A system-wide message meaning "Please enter [field name]" (required field is missing) |
| KKSV0004 | Screen | The primary screen ID for VLAN-ID registration operations in K-Opticom's customer system |
| DATABEAN_GET_VALUE | Constant | X31 framework constant — Instructs `sendMessageString` to read a value from the data bean |
| chkItemValue1 | Method | The first in a series of input validation methods (chkItemValue1/2/3...) that verify mandatory fields before processing |
