# Business Logic — ObjectFilter.evaluate() [11 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.ObjectFilter` |
| Layer | Utility / Inner Class (Common Component) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### ObjectFilter.evaluate()

This method is the `evaluate` implementation from the inner class `ListMultiFilter`, which implements the `Predicater<HashMap<String, Object>>` interface. The class is nested inside `JKKWribSvcKeiOperateCC` as a reusable filtering predicate. The Japanese javadoc reads "マップ判定 キーに対する値が一致するか否かの判定を実施" — "performs a map evaluation to determine whether the value for the key matches."

The method performs a **multi-value predicate check**: it retrieves the value associated with a configured key from the input map, then iterates through a pre-configured array of acceptable values. If any value in the array matches the map value, it returns `true`; otherwise, it returns `false`.

This follows the **Predicate pattern**, enabling callers to pass `ListMultiFilter` instances as filter criteria to higher-level collection operations without hardcoding multi-value membership logic. It serves as a shared utility invoked by the `Items` utility class methods (`exist`, `find`, `select`, `select2`) and XPath-related classes (`JFUXPathManager.getItem`, `JFUXPathManager.getItemAsNodeList`, `JFUXPathManager.isElement`) to filter map-based data records against lists of acceptable code values. It performs **no database operations**, **no service component calls**, and **no I/O** — pure in-memory filtering.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["evaluate(item)"])
    KEY_GET["Retrieve itemValue = item.get(key)"]
    LOOP_START{"for each value in values[]"}
    VALUE_COMPARE{"value.equals(itemValue)"}
    MATCH_TRUE["Return true (value found in array)"]
    LOOP_END["Loop exhausted — no match found"]
    NO_MATCH["Return false (value not in array)"]
    END_RETURN(["Return / Next"])

    START --> KEY_GET
    KEY_GET --> LOOP_START
    LOOP_START -- "has more values" --> VALUE_COMPARE
    VALUE_COMPARE -- "true: match found" --> MATCH_TRUE
    MATCH_TRUE --> END_RETURN
    VALUE_COMPARE -- "false: try next" --> LOOP_START
    LOOP_START -- "no more values" --> LOOP_END
    LOOP_END --> NO_MATCH
    NO_MATCH --> END_RETURN
```

**Processing flow:**

1. **Map value retrieval** — Calls `item.get(key)` on the input `HashMap` to fetch the value associated with the filter's configured key. If the key does not exist, `null` is returned.
2. **Array iteration** — Iterates through the `Object[] values` array (configured at construction time), comparing each element against the retrieved map value using `Object.equals()`.
3. **Early return on match** — If any element in the array matches, immediately returns `true`.
4. **No match fallback** — If the loop exhausts all elements without a match, returns `false`. This handles both the case where the key is absent from the map (value is `null`) and where the key exists but has a value not in the allowed list.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `item` | `HashMap<String, String>` | A map representing a single data record or item, where each key is a field name and the value is the corresponding string value. These maps represent in-memory data rows from billing/order data (e.g., service type codes, order content codes, device type codes). |
| — | `key` (instance field) | `String` | The map key to look up during evaluation. Set at construction time. Represents a field name such as a service type code key or device type code key. |
| — | `values` (instance field) | `Object[]` | An array of acceptable values for the configured key. Set at construction time. When any element in this array equals the map's value at `key`, the predicate passes. These are domain code values (e.g., code type classifications, service detail type codes, device identifiers). |

## 4. CRUD Operations / Called Services

This method performs **no database operations** and **no service component calls**. All operations are in-memory.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R (in-memory) | `HashMap.get(String)` | - | - | Retrieves the value associated with `key` from the input map. In-memory read, no DB access. |
| R (in-memory) | `Object.equals(Object)` | - | - | Compares each array element against the map-retrieved value. Returns `true` if equal, `false` otherwise. Called once per array element. |

The pre-computed code analysis graph reports terminal operations of `getString`, `isAllEmptyTarget`, and `isCollect` — these are called by the **caller methods** (`Items.exist()`, `Items.find()`, `Items.select()`) that use `ListMultiFilter.evaluate()` as their filtering predicate. The `evaluate` method itself does not invoke these terminals directly.

## 5. Dependency Trace

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

Direct callers: 131 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 | Screen logic → `Items.exist(filter)` → `evaluate` | No terminal (predicate only) |
| 2 | Screen:KKSV0004 | Screen logic → `Items.find(filter)` → `evaluate` | No terminal (predicate only) |
| 3 | Screen:KKSV0004 | Screen logic → `Items.select(filter)` → `evaluate` | No terminal (predicate only) |
| 4 | Screen:KKSV0004 | Screen logic → `Items.select2(filter)` → `evaluate` | No terminal (predicate only) |
| 5 | Screen:KKSV0010 | Screen logic → `Items.exist(filter)` → `evaluate` | No terminal (predicate only) |
| 6 | Screen:KKSV0010 | Screen logic → `Items.find(filter)` → `evaluate` | No terminal (predicate only) |
| 7 | Screen:KKSV0010 | Screen logic → `Items.select(filter)` → `evaluate` | No terminal (predicate only) |
| 8 | Screen:KKSV0020 | Screen logic → `Items.exist(filter)` → `evaluate` | No terminal (predicate only) |
| 9 | Screen:KKSV0020 | Screen logic → `Items.find(filter)` → `evaluate` | No terminal (predicate only) |
| 10 | Screen:KKSV0020 | Screen logic → `Items.select(filter)` → `evaluate` | No terminal (predicate only) |
| 11 | Screen:KKSV0030 | Screen logic → `JFUXPathManager.getItem(filter)` → `evaluate` | No terminal (predicate only) |
| 12 | Screen:KKSV0030 | Screen logic → `JFUXPathManager.isElement(filter)` → `evaluate` | No terminal (predicate only) |
| 13 | JFUMailSupportInterface | `JFUMailSupportInterface.communication()` → `evaluate` | No terminal (predicate only) |
| 14 | JFUXPathManager | `JFUXPathManager.getItemAsNodeList()` → `evaluate` | No terminal (predicate only) |
| 15 | Items utility | `Items.exist()` / `Items.find()` / `Items.select()` → `evaluate` | No terminal (predicate only) |

**Call chain explanation:** All callers go through the `Items` utility class (or related classes `JFUXPathManager`, `JFUMailSupportInterface`) which uses `evaluate` as a predicate to filter collections of map-based records. The method has no terminal CRUD operations — it is a pure function that returns a boolean. The actual database/SC operations are performed by the caller chain before or after filtering.

## 6. Per-Branch Detail Blocks

**Block 1** — [METHOD BODY] `(item: HashMap<String, String>)` (L17412)

> The method retrieves the map value at the configured key and checks whether any value in the pre-configured array matches it.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Object itemValue = item.get(key);` // Retrieves value from map at configured key |
| 2 | SET | `for (Object value : values)` // Iterates through pre-configured array of acceptable values |
| 3 | IF | `if (value.equals(itemValue))` // Compares each array element against map value |
| 4 | RETURN | `return true;` // Match found — value is in the acceptable list |
| 5 | RETURN | `return false;` // Loop exhausted — value not in the acceptable list or key missing |

