# Business Logic — KKW00816SFLogic.editIspNinshoId() [20 LOC]

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

## 1. Role

### KKW00816SFLogic.editIspNinshoId()

The `editIspNinshoId` method transforms an ISP authentication ID (`ispNinshoId`) by inserting an "P" suffix character at a position determined by whether the input string contains an "@" symbol. If the ISP authentication ID contains "@" (meaning it follows an email-style local-part and domain-part format), the method inserts "P" immediately before the "@" — effectively marking the local-part portion. If the string does not contain "@", the method simply appends "P" to the very end of the ID. This transformation is a data normalization step applied to ISP credential identifiers within the telecom service registration flow, preparing them for downstream processing by appending a version/type discriminator ("P"). The method implements a conditional string mutation pattern and serves as a shared utility within the `KKW00816SF` screen logic class, used by `getMltiseId()` to build a multi-issuer identifier with consistent formatting.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editIspNinshoId(ispNinshoId)"])
    CHECK_EMPTY["Check: isNullBlank(ispNinshoId) == false AND indexOf(@) != -1"]
    FIND_AT["Find indexOf(@) to get idx"]
    SPLIT_BEFORE["SET: ispNinshoIdMae = ispNinshoId.substring(0, idx)
// @-preceding portion (excluding @)"]
    SPLIT_AFTER["SET: ispNinshoIdAto = ispNinshoId.substring(idx)
// @-following portion (including @)"]
    INSERT_P["SET: rtrStr = ispNinshoIdMae + P + ispNinshoIdAto
// Insert P before @"]
    APPEND_P["SET: rtrStr = ispNinshoId + P
// Append P to end"]
    RETURN("Return rtrStr")

    START --> CHECK_EMPTY
    CHECK_EMPTY -- true --> FIND_AT
    FIND_AT --> SPLIT_BEFORE
    SPLIT_BEFORE --> SPLIT_AFTER
    SPLIT_AFTER --> INSERT_P
    INSERT_P --> RETURN
    CHECK_EMPTY -- false --> APPEND_P
    APPEND_P --> RETURN
```

The method processes the ISP authentication ID through a single conditional branch. When the input passes the guard clause (non-null/non-blank AND contains "@"), the string is split at the "@" boundary and a "P" discriminator is inserted between the two parts. When the input fails either condition (null/blank or no "@" present), a trailing "P" is appended directly. Both paths converge to the same return value, producing a uniformly formatted ISP credential identifier.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `ispNinshoId` | `String` | ISP Authentication ID — the credential identifier used to authenticate the customer's ISP (Internet Service Provider) connection. This field may be formatted as an email-style address (e.g., `user@isp-domain`) or as a plain alphanumeric string. |

**Instance fields / external state read:** None. This method is stateless — it does not reference any instance fields, configuration, or external data sources.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | JKKStringUtil | - | Utility validation — checks if the input `ispNinshoId` is null or blank (whitespace-only). Used as a guard clause before further processing. |

**Notes:** This method is a pure string transformation — it performs no database operations, no service component calls, and no create/read/update/delete activity. The sole external dependency is `JKKStringUtil.isNullBlank()`, which is a utility-level null/blank check used for input validation.

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW00816SFLogic.getMltiseId()` | `getMltiseId()` -> `KKW00816SFLogic.editIspNinshoId` | `isNullBlank [R] N/A`, `substring [-] N/A` |

The method is private and called exclusively by `getMltiseId()` within the same class (`KKW00816SFLogic`). It does not participate in a broader screen or batch call chain and is not directly invoked by any UI entry point.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(ispNinshoId is not null/blank AND contains "@")` (L651)

> Guard clause combined with "@" presence check. Both conditions must be true (AND) to take the branch that inserts "P" before "@".

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JKKStringUtil.isNullBlank(ispNinshoId)` // Null/blank validation check |
| 2 | EXEC | `ispNinshoId.indexOf("@") != -1` // Check for "@" symbol presence |

**Block 1.1** — THEN (L653–L659) `[Insert P before @]`

> When `ispNinshoId` is valid AND contains "@", split the string at "@" and insert "P" between the local-part and domain-part.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `int idx = ispNinshoId.indexOf("@")` // Find position of "@" character |
| 2 | SET | `String ispNinshoIdMae = ispNinshoId.substring(0, idx)` // Characters before "@" (exclusive) |
| 3 | SET | `String ispNinshoIdAto = ispNinshoId.substring(idx)` // Characters from "@" onward (inclusive) |
| 4 | SET | `rtrStr = ispNinshoIdMae + "P" + ispNinshoIdAto` // Concatenate: [before@] + P + [@after] |

**Block 2** — ELSE (L660–L662) `[Append P to end]`

> When `ispNinshoId` is null/blank, does not contain "@", or both — simply append "P" to the end of the input string.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtrStr = ispNinshoId + "P"` // Append "P" suffix to the entire string |

**Block 3** — RETURN (L663)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return rtrStr` // Return the transformed ISP authentication ID |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ispNinshoId` | Field | ISP Authentication ID — the credential identifier used to authenticate the customer's ISP (Internet Service Provider) connection. "Ninsho" is Japanese for "authentication/certification" (認証). |
| `rtrStr` | Field | Return string — the intermediate variable that holds the transformed ISP authentication ID before being returned. |
| `ispNinshoIdMae` | Field | ISP Authentication ID (before) — the substring of the original ID that appears before the "@" character (exclusive of "@"). "Mae" is Japanese for "before" (前). |
| `ispNinshoIdAto` | Field | ISP Authentication ID (after) — the substring starting from the "@" character to the end of the string (inclusive of "@"). "Ato" is Japanese for "after" (後). |
| "P" suffix | Business term | Version/type discriminator character appended to ISP authentication IDs to mark the format variant or generation of the credential. |
| `isNullBlank` | Utility method | Null/blank validation — checks whether a string is null, empty, or consists only of whitespace characters. |
| `indexOf` | Java method | Finds the first occurrence index of a character within a string. Returns -1 if not found. |
| `substring` | Java method | Extracts a substring from a string given start and end indices. |
| `KKW00816SF` | Module | Screen module for multi-issuer service configuration. Part of the web-view layer handling ISP-related operations. |
