# Business Logic — JBSbatKKCrsChgFixAfNetflixRnk.isNetflixPackPcrs() [15 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKCrsChgFixAfNetflixRnk` |
| Layer | Service |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKCrsChgFixAfNetflixRnk.isNetflixPackPcrs()

This method serves as a **Netflix pack course code discriminator** within the K-Opticom customer core system batch processing pipeline. It determines whether a given target course code (`trgtPcrsCd`) corresponds to a Netflix bundle service — i.e., a "Netflix Pack" tariff course offered by the ISP. The Netflix Pack is a bundled service offering where Netflix streaming is included as part of a broadband/internet service plan.

The method operates as a **lookup utility** (delegation pattern) that delegates to an in-memory `HashMap` (`netflixPackPcrsList`) pre-populated during the batch's `initial()` phase from the `KK_M_PCRS` (Master Course/Price) table. This approach avoids repeated database queries for each course code validation during the main processing loop, implementing a **cache-then-lookup** optimization pattern.

Its role in the larger system is to support the **post-course-change fix-up batch** (`JBSbatKKCrsChgFixAfNetflixRnk`), which runs after course changes and ETFLIX contract cancellations are finalized. The batch uses this method in a dual-check pattern within `execute()`: it verifies whether the *previous* course was a Netflix Pack while the *new* course is not, to trigger downstream Netflix information integration services. This ensures that bundle integrations (such as the third-party vendor bundle ID) are correctly synchronized during course modifications involving Netflix Pack services.

