---

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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.DchskmFilter` |
| Layer | Common Component (Package: `com.fujitsu.futurity.bp.custom.common`) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### DchskmFilter.evaluate()

The `evaluate` method implements a **map-based multi-value predicate** used to determine whether a given value associated with a specific key in a data map matches any value in a predefined whitelist of acceptable values. In business terms, it functions as a **filter validator** that answers the question: "Does this map entry's value belong to an accepted set for this key?" The Javadoc states: _"Map determination — determines whether the value for the key matches"_ (マップ判定 キーに対する値が一致するか否かの判定を実施).

This method follows a **Predicate design pattern** — it implements the `Predicater<HashMap<String, String>>` interface, allowing it to be used as a reusable filter within a pipeline or collection-filtering operation. It is instantiated with a specific `key` (e.g., a service type code field name) and an array of `values` (e.g., a set of accepted codes like `{"01", "02", "03"}`), then evaluated against data maps at runtime.

Its **role in the larger system** is that of a shared filtering utility invoked during service contract line item processing. Callers in `Items.exist()`, `Items.find()`, `Items.select()`, and `JFUXPathManager` methods use this filter to selectively include or exclude data entries based on key-value matching. This is a **shared utility** (not a screen entry point) called from many paths throughout the WribSvcKeiOperate workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["evaluate(item)"])
    ITEM_GET["Get itemValue = item.get(key)"]
    LOOP_START{"For each value in values"}
    EQUAL_CHECK{"value.equals(itemValue)"}
    MATCH_TRUE["Match found"]
    MATCH_RETURN["Return true"]
    NEXT_ITER["Next iteration"]
    NO_MATCH["No match in array"]
    NO_RETURN["Return false"]
    END(["Return / Next"])

    START --> ITEM_GET
    ITEM_GET --> LOOP_START
    LOOP_START --> EQUAL_CHECK
    EQUAL_CHECK -->|true| MATCH_TRUE
    MATCH_TRUE --> MATCH_RETURN
    MATCH_RETURN --> END
    EQUAL_CHECK -->|false| NEXT_ITER
    NEXT_ITER --> LOOP_START
    LOOP_START -->|no more items| NO_MATCH
    NO_MATCH --> NO_RETURN
    NO_RETURN --> END
```

The method performs a simple **linear search with early-exit** pattern:
1. Retrieves the value from the input map at the configured key position.
2. Iterates through the pre-registered `values` array (configured at construction time).
3. Compares each array element against the retrieved map value using `Object.equals()`.
4. If any comparison succeeds, immediately returns `true`.
5. If the loop exhausts all values without a match, returns `false`.

No conditional branching by constant, no SC/CBS calls, no DB operations — this is a pure in-memory comparison utility.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `item` | `HashMap<String, String>` | A data map representing a single record or entity's field-value pairs. Keys are field identifiers (e.g., service type codes, contract statuses) and values are their corresponding string values. This map is typically constructed from database results or XPath node processing during order/service-kei (サービス契約明細) workflow processing. |

**Instance fields read by the method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `key` | `String` | The map key (field name) to look up. This is set at construction time and defines which field in the map this filter instance checks (e.g., "svc_kei_cd" for service contract detail code). |
| `values` | `Object[]` | An array of acceptable values for the configured key. Set at construction time, this acts as a whitelist — the filter returns `true` only if the map's value for `key` matches any element in this array. |

## 4. CRUD Operations / Called Services

This method performs **no** SC/CBS calls, database operations, or entity reads/writes. It operates entirely in memory using standard Java HashMap and Object operations.

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `item.get(key)` | - | - | Reads a value from the input HashMap by key — in-memory data retrieval, no database or SC call. |
| R | `value.equals(itemValue)` | - | - | Compares array element against retrieved map value using Java's Object.equals — in-memory comparison. |

## 5. Dependency Trace

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

Direct callers of this method:

| Caller | Kind |
|--------|------|
| `Items.exist()` | Utility — checks if an item exists in a collection matching this filter |
| `Items.find()` | Utility — finds an item matching this filter |
| `Items.select()` | Utility — selects items matching this filter |
| `JFUMailSupportInterface.communication()` | Mail support interface — uses filter during mail processing workflows |
| `JFUXPathManager.getItem()` | XPath manager — retrieves items filtered by this predicate |
| `JFUXPathManager.getItemAsNodeList()` | XPath manager — retrieves node lists filtered by this predicate |
| `JFUXPathManager.isElement()` | XPath manager — checks if a node matches this filter |

