---

# Business Logic — JKKUsePlaceAdInfUpdCC.createPrgTokkiMapKaisen() [100 LOC]

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

## 1. Role

### JKKUsePlaceAdInfUpdCC.createPrgTokkiMapKaisen()

This method generates **progression remarks (特記事項, Tokki Jikou)** for a use place address change request. In the K-Opticom telecom customer management system, when a customer's registered address is modified, the system must produce a before/after diff text for audit and display purposes. This method performs that diff computation in text format.

It handles three categories of address data: **postal code changes**, **full address block changes** (prefecture, city, district, etc.), and **address non-fixation status changes** (whether the address is confirmed or still unconfirmed). For each changed category, it assembles a human-readable Japanese string in the format "Before label + old value、" and "After label + new value、", then trims trailing punctuation and truncates to a maximum of 128 characters per remark.

The method uses a **routing/dispatch pattern** — it checks each address field independently, building remark fragments only for fields that actually changed between old and new values. It delegates no external services or database operations; all logic is pure in-memory computation. Its role is to serve the `updateUsePlaceAd()` method in the same class, which orchestrates the full use-place address update workflow.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["createPrgTokkiMapKaisen"])
    START --> INIT["Initialize prgMap, prg_tkjk, prg_tkjk2"]

    INIT --> CND1{Is postal code changed?}
    CND1 -- Yes --> C1["Build postal code change info: prg_tkjk = PCG_RIYOBASHO_PCD_TEXT + old + PCG_KUTEN_CANMA"]
    C1 --> C2["Build postal code change after: prg_tkjk2 = PCG_RIYOBASHO_PCD_TEXT_AF + new + PCG_KUTEN_CANMA"]
    CND1 -- No --> SKIP1["Skip postal code block"]
    C2 --> CND2
    SKIP1 --> CND2

    CND2{Is any address field changed?}
    CND2 -- Yes --> CND2_YES
    CND2 -- No --> SKIP2["Skip address block"]

    subgraph AddressChange["Postal code change branch"]
        CND2_YES --> A1["Build old address: prg_tkjk = label + state + city + oazutsu + azcho + bnchigo + adrttm + adrrm + comma"]
        A1 --> A2["Build new address: prg_tkjk2 = label_af + state + city + oazutsu + azcho + bnchigo + adrttm + adrrm + comma"]
    end

    A2 --> CND3{Has address non-fix flag changed?}
    SKIP2 --> CND3

    CND3 -- Yes --> CND3_YES
    CND3 -- No --> SKIP3["Skip non-fix flag block"]

    subgraph NonFix["Non-fix flag branch"]
        CND3_YES --> CND3A{Is old value null or empty?}
        CND3A -- Yes --> NF1["prg_tkjk = label + old value + comma"]
        CND3A -- No --> CND3B{"Is old value '0'?"}
        CND3B -- Yes --> NF2["prg_tkjk = label + PCG_RIYOBASHO_AD_FIX_FLG + comma"]
        CND3B -- No --> CND3C{"Is old value '1'?"}
        CND3C -- Yes --> NF3["prg_tkjk = label + PCG_RIYOBASHO_AD_MI_FIX_FLG + comma"]
        CND3C -- No --> NF4["No text added"]
    end

    NF1 --> TRIM1["Trim trailing comma from prg_tkjk"]
    NF2 --> TRIM1
    NF3 --> TRIM1
    NF4 --> TRIM1
    SKIP3 --> TRIM1

    TRIM1 --> CHK1{Length > 128?}
    CHK1 -- Yes --> TRIM1_YES["prg_tkjk = prg_tkjk.substring(0, 128)"]
    CHK1 -- No --> CHK2{prg_tkjk2 length > 128?}
    TRIM1_YES --> CHK2

    CHK2 -- Yes --> TRIM2_YES["prg_tkjk2 = prg_tkjk2.substring(0, 128)"]
    CHK2 -- No --> PUT["prgMap.put PRG_TKJK_1 = prg_tkjk"]
    TRIM2_YES --> PUT

    PUT --> PUT2["prgMap.put PRG_TKJK_2 = prg_tkjk2"]
    PUT2 --> RET(["Return prgMap"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `kk0251_a010_map` | `HashMap<String, Object>` | The **old/use-place address data map** — contains the original address values as stored in the database before any changes. Keys reference `EKK0251A010CBSMsg1List` constants such as `KAISEN_PLACE_PCD` (postal code), `KAISEN_PLACE_CITY_NM` (city name), and `KISN_PLC_AD_MI_FIX_FLG` (address non-fixation flag). This is the source of "before" values for the diff. |
| 2 | `updateMap` | `HashMap<String, Object>` | The **new/update address data map** — contains the new values entered by the user or system during the address change request. Keys reference parameter constants such as `PARAM_AD_PCD` (postal code), `PARAM_AD_STATE_NM` (prefecture), `PARAM_AD_CITY_NM` (city), etc. This is the source of "after" values for the diff. |

**Instance fields / external state:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `PRG_TKJK_MAX_VALUE` | `int = 128` | Maximum character length allowed for a progression remark. Remarks exceeding this are truncated. |
| `PCG_KUTEN_CANMA` | `String = "、"` | Japanese comma separator used as punctuation between remark fragments. |
| `PCG_RIYOBASHO_PCD_TEXT` | `String = "変更前郵便番号:"` | Label prefix meaning "Before change postal code:" — prepended to old postal code in the remark. |
| `PCG_RIYOBASHO_PCD_TEXT_AF` | `String` (after variant) | Label prefix for the after postal code remark (new postal code). |
| `PCG_RIYOBASHO_AD_TEXT` | `String` | Label prefix for the old address in the remark. |
| `PCG_RIYOBASHO_AD_TEXT_AF` | `String` (after variant) | Label prefix for the new address in the remark. |
| `PCG_RIYOBASHO_AD_MI_FIX_TEXT` | `String` | Label prefix for the address non-fixation status remark. |
| `PCG_RIYOBASHO_AD_FIX_FLG` | `String` | Display text meaning "Address not fixed / unconfirmed" — used when the old flag value is `"0"`. |
| `PCG_RIYOBASHO_AD_MI_FIX_FLG` | `String` | Display text meaning "Address fixed / confirmed" — used when the old flag value is `"1"`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKUsePlaceAdInfUpdCC.isSameObj` | JKKUsePlaceAdInfUpdCC | - | Internal utility method for deep equality comparison of two objects (handles null, type, and value checks). Used for field-level change detection. |
| - | `String.substring` | String | - | Java built-in string substring. Used to remove trailing comma and truncate remarks exceeding 128 characters. |

**Notes:** This method performs **no database or service component calls**. It is a pure in-memory computation — a transformer/builder that compares two maps and produces formatted text. All comparison logic is delegated to `isSameObj()` (a private utility method of the same class), and all string manipulation uses standard Java `String.substring()`.

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKUsePlaceAdInfUpdCC.updateUsePlaceAd | `updateUsePlaceAd()` -> `createPrgTokkiMapKaisen(kk0251_a010_map, paramMap)` | `isSameObj [R] -`, `substring [R] -` |

**Call context:** The method is called from `updateUsePlaceAd()` at line 1070 of `JKKUsePlaceAdInfUpdCC.java`. After `updateUsePlaceAd()` performs validation and gathers address change data into `paramMap`, it invokes `createPrgTokkiMapKaisen()` to generate the before/after progression remarks. The result (`prgMap`) is then used to populate the `KAISEN_PLC_KSH_AD_SAI_FLG` and related fields for the final address update.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (postal code changed) `(L2722)`

> Compares the postal code from the old map against the new postal code from the update map. If they differ, builds before/after remark fragments.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `isSameObj(kk0251_a010_map.get(KAISEN_PLACE_PCD), updateMap.get(PARAM_AD_PCD))` | Check if postal code changed. Negated: branch taken when postal code **changed**. |
| 2 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_PCD_TEXT + oldPostalCode + PCG_KUTEN_CANMA` | Build before remark: e.g. "変更前郵便番号:123-4567、" |
| 3 | SET | `prg_tkjk2 = prg_tkjk2 + PCG_RIYOBASHO_PCD_TEXT_AF + newPostalCode + PCG_KUTEN_CANMA` | Build after remark with new postal code value |

**Block 2** — IF (any address field changed) `(L2733–2740)`

> Checks 7 address fields: prefecture, city, district (oazutsu), block (azcho), branch number (bnchigo), street address term (adrttm), and street address (adrrm). If **any** of them changed, builds a full before/after address remark.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_STATE_NM))` | Check if prefecture (state name) changed |
| 2 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_CITY_NM))` | Check if city name changed |
| 3 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_OAZTSU_NM))` | Check if district (oazutsu) changed |
| 4 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_AZCHO_NM))` | Check if block (azcho) changed |
| 5 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_BNCHIGO))` | Check if branch number changed |
| 6 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_ADRTTM))` | Check if street address term changed |
| 7 | CALL | `isSameObj(old, updateMap.get(PARAM_AD_ADRRM))` | Check if street address changed |
| 8 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_AD_TEXT + oldState + oldCity + oldOaztsu + oldAzcho + oldBnchigo + oldAdrttm + oldAdrrm + PCG_KUTEN_CANMA` | Build old address remark: full concatenated address from DB |
| 9 | SET | `prg_tkjk2 = prg_tkjk2 + PCG_RIYOBASHO_AD_TEXT_AF + newState + newCity + newOaztsu + newAzcho + newBnchigo + newAdrttm + newAdrrm + PCG_KUTEN_CANMA` | Build new address remark: full concatenated new address |

**Block 3** — IF (address non-fixation flag changed) `(L2757)`

> Checks whether the `KISN_PLC_AD_MI_FIX_FLG` (address non-fixation flag) has changed. This flag indicates whether the registered address is confirmed or still unconfirmed.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `isSameObj(oldFlag, updateMap.get(KISN_PLC_AD_MI_FIX_FLG))` | Check if address non-fixation flag changed. Branch taken when **different**. |

**Block 3.1** — IF (old flag is null or empty) `(L2761–2763)`

> When the old flag is null or empty, append the old value directly. This handles the case where the address was never set (blank).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_AD_MI_FIX_TEXT + oldFlag + PCG_KUTEN_CANMA` | Build remark with raw old value (may be empty string) |

