# Business Logic — JKKOpSvcHktgiUpdCC.addMyHomePage() [348 LOC]

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

## 1. Role

### JKKOpSvcHktgiUpdCC.addMyHomePage()

This method performs the **transfer destination My Home Page option registration** in the context of a service contract transfer operation (引継ぎ — hikitsugi). When a customer's service contract is being transferred from a source (引継元) to a destination, this method manages the lifecycle of the My Home Page (My HP) option at the transfer source. Specifically, it handles two distinct business scenarios: **canceling existing My Home Page entries that lack a URL account** (i.e., incomplete/unconfigured accounts that are not yet active), and then **registering a brand-new My Home Page option** at the transfer source to continue the service after the contract transfer.

The method implements a **routing/dispatch design pattern** — it routes processing based on the service contract status codes stored in the work map, distinguishing between services that are still active (CD00037_SVCTK_CHU), suspended (CD00037_CNC_ZM = "030"), already canceled (CD00037_DSL_ZM = "910"), or under investigation (CD00037_SHOSA_ZUMI = "020"). This allows it to perform the appropriate cancellation or registration steps depending on the current state of the source contract.

The method also implements a **gate-keeping / early-exit pattern**: it first scans the existing My Home Page list to check whether any valid (non-canceled) My Home Page already exists at the source. If a valid My Home Page is found (yuukouMyHPFlg = true), the method exits early without performing any registration. This prevents duplicate or conflicting My Home Page options from being created when the customer already has a functional My Home Page account in place.

Its role in the larger system is that of a **shared business coordination component** called by higher-level CBS methods during the service contract transfer workflow. It acts as the central orchestrator for My Home Page option management within the transfer process, delegating to specialized service component (SC) methods for data access, to mappers for input message construction, and to aging utilities for system notification management.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addMyHomePage"])
    INIT["Initialize: work variables from workMap"]
    CHECK_FLG["Check: !yuukouMyHPFlg"]
    SCAN["Scan: Find valid MyHP in retHikiMotoMyHpEKK0361B001"]
    SKIP["Skip: valid MyHP exists, exit early"]
    CANCEL_NULL_URL["Loop: Cancel MyHP entries with null URL account"]
    GET_INFO["getOpSvcKeiInfo: retrieve service details"]
    STATUS_CHECK["Check: opSvcKeiStat vs CD00037_CNC_ZM"]
    STATUS_GT["opSvcKeiStat > CD00037_CNC_ZM (not canceled)"]
    STATUS_EQ["opSvcKeiStat = CD00037_CNC_ZM (suspended)"]
    STATUS_DEFAULT["Default: do nothing"]
    PROV_CANCEL["Provisional cancel: EKK0351C220"]
    FULL_CANCEL["Full cancel: EKK0351C240 + confirm: EKK0351C250"]
    END_AGEING_1["updateAging: AGING_EXEC_KBN_END"]
    REG_NEW_MYHP["Register new My Home Page option"]
    GET_CAPA["getCapa: retrieve MyHP capacity"]
    EKK0361D010["EKK0361D010 CBS: create new MyHP option contract"]
    GET_NEW_NO["Get hikiMotoNewOpSvcKeiNo from response"]
    ISP_STATUS_CHECK["Check: hikiMotoSvcKeiStat vs CD00037_SHOSA_ZUMI"]
    ISP_INVESTIGATE["hikiMotoSvcKeiStat = CD00037_SHOSA_ZUMI (investigation done)"]
    ISP_SUSPEND["Else: hikiMotoSvcKeiStat = canceled, cancel ISP"]
    ISP_REG["Register ISP: EKK0361C010"]
    ISP_CNCL["Cancel ISP: EKK0361C030"]
    GET_NEW_INFO["getOpSvcKeiInfo: retrieve new service details"]
    REGISTER_AGEING["updateAging: AGING_EXEC_KBN_ADD"]
    DSL_CHECK["Check: CD00037_DSL_ZM == hikiMotoSvcKeiStat"]
    CANCEL_NEW["Cancel newly registered MyHP (source was canceled)"]
    NON_BILL_JDG["Non-billable judgment: runHiChrgJdgUtil"]
    CANCEL_NEW_OPT["Cancel new option: EKK0351C240 + EKK0351C250"]
    GET_CANCEL_INFO["getOpSvcKeiInfo: retrieve canceled service details"]
    END_AGEING_2["updateAging: AGING_EXEC_KBN_END"]
    END_NODE["Return"]

    START --> INIT --> SCAN --> CHECK_FLG
    CHECK_FLG -- "false" --> SKIP --> END_NODE
    CHECK_FLG -- "true" --> CANCEL_NULL_URL
    CANCEL_NULL_URL --> GET_INFO --> STATUS_CHECK
    STATUS_CHECK -- ">" --> PROV_CANCEL --> END_AGEING_1
    STATUS_CHECK -- "=" --> FULL_CANCEL --> END_AGEING_1
    STATUS_CHECK -- "else" --> STATUS_DEFAULT --> END_AGEING_1
    END_AGEING_1 --> REG_NEW_MYHP --> GET_CAPA --> EKK0361D010 --> GET_NEW_NO --> ISP_STATUS_CHECK
    ISP_STATUS_CHECK -- "> 0" --> STATUS_DEFAULT
    ISP_STATUS_CHECK -- "= 0" --> ISP_INVESTIGATE --> ISP_REG --> GET_NEW_INFO
    ISP_STATUS_CHECK -- "else" --> ISP_SUSPEND --> ISP_CNCL --> GET_NEW_INFO
    REGISTER_AGEING --> DSL_CHECK
    DSL_CHECK -- "true" --> CANCEL_NEW --> NON_BILL_JDG --> CANCEL_NEW_OPT --> GET_CANCEL_INFO --> END_AGEING_2 --> END_NODE
    DSL_CHECK -- "false" --> END_NODE
