# Business Logic — SCW00401SFLogic.chkItemValue2() [31 LOC]

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

## 1. Role

### SCW00401SFLogic.chkItemValue2()

This method performs the **second-stage item validation** for the eo electric phone VLAN-ID registration screen (SCW00401SF). It validates the preconditions required before allowing a VLAN-ID registration operation to proceed. Specifically, it ensures the customer is using an **eo electric phone** (eo Hikari Denwa) service contract as the base, and that the **SOD (Service Order Data) business integration status** does not hold any unresolved pending responses — because VLAN-ID assignment depends on SOD being fully resolved. The method implements a **gatekeeper pattern**: it reads key data fields from the service form bean, evaluates them against business rules, and either returns `true` to permit processing or returns `false` with a user-facing error message directing the operator to the issue. If called from `confirmCreate()`, this validation ensures the create (registration) confirmation step does not proceed until these conditions are met.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["chkItemValue2 begins"])

    CHK_EO["Check eo electric phone flag"]
    GET_EOF["GET eoflg = bean.sendMessageString(EO_TEL_FLG_01)"]
    COND_EOF{eoflg == 1?}

    SET_EKB0780["setMessageInfo: EKB0780_KW - Contract service, eo electric phone other, Registration process"]
    RET_FALSE_1["Return false"]

    SOD_CHECK["Check SOD business integration status"]
    GET_SOD["GET sodworksts = bean.sendMessageString(SOD_WORK_RNKI_STAT_01)"]
    COND_SOD_WAIT_RES{sodworksts == 002?}
    SET_EKB1040_WAIT_RES["setMessageInfo: EKB1040_JW - Record state, Business integration wait SOD response pending, VLAN-ID registration"]
    RET_FALSE_2["Return false"]

    COND_SOD_WAIT_FIN{sodworksts == 003?}
    SET_EKB1040_WAIT_FIN["setMessageInfo: EKB1040_JW - Record state, Business integration wait SOD response completed, VLAN-ID registration"]
    RET_FALSE_3["Return false"]

    RET_TRUE["Return true"]

    START --> CHK_EO --> GET_EOF --> COND_EOF
    COND_EOF -- No --> SET_EKB0780 --> RET_FALSE_1
    COND_EOF -- Yes --> SOD_CHECK --> GET_SOD --> COND_SOD_WAIT_RES
    COND_SOD_WAIT_RES -- Yes --> SET_EKB1040_WAIT_RES --> RET_FALSE_2
    COND_SOD_WAIT_RES -- No --> COND_SOD_WAIT_FIN
    COND_SOD_WAIT_FIN -- Yes --> SET_EKB1040_WAIT_FIN --> RET_FALSE_3
    COND_SOD_WAIT_FIN -- No --> RET_TRUE
```

**CRITICAL — Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `EO_TEL_FLG_01` | `"eo electric phone flag"` | Form bean key identifying whether the customer has an eo electric phone service contract |
| `SOD_WORK_RNKI_STAT_01` | `"SOD business integration status"` | Form bean key for the SOD business integration status value |
| `SOD_RNKI_STAT_NO` | `"001"` | SOD business integration status: No integration (non-SOD service) |
| `SOD_RNKI_STAT_WAIT_RES` | `"002"` | SOD business integration status: Business integration wait, SOD response pending |
| `SOD_RNKI_STAT_WAIT_FIN` | `"003"` | SOD business integration status: Business integration wait, SOD response completed |
| `SOD_RNKI_STAT_FIN` | `"004"` | SOD business integration status: Business integration completed |
| `JPCOnlineMessageConstant.EKB0780_KW` | — | Error message key: not eo electric phone — registration not available |
| `JPCOnlineMessageConstant.EKB1040_JW` | — | Error message key: VLAN-ID registration blocked due to SOD wait status |

**Block Descriptions:**

1. **Block 1 (L286–291):** Validates that the base service is eo electric phone. Reads `EO_TEL_FLG_01` from the bean. If the value is not `"1"`, displays an error message indicating registration processing is only available for eo electric phone contracts, and returns `false`.

2. **Block 2 (L293–298):** Checks if the SOD business integration status is `"002"` (wait, SOD response pending). If so, displays an error message indicating VLAN-ID registration cannot proceed because SOD response is not yet received, and returns `false`.

3. **Block 3 (L299–303):** Checks if the SOD business integration status is `"003"` (wait, SOD response completed). If so, displays an error message indicating VLAN-ID registration cannot proceed because SOD response has been received but finalization is still pending, and returns `false`.

4. **Block 4 (L314):** If all checks pass, returns `true` to allow the registration process to continue.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The service form bean for screen SCW00401SF. It carries all user-entered and system-populated form values including the eo electric phone flag (`EO_TEL_FLG_01`) and the SOD business integration status (`SOD_WORK_RNKI_STAT_01`). This bean is used to read data from the screen context to validate preconditions. |

**Instance fields read:**
- `this` — the `SCW00401SFLogic` instance itself (passed to `setMessageInfo` as the context object for message resolution).

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X31SDataBeanAccess.sendMessageString` | - | - | Reads the eo electric phone flag value (`EO_TEL_FLG_01`) from the service form bean |
| - | `JCCWebCommon.setMessageInfo` | - | - | Sets an error message (EKB0780_KW) when the customer is not using eo electric phone |
| - | `X31SDataBeanAccess.sendMessageString` | - | - | Reads the SOD business integration status value (`SOD_WORK_RNKI_STAT_01`) from the service form bean |
| - | `JCCWebCommon.setMessageInfo` | - | - | Sets an error message (EKB1040_JW) when SOD response is pending (status 002) |
| - | `JCCWebCommon.setMessageInfo` | - | - | Sets an error message (EKB1040_JW) when SOD response is completed but not finalized (status 003) |

