# Business Logic — KKW00816SFLogic.getMltiseId() [76 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SFLogic` |
| Layer | Controller (webview logic layer) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SFLogic.getMltiseId()

This method performs **fixed Global IP address contract determination** for a multi-session authentication session in the telecom service contract system. Specifically, it analyzes the list of operational service contracts associated with the current session to determine whether the customer has (or is subscribing to) a **fixed Global IP address contract** (`OP_SVC_CD_VALUE_0040 = "0040"` — Fixed Global IP Address).

When a fixed Global IP contract is detected, the method marks the session as a **"new/static"** registration scenario: it edits the multi-session authentication ID to include a "P" suffix (via `editIspNinshoId`), and sets the request type code to "New" (`YOKYU_SBT_CD_02 = "02"`), order content code to "Multi-session (static) / Registration" (`ODR_NAIYO_CD_144`), clears the service detail work number, and clears the service contract work timestamp.

When no fixed Global IP contract is found, it marks the session as a **"change/dynamic"** scenario: it sets the request type to "Change" (`YOKYU_SBT_CD_04 = "04"`), order content to "Multi-session (dynamic) / Registration" (`ODR_NAIYO_CD_142`), and preserves existing service detail work numbers and timestamps.

This method serves as a **routing/dispatch** mechanism that branches business processing between two fundamentally different multi-session authentication flows — static (fixed IP) versus dynamic (change) — and is called by three entry points within the same logic class (`actionAddMltise`, `actionFixAddMltise`, `actionMltiseInit`), all of which are screen-action methods on the same screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getMltiseId paramBean"])
    START --> ISFIXIPAD["isFixipad = false"]
    ISFIXIPAD --> EXTRACT["Extract fields from paramBean[0]"]
    EXTRACT --> CHECK_OP["opsvkList = paramBean[0].getDataBeanArray OP_SVC_KEI_LIST"]
    CHECK_OP --> OP_NULL{opsvkList != null?}
    OP_NULL -->|No| ELSE_BRANCH["Set change/dynamic constants"]
    OP_NULL -->|Yes| LOOP["for i = 0 to getCount"]
    LOOP --> GET_SUB["subbean = opsvkList.getDataBean i"]
    GET_SUB --> SUB_NULL{subbean != null?}
    SUB_NULL -->|No| NEXT_ITER["continue"]
    SUB_NULL -->|Yes| GET_SVC_CD["opSvcCd = subbean.sendMessageString OP_SVC_CD_02"]
    GET_SVC_CD --> GET_SVC_STAT["opSvcKeiStat = subbean.sendMessageString OP_SVC_KEI_STAT_02"]
    GET_SVC_STAT --> CHECK_SVC{opSvcCd == OP_SVC_CD_VALUE_0040?}
    CHECK_SVC -->|No| NEXT_ITER
    CHECK_SVC -->|Yes| CHECK_STAT{opSvcKeiStat == 100 or 030 or 020?}
    CHECK_STAT -->|No| NEXT_ITER
    CHECK_STAT -->|Yes| SET_FIXIPAD["isFixipad = true"]
    SET_FIXIPAD --> NEXT_ITER
    NEXT_ITER --> END_LOOP{i < getCount?}
    END_LOOP -->|Yes| GET_SUB
    END_LOOP -->|No| FIXIPAD_CHECK{isFixipad?}
    FIXIPAD_CHECK -->|Yes| SET_CONSTS["Set new/static constants + editIspNinshoId"]
    FIXIPAD_CHECK -->|No| ELSE_BRANCH
    SET_CONSTS --> RETURN["return isFixipad"]
    ELSE_BRANCH --> RETURN
