# Business Logic — JKKAdchgTelInfoChgCC.setTelSvcKeiUcwkNo() [118 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKAdchgTelInfoChgCC` |
| Layer | CC / Common Component (business logic coordination layer within the Fujitsu Futurity BPM framework) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKAdchgTelInfoChgCC.setTelSvcKeiUcwkNo()

This method sets the service contract detail numbers (svc_kei_ucwk_no) of the **post-move address** into the **address change schema** and **address change provisional registration schema** parameters — effectively propagating telephone service contract line-item detail numbers through the address change workflow so that downstream processing screens receive correct service data. It handles up to two telephone lines independently, each potentially representing a different business scenario: number cancellation (dslFlgTelNo = "1") or number modification/addition (dslFlgTelNo != "1"). For each telephone line, it dispatches into four sub-branches based on whether the pre-move detail number exists and whether a post-move detail number was provided — covering forward service detail continuation, number addition, and number addition correction. The method implements a **routing/dispatch pattern**: it reads state from a shared request parameter map, fetches the current service contract detail list, and then calls overloaded helper methods to populate the appropriate schema fields depending on the business context. It serves as a shared utility within the larger address change (JKKAdchg) module, specifically invoked at the end of the `telInfoChgAfter` flow (after all other telephone info changes are settled) by screen CCs in the KKSV0725 series (address change screens).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setTelSvcKeiUcwkNo"])
    START --> GET_PARAMS["Get request parameters param HashMap"]
    GET_PARAMS --> GET_DATA["Extract fields from param svcKeiNo svcKeiUcwkNo1 svcKeiUcwkNo2 dslFlgTelNo1 dslFlgTelNo2 aftSvcKeiUcwkNo1 aftSvcKeiUcwkNo2 modifyTelNo1 modifyTelNo2"]
    GET_DATA --> FETCH_LIST["Call getEKK0161B004 Service contract detail list"]
    FETCH_LIST --> CHECK_TEL1{dslFlgTelNo1 equals 1}

    CHECK_TEL1 -->|"Yes"| TEL1_CANCEL_CHECK{svcKeiUcwkNo1 not empty?}
    CHECK_TEL1 -->|"No"| TEL1_MODIFY_CHECK{svcKeiUcwkNo1 not empty?}

    TEL1_CANCEL_CHECK -->|"Yes"| CALL_SET_NULL_1["Call setTelSvcKeiUcwkNo svcKeiUcwkNo1 null"]
    TEL1_CANCEL_CHECK -->|"No"| TEL1_CANCEL_NOOP["No-op adchgHonCmtAfterFix handles"]

    TEL1_MODIFY_CHECK -->|"Yes"| CALL_SET_LIST_1["Call setTelSvcKeiUcwkNo svcKeiUcwkNo1 kk0161_b004_lit"]
    TEL1_MODIFY_CHECK -->|"No"| CHECK_AFTER_1{aftSvcKeiUcwkNo1 empty?}

    CHECK_AFTER_1 -->|"Yes"| CALL_ADD_1["Call addTelSvcKeiUcwkNo modifyTelNo1 kk0161_b004_lit"]
    CHECK_AFTER_1 -->|"No"| CALL_TEISEI_1["Call setTelSvcKeiUcwkNoTeisei aftSvcKeiUcwkNo1 modifyTelNo1 kk0161_b004_lit"]

    CHECK_TEL2{dslFlgTelNo2 equals 1}

    CHECK_TEL2 -->|"Yes"| TEL2_CANCEL_CHECK2{svcKeiUcwkNo2 not empty?}
    CHECK_TEL2 -->|"No"| TEL2_MODIFY_CHECK2{svcKeiUcwkNo2 not empty?}

    TEL2_CANCEL_CHECK2 -->|"Yes"| CALL_SET_NULL_2["Call setTelSvcKeiUcwkNo svcKeiUcwkNo2 null"]
    TEL2_CANCEL_CHECK2 -->|"No"| TEL2_CANCEL_NOOP2["No-op adchgHonCmtAfterFix handles"]

    TEL2_MODIFY_CHECK2 -->|"Yes"| CALL_SET_LIST_2["Call setTelSvcKeiUcwkNo svcKeiUcwkNo2 kk0161_b004_lit"]
    TEL2_MODIFY_CHECK2 -->|"No"| CHECK_AFTER_2{aftSvcKeiUcwkNo2 empty?}

    CHECK_AFTER_2 -->|"Yes"| CALL_ADD_2["Call addTelSvcKeiUcwkNo modifyTelNo2 kk0161_b004_lit"]
    CHECK_AFTER_2 -->|"No"| CALL_TEISEI_2["Call setTelSvcKeiUcwkNoTeisei aftSvcKeiUcwkNo2 modifyTelNo2 kk0161_b004_lit"]

    CALL_SET_NULL_1 --> END(["Return void"])
    CALL_SET_NULL_2 --> END
    CALL_SET_LIST_1 --> END
    CALL_SET_LIST_2 --> END
    CALL_ADD_1 --> END
    CALL_ADD_2 --> END
    CALL_TEISEI_1 --> END
    CALL_TEISEI_2 --> END
    TEL1_CANCEL_NOOP --> END
    TEL2_CANCEL_NOOP2 --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no direct parameters. It reads all its data from the shared request parameter map (`getRequestParameter()`), which is populated by the calling screen/workflow context. |