**Notes:**
- This method is **purely a validation gate** — it performs no database CRUD operations.
- It reads data from the form bean (in-memory, already populated from prior screen processing).
- It sets user-facing error messages via the `JCCWebCommon` and `JPCOnlineMessageConstant` infrastructure.
- The commented-out section (L305–312) would have additionally validated the `REQ_JI_KJAK_NO_01` (Temporary Work Case Number) field but is currently disabled.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: SCW00401SFLogic.confirmCreate() | `confirmCreate()` -> `chkItemValue2(bean)` | `setMessageInfo [M] EKB0780_KW, EKB1040_JW (messages)` |

**Notes:**
- No screen/batch entry points (KKSV*) were found within 8 hops. The caller is a private method within the same logic class (`confirmCreate()`), suggesting this is an internal validation step during the create/registration confirmation flow.
- All terminal operations are message-setting calls (`setMessageInfo`, `sendMessageString`) — no entity-level CRUD operations are reached from this method.

## 6. Per-Branch Detail Blocks

### Block 1 — IF `(!(\"1\".equals(eoflg)))` [EO_TEL_FLG_01="eo electric phone flag"] (L286)

Validates that the customer's base service is eo electric phone. This is a hard gate — VLAN-ID registration is only available for eo electric phone customers.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eoflg = bean.sendMessageString(EO_TEL_FLG_01, X31CWebConst.DATABEAN_GET_VALUE)` // Read eo electric phone flag from form bean |
| 2 | COND | `!(\"1\".equals(eoflg))` // [EO_TEL_FLG_01="1" means eo electric phone service] |
| 3 | EXEC | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0780_KW, new String[]{"Contract service", "eo electric phone other", "Registration process"})` // Display error: registration only available for eo electric phone contracts |
| 4 | RETURN | `return false` // Block processing |

### Block 2 — IF `(JSCStrConstant.SOD_RNKI_STAT_WAIT_RES.equals(sodworksts))` [SOD_RNKI_STAT_WAIT_RES="002"] (L294)

Checks if the SOD business integration status is "002" (business integration wait, SOD response pending). This state means the SOD response has not yet arrived, so VLAN-ID registration cannot proceed.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sodworksts = bean.sendMessageString(SOD_WORK_RNKI_STAT_01, X31CWebConst.DATABEAN_GET_VALUE)` // Read SOD business integration status from form bean |
| 2 | COND | `JSCStrConstant.SOD_RNKI_STAT_WAIT_RES.equals(sodworksts)` // [SOD_RNKI_STAT_WAIT_RES="002" - Business integration wait, SOD response pending] |
| 3 | EXEC | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1040_JW, new String[]{"Record state", "Business integration wait SOD response pending", "VLAN-ID registration"})` // Display error: VLAN-ID registration blocked by pending SOD response |
| 4 | RETURN | `return false` // Block processing |

### Block 3 — IF `(JSCStrConstant.SOD_RNKI_STAT_WAIT_FIN.equals(sodworksts))` [SOD_RNKI_STAT_WAIT_FIN="003"] (L299)

Checks if the SOD business integration status is "003" (business integration wait, SOD response completed). Even though the SOD response has been received, finalization is not yet done, so VLAN-ID registration must still be blocked.

| # | Type | Code |
|---|------|------|
| 1 | COND | `JSCStrConstant.SOD_RNKI_STAT_WAIT_FIN.equals(sodworksts)` // [SOD_RNKI_STAT_WAIT_FIN="003" - Business integration wait, SOD response completed] |
| 2 | EXEC | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB1040_JW, new String[]{"Record state", "Business integration wait SOD response completed", "VLAN-ID registration"})` // Display error: VLAN-ID registration blocked by pending SOD finalization |
| 3 | RETURN | `return false` // Block processing |