```

> **Notes:**
> - `OP_SVC_CD_VALUE_0040 = "0040"` [-> OP_SVC_CD_VALUE_0040="0040" (JKKCommonConst.java:209)] — Fixed Global IP Address service code
> - `SVC_KEI_STAT_100 = "100"` [-> SVC_KEI_STAT_100="100" (JKKCommonConst.java)] — Service contract status: Active/Completed
> - `SVC_KEI_STAT_030` [-> SVC_KEI_STAT_030 (JKKCommonConst.java)] — Service contract status: Suspended
> - `SVC_KEI_STAT_020` [-> SVC_KEI_STAT_020 (JKKCommonConst.java)] — Service contract status: Pending
> - `YOKYU_SBT_CD_02 = "02"` [-> YOKYU_SBT_CD_02="02" (JKKCommonConst.java:2640)] — Request type: New
> - `YOKYU_SBT_CD_04 = "04"` [-> YOKYU_SBT_CD_04="04" (JKKCommonConst.java)] — Request type: Change
> - `ODR_NAIYO_CD_144 = "144"` [-> ODR_NAIYO_CD_144 (JKKCommonConst.java)] — Order content: Multi-session (static) / Registration (Fixed IP)
> - `ODR_NAIYO_CD_142 = "142"` [-> ODR_NAIYO_CD_142 (JKKCommonConst.java)] — Order content: Multi-session (dynamic) / Registration (Change)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | An array of DataBean access objects carrying DB search results for the current multi-session authentication context. `paramBean[0]` is the primary DataBean that holds session-level fields (authentication ID, password, service detail work number, generation timestamp) and a nested DataBeanArray (`OP_SVC_KEI_LIST`) containing the list of operational service contracts for the customer. |

**Instance fields read/written by this method:**

| Field | Access Type | Business Description |
|-------|-------------|---------------------|
| `shk_mltise_ninsho_id_pwd` | Write | Shared secret multi-session authentication password — credentials for the multi-session ID |
| `mltise_ninsho_id` | Read/Write | Multi-session authentication ID — the core identifier used to distinguish the current session from others on the same line |
| `svc_kei_ucwk_no` | Read/Write | Service detail work number — internal tracking ID for service contract line items |
| `kk0161_gene_add_dtm` | Read/Write | Service contract generation/addition timestamp — when the service contract line was generated |
| `yokyu_sbt_cd` | Write | Request type code — distinguishes "New" (`"02"`) from "Change" (`"04"`) |
| `odr_naiyo_cd` | Write | Order content code — classifies the order type (multi-session static registration `"144"` vs dynamic registration `"142"`) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `paramBean[0].sendMessageString(KKW00816SFConst.SHK_MLTISE_NINSHO_ID_PWD, ...)` | — | — | Reads shared secret multi-session authentication password from the primary DataBean |
| R | `paramBean[0].sendMessageString(KKW00816SFConst.MLTISE_NINSHO_ID, ...)` | — | — | Reads multi-session authentication ID from the primary DataBean |
| R | `paramBean[0].sendMessageString(KKW00816SFConst.SVC_KEI_UCWK_NO, ...)` | — | — | Reads service detail work number from the primary DataBean |
| R | `paramBean[0].sendMessageString(KKW00816SFConst.KK0161_GENE_ADD_DTM, ...)` | — | — | Reads service contract generation/addition timestamp from the primary DataBean |
| R | `paramBean[0].getDataBeanArray(KKW00816SFConst.OP_SVC_KEI_LIST)` | — | — | Retrieves the array of operational service contracts (service type details) for the customer |
| R | `opsvkList.getCount()` | — | — | Gets the count of operational service contract items in the list |
| R | `opsvkList.getDataBean(i)` | — | — | Retrieves the i-th operational service contract DataBean |
| R | `subbean.sendMessageString(KKW00816SFConst.OP_SVC_CD_02, ...)` | — | — | Reads the operational service code from a service contract item |
| R | `subbean.sendMessageString(KKW00816SFConst.OP_SVC_KEI_STAT_02, ...)` | — | — | Reads the operational service status from a service contract item |
| U | `editIspNinshoId(mltise_ninsho_id)` | — | — | Edits the ISP authentication ID to insert "P" suffix for fixed Global IP scenario |
| R | `JKKStringUtil.isNullBlank(ispNinshoId)` | — | — | Utility: checks if the authentication ID is null or blank (called within `editIspNinshoId`) |

## 5. Dependency Trace

### Direct callers (from code analysis graph):

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW00816SFLogic.actionAddMltise()` | `actionAddMltise` -> `getMltiseId(paramBean)` | `editIspNinshoId [U] —`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `getDataBean [-]`, `getCount [-]`, `getDataBeanArray [-]` |
| 2 | `KKW00816SFLogic.actionFixAddMltise()` | `actionFixAddMltise` -> `getMltiseId(paramBean)` | `editIspNinshoId [U] —`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `getDataBean [-]`, `getCount [-]`, `getDataBeanArray [-]` |
| 3 | `KKW00816SFLogic.actionMltiseInit()` | `actionMltiseInit` -> `getMltiseId(paramBean)` | `editIspNinshoId [U] —`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `sendMessageString [-]`, `getDataBean [-]`, `getCount [-]`, `getDataBeanArray [-]` |