```

**Processing Summary:**

1. **Initialization** — Extracts key values from the `workMap` using helper getters: source SYSID, source service contract number, source service contract status, transfer type (異動区分), and application date (適用年月日).

2. **Validity Scan (Gate Check)** — Iterates through the existing My Home Page list (`retHikiMotoMyHpEKK0361B001`) to check if any **valid** (status > `CD00037_CNC_ZM` = "030", type = `OP_SVC_CD_MYHOMEPAGE` = "B002", and NOT the one being transferred) My Home Page exists. If any such entry is found (`yuukouMyHPFlg = true`), the method exits early to prevent duplicate registration.

3. **Cancel Incomplete MyHP Entries** — If no valid My HP exists, iterates through the My Home Page list again. For entries that are My Home Page type and have a **null URL account** (unconfigured/unactivated), the method retrieves the full service contract info, then processes the service contract based on its status:
   - **Status > "030"**: Provisional cancellation via `EKK0351C220`.
   - **Status = "030" (CD00037_CNC_ZM, 結了済/suspended)**: Full cancellation workflow including non-billable judgment, provisional cancel (`EKK0351C240`), and confirm cancel (`EKK0351C250`).
   - **Other**: No action.

4. **Register New MyHP Option** — After cleanup, registers a brand-new My Home Page option at the transfer source: retrieves capacity via `getCapa`, invokes `EKK0361D010` CBS to create the contract, and obtains the new option service contract number.

5. **ISP Sub-Option Processing** — Handles the ISP sub-option based on the source service contract status:
   - **Status > "020" (CD00037_SHOSA_ZUMI)**: No action.
   - **Status = "020"**: Register ISP via `EKK0361C010`.
   - **Status < "020" (canceled)**: Cancel ISP via `EKK0361C030`.

6. **Retrieve New Service Info & Register Aging** — Fetches the newly registered service contract details, then registers the My Home Page option in the aging system.

7. **Cancel if Source Was Canceled** — If the source service contract was already canceled (`CD00037_DSL_ZM` = "910"), the newly registered MyHP must also be canceled: performs non-billable judgment, cancel (`EKK0351C240`), confirm cancel (`EKK0351C250`), retrieves the canceled service info, and ends aging.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle — carries session context, connection, and transaction state for the current business operation |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing model group and control map — serves as the data carrier for input/output during CBS invocations and mapper operations |
| 3 | `retHikiMotoEKK0081A010` | `CAANMsg[]` | Unique inquiry result for source service contract (EKK0081A010) — contains the source service contract header data used in non-billable judgment processing |
| 4 | `retHikiMotoEKK0351A010` | `CAANMsg[]` | Unique inquiry result for source option service contract (EKK0351A010) — contains the source option service contract details including contract number and status |
| 5 | `retHikiMotoEKK0361A010` | `CAANMsg[]` | Unique inquiry result for source option service contract (ISP) (EKK0361A010) — contains source ISP option contract details used to build the new registration input |
| 6 | `retHikiMotoMyHpEKK0361B001` | `CAANMsg[]` | Source option service contract list inquiry result (EKK0361B001) — contains the list of all My Home Page option entries at the source, including contract numbers, statuses, service codes, and URL accounts. Iterated twice: first for validity check, then for cancellation of null-URL entries |
| 7 | `hikiMotoSeikyKeiNo` | `String` | Source billing contract number (引継元請求契約番号) — the billing contract to which the transferred My Home Page option will be linked |
| 8 | `mskmDtlNo` | `String` | Application detail number (申込明細番号) — identifies the specific application line item within the overall service order |
| 9 | `workMap` | `HashMap<String, Object>` | Work map — contains shared business data passed through the transfer workflow, including source SYSID, source service contract number, service contract status, and transfer type. Used to extract context values via helper getters |
| 10 | `hikiMotoOpSvcKeiNo` | `String` | Source option service contract number (引継元オプションサービス契約番号) — the specific option service contract being transferred. Used to distinguish from other My Home Page entries during the validity scan (CD0001247 change, 2014/04/02) |

**Instance fields / external state used:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `this.mapper` | `JKKDslRunMapperCC` | DSL mapper instance used to construct input messages for CBS invocations (EKK0351C220, EKK0351C240, EKK0351C250, EKK0361C010, EKK0361C030, EKK0361D010) |
| `motoLastUpdDtm` | `String` | Last update date-time from workMap — tracked across cancel/confirm operations to maintain update timestamp chain |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSysid` | - | workMap | Retrieves the source SYSID from the work map — identifies the source system for the contract transfer |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSvcKeiNo` | - | workMap | Retrieves the source service contract number from the work map — the main contract being transferred |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSvcKeiStat` | - | workMap | Retrieves the source service contract status from the work map — determines what processing path to take (active, suspended, canceled) |
| R | `JKKOpSvcHktgiUpdCC.getIdoDiv` | - | workMap | Retrieves the transfer type (異動区分) — classifies the kind of transfer operation (e.g., normal transfer, port-in) |
| R | `JKKOpSvcHktgiUpdCC.getAplyYmd` | - | workMap | Retrieves the application date (適用年月日) — the effective date for the transfer |
| R | `JKKOpSvcHktgiUpdCC.getCapa` | - | CBS: capacity inquiry | Retrieves the My Home Page capacity (容量) for the source service contract, used to populate the new registration |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoPcrsCd` | - | workMap | Retrieves the source product code (商品番号) — used as context for capacity retrieval |
| R | `JKKOpSvcHktgiUpdCC.getOpSvcKeiInfo` | - | SC: EKK0351A010, EKK0361A010, EKK0401B001 | Retrieves complete option service contract info including option contract, ISP sub-contract, and sub-option contract list |
| C | `JKKOpSvcHktgiUpdCC.addYYYYMMDD` | - | Utility | Adds/subtracts days from a date string — used to calculate service charge end date (application date - 1 day) |
| R | `JBSbatFUCaseFileRnkData.getString` | - | JBSbatFUCaseFileRnkData | Reads string fields from the case file rank data object (data extraction from input map) |
| R | `JBSbatFUMoveNaviData.getString` | - | JBSbatFUMoveNaviData | Reads string fields from the move navigation data object (data extraction) |
| R | `JBSbatZMAdDataSet.getString` | - | JBSbatZMAdDataSet | Reads string fields from the message data set (data extraction) |
| U | `JKKCasOpSvcKeiDslCC.editInMsgEKK0351C250` | EKK0351C250 | - | Constructs input message for option service contract cancel confirmation (cancel type: transfer destination) |
| U | `JKKDslRunMapperCC.editInMsgEKK0351C220` | EKK0351C220 | - | Constructs input message for provisional cancel of option service contract (cancel type: provisional) |
| U | `JKKDslRunMapperCC.editInMsgEKK0351C240` | EKK0351C240 | - | Constructs input message for full cancel of option service contract (cancel type: full) |
| U | `JKKDslRunMapperCC.editInMsgEKK0351C250` | EKK0351C250 | - | Constructs input message for option service contract cancel confirmation |
| U | `JKKEohTvGuideMskmCntUpdCC.editInMsgEKK0351C220` | EKK0351C220 | - | Constructs input message for option service contract cancel (TV guide context) |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C220` | EKK0351C220 | - | Constructs input message for option service contract cancel (Netflix context) |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C240` | EKK0351C240 | - | Constructs input message for Netflix option cancel |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0351C250` | EKK0351C250 | - | Constructs input message for Netflix cancel confirmation |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0361C010` | EKK0361C010 | - | Constructs input message for Netflix ISP registration |
| U | `JKKNetflixOpAddDslCC.editInMsgEKK0361C030` | EKK0361C030 | - | Constructs input message for Netflix ISP cancellation |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C220` | EKK0351C220 | - | Constructs input message for Netflix payment-related cancel |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C240` | EKK0351C240 | - | Constructs input message for Netflix payment cancel |
| U | `JKKNetflixPaiMkkaCC.editInMsgEKK0351C250` | EKK0351C250 | - | Constructs input message for Netflix payment cancel confirmation |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C220` | EKK0351C220 | - | Constructs input message for Netflix premium plan cancel |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C240` | EKK0351C240 | - | Constructs input message for Netflix premium plan cancel |
| U | `JKKNetflixPremiumPlanCnslDslCC.editInMsgEKK0351C250` | EKK0351C250 | - | Constructs input message for Netflix premium plan cancel confirmation |
| C | `JKKOpSvcHktgiUpdCC.addYYYYMMDD` | - | Utility | Utility to add/subtract days from a date — used to compute service charge end date (apply date - 1) |
| R | `JKKOpSvcHktgiUpdCC.getAplyYmd` | - | workMap | Reads application date from work map |
| R | `JKKOpSvcHktgiUpdCC.getCapa` | - | CBS: capacity inquiry | Retrieves My HP capacity for a sub-option service code |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoPcrsCd` | - | workMap | Retrieves product code from work map |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSvcKeiNo` | - | workMap | Reads source service contract number from work map |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSvcKeiStat` | - | workMap | Reads source service contract status from work map |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoSysid` | - | workMap | Reads source SYSID from work map |
| R | `JKKOpSvcHktgiUpdCC.getIdoDiv` | - | workMap | Reads transfer type from work map |
| R | `JKKOpSvcHktgiUpdCC.getOpSvcKeiInfo` | - | SC: EKK0351A010, EKK0361A010, EKK0401B001 | Retrieves full option service contract details |
| U | `JKKOpSvcHktgiUpdCC.updateAging` | - | Aging system | Registers or ends aging target entries — called with AGING_EXEC_KBN_ADD for new registrations and AGING_EXEC_KBN_END for cancellations |
| - | `JKKOpSvcHktgiUpdCC.isNull` | - | Utility | Null check utility — validates whether string values are null or empty |
| C | `runSc(handle, param, EKK0351C220, inputMap)` | EKK0351C220 | KK_T_OPSVKEI / KK_T_OPSVKEI_DSL | Provisional cancel of option service contract — sets provisional cancellation flag |
| C | `runSc(handle, param, EKK0351C240, inputMap)` | EKK0351C240 | KK_T_OPSVKEI / KK_T_OPSVKEI_DSL | Full cancel of option service contract — performs actual cancellation with end dates |
| C | `runSc(handle, param, EKK0351C250, inputMap)` | EKK0351C250 | KK_T_OPSVKEI / KK_T_OPSVKEI_DSL | Option service contract cancel confirmation — finalizes the cancellation |
| C | `runSc(handle, param, EKK0361D010, inputMap)` | EKK0361D010 | KK_T_OPSVKEI_ISP | Register new option service contract (ISP) — creates the new My HP option |
| C | `runSc(handle, param, EKK0361C010, inputMap)` | EKK0361C010 | KK_T_OPSVKEI_ISP | Register ISP option — registers the ISP sub-option for the newly created My HP |
| C | `runSc(handle, param, EKK0361C030, inputMap)` | EKK0361C030 | KK_T_OPSVKEI_ISP | Cancel ISP option — cancels the ISP sub-option when source is already canceled |
| R | `retMsg.getString(EKK0351C220CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from provisional cancel response |
| R | `retMsg.getString(EKK0351C240CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from full cancel response |
| R | `retMsg.getString(EKK0351C250CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from cancel confirm response |
| R | `retMsg.getString(EKK0361D010CBSMsg.OP_SVC_KEI_NO)` | - | In-memory | Reads the newly created option service contract number from registration response |
| R | `retMsg.getString(EKK0361D010CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from new registration response |
| R | `retMsg.getString(EKK0361C010CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from ISP registration response |
| R | `retMsg.getString(EKK0361C030CBSMsg.UPD_DTM)` | - | In-memory | Reads the updated date-time from ISP cancel response |
| U | `runHiChrgJdgUtil(handle, param, inMap, ...)` | - | Utility | Non-billable judgment utility — determines whether to waive charges during cancellation based on the DSL sub-option flag |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 11 methods.
Terminal operations from this method: `updateAging` [U], `getOpSvcKeiInfo` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `runSc` [-], `editInMsgEKK0351C250` [U], `editInMsgEKK0351C250` [U], `editInMsgEKK0351C250` [U], `editInMsgEKK0351C250` [U], `editInMsgEKK0351C250` [U], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `runSc` [-], `editInMsgEKK0351C240` [U]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKOpSvcHktgiUpdCC.copyOption | `JKKOpSvcHktgiUpdCC.copyOption` → `JKKOpSvcHktgiUpdCC.addMyHomePage` | `EKK0351C220 [C] KK_T_OPSVKEI`, `EKK0351C240 [U] KK_T_OPSVKEI_DSL`, `EKK0351C250 [U] KK_T_OPSVKEI_ISP`, `EKK0361D010 [C] KK_T_OPSVKEI_ISP`, `EKK0361C010 [C] KK_T_OPSVKEI_ISP`, `EKK0361C030 [U] KK_T_OPSVKEI_ISP`, `updateAging [U] Aging system`, `getOpSvcKeiInfo [R] KK_T_OPSVKEI` |
| 2 | CBS: JKKOpSvcHktgiUpdCC.copyOption | (same as above — copyOption is the primary caller of addMyHomePage) | `runHiChrgJdgUtil [-] Non-billable judgment utility`, `addYYYYMMDD [C] Date utility`, `getCapa [R] Capacity inquiry` |

## 6. Per-Branch Detail Blocks

**Block 1** — [INIT] Initialization of local variables (L6776)

> Initializes all local working variables by extracting values from the work map and setting up null-initialized data structures.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` |
| 2 | SET | `retMsg = null` |
| 3 | CALL | `hikiMotoSysid = getHikiMotoSysid(workMap)` // 引継元SYSID — source system ID |
| 4 | CALL | `hikiMotoSvcKeiNo = getHikiMotoSvcKeiNo(workMap)` // 引継元サービス契約番号 — source service contract number |
| 5 | CALL | `hikiMotoSvcKeiStat = getHikiMotoSvcKeiStat(workMap)` // 引継元サービス契約ステータス — source service contract status |
| 6 | CALL | `idoDiv = getIdoDiv(workMap)` // 異動区分 — transfer type classification |
| 7 | CALL | `aplyYmd = getAplyYmd(workMap)` // 適用年月日 — effective application date (YYYYMMDD) |
| 8 | SET | `opSvcKeiInfo = null` // getOpSvcKeiInfoの結果 — result of option service contract info retrieval |
| 9 | SET | `msgsEKK0351A010 = null` // オプションサービス契約一意照会結果 — option service contract unique inquiry result |
| 10 | SET | `msgsEKK0361A010 = null` // オプションサービス契約＜ISP＞一意照会結果 — ISP option contract inquiry result |
| 11 | SET | `msgsEKK0401B001 = null` // サブオプションサービス契約一覧照会結果 — sub-option service contract list result |
| 12 | SET | `yuukouMyHPFlg = false` // Valid My HP existence flag |

**Block 2** — [WHILE LOOP] Scan for valid MyHP in existing list (L6807)

> Iterates through all My Home Page entries in the source list to check if any valid (non-canceled) My Home Page already exists, excluding the one currently being transferred.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` — loop counter |
| 2 | SET | `i < retHikiMotoMyHpEKK0361B001.length` — loop condition |
| 3 | SET | `i++` — increment |
| 4 | SET | `opSvcKeiNo = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_KEI_NO)` — option service contract number |
| 5 | SET | `opSvcKeiStat = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_KEI_STAT)` — option service contract status |
| 6 | SET | `opSvcCd = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_CD)` — option service code |
| 7 | IF | `JKKStrConst.CD00037_DSL_ZM = "910" (解除済/canceled) > opSvcKeiStat` AND `OP_SVC_CD_MYHOMEPAGE = "B002" == opSvcCd` AND `!opSvcKeiNo.equals(hikiMotoOpSvcKeiNo)` [L6810] |
| 8 | SET | `yuukouMyHPFlg = true` // 引継ぐMyHP以外で解約済未満のMyホームページがある — valid MyHP exists other than the one being transferred |

**Block 3** — [IF] `!yuukouMyHPFlg` — Cancel null-URL MyHP entries and register new one (L6823)

> If no valid existing My HP was found, process all MyHP entries that lack a URL account (incomplete/unactivated), cancel them, and register a brand-new My HP option.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!yuukouMyHPFlg` [L6823] |
| 2 | [nested: see Block 3.1 through Block 3.5 below] | |

**Block 3.1** — [WHILE LOOP] Cancel MyHP entries with null URL account (L6825)

> Iterates through My Home Page list, looking for entries that are My HP type and have a null URL account (unconfigured).

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` |
| 2 | SET | `i < retHikiMotoMyHpEKK0361B001.length` |
| 3 | SET | `i++` |
| 4 | SET | `opSvcKeiNo = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_KEI_NO)` — option service contract number |
| 5 | SET | `opSvcCd = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_CD)` — option service code |
| 6 | SET | `opSvcKeiStat = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.OP_SVC_KEI_STAT)` — option service contract status |
| 7 | SET | `urlAccount = retHikiMotoMyHpEKK0361B001[i].getString(EKK0361B001CBSMsg1List.URL_ACCOUNT)` — URL account (引継元のURLアカウント) |
| 8 | IF | `OP_SVC_CD_MYHOMEPAGE = "B002" == opSvcCd` AND `isNull(urlAccount) == true` [L6832] |

**Block 3.1.1** — [IF] Cancel MyHP with null URL account (L6837)

> For My HP entries with null URL account: retrieve full service info, then cancel based on contract status.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `opSvcKeiInfo = getOpSvcKeiInfo(handle, param, opSvcKeiNo)` // オプションサービス契約情報取得 — retrieve option service contract info |
| 2 | SET | `msgsEKK0351A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC = "OP_SVC")` |
| 3 | SET | `msgsEKK0361A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC_ISP = "OP_SVC_ISP")` |
| 4 | SET | `msgsEKK0401B001 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_SBOP_SVC = "SBOP_SVC")` |
| 5 | IF | `JKKStrConst.CD00037_CNC_ZM = "030" (結了済/suspended) > opSvcKeiStat` [L6847] |
| 6 | [nested: see Block 3.1.1.1] | |
| 7 | ELSE-IF | `JKKStrConst.CD00037_CNC_ZM = "030" == opSvcKeiStat` (結了済の場合、解約 — if suspended, cancel) [L6856] |
| 8 | [nested: see Block 3.1.1.2] | |
| 9 | ELSE | (Do nothing — 何もしない) [L6892] |
| 10 | EXEC | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, AGING_EXEC_KBN_END = "03")` // エイジング使用終了 — aging usage end |

**Block 3.1.1.1** — [IF] Status > "030" — Provisional Cancel (L6849)

> Service is not yet canceled. Perform provisional cancellation only.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = this.mapper.editInMsgEKK0351C220(param, opSvcKeiNo, mskmDtlNo, motoLastUpdDtm, idoDiv)` // Constructs input for provisional cancel |
| 2 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0351C220, inputMap)` // Provisional cancel — option service contract provisional cancellation |
| 3 | SET | `motoLastUpdDtm = retMsg.getString(EKK0351C220CBSMsg.UPD_DTM)` — get updated date-time after cancel |

**Block 3.1.1.2** — [IF] Status = "030" — Full Cancel (L6856)

> Service is suspended (結了済). Perform full cancellation including non-billable judgment, cancel, and confirm cancel.

| # | Type | Code |
|---|------|------|
| 1 | SET | `inMap = new HashMap<String, Object>()` |
| 2 | SET | `svcEndYmd = aplyYmd` // サービス終了年月日 — service end date |
| 3 | SET | `svcChrgEndYmd = addYYYYMMDD(aplyYmd, -1)` // サービス課金終了年月日（適用日−1日） — service charge end date = application date minus 1 day |
| 4 | SET | `inMap.put("svc_chrg_endymd", svcChrgEndYmd)` // サービス課金終了年月日 |
| 5 | SET | `inMap.put("svc_endymd", svcEndYmd)` // サービス終了年月日 |
| 6 | SET | `jdgHiChrgMapOpSvcKei = runHiChrgJdgUtil(handle, param, inMap, retHikiMotoEKK0081A010[0], null, msgsEKK0351A010[0], null, DSL_SBT_FLG_OP_SVC_KEI_DSL = "2")` // 非課金判定部品実行＜オプション＞ — non-billable judgment for option |
| 7 | SET | `inputMap = this.mapper.editInMsgEKK0351C240(param, opSvcKeiNo, msgsEKK0351A010[0], mskmDtlNo, aplyYmd, svcEndYmd, svcChrgEndYmd, motoLastUpdDtm, idoDiv, SVC_DLRE_CD_HKTG = "04", jdgHiChrgMapOpSvcKei)` // Constructs input for full cancel |
| 8 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0351C240, inputMap)` — full cancel of option service contract |
| 9 | SET | `motoLastUpdDtm = retMsg.getString(EKK0351C240CBSMsg.UPD_DTM)` — get updated date-time |
| 10 | SET | `inputMap = this.mapper.editInMsgEKK0351C250(param, opSvcKeiNo, msgsEKK0351A010[0], svcEndYmd, svcChrgEndYmd, motoLastUpdDtm, idoDiv, SVC_DLRE_CD_HKTG = "04", jdgHiChrgMapOpSvcKei)` // Constructs input for cancel confirm |
| 11 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0351C250, inputMap)` — cancel confirmation |
| 12 | SET | `motoLastUpdDtm = retMsg.getString(EKK0351C250CBSMsg.UPD_DTM)` — get updated date-time |

**Block 3.2** — [IF] Register new My Home Page option (L6948)

> After canceling incomplete entries, register a brand-new My Home Page option at the transfer source.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `capa = getCapa(handle, param, getHikiMotoPcrsCd(workMap), SBOP_SVC_CD_HP_CAPA = "D04")` — retrieve My HP capacity |
| 2 | SET | `inputMap = this.mapper.editInMsgEKK0361D010New(param, retHikiMotoEKK0361A010[0], hikiMotoSeikyKeiNo, hikiMotoSvcKeiNo, hikiMotoSysid, mskmDtlNo, getIdoDiv(workMap), aplyYmd, capa, motoLastUpdDtm)` // 引継元情報をセット — set transfer source info |
| 3 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0361D010, inputMap)` — register new option service contract (ISP) |
| 4 | SET | `motoLastUpdDtm = retMsg.getString(EKK0361D010CBSMsg.UPD_DTM)` — get updated date-time |
| 5 | SET | `hikiMotoNewOpSvcKeiNo = retMsg.getString(EKK0361D010CBSMsg.OP_SVC_KEI_NO)` — newly registered option service contract number |

