# (DD23) Business Logic — JKKStringUtil.isNullBlank() [8 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.common.util.JKKStringUtil` |
| Layer | Utility (Common Component) |
| Module | `util` (Package: `eo.common.util`) |

## 1. Role

### JKKStringUtil.isNullBlank()

**isNullBlank()** is a shared static utility method used across the enterprise application to validate whether a given String argument is either `null` or an empty string (`""`). Its business purpose is to serve as the canonical null-or-blank check for any code path that must guard against missing or absent string data — for example, before performing string operations, comparing values, or accessing data that assumes a non-empty payload. The method follows the **Guard Clause** design pattern: when a precondition (the string must not be null or empty) is violated, it short-circuits execution by returning `true`, allowing callers to branch on this result and skip subsequent processing. It is a foundational building block referenced by CBS classes (e.g., `JKKHakkoSODCC`) for data validation prior to service order processing, and internally by `nullBlankToSpace()` to decide whether to replace missing values with a space character. Its role in the larger system is that of a reusable, side-effect-free predicate — it reads no external state, performs no I/O, and returns a deterministic boolean based solely on its single input.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isNullBlank(str)"])
    CHECK_NULL{"str == null"}
    CHECK_EMPTY["empty string check"]
    RETURN_TRUE(["return true"])
    RETURN_FALSE(["return false"])

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RETURN_TRUE
    CHECK_NULL -->|No| CHECK_EMPTY
    CHECK_EMPTY -->|Yes| RETURN_TRUE
    CHECK_EMPTY -->|No| RETURN_FALSE
```

The method performs two guard-checks in sequence. First, it checks whether the input reference is `null` (the object was never instantiated). If so, it returns `true` immediately. If not, it proceeds to the second check: whether the string's content equals `""` (the empty string literal). This is evaluated using the safe pattern `"".equals(str)`, which avoids a `NullPointerException` even if `str` happens to be `null` in a buggy code path. If the string is empty, it returns `true`. If neither condition is met — meaning the string contains at least one character — it returns `false`.

There are no constant comparisons, no conditional branches that route to different business operations, and no looping constructs. The control flow is a simple linear predicate with two conditions combined via logical OR.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `str` | `String` | The string value to be validated for nullness or emptiness. Represents any business data that is transmitted as a string — such as service detail numbers (`mskmDtlNo`), equipment serial numbers (`KIKI_SEIZO_NO`), or internal tracking IDs. If `null`, the calling code typically skips subsequent processing or treats the value as missing. If empty (`""`), it is treated identically to `null` by this method, indicating an absent or defaulted value. |

No instance fields or external state are read by this method. It is purely a function of its input parameter.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls no external services, CBS classes, DAOs, or database-accessing methods. It operates entirely on its input parameter using Java's built-in string equality check.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | N/A | N/A | N/A | No database or service operations — pure in-memory predicate |

## 5. Dependency Trace

### Callers

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS:JKKHakkoSODCC | `JKKHakkoSODCC.<various methods>` -> `JKKStringUtil.isNullBlank` | None (utility check only) |
| 2 | Utility:JKKStringUtil | `nullBlankToSpace(str)` -> `isNullBlank(str)` | None (internal recursive call) |

### Caller details (JKKHakkoSODCC context)

The method is used within `JKKHakkoSODCC` (a Service Order Data creation/processing CBS class) for input validation in multiple places:

- **Line 8383**: Validates `mskmDtlNo` (equipment detail number) before comparing it with `svcKeiUcwkMskmDtlNo`. If null/blank, the guard clause skips the equality comparison to avoid `NullPointerException`.
- **Line 14820, 15249, 15412, 15737**: Validates `mskmDtlNo` or `op_mskm_dtl_no` against `svcKeiUcwkMskmDtlNo` for equipment-related service contract comparisons.
- **Line 23415, 23475, 23518, 23603, 23644**: Validates `va_kiki_chg_no` (validation equipment change number) and `KIKI_SEIZO_NO` (equipment serial number) fields during equipment change processing.

### Call chain summary

```
Screen/CBS Entry -> JKKHakkoSODCC.<business method> -> JKKStringUtil.isNullBlank(str)
                                                          (returns boolean, no further calls)
```

There are **no terminal CRUD operations** reachable from this method — it is a pure utility predicate with no downstream side effects.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (logical OR: null check) `(str == null || "".equals(str))` (L38)

> Evaluates the null-or-empty guard condition. The `||` operator ensures short-circuit evaluation: if `str` is `null`, the second condition is not evaluated.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `str == null` // First guard: reference is not pointing to any object |
| 2 | CHECK | `"".equals(str)` // Second guard: string is empty — uses literal-first pattern to avoid NPE [-> STRING_BLANK=""] |

### Block 1.1 — THEN (null condition met) (L39)

> The input reference is `null`. This indicates the caller did not provide a value, or the value was unset before this method was invoked.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Indicates the string is null — caller should treat as missing/blank |

### Block 1.2 — ELSE (empty string condition met) (L39-L41)

> The reference is not `null` but the string content equals `""`. This indicates the caller provided an explicitly empty string.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Indicates the string is empty — treated same as null for business logic |

### Block 1.3 — ELSE (neither null nor empty) (L42)

> The string reference is non-null and its content is not `""`. The string contains at least one character, so it is considered a valid, non-blank value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // String is non-null and non-empty — valid value |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `isNullBlank` | Method | Null/Blank Check — utility predicate that returns `true` when a string is either `null` or `""` |
| `mskmDtlNo` | Field | Equipment Detail Number — identifier for an equipment detail line item within a service contract work record |
| `svcKeiUcwkMskmDtlNo` | Field | Service Line Equipment Work Equipment Detail Number — the equipment detail number associated with a service line work record |
| `va_kiki_chg_no` | Field | Validation Equipment Change Number — equipment change number used during equipment modification processing |
| `KIKI_SEIZO_NO` | Field | Equipment Serial Number — unique identifier for physical equipment assets |
| `op_mskm_dtl_no` | Field | Operation Equipment Detail Number — equipment detail number in an operation/change context |
| `nullBlankToSpace` | Method | Null/Blank-to-Space — companion utility that replaces null/blank strings with a single space character (`" "`) |
| STRING_BLANK | Constant | Empty string literal `""` — the canonical representation of a zero-length string |
| Guard Clause | Pattern | A programming pattern that returns early when a precondition is not met, preventing downstream errors like `NullPointerException` |
