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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKWribSvcKeiOperateCC.ListMultiFilter` |
| Layer | CC / Common Component — inner class within `JKKWribSvcKeiOperateCC` |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### ListMultiFilter.evaluate()

`ListMultiFilter` is an inner class that implements the `Predicater<HashMap<String, String>>` functional interface. Its purpose is to serve as a **multi-value key-based filter** for HashMap collections in the broadband service contract processing pipeline. Specifically, `evaluate()` checks whether a given HashMap contains a key whose value matches **any** of a pre-defined set of acceptable values (an `Object[]` array stored in the `values` field). This enables efficient "is value in this allowed set?" queries without requiring the caller to write explicit loop-and-compare logic.

The method uses a **filter/dispatch design pattern** — it is instantiated with a specific key and a set of acceptable values, then passed as a predicate to collection operations (`Items.exist()`, `Items.find()`, `Items.select()`). In the broader system, this pattern allows the broadband service contract workflow to perform declarative, reusable filtering on HashMap-based data structures that represent service items, contract records, or order data.

Because `ListMultiFilter` operates on arbitrary key-value pairs, it is a generic utility used across many different service types and processing contexts — it does not itself handle any specific telecom service domain; rather, it provides a building block for higher-level filtering operations on the service contract data model.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["evaluate(item)"])
    GET["itemValue = item.get(key)"]
    LOOP["for (Object value : values)"]
    CHECK["value.equals(itemValue)"]
    MATCH["return true"]
    NEXT["next iteration"]
    ENDFOR["all values checked"]
    RETURNFALSE["return false"]
    ENDFN(["End"])

    START --> GET
    GET --> LOOP
    LOOP --> CHECK
    CHECK -->|match found| MATCH
    MATCH --> ENDFN
    CHECK -->|no match| NEXT
    NEXT --> ENDFOR
    ENDFOR --> RETURNFALSE
    RETURNFALSE --> ENDFN
```

> **Note:** The `key` and `values` fields are **constructor-injected** (no constant resolution required). The `key` is a String representing the HashMap key to inspect; `values` is an `Object[]` array of acceptable values to match against. The actual key and values are set when the `ListMultiFilter` instance is created.

**Processing summary:**
1. Retrieve the value from the input HashMap at the configured key.
2. Iterate through all acceptable values in the `values` array.
3. If any value matches the retrieved item value (via `Object.equals()`), return `true`.
4. If the loop exhausts all values without a match, return `false`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `item` | `HashMap<String, String>` | A HashMap representing a single business entity (e.g., a service item, contract record, or order data entry). The keys correspond to field names in the service contract data model, and values are the field values to be evaluated. |
| 2 | `key` (field, constructor-injected) | `String` | The HashMap key to inspect. Represents the field name whose value is being checked against the allowed set (e.g., a service code, status code, or type code). |
| 3 | `values` (field, constructor-injected) | `Object[]` | An array of acceptable values. The method returns `true` if the value found at `key` in `item` matches **any** element in this array. Used to implement "is this value in the allowed set?" logic. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `item.get(key)` | — | — | Reads the value from the input HashMap at the configured key. |
| R | `value.equals(itemValue)` | — | — | Compares each acceptable value against the retrieved HashMap value. No database operation. |

**Analysis:** This method performs **pure in-memory logic** with no SC (Service Component) calls, no CBS (Common Business Service) invocations, and no direct database or entity operations. It is a predicate/filter function that operates entirely on the in-memory `HashMap` parameter and the constructor-injected `key` and `values` fields. All data retrieval and persistence is handled by the caller (e.g., `Items.exist()`, `Items.find()`, `Items.select()`), which in turn may invoke SC/CBS layers.

## 5. Dependency Trace

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

**Direct callers of this method (via `Predicater<HashMap<String, String>>` interface):**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `Items.exist()` | `Items.exist(collection, predicate)` → `predicate.evaluate(item)` | No terminal — pure in-memory filter |
| 2 | `Items.find()` | `Items.find(collection, predicate)` → `predicate.evaluate(item)` | No terminal — pure in-memory filter |
| 3 | `Items.select()` | `Items.select(collection, predicate)` → `predicate.evaluate(item)` | No terminal — pure in-memory filter |
| 4 | `JFUMailSupportInterface.communication()` | Uses `ListMultiFilter` as predicate for filtering HashMap collections | Depends on caller's data flow |
| 5 | `JFUXPathManager.getItem()` | Uses `ListMultiFilter` as predicate for XPath-based lookup | Depends on caller's data flow |
| 6 | `JFUXPathManager.getItemAsNodeList()` | Uses `ListMultiFilter` as predicate for node list filtering | Depends on caller's data flow |
| 7 | `JFUXPathManager.isElement()` | Uses `ListMultiFilter` as predicate for element existence check | Depends on caller's data flow |