**Notes:**
- All callers are private methods within the same `KKW00816SFLogic` class.
- These three methods (`actionAddMltise`, `actionFixAddMltise`, `actionMltiseInit`) are screen-action entry points that handle multi-session authentication operations on the KKW00816SF screen.
- The terminal operations from this method are all **local DataBean reads** and the `editIspNinshoId` write — no external SC/CBS calls or database operations are performed by `getMltiseId` itself.

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGNMENT] (L563)

Initialize the fixed Global IP detection flag to `false`. This boolean is the core state variable that determines which processing branch the method follows.

| # | Type | Code |
|---|------|------|
| 1 | SET | `isFixipad = false` |

**Block 2** — [FIELD ASSIGNMENT BLOCK] — Extract primary DataBean fields (L565–L568)

Extract the four key fields from `paramBean[0]` and store them in instance fields. These fields represent the current multi-session authentication context.

| # | Type | Code |
|---|------|------|
| 1 | SET | `shk_mltise_ninsho_id_pwd = paramBean[0].sendMessageString(KKW00816SFConst.SHK_MLTISE_NINSHO_ID_PWD, X31CWebConst.DATABEAN_GET_VALUE)` // Sets shared secret password [-> SHK_MLTISE_NINSHO_ID_PWD (KKW00816SFConst.java)] |
| 2 | SET | `mltise_ninsho_id = paramBean[0].sendMessageString(KKW00816SFConst.MLTISE_NINSHO_ID, X31CWebConst.DATABEAN_GET_VALUE)` // Sets multi-session authentication ID [-> MLTISE_NINSHO_ID (KKW00816SFConst.java)] |
| 3 | SET | `svc_kei_ucwk_no = paramBean[0].sendMessageString(KKW00816SFConst.SVC_KEI_UCWK_NO, X31CWebConst.DATABEAN_GET_VALUE)` // Sets service detail work number [-> SVC_KEI_UCWK_NO (KKW00816SFConst.java)] |
| 4 | SET | `kk0161_gene_add_dtm = paramBean[0].sendMessageString(KKW00816SFConst.KK0161_GENE_ADD_DTM, X31CWebConst.DATABEAN_GET_VALUE)` // Sets service contract generation timestamp [-> KK0161_GENE_ADD_DTM (KKW00816SFConst.java)] |

**Block 3** — [IF] `(opsvkList != null)` — Check if operational service contract list exists (L571–L572)

The operational service contracts are retrieved as a nested DataBeanArray from the primary DataBean. This array contains the list of service types (e.g., FTTH, Fixed Global IP, Mail) currently subscribed by the customer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `opsvkList = paramBean[0].getDataBeanArray(KKW00816SFConst.OP_SVC_KEI_LIST)` // Gets operational service type list [-> OP_SVC_KEI_LIST (KKW00816SFConst.java)] |
| 2 | IF | `if (opsvkList != null)` (L572) — Check if the service contract list is not null |

**Block 3.1** — [FOR LOOP] `i = 0; i < opsvkList.getCount()` (L576)

Iterate over each operational service contract item to check for fixed Global IP.

| # | Type | Code |
|---|------|------|
| 1 | SET | `subbean = null` |
| 2 | SET | `subbean = opsvkList.getDataBean(i)` // Retrieves i-th service contract item |

**Block 3.1.1** — [IF] `(subbean == null)` (L581)

Skip null entries in the service contract list (defensive check against gaps in the array).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip null subbean, move to next iteration |

**Block 3.1.2** — [IF] `(JKKCommonConst.OP_SVC_CD_VALUE_0040.equals(opSvcCd))` (L588)

Check if the operational service code matches the **Fixed Global IP Address** code. This is the primary filter for fixed Global IP detection.

| # | Type | Code |
|---|------|------|
| 1 | SET | `opSvcCd = subbean.sendMessageString(KKW00816SFConst.OP_SVC_CD_02, X31CWebConst.DATABEAN_GET_VALUE)` // Reads operational service code [-> OP_SVC_CD_02 (KKW00816SFConst.java)] |
| 2 | SET | `opSvcKeiStat = subbean.sendMessageString(KKW00816SFConst.OP_SVC_KEI_STAT_02, X31CWebConst.DATABEAN_GET_VALUE)` // Reads operational service status [-> OP_SVC_KEI_STAT_02 (KKW00816SFConst.java)] |
| 3 | IF | `if (JKKCommonConst.OP_SVC_CD_VALUE_0040.equals(opSvcCd))` [-> OP_SVC_CD_VALUE_0040="0040" (JKKCommonConst.java:209)] — Fixed Global IP Address service code |