### Block 4 — ELSE (implicit success path) (L314)

If all checks pass (eo electric phone confirmed AND SOD status is not in any pending/wait state), processing is permitted to continue.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // All validations passed, permit VLAN-ID registration |

### Block 5 — COMMENTED OUT (DISABLED) [REQ_JI_KJAK_NO_01="Temporary Work Case Number"] (L305–312)

The commented-out code block would have validated that a temporary work case number was obtained. This validation is currently disabled and will need to be re-enabled in a future update.

| # | Type | Code |
|---|------|------|
| 1 | SET | `reqJiKjakNo = bean.sendMessageString(REQ_JI_KJAK_NO_01, X31CWebConst.DATABEAN_GET_VALUE)` // [DISABLED] Read temporary work case number |
| 2 | COND | `"".equals(reqJiKjakNo) || reqJiKjakNo == null` // [DISABLED] Check if case number is empty or null |
| 3 | EXEC | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB0930_NW, new String[]{"Temporary work case number could not be obtained", "VLAN-ID registration"})` // [DISABLED] Display error |
| 4 | RETURN | `return false` // [DISABLED] Block processing |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `eoflg` | Field | eo electric phone flag — indicates whether the customer has an eo electric phone (eo Hikari Denwa) service contract; `"1"` means yes |
| `sodworksts` | Field | SOD work rank status — the current status of the SOD (Service Order Data) business integration process |
| SOD | Acronym | Service Order Data — external telecom order fulfillment system that manages service orders for broadband and phone services |
| SOD_RNKI_STAT_NO | Constant | `"001"` — SOD business integration status: No integration (non-SOD service) |
| SOD_RNKI_STAT_WAIT_RES | Constant | `"002"` — SOD business integration status: Business integration wait, SOD response pending (response not yet received) |
| SOD_RNKI_STAT_WAIT_FIN | Constant | `"003"` — SOD business integration status: Business integration wait, SOD response completed (response received but not yet finalized) |
| SOD_RNKI_STAT_FIN | Constant | `"004"` — SOD business integration status: Business integration completed |
| EO_TEL_FLG_01 | Constant | Form bean key string — `"eo electric phone flag"` — used to retrieve the eo electric phone flag value from the service form bean |
| SOD_WORK_RNKI_STAT_01 | Constant | Form bean key string — `"SOD business integration status"` — used to retrieve the SOD status value from the service form bean |
| REQ_JI_KJAK_NO_01 | Constant | Form bean key string — `"Temporary Work Case Number"` — used to retrieve the temporary work case number (currently unused) |
| EKB0780_KW | Message Key | Error message template: displayed when the customer is not using eo electric phone and attempts VLAN-ID registration |
| EKB1040_JW | Message Key | Error message template: displayed when VLAN-ID registration is blocked due to pending SOD business integration |
| EKB0930_NW | Message Key | Error message template (commented out): displayed when temporary work case number could not be obtained |
| VLAN-ID | Business term | Virtual LAN Identifier — a network identifier assigned to a customer's line for traffic separation in fiber optic services |
| X31SDataBeanAccess | Class | Service form bean access class — provides `sendMessageString()` to retrieve form field values by key |
| JCCWebCommon | Class | Web common utility class — provides `setMessageInfo()` for setting screen-level error/information messages |
| confirmCreate | Method | The caller of `chkItemValue2` — performs the create/registration confirmation step in the SCW00401SF screen flow |