**Block 3.3** — [IF] Process ISP sub-option based on source status (L6966)

> Handles the ISP sub-option for the newly registered My Home Page, based on the source service contract status.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKStrConst.CD00037_SHOSA_ZUMI = "020" (調査済/investigation done) < hikiMotoSvcKeiStat` [L6968] |
| 2 | [Do nothing — 何もしない] | |
| 3 | ELSE-IF | `JKKStrConst.CD00037_SHOSA_ZUMI = "020" == hikiMotoSvcKeiStat` (investigation done) [L6971] |
| 4 | SET | `inputMap = this.mapper.editInMsgEKK0361C010(param, hikiMotoNewOpSvcKeiNo, getIdoDiv(workMap), motoLastUpdDtm)` — constructs input for ISP registration |
| 5 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0361C010, inputMap)` — register ISP sub-option |
| 6 | SET | `motoLastUpdDtm = retMsg.getString(EKK0361C010CBSMsg.UPD_DTM)` — get updated date-time |
| 7 | ELSE | (Else is suspended only per comment — elseは、仕様上、結了済のみ) [L6980] |
| 8 | SET | `inputMap = this.mapper.editInMsgEKK0361C030(param, hikiMotoNewOpSvcKeiNo, getIdoDiv(workMap), motoLastUpdDtm)` — constructs input for ISP cancel |
| 9 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0361C030, inputMap)` — cancel ISP sub-option |
| 10 | SET | `motoLastUpdDtm = retMsg.getString(EKK0361C030CBSMsg.UPD_DTM)` — get updated date-time |

**Block 3.4** — [GET] Retrieve new service info and register aging (L6994)

> After ISP processing, fetch the full details of the newly registered service and register it in the aging system.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `opSvcKeiInfo = getOpSvcKeiInfo(handle, param, hikiMotoNewOpSvcKeiNo)` — retrieve new service contract details |
| 2 | SET | `msgsEKK0351A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC = "OP_SVC")` |
| 3 | SET | `msgsEKK0361A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC_ISP = "OP_SVC_ISP")` |
| 4 | SET | `msgsEKK0401B001 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_SBOP_SVC = "SBOP_SVC")` |
| 5 | CALL | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, AGING_EXEC_KBN_ADD = "01")` — register aging for new MyHP option |

