---

# Business Logic — JBSbatKKAdChgSodUpd.makeAgingInfoList() [63 LOC]

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

## 1. Role

### JBSbatKKAdChgSodUpd.makeAgingInfoList()

This method assembles an **aging target information list** used during the address-change (住所変更) batch process to identify which ISP-related fields require aging (i.e., are eligible for value updates or aging-triggered processing). It queries the operation service contract <ISP> table (`KK_T_OPSVKEI_ISP`) to extract email addresses (MLAD) and POP IDs, and queries the sub-operation service contract tables (`KK_T_SBOP_SVC_KEI` / `KK_T_SBOPSVKEI_ISP`) to extract email aliases. Each extracted value is categorized into an aging info map with a type code (`aging_sbt_cd`) and target value (`aging_tg_value`), then appended to the result list. The method implements a **data extraction and classification pattern**: it queries relational data, applies blank checks to filter meaningful values, and normalizes each piece into a uniform aging info structure. It is a shared utility method, called by `setKKSV056501CC()` and `setKKSV056505CC()` within the same class, feeding aging data downstream to the broader address-change service contract update flow. Three aging categories are supported: Mail (code "009") for the primary email address, POP ID (code "007") for the Point of Presence identifier, and Mail Alias (code "008") for derived email aliases combined with the primary MLAD when present.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["makeAgingInfoList params"])
    START --> INIT["Initialize agingInfoList"]
    INIT --> QUERRY_OP["Query opSvcKeiISPInfo"]
    QUERRY_OP --> MLAD["Read MLAD field"]
    MLAD --> MLAD_NBL{"isNullBlank maid"}
    MLAD_NBL --> |"false"| MLMAP["Create agingInfoMap"]
    MLMAP --> MLAD_CD["Put aging_sbt_cd 009"]
    MLAD_CD --> MLAD_VAL["Put aging_tg_value"]
    MLAD_VAL --> MLAD_ADD["Add to agingInfoList"]
    MLAD_ADD --> POPID_R["Read POP_ID field"]
    MLAD_NBL --> |"true"| POPID_R
    POPID_R --> POPID_NBL{"isNullBlank maid"}
    POPID_NBL --> |"false"| POPMAP["Create agingInfoMap"]
    POPMAP --> POP_CD["Put aging_sbt_cd 007"]
    POP_CD --> POP_VAL["Put aging_tg_value"]
    POP_VAL --> POP_ADD["Add to agingInfoList"]
    POP_ADD --> SBOP_Q["Query sub-opSvcKei"]
    SBOP_Q --> LOOP_CHECK{"selectNext not null"}
    LOOP_CHECK --> |"false"| RET["Return agingInfoList"]
    LOOP_CHECK --> |"true"| SBOP_PK["Query SBOP ISP info"]
    SBOP_PK --> ALIAS_R["Read alias field"]
    ALIAS_R --> ALIAS_NBL{"isNullBlank alias"}
    ALIAS_NBL --> |"false"| ALMAP["Create agingInfoMap"]
    ALMAP --> AL_CD["Put aging_sbt_cd 008"]
    AL_CD --> AL_MLAD{"isNullBlank maid"}
    AL_MAP_SKIP["Continue to loop"]
    AL_MLAD --> |"false"| AL_IDX["Find at index"]
    AL_IDX --> AL_IDX_CHECK{"idx not -1"}
    AL_IDX_CHECK --> |"false"| AL_MAP_SKIP
    AL_IDX_CHECK --> |"true"| AL_SUB["Append maid to alias"]
    AL_SUB --> AL_VAL["Put aging_tg_value"]
    AL_VAL --> AL_ADD["Add to agingInfoList"]
    AL_ADD --> LOOP_CHECK
    AL_MLAD --> |"true"| AL_VAL
    AL_MAP_SKIP --> LOOP_CHECK
    RET --> END(["END"])