**Block 3.2** — IF (old flag equals "0") `(L2765–2766)`

> The flag value "0" means the address is **not fixed / unconfirmed**. Display a resolved label instead of the raw code.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_AD_MI_FIX_TEXT + PCG_RIYOBASHO_AD_FIX_FLG + PCG_KUTEN_CANMA` | Build remark: e.g. "住所未確定:住所未確定、" (Address not fixed) |

**Block 3.3** — IF (old flag equals "1") `(L2768–2769)`

> The flag value "1" means the address is **fixed / confirmed**. Display the resolved "confirmed" label.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prg_tkjk = prg_tkjk + PCG_RIYOBASHO_AD_MI_FIX_TEXT + PCG_RIYOBASHO_AD_MI_FIX_FLG + PCG_KUTEN_CANMA` | Build remark: e.g. "住所未確定:住所確定、" (Address confirmed) |

**Block 4** — IF (prg_tkjk has content and length > 0) `(L2773–2797)`

> Trims the trailing Japanese comma from the first remark and enforces the 128-character maximum.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prg_tkjk_length = prg_tkjk.length()` | Get character count |
| 2 | SET | `prg_tkjk_getalue = prg_tkjk.substring(0, prg_tkjk_length - 1)` | Remove trailing comma by slicing one character shorter |
| 3 | SET | `prg_tkjk = prg_tkjk_getalue` | Reassign trimmed string |
| 4 | IF | `prg_tkjk_length - 1 > PRG_TKJK_MAX_VALUE` — `PRG_TKJK_MAX_VALUE = 128` | Check if trimmed length exceeds maximum |
| 5.1 | SET | `prg_tkjk_select = prg_tkjk.substring(0, PRG_TKJK_MAX_VALUE)` | Extract only first 128 characters |
| 5.2 | SET | `prg_tkjk = prg_tkjk_select` | Reassign truncated string |

**Block 5** — IF (prg_tkjk2 has content and length > 0) `(L2798–2810)`

> Same trim and truncate logic applied to the second remark (after values).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prg_tkjk2_length = prg_tkjk2.length()` | Get character count |
| 2 | SET | `prg_tkjk2_getalue = prg_tkjk2.substring(0, prg_tkjk2_length - 1)` | Remove trailing comma |
| 3 | SET | `prg_tkjk2 = prg_tkjk2_getalue` | Reassign trimmed string |
| 4 | IF | `prg_tkjk2_length - 1 > PRG_TKJK_MAX_VALUE` — `PRG_TKJK_MAX_VALUE = 128` | Check if trimmed length exceeds maximum |
| 5.1 | SET | `prg_tkjk2_select = prg_tkjk2.substring(0, PRG_TKJK_MAX_VALUE)` | Extract only first 128 characters |
| 5.2 | SET | `prg_tkjk2 = prg_tkjk2_select` | Reassign truncated string |