**Block 3.5** — [IF] Cancel new MyHP if source was canceled (L7022)

> If the source service contract was already canceled (解除済 = "910"), the newly registered My HP must also be canceled to maintain consistency.

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKStrConst.CD00037_DSL_ZM = "910" (解除済/canceled) == hikiMotoSvcKeiStat` [L7022] |
| 2 | SET | `inMap = new HashMap<String, Object>()` |
| 3 | SET | `svcEndYmd = aplyYmd` // サービス終了年月日 — service end date (note: assigned twice in source) |
| 4 | SET | `svcChrgEndYmd = addYYYYMMDD(aplyYmd, -1)` // サービス課金終了年月日（適用日−1日） — service charge end date |
| 5 | SET | `inMap.put("svc_chrg_endymd", svcChrgEndYmd)` |
| 6 | SET | `inMap.put("svc_endymd", svcEndYmd)` |
| 7 | SET | `jdgHiChrgMapOpSvcKei = runHiChrgJdgUtil(handle, param, inMap, retHikiMotoEKK0081A010[0], null, msgsEKK0351A010[0], null, DSL_SBT_FLG_OP_SVC_KEI_DSL = "2")` — non-billable judgment for option |
| 8 | SET | `inputMap = this.mapper.editInMsgEKK0351C240(param, hikiMotoNewOpSvcKeiNo, msgsEKK0351A010[0], mskmDtlNo, aplyYmd, svcEndYmd, svcChrgEndYmd, motoLastUpdDtm, idoDiv, SVC_DLRE_CD_NORMAL = "01", jdgHiChrgMapOpSvcKei)` // Constructs input for cancel (normal type, not transfer) |
| 9 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0351C240, inputMap)` — cancel newly registered My HP option |
| 10 | SET | `motoLastUpdDtm = retMsg.getString(EKK0351C240CBSMsg.UPD_DTM)` |
| 11 | SET | `inputMap = this.mapper.editInMsgEKK0351C250(param, hikiMotoNewOpSvcKeiNo, msgsEKK0351A010[0], svcEndYmd, svcChrgEndYmd, motoLastUpdDtm, idoDiv, SVC_DLRE_CD_NORMAL = "01", jdgHiChrgMapOpSvcKei)` // cancel confirm |
| 12 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0351C250, inputMap)` — cancel confirmation |
| 13 | SET | `motoLastUpdDtm = retMsg.getString(EKK0351C250CBSMsg.UPD_DTM)` |
| 14 | CALL | `opSvcKeiInfo = getOpSvcKeiInfo(handle, param, hikiMotoNewOpSvcKeiNo)` — retrieve canceled service details |
| 15 | SET | `msgsEKK0351A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC = "OP_SVC")` |
| 16 | SET | `msgsEKK0361A010 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_OP_SVC_ISP = "OP_SVC_ISP")` |
| 17 | SET | `msgsEKK0401B001 = (CAANMsg[])opSvcKeiInfo.get(MAP_KEY_SBOP_SVC = "SBOP_SVC")` |
| 18 | CALL | `updateAging(handle, param, msgsEKK0351A010[0], msgsEKK0361A010[0], msgsEKK0401B001, AGING_EXEC_KBN_END = "03")` — end aging |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hikiMoto` | Field prefix | 引継元 — Transfer source; the original service contract before a contract transfer operation |
| `hikiMotoSeikyKeiNo` | Field | 引継元請求契約番号 — Source billing contract number; the billing contract that owns the transferred service |
| `hikiMotoSvcKeiNo` | Field | 引継元サービス契約番号 — Source service contract number; the main service contract being transferred |
| `hikiMotoSvcKeiStat` | Field | 引継元サービス契約ステータス — Source service contract status; indicates whether the contract is active, suspended, canceled, etc. |
| `hikiMotoSysid` | Field | 引継元SYSID — Source system ID; identifies the source system of record for the transferred contract |
| `hikiMotoPcrsCd` | Field | 引継元商品番号 — Source product code; identifies the product type associated with the source contract |
| `hikiMotoOpSvcKeiNo` | Field | 引継元オプションサービス契約番号 — Source option service contract number; the specific option contract being transferred |
| `hikiMotoNewOpSvcKeiNo` | Field | 引継元新規オプションサービス契約番号 — Newly registered option service contract number at the transfer source |
| `mskmDtlNo` | Field | 申込明細番号 — Application detail number; identifies the specific line item within a service order application |
| `idoDiv` | Field | 異動区分 — Transfer type classification; distinguishes between different kinds of service changes (e.g., normal transfer, port-in) |
| `aplyYmd` | Field | 適用年月日 — Effective application date; the date the transfer takes effect, in YYYYMMDD format |
| `motoLastUpdDtm` | Field | 元最終更新日時 — Source last update date-time; tracks the most recent update timestamp across chained operations |
| `yuukouMyHPFlg` | Field | 有効MyHPフラグ — Valid My HP flag; indicates whether a valid (non-canceled) My Home Page already exists at the source |
| `svcEndYmd` | Field | サービス終了年月日 — Service end date; the date when the service contract officially terminates |
| `svcChrgEndYmd` | Field | サービス課金終了年月日 — Service charge end date; the date when billing for the service ends (typically application date - 1 day) |
| `capa` | Field | 容量 — Capacity; the storage or bandwidth capacity allocated to the My Home Page option |
| `CD00037_CNC_ZM` | Constant | "030" — 結了済 (Suspended); service contract status indicating the contract has been formally suspended |
| `CD00037_DSL_ZM` | Constant | "910" — 解除済 (Canceled); service contract status indicating the contract has been fully canceled |
| `CD00037_SHOSA_ZUMI` | Constant | "020" — 調査済 (Investigation done); service contract status indicating the contract is under investigation |
| `CD00037_UK_ZM` | Constant | "010" — 受付済 (Received); service contract status indicating the contract has been accepted but not yet active |
| `CD00037_SVCTK_CHU` | Constant | "100" — サービス提供中 (Service in progress); service contract status indicating the service is actively running |
| `OP_SVC_CD_MYHOMEPAGE` | Constant | "B002" — My Home Page option service code; the service code that identifies the My Home Page option |
| `SBOP_SVC_CD_HP_CAPA` | Constant | "D04" — Sub-option service code for My HP capacity; identifies the capacity-related sub-option for My Home Page |
| `AGING_EXEC_KBN_ADD` | Constant | "01" — Aging registration category; triggers registration of a new entry in the aging system |
| `AGING_EXEC_KBN_END` | Constant | "03" — Aging usage end category; triggers removal/end of an aging target entry |
| `DSL_SBT_FLG_OP_SVC_KEI_DSL` | Constant | "2" — DSL sub-option flag for option service contract; identifies this contract as a DSL-related option service line |
| `SVC_DLRE_CD_HKTG` | Constant | "04" — Service deletion reason code for transfer; indicates the cancel is triggered by a contract transfer operation |
| `SVC_DLRE_CD_NORMAL` | Constant | "01" — Service deletion reason code for normal cancel; indicates a standard cancellation (not transfer-related) |
| `MAP_KEY_OP_SVC` | Constant | "OP_SVC"; map key for retrieving option service contract data from getOpSvcKeiInfo result |
| `MAP_KEY_OP_SVC_ISP` | Constant | "OP_SVC_ISP"; map key for retrieving ISP sub-option contract data from getOpSvcKeiInfo result |
| `MAP_KEY_SBOP_SVC` | Constant | "SBOP_SVC"; map key for retrieving sub-option service contract list data from getOpSvcKeiInfo result |
| `EKK0361B001` | SC Code | Option service contract list inquiry SC; retrieves a list of all option service contracts for a given service |
| `EKK0351A010` | SC Code | Option service contract unique inquiry SC; retrieves detailed information for a specific option service contract |
| `EKK0361A010` | SC Code | Option service contract (ISP) unique inquiry SC; retrieves ISP sub-option contract details |
| `EKK0401B001` | SC Code | Sub-option service contract list inquiry SC; retrieves a list of sub-option service contracts |
| `EKK0351C220` | SC Code | Option service contract provisional cancel SC; performs a provisional cancellation of an option service contract |
| `EKK0351C240` | SC Code | Option service contract cancel SC; performs full cancellation of an option service contract with end dates |
| `EKK0351C250` | SC Code | Option service contract cancel confirm SC; confirms the cancellation of an option service contract |
| `EKK0361D010` | SC Code | Option service contract (ISP) registration SC; creates a new option service contract (ISP) record |
| `EKK0361C010` | SC Code | Option service contract (ISP) registration SC; registers an ISP sub-option |
| `EKK0361C030` | SC Code | Option service contract (ISP) cancel SC; cancels an ISP sub-option |
| `KK_T_OPSVKEI` | Entity/DB | Option service contract table; stores main option service contract records |
| `KK_T_OPSVKEI_DSL` | Entity/DB | Option service contract DSL table; stores DSL-related service contract records (charges, cancel flags) |
| `KK_T_OPSVKEI_ISP` | Entity/DB | Option service contract ISP table; stores ISP sub-option service contract records |
| Aging system | External system | System that tracks usage of communication services (email, etc.) and their start/end dates |
| My Home Page (My HP) | Business term | My ホームページ — A web-based personal homepage service offered as an option to telecom customers |
| URL account | Business term | URLアカウント — The web account identifier for My Home Page; if null, the My HP service is unconfigured/unactivated |
| Provisional cancel | Business process | 仮解約 — A provisional cancellation step that flags the contract for cancellation without finalizing it; typically followed by a confirm cancel step |
| Full cancel | Business process | 解約 — Complete cancellation of a service contract, setting both service end date and charge end date |
| Cancel confirm | Business process | 解約確定 — Final confirmation of a service cancellation, making it irrevocable |
| Non-billable judgment | Business process | 非課金判定 — Process to determine whether cancellation charges should be waived based on business rules |
| ISP sub-option | Business term | ISPサブオプション — Internet Service Provider sub-option; a sub-service linked to the main option service contract |
| Contract transfer (引継ぎ) | Business process | A service operation where a customer's contract is transferred from one source entity/account to another |

---

**Project:** Futurity Platform — Business Process Layer
**Class:** `JKKOpSvcHktgiUpdCC` (Option Service Contract Transfer Update Common Component)
**Method:** `addMyHomePage` — Transfer destination My Home Page option registration
**JIRA/Change:** OM-2014-0001247 (2014/04/02), OM-2013-0001096 (2013/09/11)
**Lines:** 6762–7109 (348 LOC)
**Author:** Fujitsu