### Block 1.1 — [IF BRANCH] `(value.equals(itemValue) == true)` (L17417)

> The current array element matches the map value. Return `true` immediately without checking remaining elements.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Value found in acceptable values array |

### Block 1.2 — [IF FALLTHROUGH] `(value.equals(itemValue) == false)` (L17416)

> The current array element does not match. Continue iterating to the next element in the array. If all elements are exhausted, fall through to the method's final `return false`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | (loop continues — no statement, falls through to next array element) |

### Block 1.3 — [ELSE FALLTHROUGH] `(loop exhausted — no element matched)` (L17421)

> All elements in the `values` array have been compared against the map value without finding a match. This includes the case where the key is absent from the map (`itemValue` is `null`). Returns `false`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` // No match found — value is not in the acceptable list |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `Predicater<T>` | Interface | A functional interface defining a single-argument predicate method (`evaluate(T)`) used throughout the system to filter collections. |
| `ListMultiFilter` | Class | An inner predicate class that matches map entries if the value at a configured key is present in a pre-configured array of acceptable values. Used for multi-value inclusion checks. |
| `key` | Field | The map key (field name) used to look up a value during evaluation. Set at construction time. |
| `values` | Field | An array of acceptable values for the configured key. Set at construction time. Used for multi-value membership checks. |
| `item` | Parameter | A `HashMap<String, String>` representing a single data record, containing field names as keys and field values as string values. |
| `CDxxxxx` (e.g., `CD00037`, `CD00212`) | Constant prefix | Code classification — these constants represent master data code types in the billing system (service type codes, order content codes, device type codes). |
| `CDXXXXX_*` (e.g., `CDXXXXX_SVC_KEI`, `CDXXXXX_NET_PACK`) | Constant prefix | Service detail type codes — classify service line items and device types (FTTH service contract, net pack, DSL pack, STB, splitter). |
| SvcKei | Business term | Service line (系) — a service contract line item in the billing system, representing a specific service or device under a customer's contract. |
| `SvcKeiUCwkNo` | Field | Service detail work number — internal tracking ID for service contract line items. |
| `OdrNaiyoCd` | Field | Order content code — classifies the type of order (FTTH registration, change, cancellation). |
| `CdType` | Field | Code type — categorizes what kind of classification code a value represents (e.g., service type, device type). |
| KK | Prefix | "Kei Keiyaku" (Line Contract) — prefix used in entity/table names for service line contract data. |
| Items | Utility class | A utility class providing filtering operations (`exist`, `find`, `select`, `select2`) on collections of map-based records using predicates. |
| `HashMap<String, String>` | Type | An in-memory map structure used throughout the system to represent individual data records, where each field is a key-value pair. |
| `JFUXPathManager` | Class | A utility class for XPath-based XML/node access, providing methods like `getItem`, `getItemAsNodeList`, `isElement` that accept predicates for filtering. |
| `JFUMailSupportInterface` | Class | An interface for mail support operations, invoking predicates to filter mail-related data records. |