The method implements a **guard-check design pattern** — it first validates input non-blankness, then performs a fast `HashMap.containsKey()` lookup, providing an efficient true/false predicate for Netflix Pack membership.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isNetflixPackPcrs(trgtPcrsCd)"])
    COND1{"trgtPcrsCd is not
null/blank?"}
    COND2{"netflixPackPcrsList
contains key trgtPcrsCd?"}
    TRUE["return true"]
    FALSE["return false"]
    END(["Return"])

    START --> COND1
    COND1 -->|Yes| COND2
    COND1 -->|No| FALSE
    COND2 -->|Yes| TRUE
    COND2 -->|No| FALSE
    TRUE --> END
    FALSE --> END
```

This method performs a two-stage membership check:

1. **Null/Blank Guard**: Validates that the input `trgtPcrsCd` is neither null nor blank (empty string or whitespace-only). If the code is null/blank, it immediately returns `false`, treating it as non-Netflix-Pack. This is the safe default — an invalid or missing course code should not trigger Netflix Pack-specific processing.

2. **HashMap Key Lookup**: If the code passes the guard, it performs a `HashMap.containsKey()` lookup against the pre-populated `netflixPackPcrsList`. This map was built during `initial()` by querying the `KK_M_PCRS` (Master Course) table and filtering for Netflix Pack course records. The original implementation used `HashSet.contains()` (pre-ANK-3987-13-00), but was upgraded to `HashMap.containsKey()` to support storing additional metadata (such as `TAJGS_BUNDLE_ID`) alongside each course code, enabling future extensibility without further structural changes.

If the code is found in the map, it returns `true` (indicating the course is a Netflix Pack course). Otherwise, it returns `false`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `trgtPcrsCd` | `String` | Target course code — the tariff/price plan code to check for Netflix Pack membership. This code corresponds to a row in the `KK_M_PCRS` (Master Course) table and identifies a specific service plan (e.g., a broadband-only plan, a Netflix bundle plan, etc.). It is used as the lookup key against the pre-populated `netflixPackPcrsList` HashMap. Valid values are course codes such as those returned from the `JBSbatKK_M_PCRS.PCRS_CD` column; null or blank values are treated as non-Netflix-Pack. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `netflixPackPcrsList` | `HashMap<String, HashMap<String, String>>` | Netflix Pack course code lookup map. Keys are course codes (`PCRS_CD`), values are inner maps containing associated metadata (e.g., `TAJGS_BUNDLE_ID` — third-party vendor bundle identifier). Populated during `initial()` from the `KK_M_PCRS` table. |

## 4. CRUD Operations / Called Services

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

This method makes one method call to a utility component for null/blank validation:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKStringUtil.isNullBlank` | - | - | Calls `isNullBlank` utility to validate that `trgtPcrsCd` is not null, empty, or whitespace-only |

**Notes:**
- No database or entity operations occur directly within this method. Data access (reading from `KK_M_PCRS` to populate `netflixPackPcrsList`) happens in the `initial()` method, not here.
- The `HashMap.containsKey()` call is an in-memory lookup and does not constitute a CRUD operation.
- This method is a pure predicate function — it reads from an already-populated instance field and returns a boolean.

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKCrsChgFixAfNetflixRnk | `JBSbatKKCrsChgFixAfNetflixRnk.execute()` -> `JBSbatKKCrsChgFixAfNetflixRnk.isNetflixPackPcrs(trgtPcrsCd)` | `isNullBlank` [-], `HashMap.containsKey` [-] |

**Call Chain Detail:**
The `execute()` method within `JBSbatKKCrsChgFixAfNetflixRnk` invokes `isNetflixPackPcrs()` twice — once with `chgeBfPcrsCd` (the previous course code before the change) and once with `pcrsCd` (the new course code). This dual invocation forms a conditional guard:

```
isNetflixPackPcrs(chgeBfPcrsCd) && !isNetflixPackPcrs(pcrsCd)
```

This condition triggers Netflix information integration service calls only when transitioning **from** a Netflix Pack course **to** a non-Netflix Pack course, i.e., when a customer is downgrading or removing the Netflix bundle.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(trgtPcrsCd is not null/blank)` (L283)

> Null/blank guard check. If the input course code is invalid (null, empty, or whitespace-only), skip the lookup and return false.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JKKStringUtil.isNullBlank(trgtPcrsCd)` // Validates input is not null, empty, or whitespace |

**Block 1.1** — IF-BRANCH-TRUE `(trgtPcrsCd is not null/blank → true, i.e., !isNullBlank is true)` (L284)

> Input is valid. Proceed to check if this course code is a Netflix Pack course via HashMap lookup.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `netflixPackPcrsList.containsKey(trgtPcrsCd)` // HashMap key lookup for Netflix Pack membership [-> ANK-3987-13-00: Upgraded from HashSet.contains()] |

**Block 1.1.1** — IF-BRANCH-TRUE `(containsKey returns true)` (L287)

> The course code exists in the Netflix Pack map. Return true to indicate this is a Netflix Pack course.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Course code is a Netflix Pack course |

**Block 1.1.2** — IF-BRANCH-FALSE `(containsKey returns false)` (L289)

> The course code is not found in the Netflix Pack map. Fall through to the method's default return.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | (fall through to line 291) |

**Block 2** — ELSE-IMPLICIT `(trgtPcrsCd is null/blank)` (L291)

> Input was null/blank — treated as non-Netflix-Pack. This is the safe default to prevent unintended Netflix Pack processing on invalid codes.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // Not a Netflix Pack course (invalid input) |

**Block 1.1.1-Alternative** — PRE-ANK-3987-13-00 (`HashSet.contains` branch) (L286, commented)

> Original implementation (prior to ANK-3987-13-00 change). Used `HashSet<String>` instead of `HashMap<String, HashMap<String, String>>`. The `contains()` check served the same Netflix Pack membership purpose but stored no additional metadata.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `netflixPackPcrsList.contains(trgtPcrsCd)` // PRE-3987: HashSet.contains (commented out) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `trgtPcrsCd` | Parameter | Target course code — the tariff/price plan code being checked for Netflix Pack membership |
| `PCRS_CD` | Field | Course code (Price Course Code) — identifier for a specific service plan in the `KK_M_PCRS` master table |
| `KK_M_PCRS` | Table | Master Course/Price table — contains master data for all tariff and service plans |
| `netflixPackPcrsList` | Field | Netflix Pack course code lookup map — HashMap indexed by course code, populated from `KK_M_PCRS` during batch initialization |
| `TAJGS_BUNDLE_ID` | Field | Third-party vendor bundle ID — external identifier for the Netflix bundle, used in integrations with external vendor systems |
| Netflix Pack | Business term | A bundled service offering that includes Netflix streaming as part of a broadband/internet service plan |
| COURSE_CHG_FIX_02 | Constant | Course change fix flag — value "02", indicates post-course-change fix-up processing |
| NPACK_FLG_ARI_1 | Constant | Netflix Pack "with" flag — value "1", indicates Netflix Pack is included |
| NPACK_FLG_NASI_0 | Constant | Netflix Pack "without" flag — value "0", indicates Netflix Pack is not included |
| `initial()` | Method | Batch initialization method — runs before main processing, queries `KK_M_PCRS` and populates `netflixPackPcrsList` |
| `execute()` | Method | Batch main processing method — reads input item, performs course change analysis, invokes Netflix integration services |
| JKKStringUtil | Utility | Common string utility class providing null/blank checking methods (`isNullBlank`) |
| ANK-3987-13-00 | Change ticket | Change ticket that upgraded `netflixPackPcrsList` from `HashSet<String>` to `HashMap<String, HashMap<String, String>>` to support bundle ID metadata |