```

**Processing overview:**

1. **Initialize** an empty `agingInfoList` to collect aging info maps.
2. **Query** the operation service contract <ISP> record using `getOpSvcKeiISPInfo()` with the service key number and generated addition datetime.
3. **Extract MLAD (Mail Address)** and check if it is non-blank. If present, create an aging info map with `aging_sbt_cd = "009"` (Mail) and store the MLAD value.
4. **Extract POP_ID** and — critically — re-check `isNullBlank(mlad)` (the same MLAD variable, not POP_ID, per the source code). If MLAD is still non-blank, create an aging info map with `aging_sbt_cd = "007"` (POP ID) and store the POP_ID value. Note: This conditional gate means the POP_ID is only added when MLAD is also present.
5. **Query sub-operation service contracts** via `executeKK_T_SBOP_SVC_KEI_KK_SELECT_013(op_svc_kei_no, opeDate)`, then iterate through all returned rows.
6. For each sub-operation service contract row, **query ISP info** via `executeKK_T_SBOPSVKEI_ISP_PKSELECT()` using the service key number, sub-service key number, and generated addition datetime as composite keys.
7. **Extract the email alias** from the sub-ISP info. If non-blank, create an aging info map with `aging_sbt_cd = "008"` (Mail Alias). If MLAD is also present, locate the `@` character index and **append the MLAD portion** (e.g., the domain part) to the alias before storing.
8. **Return** the fully assembled aging info list.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `op_svc_kei_no` | `String` | Operation Service Contract Number — the unique key identifying the top-level service contract for a customer. Used to look up ISP-related data across `KK_T_OPSVKEI_ISP` and `KK_T_SBOP_SVC_KEI` tables. Drives all data retrieval in this method. |
| 2 | `gene_add_dtm` | `String` | Generated Addition DateTime — a timestamp used to pinpoint a specific contract addition event. Used as a key parameter in `getOpSvcKeiISPInfo()` to filter the ISP contract record to the correct addition version. |

**Instance fields / external state read:**

| Name | Type | Business Description |
|------|------|---------------------|
| `opeDate` | `String` (inherited from `JBSbatBusinessService`) | Operation Date — the current batch processing date. Passed to `executeKK_T_SBOP_SVC_KEI_KK_SELECT_013()` to filter sub-operation service contracts. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKKAdChgSodUpd.getOpSvcKeiISPInfo` | (inferred: EKKxxxxSC) | `KK_T_OPSVKEI_ISP` | Reads operation service contract <ISP> data using service key number and addition datetime as composite keys. Returns a `JBSbatCommonDBInterface` containing MLAD and POP_ID fields. |
| - | `JBSbatKKAdChgSodUpd.executeKK_T_SBOP_SVC_KEI_KK_SELECT_013` | (inferred: EKKxxxxSC) | `KK_T_SBOP_SVC_KEI` | Executes a SELECT query on the sub-operation service contract table to find all sub-service contracts linked to the given operation service contract number. Iterated via `selectNext()` in a while loop. |
| R | `JBSbatKKAdChgSodUpd.executeKK_T_SBOPSVKEI_ISP_PKSELECT` | (inferred: EKKxxxxSC) | `KK_T_SBOPSVKEI_ISP` | Queries the sub-operation service contract <ISP> table using a composite primary key (op_svc_kei_no, sbop_svc_kei_no, gene_add_dtm). Returns ISP-specific fields including ALIAS. |
| R | `JBSbatKK_T_OPSVKEI_ISP.getString` (MLAD) | - | `KK_T_OPSVKEI_ISP` | Reads the primary email address (MLAD - Mail Address) field from the operation service contract <ISP> record. |
| R | `JBSbatKK_T_OPSVKEI_ISP.getString` (POP_ID) | - | `KK_T_OPSVKEI_ISP` | Reads the POP_ID (Point of Presence ID) field from the operation service contract <ISP> record. |
| R | `JBSbatKK_T_SBOPSVKEI_ISP.getString` (ALIAS) | - | `KK_T_SBOPSVKEI_ISP` | Reads the email alias field from the sub-operation service contract <ISP> record. |
| - | `JBSbatKK_T_SBOP_SVC_KEI.selectNext` | - | `KK_T_SBOP_SVC_KEI` | Iterates over the result set of the sub-operation service contract query, returning one row at a time until null. |
| - | `JKKBatClarisAuthCrdt.isNullBlank` | - | - | Utility method (inherited from base class or static import `JKKStringUtil.isNullBlank`) that checks whether a String is null or blank. Used in 15+ call sites across the codebase. |
| - | `JBSbatCommonDBInterface.getString` | - | - | Generic field access method on database interface records. Used to read MLAD, POP_ID, ALIAS, and other fields from all queried data objects. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `isNullBlank` [-], `substring` [-], `substring` [-], `substring` [-], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch:KKSV056501 | `JBSbatKKAdChgSodUpd.setKKSV056501CC` -> `JBSbatKKAdChgSodUpd.makeAgingInfoList` | `getOpSvcKeiISPInfo [R] KK_T_OPSVKEI_ISP`, `executeKK_T_SBOP_SVC_KEI_KK_SELECT_013 [R] KK_T_SBOP_SVC_KEI`, `executeKK_T_SBOPSVKEI_ISP_PKSELECT [R] KK_T_SBOPSVKEI_ISP` |
| 2 | Batch:KKSV056505 | `JBSbatKKAdChgSodUpd.setKKSV056505CC` -> `JBSbatKKAdChgSodUpd.makeAgingInfoList` | `getOpSvcKeiISPInfo [R] KK_T_OPSVKEI_ISP`, `executeKK_T_SBOP_SVC_KEI_KK_SELECT_013 [R] KK_T_SBOP_SVC_KEI`, `executeKK_T_SBOPSVKEI_ISP_PKSELECT [R] KK_T_SBOPSVKEI_ISP` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialization (L2281)