**No screen/batch entry points found within 8 hops.** Direct callers found: 7 methods (as listed above).

**Terminal operations from this method:** None — this method performs no SC calls, CBS calls, or database operations. It is a stateless predicate function.

**Note on `SvcKeiFinderWithDchskmTrgtSvc`:** There is a separate inner class `SvcKeiFinderWithDchskmTrgtSvc` in the same file (`JKKWribSvcKeiOperateCC`) which implements `Predicater<CAANMsg>` (not `Predicater<HashMap<String, String>>`). The `ListMultiFilter` class specifically targets `HashMap<String, String>` predicates, while `SvcKeiFinderWithDchskmTrgtSvc` targets `CAANMsg` predicates for broadband service key item matching against target service codes, processing group codes, contract codes, and plan codes.

## 6. Per-Branch Detail Blocks

**Block 1** — [GET] `(item.get(key))` (L17415)

> Retrieve the value from the input HashMap at the configured key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itemValue = item.get(key)` // Retrieve value from HashMap; may be null if key not present |

**Block 2** — [FOR LOOP] `(Object value : values)` (L17417)

> Iterate through all acceptable values in the constructor-injected `values` array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `value` ← each element from `values[]` // Iteration variable |

**Block 2.1** — [IF] `(value.equals(itemValue))` (L17418)

> Check if the current acceptable value matches the retrieved HashMap value.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `value.equals(itemValue)` // Compare acceptable value with HashMap value |
| 2 | RETURN | `return true` // Match found — filter accepts this item |

**Block 2.2** — [ELSE-implicit] `(no match)` (L17418)

> No match found for this value; continue iterating.

| # | Type | Code |
|---|------|------|
| 1 | SET | continue loop // Proceed to next value in `values[]` |

**Block 3** — [RETURN] `(all values exhausted without match)` (L17421)

> All acceptable values have been checked without finding a match.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // No match found — filter rejects this item |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `Predicater<T>` | Interface | Functional interface defining a single `evaluate(T item)` method that returns a boolean. Used throughout the system as a filter/condition contract for collection operations. |
| `ListMultiFilter` | Class | Inner class implementing `Predicater<HashMap<String, String>>`. Provides a reusable multi-value filter for checking if a HashMap value at a given key matches any value in an allowed set. |
| `evaluate` | Method | Predicate evaluation method. Returns `true` if the HashMap's value at the configured key is in the allowed values array; `false` otherwise. |
| `key` | Field | The HashMap key (field name) to inspect during evaluation. Set via constructor at filter creation time. |
| `values` | Field | Array of acceptable values. The filter returns `true` if the HashMap value matches any element in this array. Set via constructor at filter creation time. |
| `item` | Parameter | Input HashMap representing a business entity (service item, contract record, etc.) whose field value is being filtered. |
| `Items.exist()` | Method | Collection utility that checks if any element in a collection satisfies a given predicate. |
| `Items.find()` | Method | Collection utility that returns the first element in a collection satisfying a given predicate. |
| `Items.select()` | Method | Collection utility that returns a filtered copy of a collection containing only elements that satisfy a given predicate. |
| `JKKWribSvcKeiOperateCC` | Class | Broadband service contract key operation common component. Contains multiple inner classes (filters, movers, finders) that support the broadband service contract processing workflow. |

---

**Note on file path discrepancy:** The FQN `com.fujitsu.futurity.bp.custom.common.SvcKeiFinderWithDchskmTrgtSvc` and the HashMap-based `evaluate` method at lines 17412–17422 refer to the inner class `ListMultiFilter` in `JKKWribSvcKeiOperateCC.java`. The class `SvcKeiFinderWithDchskmTrgtSvc` (defined at line 16842 in the same file) implements `Predicater<CAANMsg>` and its `evaluate` method accepts a `CAANMsg` parameter instead of `HashMap<String, String>`. This document covers the method at the specified line range.
