# Business Logic — JZMEnumSwitchCC.bmpAbolition_OtherComp_Cancel() [55 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JZMEnumSwitchCC` |
| Layer | CC/Common Component (EJB custom component, within `com.fujitsu.futurity.bp.custom.common`) |
| Module | `common` |

## 1. Role

### JZMEnumSwitchCC.bmpAbolition_OtherComp_Cancel()

This method handles the **Number Portability Abolishment (Other-Company Reception) Cancellation** business operation — scenario 7 in the ENUM switch routing flow (Javadoc: 申請内容_7：番ポ廃止(他社受付)・取消処理). In the Japanese telecom domain, when a customer had previously requested to abolish their port-in (number portability to K-Opticom) under an "other-company reception" context, this method reverses that pending abolition request, effectively cancelling the port-abolishment process and restoring the ENUM-related service data to a clean state.

The method implements a **guard-gate-then-execute** design pattern: it first runs three sequential validation checks (service contract status, booking registration status, and aging key status) and short-circuits with specific error flags if any check fails. Only when all checks pass does it proceed to the core execution phase, which issues the relevant SOD (Service Order Data) documents, updates the port authorization reception info, refreshes the phone number master, and manages the aging schema data lifecycle.

Its role in the larger system is as a **shared routing dispatch target** — it is invoked from `JZMEnumSwitchCC.enumSwitch()`, which receives requests from multiple screen handlers and routes them to this method based on the application content flag (`SINSEI_NAIYO_FLG = "7"`). This makes the method a domain-specific service orchestrator within the ENUM switch product suite, handling the complete lifecycle of a port-abolishment cancellation across multiple downstream service components.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["bmpAbolition_OtherComp_Cancel"])
    LOG_START["printlnEjbLog : start"]

    CHECK_STAT{"serviceKeiStatCheck<br/>telno service status"}
    ERR_7001["inMap.put ERR_FLG = 7001<br/>param.setData<br/>return param"]

    CHECK_BOOKING{"chkItenToki<br/>booking registration status"}
    ERR_7002["inMap.put ERR_FLG = 7002<br/>param.setData<br/>return param"]

    CHECK_AGING{"agingStatCheck<br/>aging status != 300"}
    ERR_7003["inMap.put ERR_FLG = 7003<br/>param.setData<br/>return param"]

    CALL_SOD["callJKKHakkoSODCC<br/>ENUM deletion SOD + port authorization start"]
    CALL_PORT["callETU0151C010<br/>port authorization reception info SOD issuance"]
    CALL_MASTER["callEZM0121C010<br/>phone number master update"]
    CALL_AGING_DEL["callEZM0111E010<br/>aging schema data delete<br/>aging status Usage Completed"]

    CHECK_FUNC{"funcCd == 1"}
    CALL_AGING_REG["callEZM0111D010<br/>aging schema data register<br/>aging status Usage Completed to In Use"]

    LOG_END["printlnEjbLog : end<br/>return param"]

    START --> LOG_START
    LOG_START --> CHECK_STAT
    CHECK_STAT -- false --> ERR_7001
    CHECK_STAT -- true --> CHECK_BOOKING
    CHECK_BOOKING -- false --> ERR_7002
    CHECK_BOOKING -- true --> CHECK_AGING
    CHECK_AGING -- false --> ERR_7003
    CHECK_AGING -- true --> CALL_SOD
    CALL_SOD --> CALL_PORT
    CALL_PORT --> CALL_MASTER
    CALL_MASTER --> CALL_AGING_DEL
    CALL_AGING_DEL --> CHECK_FUNC
    CHECK_FUNC -- true --> CALL_AGING_REG
    CHECK_FUNC -- false --> LOG_END
    CALL_AGING_REG --> LOG_END