> Initializes the result list and a null reference for the aging info map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `agingInfoList = new ArrayList<HashMap<String, Object>>()` // Empty list to hold aging info entries |
| 2 | SET | `agingInfoMap = null` // Null reference, created per entry when needed |

**Block 2** — [COMMENT] Operation Service Contract <ISP> Query (L2283)

> Japanese comment: オプションサービス契約<ISP>検索 — "Option Service Contract <ISP> Search"

**Block 3** — [CALL] Query ISP Info (L2286)

> Retrieves the operation service contract <ISP> record.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `opSvcKeiISPInfo = getOpSvcKeiISPInfo(op_svc_kei_no, gene_add_dtm)` |

**Block 4** — [COMMENT] Mail Address extraction (L2288)

> Japanese comment: メールアドレス — "Email Address"

**Block 5** — [SET] Read MLAD (L2289)

> Reads the primary mail address (MLAD) from the ISP record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mlad = opSvcKeiISPInfo.getString(JBSbatKK_T_OPSVKEI_ISP.MLAD)` |

**Block 6** — [IF] MLAD non-blank check (L2290)

> Condition: `!isNullBlank(mlad)` — If the primary email address exists.
> When true: create an aging entry with type code "009" (Mail).

| # | Type | Code |
|---|------|------|
| 1 | SET | `agingInfoMap = new HashMap<String, Object>()` |
| 2 | SET | `agingInfoMap.put("aging_sbt_cd", "009")` [-> `aging_sbt_cd = "009"` (Mail type)] |
| 3 | SET | `agingInfoMap.put("aging_tg_value", mlad)` [-> `aging_tg_value` = primary email address] |
| 4 | EXEC | `agingInfoList.add(agingInfoMap)` |

**Block 7** — [COMMENT] POP ID (L2295)

> Japanese comment: POPID — "POP ID" (Point of Presence Identifier)

**Block 8** — [SET] Read POP_ID (L2296)

> Reads the POP_ID from the ISP record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `popId = opSvcKeiISPInfo.getString(JBSbatKK_T_OPSVKEI_ISP.POP_ID)` |

**Block 9** — [IF] POP_ID addition condition (L2297)

> Condition: `!isNullBlank(mlad)` — Uses the **same MLAD variable** (not `popId`). This means the POP_ID aging entry is only added when MLAD is also non-blank (a dependent addition pattern).
> When true: create an aging entry with type code "007" (POP ID).

| # | Type | Code |
|---|------|------|
| 1 | SET | `agingInfoMap = new HashMap<String, Object>()` |
| 2 | SET | `agingInfoMap.put("aging_sbt_cd", "007")` [-> `aging_sbt_cd = "007"` (POP ID type)] |
| 3 | SET | `agingInfoMap.put("aging_tg_value", popId)` [-> `aging_tg_value` = POP identifier] |
| 4 | EXEC | `agingInfoList.add(agingInfoMap)` |

**Block 10** — [COMMENT] Sub-Operation Service Contract <ISP> Query (L2302)

> Japanese comment: サブオプションサービス契約<ISP>検索 — "Sub-Option Service Contract <ISP> Search"

**Block 11** — [CALL] Query Sub-Operation Service Contracts (L2305)

> Executes a SELECT on the sub-operation service contract table.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_SBOP_SVC_KEI_KK_SELECT_013(new String[]{op_svc_kei_no, opeDate})` |
| 2 | SET | `adchgDtlInfo = null` // Initialize cursor for iteration |

**Block 12** — [WHILE] Iterate sub-contract rows (L2306-2334)