**Block 3.1.2.1** — [IF] `(opSvcKeiStat == 100 || 030 || 020)` (L590–L592)

Check if the service contract status indicates a valid/fixed contract. Originally only status `100` was checked, but the code was modified (OM-2013-0002398, 2013/11/14) to also accept status `030` and `020`, broadening the detection to include suspended and pending contracts.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (JKKCommonConst.SVC_KEI_STAT_100.equals(opSvcKeiStat) || JKKCommonConst.SVC_KEI_STAT_030.equals(opSvcKeiStat) || JKKCommonConst.SVC_KEI_STAT_020.equals(opSvcKeiStat))` [-> SVC_KEI_STAT_100="100", SVC_KEI_STAT_030, SVC_KEI_STAT_020 (JKKCommonConst.java)] — Status: Active/Suspended/Pending |
| 2 | SET | `isFixipad = true` // Fixed Global IP contract found |

**Block 4** — [IF/ELSE] `(isFixipad)` (L607–L632)

The main branching decision point. Determines whether to apply "new/static" constants (Fixed Global IP found) or "change/dynamic" constants (no Fixed Global IP).

**Block 4.1** — [IF] `(isFixipad == true)` — Fixed Global IP contract detected (L610–L623)

A fixed Global IP address contract was found. Apply "new/static" registration parameters: edit the ISP authentication ID to mark it as a fixed IP variant, set the request type to "New", set the order content to "Multi-session (static) / Registration", and clear the service detail work number and timestamp.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mltise_ninsho_id = editIspNinshoId(mltise_ninsho_id)` // Edits ISP auth ID to include "P" marker [-> editIspNinshoId (KKW00816SFLogic.java:643)] |
| 2 | SET | `yokyu_sbt_cd = JKKCommonConst.YOKYU_SBT_CD_02` [-> YOKYU_SBT_CD_02="02" (JKKCommonConst.java:2640)] // Request type: New |
| 3 | SET | `odr_naiyo_cd = JKKCommonConst.ODR_NAIYO_CD_144` [-> ODR_NAIYO_CD_144="144" (JKKCommonConst.java)] // Order content: Multi-session (static) / Registration |
| 4 | SET | `svc_kei_ucwk_no = ""` // Service detail work number cleared [Removed in v1.02.00; now always cleared] |
| 5 | SET | `kk0161_gene_add_dtm = ""` // Service contract generation timestamp cleared |

**Block 4.1.1** — Nested detail of `editIspNinshoId(mltise_ninsho_id)` (L643–L670)