**Instance fields / external state read by this method:**

| # | Field / External State | Type | Business Description |
|---|----------------------|------|---------------------|
| 1 | `keepReqParam` (via `getRequestParameter()`) | `ThreadLocal<IRequestParameterReadWrite>` | Shared request parameter map holding all screen inputs for this thread — contains telephone numbers, cancellation flags, and post-move detail numbers extracted from the address change screen |
| 2 | `getEKK0161B004(svcKeiNo)` | Service call | Fetches the service contract detail list (kk0161_b004_lit) keyed by the telephone service contract number |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKAdchgTelInfoChgCC.getEKK0161B004` | EKK0161B004SC | KK_T_SVC_KEI (Service Contract Detail) | Reads the service contract detail list for the given service contract number (svcKeiNo) — used to populate detail number assignments |
| U | `JKKAdchgTelInfoChgCC.setTelSvcKeiUcwkNo` | - | Address Change Schema / Provisional Registration Schema | Internal overloaded method that sets the service detail work number into the address change schema parameters |
| U | `JKKAdchgTelInfoChgCC.setTelSvcKeiUcwkNoTeisei` | - | Address Change Schema / Provisional Registration Schema | Internal method that sets service detail number with correction (teisei) — for number addition correction scenarios |
| C | `JKKAdchgTelInfoChgCC.addTelSvcKeiUcwkNo` | - | Address Change Schema / Provisional Registration Schema | Internal method that adds new service contract detail entries for new telephone number additions |

### Detailed CRUD Analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getEKK0161B004(svcKeiNo)` | EKK0161B004SC | KK_T_SVC_KEI | Reads the service contract detail list (line items) for the telephone service contract number, providing the context for how service details should be updated |
| U | `setTelSvcKeiUcwkNo(svcKeiUcwkNo1, null)` | JKKAdchgTelInfoChgCC | N/A (in-memory schema update) | Sets the pre-move service detail number to the post-move schema with null detail — used for cancellation scenarios where the detail number itself is carried forward but the detail list is discarded |
| U | `setTelSvcKeiUcwkNo(svcKeiUcwkNo1, kk0161_b004_lit)` | JKKAdchgTelInfoChgCC | N/A (in-memory schema update) | Sets the pre-move service detail number with the full detail list — used for modification scenarios where both the number and detail information persist |
| C | `addTelSvcKeiUcwkNo(modifyTelNo, kk0161_b004_lit)` | JKKAdchgTelInfoChgCC | N/A (in-memory schema update) | Creates new service contract detail entries for a new telephone number addition, populated with the fetched detail list |
| U | `setTelSvcKeiUcwkNoTeisei(aftSvcKeiUcwkNo, modifyTelNo, kk0161_b004_lit)` | JKKAdchgTelInfoChgCC | N/A (in-memory schema update) | Sets the service detail number with correction data (teisei) — used when a post-move detail number was pre-allocated but needs to be corrected with the actual modification |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNoTeisei` [-], `setTelSvcKeiUcwkNoTeisei` [-], `addTelSvcKeiUcwkNo` [C], `addTelSvcKeiUcwkNo` [C], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNoTeisei` [-], `setTelSvcKeiUcwkNoTeisei` [-], `addTelSvcKeiUcwkNo` [C], `addTelSvcKeiUcwkNo` [C], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNo` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0725 | `KKSV0725Flow.invokeOperation` -> `KKSV0725OPOperation.getInvokeCBS` (target8a: `telInfoChgAfter`) -> `JKKAdchgTelInfoChgCC.telInfoChgAfter` -> `JKKAdchgTelInfoChgCC.setTelSvcKeiUcwkNo` | `setTelSvcKeiUcwkNo` [-], `setTelSvcKeiUcwkNoTeisei` [-], `addTelSvcKeiUcwkNo` [C], `getEKK0161B004` [R] |

**Additional entry points into `telInfoChgAfter` (which invokes this method):**
- KKSV0725330CC — Post-move telephone info change screen CC (the direct CC caller of `telInfoChgAfter`)

**CCRequestBroker targets for JKKAdchgTelInfoChgCC** (from KKSV0725OPOperation.java):
- target83: `telInfoChg` called from KKSV0725310CC
- target87: `telInfoChg` called from KKSV0725320CC
- target93: `itenTokiInfoSettei` called from KKSV0725315CC
- target95: `itenTokiInfoSettei` called from KKSV0725325CC
- target8a: `telInfoChgAfter` called from KKSV0725330CC — **this is the chain that reaches `setTelSvcKeiUcwkNo`**

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGNMENT] Parameter extraction (L1241)

> Extract all needed fields from the shared request parameter map into local variables. This is a data extraction step — no conditional logic.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param = getRequestParameter()` // Obtain request parameter HashMap [-> ThreadLocal keepReqParam.get().getData(keepFixedText.get())] |
| 2 | SET | `svcKeiNo = (String) param.get("svc_kei_no")` // Telephone service contract number |
| 3 | SET | `svcKeiUcwkNo1 = (String) param.get("svc_kei_ucwk_no_1")` // Pre-move telephone 1 service contract detail number |
| 4 | SET | `svcKeiUcwkNo2 = (String) param.get("svc_kei_ucwk_no_2")` // Pre-move telephone 2 service contract detail number |
| 5 | SET | `dslFlgTelNo1 = (String) param.get("dsl_flg_tel_no_1")` // Pre-move telephone 1 cancellation flag (1 = cancelled) |
| 6 | SET | `dslFlgTelNo2 = (String) param.get("dsl_flg_tel_no_2")` // Pre-move telephone 2 cancellation flag (1 = cancelled) |
| 7 | SET | `aftSvcKeiUcwkNo1 = (String) param.get("after_svc_kei_ucwk_no_1")` // Post-move telephone 1 service contract detail number |
| 8 | SET | `aftSvcKeiUcwkNo2 = (String) param.get("after_svc_kei_ucwk_no_2")` // Post-move telephone 2 service contract detail number |
| 9 | SET | `modifyTelNo1 = (String) param.get("modify_tel_no_1")` // Telephone number 1 of post-move as corrected this time |
| 10 | SET | `modifyTelNo2 = (String) param.get("modify_tel_no_2")` // Telephone number 2 of post-move as corrected this time |