```

**Error Flag Constant Resolution:**
- `ENUMCC_ERR_FLG_7001 = "7001"` — Contract-existing data presence error (契約中のデータ存在エラー)
- `ENUMCC_ERR_FLG_7002 = "7002"` — Booking-registered data presence error (予約登録済みデータ存在エラー)
- `ENUMCC_ERR_FLG_7003 = "7003"` — Aging status is not "Aging" (エイジングステータスが「エイジング中」以外エラー)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session handle carrying the EJB session context, used for resource management and transaction boundaries across all downstream service calls. |
| 2 | `param` | `IRequestParameterReadWrite` | Request/response parameter object that holds input data and is used to return error flags and messages to the caller via `setData()`. |
| 3 | `fixedText` | `String` | Fixed service message text (Japanese service messages) — a message template/prefix used when setting error responses via `param.setData()`. |
| 4 | `funcCd` | `String` | Business code that determines post-cancellation aging data behavior. Value `"1"` triggers additional aging schema data registration (aging status transitions from "Usage Completed" to "In Use"), indicating this is a port-in operation; value `"2"` is excluded from this registration because the upward deletion processing has already been performed. |
| 5 | `inMap` | `HashMap<String, Object>` | Parameter map carrying the telephone number (`KEY_TELNO = "key_telno"`), aging key number (`KEY_AGING_NO = "key_aging_no"`), and the error flag (`ERR_FLG = "ERR_FLG"`). Used to read validation inputs and write back error flags on failure paths. |

**External state / instance fields read:** None — this method is fully stateless with respect to instance fields; all external dependencies are injected via method parameters.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JZMEnumSwitchCC.serviceKeiStatCheck` | (internal) | - | Reads service contract status for the given telephone number to verify no active contract data exists. Guard check. |
| R | `JZMEnumSwitchCC.chkItenToki` | (internal) | - | Reads booking/registration status to verify no pending booking-registered data exists for the telephone number. Guard check. |
| R | `JZMEnumSwitchCC.agingStatCheck` | (internal) | - | Reads aging schema status to verify the aging key status equals `AGING_STAT_300 = "300"` ("Aging"). Guard check. |
| R | `JZMEnumSwitchConstCC` constants | (internal) | - | Reads constant values: `ERR_FLG`, `ENUMCC_ERR_FLG_7001/7002/7003`, `KEY_TELNO`, `KEY_AGING_NO`, `AGING_STAT_300`. |
| C | `JZMEnumSwitchCC.callJKKHakkoSODCC` | JKKHakkoSODCC | SOD tables | Issues the ENUM deletion SOD (port-out termination) and port authorization start SOD documents via JKKHakkoSODCC. Creates service order records. |
| C | `callETU0151C010` | ETU0151C010 | Port authorization reception info table | Issues SOD (year/month/day/hour/minute/second) for the port authorization reception info and updates the port authorization reception info status to `"030"` (CSV export completed). |
| U | `callEZM0121C010` | EZM0121C010 | Phone number master table | Updates the phone number master record for the telephone number being processed. |
| U | `callEZM0111E010` | EZM0111E010 | Aging schema table | Deletes aging schema data and sets aging status to "Usage Completed" (使用終了). |
| R | `JZMEnumSwitchCC.printlnEjbLog` | (internal) | - | Writes log statements to track method entry and exit. |
| U | `callEZM0111D010` | EZM0111D010 | Aging schema table | Registers aging schema data and transitions aging status from "Usage Completed" (使用終了) to "In Use" (使用中). Only executed when `funcCd == "1"`. |
| U | `param.setData` | (internal) | - | Sets response parameters on the `param` object using `fixedText` and `inMap` for error flag return. |

### Pre-computed data transfer object (setData) evidence:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | (internal) | Data transfer object | Sets data in `JBSbatAKKshkmRsltInfoTukiawsday` DTO |
| U | `JBSbatAKKshkmRsltInfoTukiaws.setData` | (internal) | Data transfer object | Sets data in `JBSbatAKKshkmRsltInfoTukiaws` DTO |
| U | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | (internal) | Data transfer object | Sets data in `JBSbatAKKshkmRsltInfoTukiawsRealSkh` DTO |
| U | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | (internal) | Data transfer object | Sets data in `JBSbatAKKshkmRsltInfTkCvsNCnsl` DTO |
| U | `JBSbatKKGetCTITelno.setData` | (internal) | Data transfer object | Sets data in `JBSbatKKGetCTITelno` DTO |

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `printlnEjbLog` [-], `callEZM0111D010` [-], `callEZM0111E010` [-], `callEZM0121C010` [-], `callETU0151C010` [-], `callJKKHakkoSODCC` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `agingStatCheck` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `setData` [-], `chkItenToki` [-], `setData` [-], `setData` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `JZMEnumSwitchCC.enumSwitch()` | `enumSwitch()` -> `bmpAbolition_OtherComp_Cancel(handle, param, fixedText, funcCd, inMap)` | `callJKKHakkoSODCC [C] SOD tables`, `callETU0151C010 [C] Port auth reception info`, `callEZM0121C010 [U] Phone number master`, `callEZM0111E010 [U] Aging schema (delete)`, `callEZM0111D010 [U] Aging schema (register)`, `serviceKeiStatCheck [R]`, `chkItenToki [R]`, `agingStatCheck [R]` |