This private method inserts a "P" marker into the ISP authentication ID to indicate it is associated with a fixed Global IP address. Two cases:
- If the ID contains "@", insert "P" immediately before the "@".
- If the ID does not contain "@", append "P" at the end.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtrStr = ""` |
| 2 | IF | `!JKKStringUtil.isNullBlank(ispNinshoId) && ispNinshoId.indexOf("@") != -1` — ID is not null/blank and contains "@" |
| 3 | SET | `idx = ispNinshoId.indexOf("@")` // Find position of "@" |
| 4 | SET | `ispNinshoIdMae = ispNinshoId.substring(0, idx)` // Characters before "@" (excluding "@") |
| 5 | SET | `ispNinshoIdAto = ispNinshoId.substring(idx)` // Characters from "@" onwards (including "@") |
| 6 | SET | `rtrStr = ispNinshoIdMae + "P" + ispNinshoIdAto` // Insert "P" before "@" |
| 7 | ELSE | ID does not contain "@" |
| 8 | SET | `rtrStr = ispNinshoId + "P"` // Append "P" at end |
| 9 | RETURN | `return rtrStr` |

**Block 4.2** — [ELSE] `(isFixipad == false)` — No Fixed Global IP contract (L625–L629)

No fixed Global IP address contract was found. Apply "change/dynamic" registration parameters: set the request type to "Change" and the order content to "Multi-session (dynamic) / Registration". Existing service detail work numbers and timestamps are preserved (not cleared).

| # | Type | Code |
|---|------|------|
| 1 | SET | `yokyu_sbt_cd = JKKCommonConst.YOKYU_SBT_CD_04` [-> YOKYU_SBT_CD_04="04" (JKKCommonConst.java)] // Request type: Change |
| 2 | SET | `odr_naiyo_cd = JKKCommonConst.ODR_NAIYO_CD_142` [-> ODR_NAIYO_CD_142="142" (JKKCommonConst.java)] // Order content: Multi-session (dynamic) / Registration |

**Block 5** — [RETURN] (L632)

Return the determination result. `true` indicates a Fixed Global IP contract was detected (static/new flow). `false` indicates no Fixed Global IP contract (dynamic/change flow).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return isFixipad` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mltise_ninsho_id` | Field | Multi-session authentication ID — identifies a session within a multi-session (concurrent session) authentication setup, allowing multiple devices/users to share a single line |
| `shk_mltise_ninsho_id_pwd` | Field | Shared secret multi-session authentication password — credential used to authenticate multi-session ID changes |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for service contract line items, used for processing and audit |
| `kk0161_gene_add_dtm` | Field | Service contract generation/addition timestamp — the datetime when a service contract line was created or last modified |
| `yokyu_sbt_cd` | Field | Request type code — classifies the request as "New" (`"02"`) or "Change" (`"04"`) |
| `odr_naiyo_cd` | Field | Order content code — classifies the order type: `"144"` for multi-session (static) / registration (fixed IP), `"142"` for multi-session (dynamic) / registration (change) |
| `op_svc_cd_02` | Field | Operational service code — identifies the type of operational service (e.g., `"0040"` = Fixed Global IP Address) |
| `op_svc_kei_stat_02` | Field | Operational service type status — the current status of a service contract item (e.g., `"100"` = Active, `"030"` = Suspended, `"020"` = Pending) |
| `op_svc_kei_list` | Field | Operational service type list — array of service contract items associated with the customer/session |
| OP_SVC_CD_VALUE_0040 | Constant | Service code `"0040"` — Fixed Global IP Address (固定グローバルIPアドレス) |
| SVC_KEI_STAT_100 | Constant | Status `"100"` — Service contract status: Active / Completed (normal operation) |
| SVC_KEI_STAT_030 | Constant | Status `"030"` — Service contract status: Suspended |
| SVC_KEI_STAT_020 | Constant | Status `"020"` — Service contract status: Pending |
| YOKYU_SBT_CD_02 | Constant | Request type `"02"` — New (新規) |
| YOKYU_SBT_CD_04 | Constant | Request type `"04"` — Change (変更) |
| ODR_NAIYO_CD_144 | Constant | Order content `"144"` — Multi-session (static) / Registration — used when a Fixed Global IP address is detected |
| ODR_NAIYO_CD_142 | Constant | Order content `"142"` — Multi-session (dynamic) / Registration — used when no Fixed Global IP address is detected |
| Fixed Global IP Address (固定グローバルIPアドレス) | Business term | A service where a customer is assigned a static, publicly routable IP address — used for hosting servers, remote access, or other services requiring a fixed external address |
| Multi-session Authentication (マルチセッション認証) | Business term | A mechanism allowing multiple concurrent sessions (devices/users) to share a single telecommunication line, each identified by a unique multi-session authentication ID |
| Fixed Global IP (静的) (固定グローバルIP) | Business term | Fixed/static Global IP registration — the "new" flow where the customer is setting up a permanent fixed IP address contract |
| Dynamic (動的) | Business term | Dynamic Global IP registration (change) — the "change" flow where the customer is modifying an existing multi-session setup without a fixed IP |
| ISP Authentication ID (ISP認証ID) | Field | The identifier used for ISP-level authentication within the multi-session framework |
| "P" marker (Pマーカ) | Business term | A suffix appended to the ISP authentication ID to indicate it is associated with a Fixed Global IP address contract — inserted before "@" if present, or at the end otherwise |
| X31SDataBeanAccess | Technical | A DataBean access wrapper class providing methods to read/write values from/to a structured data container (the "X31" framework data bean) |
| X31SDataBeanAccessArray | Technical | An array variant of X31SDataBeanAccess for managing collections of DataBean items (used here for the service contract list) |
| X31CWebConst.DATABEAN_GET_VALUE | Constant | A framework constant used as a flag to retrieve a value from a DataBean |
| KKW00816SF | Module | The screen/service module handling fixed Global IP address contract operations — likely a "KK" (Komiya/Kei) "W" (Web) module |