**Block 2** — [ASSIGNMENT] Service contract detail list retrieval (L1255)

> Fetch the complete service contract detail list for the telephone service contract. This list provides the context (detail line items) needed when propagating service data to post-move schemas.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk0161_b004_lit = getEKK0161B004(svcKeiNo)` // Get service contract detail list [R: EKK0161B004SC -> KK_T_SVC_KEI] |

**Block 3** — [IF] Telephone 1 — Cancellation path (dslFlgTelNo1 equals "1") (L1258)

> Branch: The first telephone number has been cancelled (dslFlgTelNo1 = "1"). In this case, the pre-move detail number is carried forward to the post-move schema with a null detail list, unless the detail number is empty (in which case no action is taken — the follow-up `adchgHonCmtAfterFix` will handle it).

| # | Type | Code |
|---|------|------|
| 1 | COND | `dslFlgTelNo1.equals("1")` [-> "1" (Cancellation flag set)] |
| 2 | IF-THEN | [Branch: "Yes" — Number cancellation] |

**Block 3.1** — [IF] Cancellation path — pre-move detail number check (L1268)

> ANK-1665-00-00 fix: Added null check to prevent incorrect updates when pre-move detail number is missing. Previously (before ANK-1665), the code unconditionally called `setTelSvcKeiUcwkNo(svcKeiUcwkNo1, null)` which could corrupt data if svcKeiUcwkNo1 was null.

| # | Type | Code |
|---|------|------|
| 1 | COND | `!StringUtils.isEmpty(svcKeiUcwkNo1)` [-> svcKeiUcwkNo1 has content] |
| 2 | IF-THEN | [Branch: "Yes" — Set detail forward] |
| 3 | EXEC | `setTelSvcKeiUcwkNo(svcKeiUcwkNo1, (String)null)` // Set pre-move detail number to post-move with null detail [U: setTelSvcKeiUcwkNo] |
| 4 | IF-ELSE | [Branch: "No" — Commented: "Number addition cancellation — adchgHonCmtAfterFix handles it"] |

**Block 4** — [ELSE] Telephone 1 — Modification/Addition path (dslFlgTelNo1 != "1") (L1293)

> Branch: The first telephone number is NOT cancelled — it is being modified or added. Multiple sub-scenarios based on whether pre-move and post-move detail numbers exist.

| # | Type | Code |
|---|------|------|
| 1 | COND | `!StringUtils.isEmpty(svcKeiUcwkNo1)` [-> svcKeiUcwkNo1 has content (pre-move detail exists)] |
| 2 | IF-THEN | [Branch: "Yes" — Pre-move detail exists, forward with full list] |
| 3 | EXEC | `setTelSvcKeiUcwkNo(svcKeiUcwkNo1, kk0161_b004_lit)` // Set pre-move detail number with full detail list [U: setTelSvcKeiUcwkNo] |
| 4 | IF-ELSE | [Branch: "No" — Pre-move detail is empty, check post-move details] |

**Block 4.1** — [IF] Modification path — post-move detail exists? (L1297)

> ANK-1665-00-00 fix: Same null check pattern as cancellation path.

| # | Type | Code |
|---|------|------|
| 1 | COND | `StringUtils.isEmpty(aftSvcKeiUcwkNo1)` [-> Post-move detail number 1 is empty] |
| 2 | IF-THEN | [Branch: "Yes" — Number addition (no post-move detail pre-allocated)] |
| 3 | EXEC | `addTelSvcKeiUcwkNo(modifyTelNo1, kk0161_b004_lit)` // Add new service detail for the new telephone number [C: addTelSvcKeiUcwkNo] |
| 4 | IF-ELSE | [Branch: "No" — Post-move detail pre-allocated, needs correction] |

**Block 4.2** — [ELSE] Number addition correction (L1300)

> The post-move detail number was already pre-allocated (aftSvcKeiUcwkNo1 has a value) but needs to be set with correction data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setTelSvcKeiUcwkNoTeisei(aftSvcKeiUcwkNo1, modifyTelNo1, kk0161_b004_lit)` // Set detail number with correction data [U: setTelSvcKeiUcwkNoTeisei] |