**Notes:**
- `JZMEnumSwitchCC.enumSwitch()` acts as the central ENUM switch routing dispatcher. It evaluates the `SINSEI_NAIYO_FLG` (application content flag) and routes to this method when the flag equals `"7"` (Number Portability Abolishment Cancellation).
- The call chain is short — `enumSwitch()` directly invokes `bmpAbolition_OtherComp_Cancel()` with no intermediate CBS/adapter layers.

## 6. Per-Branch Detail Blocks

**Block 1** — [METHOD ENTRY] (L687)

The method begins execution and logs the start.

| # | Type | Code |
|---|------|------|
| 1 | LOG | `printlnEjbLog("JZMEnumSwitchCC:bmpAbolition_OtherComp_Cancel:start")` |

**Block 2** — [IF] `(service contract status check: !serviceKeiStatCheck(...))` (L693)

Guard check: verifies that no active contract data exists for the telephone number. The condition extracts the telephone number from `inMap` using `KEY_TELNO = "key_telno"`. If the check fails (i.e., contract data IS found), the method sets error flag `7001` and returns early.
Original comment: サービス契約ステータスチェック (Service contract status check)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `serviceKeiStatCheck(handle, param, fixedText, inMap.get("key_telno"))` // Reads contract status for the phone number |
| 2 | IF | `!serviceKeiStatCheck(...) --> true` // Contract data exists - ERROR path |
| 3 | SET | `inMap.put("ERR_FLG", "7001")` // [ERR_FLG="ERR_FLG"] [ENUMCC_ERR_FLG_7001="7001"] Error flag: contract-existing data presence error |
| 4 | EXEC | `param.setData(fixedText, inMap)` // Sets error response with fixed message text and error flag |
| 5 | RETURN | `return param` // Early return to caller |
| 6 | IF | `!serviceKeiStatCheck(...) --> false` // No contract data - proceed to next check |

**Block 3** — [IF] `(booking registration status check: !chkItenToki(...))` (L702)

Guard check: verifies that no booking-registered data exists for the telephone number. If booking data IS found (pending registration), the method sets error flag `7002` and returns early.
Original comment: トーキ登録済みチェック (Booking registration status check)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `chkItenToki(handle, param, fixedText, inMap.get("key_telno"))` // Checks booking/registration status for the phone number |
| 2 | IF | `!chkItenToki(...) --> true` // Booking data exists - ERROR path |
| 3 | SET | `inMap.put("ERR_FLG", "7002")` // [ENUMCC_ERR_FLG_7002="7002"] Error flag: booking-registered data presence error |
| 4 | EXEC | `param.setData(fixedText, inMap)` // Sets error response |
| 5 | RETURN | `return param` // Early return to caller |
| 6 | IF | `!chkItenToki(...) --> false` // No booking data - proceed to next check |

**Block 4** — [IF] `(aging status check: !agingStatCheck(..., "300"))` (L711)

Guard check: verifies that the aging key status equals `AGING_STAT_300 = "300"` ("Aging"/エイジング中). If the aging key is null/empty, or the status is NOT "Aging", the method sets error flag `7003` and returns early.
Original comment: エイジングステータスチェック (Aging status check)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `agingStatCheck(handle, param, fixedText, inMap.get("key_aging_no"), "300")` // Checks aging key status equals "300" (Aging) |
| 2 | IF | `!agingStatCheck(...) --> true` // Aging null/empty or status not equal to "300" - ERROR path |
| 3 | SET | `inMap.put("ERR_FLG", "7003")` // [ENUMCC_ERR_FLG_7003="7003"] Error flag: aging status is not "Aging" |
| 4 | EXEC | `param.setData(fixedText, inMap)` // Sets error response |
| 5 | RETURN | `return param` // Early return to caller |
| 6 | IF | `!agingStatCheck(...) --> false` // Aging status is "300" - proceed to execution phase |

**Block 5** — [Execution Phase] (L720-732)

All three guard checks passed. This block issues the core service order documents and performs master data updates for the port-abolishment cancellation.

Original comments:
- 発行・更新処理 (Issue/Update processing)
- ENUM消去SOD発行(ポートアウトの終了) (ENUM deletion SOD issuance - port-out termination)
- ENUM登録SOD発行(ポートアウトの開始) (ENUM registration SOD issuance - port-out start)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `callJKKHakkoSODCC(handle, param, fixedText)` // Issues ENUM deletion SOD and port authorization start SOD |
| 2 | CALL | `callETU0151C010(handle, param, fixedText, funcCd)` // Port authorization reception info SOD issuance; updates status to "030" (CSV export completed) |
| 3 | CALL | `callEZM0121C010(handle, param, fixedText, funcCd)` // Phone number master update |
| 4 | CALL | `callEZM0111E010(handle, param, fixedText, funcCd)` // Aging schema data deletion; aging status to "Usage Completed" (使用終了) |