> Condition: `(adchgDtlInfo = db_KK_T_SBOP_SVC_KEI.selectNext()) != null`
> Iterates over all sub-operation service contract rows for the given service key number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = new String[]{op_svc_kei_no, adchgDtlInfo.getString(SBOP_SVC_KEI_NO), adchgDtlInfo.getString(GENE_ADD_DTM)}` |
| 2 | CALL | `sbopSvcKeiISPInfo = executeKK_T_SBOPSVKEI_ISP_PKSELECT(param)` |

**Block 13** — [COMMENT] Mail Alias extraction (L2311)

> Japanese comment: メールエイリアス — "Mail Alias"

**Block 14** — [SET] Read Alias (L2312)

> Reads the email alias from the sub-ISP record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `alias = sbopSvcKeiISPInfo.getString(JBSbatKK_T_SBOPSVKEI_ISP.ALIAS)` |

**Block 15** — [IF] Alias non-blank check (L2313)

> Condition: `!isNullBlank(alias)` — If the sub-contract has an email alias.
> When true: create an aging entry with type code "008" (Mail Alias).

| # | Type | Code |
|---|------|------|
| 1 | SET | `agingInfoMap = new HashMap<String, Object>()` |
| 2 | SET | `agingInfoMap.put("aging_sbt_cd", "008")` [-> `aging_sbt_cd = "008"` (Mail Alias type)] |

**Block 16** — [IF-NESTED 15.1] MLAD append for alias enrichment (L2314-2318)

> Japanese comment: IT3-2013-0000919 2013.05.23 Y.KANATA ADD START/END — A feature-add change for appending MLAD domain to alias.
> Condition: `!isNullBlank(mlad)` — If the primary email address exists.

| # | Type | Code |
|---|------|------|
| 1 | SET | `idx = mlad.indexOf("@")` |
| 2 | IF | `idx != -1` (L2316) — If `@` character found in MLAD |
| 3 | SET | `alias += mlad.substring(idx)` [-> Appends the `@domain` portion of MLAD to alias] |

**Block 17** — [SET] Store alias value (after MLAD append logic) (L2321)

| # | Type | Code |
|---|------|------|
| 1 | SET | `agingInfoMap.put("aging_tg_value", alias)` [-> `aging_tg_value` = alias (+ optionally MLAD domain)] |
| 2 | EXEC | `agingInfoList.add(agingInfoMap)` |

**Block 18** — [RETURN] End of method (L2336)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return agingInfoList` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `op_svc_kei_no` | Field | Operation Service Contract Number — the primary key identifying a customer's top-level service contract in the address-change system. |
| `gene_add_dtm` | Field | Generated Addition DateTime — a timestamp generated during batch processing to identify a specific service contract addition event. Used as a composite key in ISP queries. |
| `opeDate` | Field | Operation Date — the current batch processing date held as an instance field, used to filter sub-operation service contract queries. |
| `aging_sbt_cd` | Field | Aging Sub-Type Code — a classification code indicating what type of aging target this entry represents. Values: "009" (Mail), "007" (POP ID), "008" (Mail Alias). |
| `aging_tg_value` | Field | Aging Target Value — the actual data value (email address, POP ID, or alias) to be aged. |
| MLAD | Field | Mail Address — the primary email address stored in the operation service contract <ISP> table (`KK_T_OPSVKEI_ISP`). |
| POP_ID | Field | Point of Presence Identifier — the network access point ID assigned to the customer's ISP connection. |
| ALIAS | Field | Email Alias — an alternative email address associated with a sub-operation service contract <ISP> record (`KK_T_SBOPSVKEI_ISP`). |
| KK_T_OPSVKEI_ISP | Entity | Operation Service Contract <ISP> table — stores ISP-specific data (MLAD, POP_ID) linked to an operation service contract. |
| KK_T_SBOP_SVC_KEI | Entity | Sub-Operation Service Contract table — stores sub-contract details linked to an operation service contract, one row per sub-service. |
| KK_T_SBOPSVKEI_ISP | Entity | Sub-Operation Service Contract <ISP> table — stores ISP-specific data (ALIAS) linked to a sub-service contract. |
| getOpSvcKeiISPInfo | Method | Retrieves the operation service contract <ISP> record for the given service key number and addition datetime. |
| executeKK_T_SBOP_SVC_KEI_KK_SELECT_013 | Method | Executes a SELECT query on `KK_T_SBOP_SVC_KEI` for sub-operation service contracts matching the given operation service key number and operation date. |
| executeKK_T_SBOPSVKEI_ISP_PKSELECT | Method | Queries `KK_T_SBOPSVKEI_ISP` using a composite primary key (op_svc_kei_no, sbop_svc_kei_no, gene_add_dtm) to retrieve ISP info for a specific sub-contract. |
| isNullBlank | Method | Utility function that returns true if a String is null, empty, or contains only whitespace. |
| agingInfoList | Variable | The result list of aging info maps, each containing an aging_sbt_cd and aging_tg_value pair. |
| agingInfoMap | Variable | A single aging info entry temporarily created for each qualifying data field. |
| ADCHG | Acronym | Address Change (住所変更) — the broader address-change update batch system this class belongs to. |
| ISP | Acronym | Internet Service Provider — the telecom/online service provider contracted by the customer. |
| SBOP | Acronym | Sub-Operation — refers to sub-service contracts under a main operation service contract. |
| SVC_KEI | Acronym | Service Contract (サービス契約) — a contract record for a specific service line item. |
| KKSV056501 | Screen/Batch | Address change batch screen/program #056501 — one of the callers of this method. |
| KKSV056505 | Screen/Batch | Address change batch screen/program #056505 — another caller of this method. |
| IT3-2013-0000919 | Change Ticket | A change ticket that added the MLAD-domain-append feature for mail aliases (2013/05/23, Y.KANATA). |

---

---