**Block 5** — [IF] Telephone 2 — Cancellation path (dslFlgTelNo2 equals "1") (L1306)

> Identical logic to Block 3 but for the second telephone line.

| # | Type | Code |
|---|------|------|
| 1 | COND | `dslFlgTelNo2.equals("1")` [-> "1" (Cancellation flag set)] |
| 2 | IF-THEN | [Branch: "Yes" — Number cancellation] |
| 3 | IF-ELSE | [Branch: "No" — adchgHonCmtAfterFix handles it] |
| 4 | IF-THEN | `!StringUtils.isEmpty(svcKeiUcwkNo2)` [-> svcKeiUcwkNo2 has content] |
| 5 | EXEC | `setTelSvcKeiUcwkNo(svcKeiUcwkNo2, (String)null)` // Set pre-move detail forward with null detail |

**Block 6** — [ELSE] Telephone 2 — Modification/Addition path (dslFlgTelNo2 != "1") (L1322)

> Identical logic to Block 4 but for the second telephone line.

| # | Type | Code |
|---|------|------|
| 1 | COND | `!StringUtils.isEmpty(svcKeiUcwkNo2)` [-> Pre-move detail number 2 has content] |
| 2 | IF-THEN | [Branch: "Yes" — Forward with full list] |
| 3 | EXEC | `setTelSvcKeiUcwkNo(svcKeiUcwkNo2, kk0161_b004_lit)` // Set pre-move detail with full detail list |
| 4 | IF-ELSE | [Branch: "No" — Pre-move detail is empty] |

**Block 6.1** — [IF] Telephone 2 post-move detail check (L1327)

| # | Type | Code |
|---|------|------|
| 1 | COND | `StringUtils.isEmpty(aftSvcKeiUcwkNo2)` [-> Post-move detail number 2 is empty] |
| 2 | IF-THEN | [Branch: "Yes" — Number addition] |
| 3 | EXEC | `addTelSvcKeiUcwkNo(modifyTelNo2, kk0161_b004_lit)` // Add new service detail for telephone 2 [C: addTelSvcKeiUcwkNo] (Fixed in IT2-2014-0000089: was incorrectly using modifyTelNo1) |
| 4 | IF-ELSE | [Branch: "No" — Post-move detail pre-allocated] |