**Block 6** — [IF] `("1".equals(funcCd))` (L734-738)

Conditional: when `funcCd` equals `"1"`, the method additionally registers aging schema data, transitioning the aging status from "Usage Completed" (使用終了) to "In Use" (使用中). When `funcCd` equals `"2"`, this registration is skipped because upward deletion processing (upward abolition) has already been performed.
Original comment: 業務コードが1の場合、処理を行う。業務コード2の場合は、削除処理がされていないため (If business code is 1, perform downward processing. (If business code 2, upward deletion processing has not been performed))

| # | Type | Code |
|---|------|------|
| 1 | IF | `"1".equals(funcCd) --> true` // funcCd is "1" - port-in operation |
| 2 | CALL | `callEZM0111D010(handle, param, fixedText, funcCd)` // Aging schema data registration; aging status "Usage Completed" to "In Use" (使用中) |
| 3 | IF | `"1".equals(funcCd) --> false` // funcCd is not "1" - skip aging registration |

**Block 7** — [METHOD EXIT] (L740-741)

The method completes execution, logs the end, and returns the param object to the caller.

| # | Type | Code |
|---|------|------|
| 1 | LOG | `printlnEjbLog("JZMEnumSwitchCC:bmpAbolition_OtherComp_Cancel:end")` |
| 2 | RETURN | `return param` // Returns the request parameter object (with possible error flag set) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| 番ポ廃止 | Japanese term | Number Portability Abolishment - the process of cancelling/dropping a previously submitted port-in (number portability to K-Opticom) request |
| 他社受付 | Japanese term | Other-Company Reception - indicates the port-abolishment request was received from a third-party (non-K-Opticom) carrier system |
| 取消処理 | Japanese term | Cancellation Processing - the operation of reversing/undoing a pending port-abolishment request |
| ENUM | Acronym | Electronic Number Mapping - telecommunications protocol for mapping phone numbers to service addresses (IETF ENUM, RFC 6116) |
| SOD | Acronym | Service Order Data - the document/work order issued to trigger or record a telecom service change operation |
| ポートアウト | Japanese term | Port-Out - the process of transferring a phone number away from K-Opticom to another carrier |
| ポートイン | Japanese term | Port-In - the process of transferring a phone number from another carrier to K-Opticom |
| エイジング | Japanese term | Aging - an internal processing tracking mechanism using key numbers and status codes to monitor the lifecycle of service operations |
| エイジング中 | Japanese term | "Aging" status (code 300) - the aging key is actively processing |
| 使用中 | Japanese term | "In Use" status (code 100) - the aging key is currently assigned and active |
| 使用終了 | Japanese term | "Usage Completed" status - the aging key is no longer in use and can be reused |
| 回復可能 | Japanese term | "Recoverable" status (code 200) - the aging key can be restored for reuse |
| トーキ登録済み | Japanese term | Booking/Registration Completed - pending booking data that has been registered but not yet fulfilled |
| 業務コード | Japanese term | Business Code (`funcCd`) - operation discriminator; "1" = port-in, "2" = port-out (upward deletion already done) |
| 契約中のデータ存在エラー | Japanese term | Contract-existing data presence error (flag 7001) - guard fails because active contract data exists |
| 予約登録済みデータ存在エラー | Japanese term | Booking-registered data presence error (flag 7002) - guard fails because pending booking data exists |
| CSV出力済 | Japanese term | "CSV export completed" (status "030") - the port authorization reception info has been exported to CSV format |
| KEY_TELNO | Constant | `key_telno` - map key for the telephone number string in `inMap` |
| KEY_AGING_NO | Constant | `key_aging_no` - map key for the aging key number in `inMap` |
| ERR_FLG | Constant | `ERR_FLG` - map key for the error flag string in `inMap` |
| SINSEI_NAIYO_FLG_7 | Constant | Application content flag value `"7"` - routes to this method (Number Portability Abolishment Cancellation) |
| IRequestParameterReadWrite | Interface | Request/response parameter interface that holds input data and supports error message return via `setData()` |
| SessionHandle | Class | EJB session handle for managing session context and transaction boundaries |