**Block 6** — SET (populate return map) `(L2812–2813)`

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `prgMap.put(EKK1091D010CBSMsg.PRG_TKJK_1, prg_tkjk)` | Store first remark (before values) |
| 2 | SET | `prgMap.put(EKK1091D010CBSMsg.PRG_TKJK_2, prg_tkjk2)` | Store second remark (after values) |

**Block 7** — RETURN `(L2815)`

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | RETURN | `return prgMap` | Return the built progression remarks map |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `createPrgTokkiMapKaisen` | Method | Creates progression remarks (tokki jikou) for use place address changes. "Kaisen" (改線) refers to line change/modification requests. |
| `kk0251_a010_map` | Parameter | Old use place address data map containing pre-change values from the database. Key prefix EKK0251A010 identifies the use place address inquiry screen. |
| `updateMap` (paramMap) | Parameter | New use place address data map containing values entered during the address change request. |
| `prgMap` | Local | Return map holding the generated progression remarks. Keys: PRG_TKJK_1 (before), PRG_TKJK_2 (after). |
| `prg_tkjk` | Local | Progression remark accumulator (before values). Contains human-readable Japanese text describing what changed. |
| `prg_tkjk2` | Local | Progression remark accumulator (after values). Contains the new values. |
| `PRG_TKJK_MAX_VALUE` | Constant | Maximum character count for a single remark field: 128 characters. |
| `PCG_KUTEN_CANMA` | Constant | Japanese comma "、" used as separator between remark fragments. |
| `PCG_RIYOBASHO_PCD_TEXT` | Constant | Label prefix "変更前郵便番号:" (Before change postal code:). |
| `KAISEN_PLACE_PCD` | Key | Postal code field key from the old address map. "Kaisen" (改線) = line change. |
| `KAISEN_PLACE_CITY_NM` | Key | City name field from the old address map. |
| `KAISEN_PLACE_STATE_NM` | Key | Prefecture (state) name field. |
| `KAISEN_PLACE_OAZTSU_NM` | Key | District (oazutsu / 大字) name — a traditional Japanese administrative subdivision below city/town level. |
| `KAISEN_PLACE_AZCHO_NM` | Key | Block (azcho / 字) name — a smaller subdivision within a district. |
| `KAISEN_PLACE_BNCHIGO` | Key | Branch number (banchigo / 番号) — the lot number in the Japanese address system. |
| `KAISEN_PLACE_ADRTTM` | Key | Street address term (adrttm / 建物名等) — building name or additional address qualifiers. |
| `KAISEN_PLACE_ADRRM` | Key | Street address (adrrm / 番地) — the lot/sub-lot number. |
| `KISN_PLC_AD_MI_FIX_FLG` | Key | Address non-fixation flag — indicates whether the registered address is confirmed. `"0"` = not fixed, `"1"` = fixed. |
| `PARAM_AD_PCD` | Key | Postal code parameter from the update map. |
| `PARAM_AD_STATE_NM` | Key | Prefecture name parameter from the update map. |
| `PARAM_AD_CITY_NM` | Key | City name parameter from the update map. |
| `PARAM_AD_OAZTSU_NM` | Key | District name parameter from the update map. |
| `PARAM_AD_AZCHO_NM` | Key | Block name parameter from the update map. |
| `PARAM_AD_BNCHIGO` | Key | Branch/lote number parameter from the update map. |
| `PARAM_AD_ADRTTM` | Key | Building name/term parameter from the update map. |
| `PARAM_AD_ADRRM` | Key | Street address parameter from the update map. |
| `EKK0251A010CBSMsg1List` | CBS Msg | CBS message constant list for EKK0251A010 — the use place address inquiry screen (Kaisen/line-change context). |
| `EKK1091D010CBSMsg` | CBS Msg | CBS message constants for EKK1091D010 — the progression remarks (tokki jikou) message. `PRG_TKJK_1` = before remark, `PRG_TKJK_2` = after remark. |
| `isSameObj` | Method | Internal utility method for deep object equality comparison. Handles null, type mismatch, and value checks. |
| `updateUsePlaceAd` | Method | The parent method that orchestrates the full use place address update process. Calls `createPrgTokkiMapKaisen` to generate remarks. |
| 特記事項 (Tokki Jikou) | Domain term | Progression remarks / special notes — a field in K-Opticom systems for documenting notable changes, including before/after diffs for audit trails. |
| 改線 (Kaisen) | Domain term | Line change / line modification — refers to changes in telecommunication line service, such as address relocation for line service. |
| 住所未確定 (Jusho Mikakutei) | Domain term | Address not fixed / unconfirmed — indicates the customer's registered address has not been officially confirmed yet. |
| 住所確定 (Jusho Kakutei) | Domain term | Address confirmed / fixed — indicates the customer's address has been officially verified. |
| PCG_RIYOBASHO_AD_FIX_FLG | Constant | Display text for "Address not fixed" status when old flag is "0". |
| PCG_RIYOBASHO_AD_MI_FIX_FLG | Constant | Display text for "Address confirmed" status when old flag is "1". |

---