**Block 6.2** — [ELSE] Telephone 2 number addition correction (L1335)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setTelSvcKeiUcwkNoTeisei(aftSvcKeiUcwkNo2, modifyTelNo2, kk0161_b004_lit)` // Set detail number with correction for telephone 2 [U: setTelSvcKeiUcwkNoTeisei] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the primary key identifying a telephone service contract in the system |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — an internal tracking ID for individual line items within a service contract (e.g., each telephone line or附加 service) |
| `svc_kei_ucwk_no_1` | Field | Pre-move telephone 1 service contract detail number — the detail number of the first telephone line at the **before-move** address |
| `svc_kei_ucwk_no_2` | Field | Pre-move telephone 2 service contract detail number — the detail number of the second telephone line at the **before-move** address |
| `dsl_flg_tel_no_1` | Field | Pre-move telephone 1 cancellation flag — when "1", the first telephone line at the pre-move address is being cancelled |
| `dsl_flg_tel_no_2` | Field | Pre-move telephone 2 cancellation flag — when "1", the second telephone line at the pre-move address is being cancelled |
| `after_svc_kei_ucwk_no_1` | Field | Post-move telephone 1 service contract detail number — the detail number allocated for the first telephone line at the **after-move** address |
| `after_svc_kei_ucwk_no_2` | Field | Post-move telephone 2 service contract detail number — the detail number allocated for the second telephone line at the **after-move** address |
| `modify_tel_no_1` | Field | Telephone number 1 of post-move as corrected this time — the actual phone number at the post-move address (corrected during this order) |
| `modify_tel_no_2` | Field | Telephone number 2 of post-move as corrected this time — the actual phone number at the post-move address (corrected during this order) |
| `kk0161_b004_lit` | Variable | Service contract detail list — a list of HashMap entries representing all detail line items of a service contract, fetched via the EKK0161B004SC service component |
| KKSV0725 | Screen | Address change screen — the primary address change business screen in the system (KKSV series) |
| `telInfoChg` | Method | Telephone info change — the main entry point method that orchestrates clear, modify, and append operations for telephone service details |
| `telInfoChgAfter` | Method | Post-move telephone info change — called after all other telephone info changes are processed; invokes `setTelSvcKeiUcwkNo` to finalize post-move detail numbers |
| `itenTokiInfoSettei` | Method | Temporary phone number settings — sets up temporary phone number forwarding information |
| KK_T_SVC_KEI | Table | Service contract detail table — stores individual service contract line items including detail numbers |
| Address change schema | Entity | In-memory parameter structure representing the address change workflow state; updated with post-move service detail numbers |
| Address change provisional registration schema | Entity | In-memory parameter structure for provisional registration during address change; populated with corrected post-move detail numbers |
| adchgHonCmtAfterFix | Method | Post-move comment fix — a downstream method (in JKKAdchgHonCmtCC) that handles telephone number addition cancellation when the detail number is not set here |
| ANK-1665-00-00 | Change ticket | Bug fix ticket (2014.01.07 Y.Kanata) — added null checks for pre-move detail numbers to prevent incorrect updates when modifying services during address change |
| IT1-2014-0000040 | Change ticket | Enhancement ticket (2014.01.24 Sunano) — added post-move detail number and telephone number fields for handling telephone number addition scenarios |
| IT2-2014-0000089 | Change ticket | Bug fix ticket (2014.01.25 Sunano) — fixed line 1336 where `addTelSvcKeiUcwkNo` was incorrectly using `modifyTelNo1` instead of `modifyTelNo2` for the second telephone line |
| CC | Acronym | Common Component — a business logic coordination class in the Fujitsu Futurity BPM framework, responsible for orchestrating service calls and parameter manipulation |
| SC | Acronym | Service Component — a data access layer class that interfaces with database tables |
| CCRequestBroker | Class | Framework class that manages invocation of CC methods from BPM operations |
| ThreadLocal<SessionHandle> | Field | Thread-safe session handle storage — maintains the database session per thread throughout the request lifecycle |
| ThreadLocal<IRequestParameterReadWrite> | Field | Thread-safe request parameter storage — maintains the shared parameter map per thread, accessed via `getRequestParameter()` |