**Call Chain Summary:**
- This method is a leaf-level utility called directly by data access helpers (`Items.*`) and XPath navigation utilities (`JFUXPathManager.*`).
- It is **not** directly invoked by any screen or batch entry point.
- No terminal SC/CBS/CRUD endpoints are reached from this method — it operates as a pure in-memory predicate.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Utility: `Items.exist` | `Items.exist(filter)` -> `filter.evaluate(item)` | `item.get(key) [R] HashMap (in-memory)` |
| 2 | Utility: `Items.find` | `Items.find(filter)` -> `filter.evaluate(item)` | `value.equals(itemValue) [R] Object[] (in-memory)` |
| 3 | Utility: `Items.select` | `Items.select(filter)` -> `filter.evaluate(item)` | `item.get(key) [R] HashMap (in-memory)` |
| 4 | Component: `JFUMailSupportInterface.communication` | `JFUMailSupportInterface.communication(...)` -> `filter.evaluate(item)` | No SC/CBS — in-memory only |
| 5 | Component: `JFUXPathManager.getItem` | `JFUXPathManager.getItem(...)` -> `filter.evaluate(item)` | No SC/CBS — in-memory only |
| 6 | Component: `JFUXPathManager.getItemAsNodeList` | `JFUXPathManager.getItemAsNodeList(...)` -> `filter.evaluate(item)` | No SC/CBS — in-memory only |
| 7 | Component: `JFUXPathManager.isElement` | `JFUXPathManager.isElement(...)` -> `filter.evaluate(item)` | No SC/CBS — in-memory only |

## 6. Per-Branch Detail Blocks

### Block 1 — IF/GET `(item.get(key))` (L17412)

Retrieves the value associated with the filter's configured key from the input map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itemValue = item.get(key)` // Get the map value for the configured key [in-memory lookup] |

### Block 2 — FOR (L17414-17416)

Iterates through the pre-configured whitelist of acceptable values, comparing each against the retrieved map value.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (Object value : values)` // Iterate over the pre-registered acceptable values array [whitelist comparison] |

#### Block 2.1 — IF-ELSE `(value.equals(itemValue))` (L17415-17416)

Compares the current whitelist element with the map value. If equal, returns `true` (early exit). If not, continues to the next iteration.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (value.equals(itemValue))` // Check if current whitelist value matches the map value [Object.equals comparison] |

##### Block 2.1.1 — IF TRUE `(match)` (L17415-17416)

A match was found in the whitelist. Return `true` immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Match found — the map value is an acceptable value for this key |

##### Block 2.1.2 — IF FALSE `(no match)` (L17415)

No match for this array element. Continue to the next element in the `values` array.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `(implicit) next iteration` // Continue to next value in the array |

### Block 3 — RETURN (L17417)

All whitelist values have been exhausted without finding a match. Return `false`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // No match found — the map value is not in the accepted whitelist for this key |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `item` | Parameter | HashMap<String, String> — A data map representing a record's field-value pairs. Keys are field identifiers (e.g., service type codes, contract statuses); values are their corresponding string values. Used throughout the WribSvcKeiOperate workflow for order and service detail processing. |
| `key` | Field | The map key (field name) to look up. Set at construction time. Defines which field in the map this filter instance checks (e.g., a service contract code field). |
| `values` | Field | An array of acceptable values (whitelist) for the configured key. Set at construction time. The filter returns `true` only if the map value for `key` matches any element in this array. |
| `Predicater<HashMap<String, String>>` | Interface | A functional interface defining the `evaluate` contract. This class implements it to serve as a reusable filter predicate for collection-based data selection and validation. |
| Map-based multi-value predicate | Pattern | A filtering design pattern where a predicate holds a fixed set of acceptable values for a specific map key, enabling O(n) linear comparison to validate whether a record belongs to an accepted set. |
| WribSvcKeiOperate | Business domain | "Wrib Service Kei Operation" — the service contract line item processing workflow. "Wrib" = written/recorded, "SvcKei" = Service Detail (サービス契約明細), "Operate" = operate/process. |

---
