# Business Logic — JKKOpSvcHktgiUpdCC.addOption() [340 LOC]

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

## 1. Role

### JKKOpSvcHktgiUpdCC.addOption()

This method performs the **option service contract inheritance (transfer / "hikitsugi") process**, handling the migration of option services from a parent service contract to a new (destination) service contract. In Japanese telecom domain terms, it processes "option inheritance" -- the operation where a customer moves their subscribed add-on services (such as email, virus check, home page, PC wide plan) from one account to another. It supports **multiple option service types**: fixed IP (B004), MyHP (B002), email (B001), mailing list (B003), multi-seccion (B015), Sagiwall (B131), Norton (B132), and various sub-option services. The method implements a **routing/dispatch pattern** by branching based on the inherited option service code (`hikiMotoOpSvcCd`) and the parent service type (MyHP vs. non-MyHP), applying the correct CBS (EKK0361D010 for ISP registration, EKK0411D010 for sub-option registration) to each case. It acts as a **shared coordination component** called by `copyOption()`, serving as the central orchestrator for the entire option inheritance workflow -- preparing data, invoking CBSs, handling sub-option registration loops, conditionally registering mail virus check, and accumulating SOD (Service Order Data) information.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addOption(params)"])
    INIT["Initialize: addSodList, inputMap, local vars"]

    INIT --> GET_HIKIMOTO["getHikiMotoOpSvcCd(workMap)"]
    GET_HIKIMOTO --> GET_VARS["getHikiSakiSysid, getHikiSakiSvcKeiNo, getHikiSakiSvcKeiStat, getHikiSakiSvcKeiUcwkNo, getIdoDiv, getAplyYmd"]
    GET_VARS --> EDIT_IN_MSG_361["editInMsgEKK0361D010 - set original option info"]
    EDIT_IN_MSG_361 --> PUT_VARS["put SVC_KEI_NO, SYSID, SEIKY_KEI_NO, MSKM_DTL_NO, UPD_DTM_BF, SVC_USE_STA_KIBO_YMD, DSP_SVCTK_STAYMD, RSV_TSTA_KIBO_YMD"]
    PUT_VARS --> CHECK_KOTEI_IP{"OP_SVC_CD_KOTEI_IP equals hikiMotoOpSvcCd<br/>B004"}

    CHECK_KOTEI_IP -- true --> PUT_UCWK_NO["put SVC_KEI_UCWK_NO = hikiSakiSvcKeiUcwkNo"]
    PUT_UCWK_NO --> RUN_361
    CHECK_KOTEI_IP -- false --> RUN_361["runSc EKK0361D010 - register option service contract (ISP)"]
    RUN_361 --> GET_RET_361["get UPD_DTM, KK0351_GENE_ADD_DTM, OP_SVC_KEI_NO, OP_SVC_KEI_STAT from retOptionMsg"]
    GET_RET_361 --> SET_WORKMAP["setHikiSakiOpSvKeiGeneAddDtm, setHikiSakiOpSvcKeiNo, setHikiSakiOpSvcKeiStat"]

    SET_WORKMAP --> SUBOPT_LOOP["for each sub-option in retHikiMotoEKK0401B001"]
    SUBOPT_LOOP --> GET_SUBOPT["getString SBOP_SVC_KEI_NO, SBOP_SVC_CD, SBOP_SVC_KEI_STAT"]
    GET_SUBOPT --> HKTG_CHK["hktgChk = true"]
    HKTG_CHK --> CHECK_STAT_9{"stat equals 910 or 920"}

    CHECK_STAT_9 -- true --> HKTG_FALSE["hktgChk = false"]
    HKTG_FALSE --> GET_STAT["getHikiMotoOpSvcKeiStat(workMap)"]
    GET_STAT --> CHECK_STAT_EQ{"parentStatus equals subStatus"}
    CHECK_STAT_EQ -- true --> GET_MSKM["get MSKM_DTL_NO from both original and sub"]
    GET_MSKM --> CHECK_MSKM_EQ{"mskmDtlNoAtOpSvcKei equals mskmDtlNoAtSbOpSvcKei"}
    CHECK_MSKM_EQ -- true --> HKTG_TRUE["hktgChk = true"]
    CHECK_MSKM_EQ -- false --> CONTINUE
    CHECK_STAT_EQ -- false --> CONTINUE
    HKTG_TRUE --> CHECK_PC_WIDE

    CHECK_STAT_9 -- false --> CHECK_PC_WIDE{"idoDiv=00003 AND sbCd=D12 AND stat<100"}

    CHECK_PC_WIDE -- true --> HKTG_FALSE_PC["hktgChk = false"]
    CHECK_PC_WIDE -- false --> CHECK_HKTG{"!hktgChk"}
    HKTG_FALSE_PC --> CONTINUE2{"!hktgChk"}
    HKTG_FALSE --> CHECK_HKTG

    CHECK_HKTG -- true --> CONTINUE
    CHECK_HKTG -- false --> GET_SBINFO["getSbOpSvcKeiInfo - get sub-option service info"]
    GET_SBINFO --> EXTRACT_MSG["extract retHikiMotoEKK0401A010, retHikiMotoEKK0411A010"]
    EXTRACT_MSG --> CHECK_MYHP{"opSvcCd=MyHP<br/>B002"}

    CHECK_MYHP -- true --> GET_ADDCAPA["getAddCapa(handle, param, workMap)"]
    GET_ADDCAPA --> EDIT_411_MYHP["editInMsgEKK0411D010MyHp with addCapa"]
    CHECK_MYHP -- false --> EDIT_411["editInMsgEKK0411D010 without addCapa"]
    EDIT_411_MYHP --> RUN_411["runSc EKK0411D010 - register sub-option service contract (ISP)"]
    EDIT_411 --> RUN_411

    RUN_411 --> GET_RET_411["get UPD_DTM from retMsg"]
    GET_RET_411 --> ADD_LISTS["hikiSakiSbOpSvcKeiNo.add, hikiSakiSbOpSvcCd.add"]
    ADD_LISTS --> CHECK_VIRUS{"sbCd=D03 (virus check)"}
    CHECK_VIRUS -- true --> SET_VIRUS["existsVirusCheck = true"]
    CHECK_VIRUS -- false --> LOOP_END
    SET_VIRUS --> LOOP_END["next iteration"]
    CONTINUE --> LOOP_END
    CONTINUE2 --> LOOP_END

    LOOP_END --> CHECK_NO_SUBOPT{"no sub-options"}
    CHECK_NO_SUBOPT -- true --> CALL_ADDMYHP["addMyHpSubOp"]
    CHECK_NO_SUBOPT -- false --> CHECK_EMAIL_FAMI{"opSvcCd=Email AND famiPackAri AND !existsVirusCheck"}

    CHECK_EMAIL_FAMI -- true --> EDIT_411_VIRUS["editInMsgEKK0411D010 - register mail virus check"]
    EDIT_411_VIRUS --> RUN_411_VIRUS["runSc EKK0411D010"]
    RUN_411_VIRUS --> ADD_LISTS_VIRUS["add to lists, create addSodMap"]
    ADD_LISTS_VIRUS --> ADD_SOD["addSodList.add"]
    ADD_SOD --> CHECK_STAT_010

    CHECK_EMAIL_FAMI -- false --> CHECK_STAT_010{"stat=010 (accepted)"}
    CALL_ADDMYHP --> CHECK_STAT_010

    CHECK_STAT_010 -- true --> CREATE_SOD["createSODParam - finalize SOD info"]
    CHECK_STAT_010 -- false --> RETURN_END["return addSodList"]
    CREATE_SOD --> RETURN_END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing CBS (Service Component) calls and reading/writing to the database. Required for all CBS invocations and data retrieval operations. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying screen input data. Used by mapper methods (`editInMsgEKK0361D010`, `editInMsgEKK0411D010`, `editInMsgEKK0411D010MyHp`) to populate input message structures for CBS calls. |
| 3 | `retHikiMotoEKK0351A010` | `CAANMsg[]` | Messages from the original (source) option service contract inquiry (EKK0351A010). Contains the original option service details including service contract detail number (mskmDtlNo) and option service code (opSvcCd) used for comparison and routing decisions. |
| 4 | `retHikiMotoEKK0361A010` | `CAANMsg[]` | Messages from the original (source) option service contract (EKK0361A010). Carries the original option service data referenced during sub-option registration and MyHP sub-option creation. |
| 5 | `retHikiMotoEKK0401B001` | `CAANMsg[]` | Messages listing all sub-option service contracts attached to the original option. This is the primary loop target -- each element represents one sub-option to potentially inherit (e.g., virus check, home page capacity, PC wide plan). |
| 6 | `hikiSakiSeikyKeiNo` | `String` | Destination billing service contract number ("seikyukei_no"). Identifies the billing contract to which the inherited options belong. Set in inputMap for CBS registration. |
| 7 | `mskmDtlNo` | `String` | Application detail number ("mukumomi shoutei no"). Internal tracking number for the service contract application. Used as a unique identifier in CBS messages and when comparing original vs. sub-option contract details. |
| 8 | `hikiMotoOpSvcKeiNo` | `String` | Original (source) option service contract number ("hikimoto opsukei no"). Identifies the service contract from which options are being inherited/ported. |
| 9 | `famiPackAri` | `Boolean` | Flag indicating whether the customer has a Family Pack subscription ("famiripakku ari"). When true AND the parent is email AND virus check was not inherited, this triggers standalone virus check registration. |
| 10 | `opSvkeiSodInfo` | `Map<String, Object>` | Option service contract SOD information map. Contains service order data used by `createSODParam` to build the final SOD parameter list. |
| 11 | `hikiSakiSbOpSvcKeiNo` | `List<String>` | Output list collecting all inherited sub-option service contract numbers. Populated during the sub-option loop as each sub-option is successfully registered. |
| 12 | `hikiSakiSbOpSvcCd` | `List<String>` | Output list collecting all inherited sub-option service codes. Corresponds positionally to `hikiSakiSbOpSvcKeiNo`. |
| 13 | `sodCcInputList` | `List<Map<String, Object>>` | Input/output list of SOD (Service Order Data) entry maps. Passed to `createSODParam` which populates it with order data for the inherited option. |
| 14 | `workMap` | `HashMap<String, Object>` | Shared working data map carrying intermediate state between methods. Used to read destination service contract metadata (SYSID, service contract number, status, detail number, transfer flag) and to write back inherited option results. |

**Instance fields read by this method:**
- `sakiLastUpdDtm` (String) -- Destination service contract last update date/time. Read from the `EKK0361D010CBSMsg.UPD_DTM` field of the CBS response and used throughout as the update timestamp for subsequent CBS calls.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JKKOpSvcHktgiUpdMapperCC.editInMsgEKK0361D010` | EKK0361D010 | - | Prepares input message for option service contract (ISP) registration (original option data) |
| C | `runSc` (via `EKK0361D010`) | EKK0361D010 | - | Registers the destination option service contract <ISP> -- creates new option contract record |
| U | `JKKOpSvcHktgiUpdMapperCC.editInMsgEKK0411D010` | EKK0411D010 | - | Prepares input message for sub-option service contract (ISP) registration (general case) |
| U | `JKKOpSvcHktgiUpdMapperCC.editInMsgEKK0411D010MyHp` | EKK0411D010 | - | Prepares input message for sub-option service contract (ISP) registration for MyHP parent |
| C | `runSc` (via `EKK0411D010`) | EKK0411D010 | - | Registers sub-option service contract <ISP> -- creates new sub-option contract record |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoOpSvcCd` | - | workMap | Retrieves the option service code from the source contract via workMap |
| R | `JKKOpSvcHktgiUpdCC.getHikiSakiSysid` | - | workMap | Retrieves the destination system ID |
| R | `JKKOpSvcHktgiUpdCC.getHikiSakiSvcKeiNo` | - | workMap | Retrieves the destination service contract number |
| R | `JKKOpSvcHktgiUpdCC.getHikiSakiSvcKeiStat` | - | workMap | Retrieves the destination service contract status |
| R | `JKKOpSvcHktgiUpdCC.getHikiSakiSvcKeiUcwkNo` | - | workMap | Retrieves the destination service contract detail number |
| R | `JKKOpSvcHktgiUpdCC.getIdoDiv` | - | workMap | Retrieves the transfer/displacement division flag |
| R | `JKKOpSvcHktgiUpdCC.getAplyYmd` | - | workMap | Retrieves the application effective year/month/day |
| R | `JKKOpSvcHktgiUpdCC.getSbOpSvcKeiInfo` | - | - | Retrieves detailed sub-option service contract info (original sub-option messages) |
| R | `JKKOpSvcHktgiUpdCC.getAddCapa` | - | - | Retrieves the additional capacity for home page during MyHP sub-option registration |
| R | `JKKOpSvcHktgiUpdCC.getHikiMotoOpSvcKeiStat` | - | workMap | Retrieves the status of the original (parent) option service contract |
| U | `JKKOpSvcHktgiUpdMapperCC.editInMsgEKK0411D010` (virus) | EKK0411D010 | - | Prepares input message for standalone mail virus check registration (Family Pack case) |
| C | `addMyHpSubOp` | - | - | Registers a home page sub-option contract when no existing sub-options are present |
| C | `createSODParam` | - | - | Creates and populates SOD (Service Order Data) parameters when the destination contract status is "accepted" (010) |
| U | `setHikiSakiOpSvKeiGeneAddDtm` | - | workMap | Sets the generation/addition date/time of the inherited option service contract |
| U | `setHikiSakiOpSvcKeiNo` | - | workMap | Sets the inherited option service contract number back to workMap |
| U | `setHikiSakiOpSvcKeiStat` | - | workMap | Sets the inherited option service contract status back to workMap |

## 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: `createSODParam` [C], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: JKKOpSvcHktgiUpdCC.copyOption() | `copyOption()` -> `JKKOpSvcHktgiUpdCC.addOption` | `EKK0361D010 [C]`, `EKK0411D010 [C]`, `createSODParam [C]`, `addMyHpSubOp [C]` |

## 6. Per-Branch Detail Blocks

**Block 1** — INIT `(local variable declarations)` (L5445)

Initialize local variables and data structures for the option inheritance process.

| # | Type | Code |
|---|------|------|
| 1 | SET | `addSodList = new ArrayList<Map<String,Object>>()` // Accumulator for SOD info of newly registered virus check |
| 2 | SET | `inputMap = new HashMap<String, Object>()` // Working map for CBS input |
| 3 | SET | `hikiSakiGeneAddDtm = null` // Inherited option generation date/time |
| 4 | SET | `retHikiMotoEKK0401A010 = null` // Sub-option contract inquiry messages |
| 5 | SET | `retHikiMotoEKK0411A010 = null` // Sub-option ISP inquiry messages |

**Block 2** — PROCESSING `(retrieve metadata from workMap)` (L5456)

Fetch the original option service code and destination service contract metadata.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `hikiMotoOpSvcCd = getHikiMotoOpSvcCd(workMap, hikiMotoOpSvcKeiNo)` // Original option service code |
| 2 | CALL | `hikiSakiSysid = getHikiSakiSysid(workMap)` // Destination SYSID |
| 3 | CALL | `hikiSakiSvcKeiNo = getHikiSakiSvcKeiNo(workMap)` // Destination service contract number |
| 4 | CALL | `hikiSakiSvcKeiStat = getHikiSakiSvcKeiStat(workMap)` // Destination service contract status |
| 5 | CALL | `hikiSakiSvcKeiUcwkNo = getHikiSakiSvcKeiUcwkNo(workMap)` // Destination service contract detail number |
| 6 | CALL | `idoDiv = getIdoDiv(workMap)` // Displacement/division flag |
| 7 | CALL | `rsvAplyYmd = getAplyYmd(workMap)` // Application effective year/month/day |

**Block 3** — OPTION SERVICE CONTRACT REGISTRATION `<ISP>` `(original option registration)` (L5467)

Prepare and execute CBS for registering the destination option service contract (ISP).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `inputMap = mapper.editInMsgEKK0361D010(param, retHikiMotoEKK0351A010[0], retHikiMotoEKK0361A010[0], getIdoDiv(workMap))` // Set original option info |
| 2 | SET | `inputMap.put(EKK0361D010CBSMsg.SVC_KEI_NO, hikiSakiSvcKeiNo)` // Service contract number |
| 3 | SET | `inputMap.put(EKK0361D010CBSMsg.SYSID, hikiSakiSysid)` // SYSID |
| 4 | SET | `inputMap.put(EKK0361D010CBSMsg.SEIKY_KEI_NO, hikiSakiSeikyKeiNo)` // Billing service contract number |
| 5 | SET | `inputMap.put(EKK0361D010CBSMsg.MSKM_DTL_NO, mskmDtlNo)` // Application detail number |
| 6 | SET | `inputMap.put(EKK0361D010CBSMsg.UPD_DTM_BF, sakiLastUpdDtm)` // Update date/time before update |
| 7 | SET | `inputMap.put(EKK0361D010CBSMsg.SVC_USE_STA_KIBO_YMD, rsvAplyYmd)` // Service use start desired date |
| 8 | SET | `inputMap.put(EKK0361D010CBSMsg.DSP_SVCTK_STAYMD, rsvAplyYmd)` // Display service contract stay date |
| 9 | SET | `inputMap.put(EKK0361D010CBSMsg.RSV_TSTA_KIBO_YMD, rsvAplyYmd)` // Reservation start desired date |

**Block 4** — IF `[fixed IP condition]` `(OP_SVC_CD_KOTEI_IP == "B004")` (L5477)

When the original option is a fixed IP address service, also set the service contract detail number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `[-> OP_SVC_CD_KOTEI_IP="B004"]` // Fixed IP Address |
| 2 | SET | `inputMap.put(EKK0361D010CBSMsg.SVC_KEI_UCWK_NO, hikiSakiSvcKeiUcwkNo)` // Service contract detail number |

**Block 5** — CALL `(execute EKK0361D010 CBS)` (L5483)

Register the destination option service contract <ISP> by invoking the CBS.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `retOptionMsg = (CAANMsg)runSc(handle, param, EKK0361D010, inputMap)` // Register option service contract <ISP> |

**Block 6** — PROCESSING `(extract CBS response)` (L5485)

Extract the update timestamp, generation date, and inherited option details from the CBS response.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sakiLastUpdDtm = retOptionMsg.getString(EKK0361D010CBSMsg.UPD_DTM)` // Update date/time |
| 2 | SET | `hikiSakiGeneAddDtm = retOptionMsg.getString(EKK0361D010CBSMsg.KK0351_GENE_ADD_DTM)` // Generation date/time |
| 3 | CALL | `setHikiSakiOpSvKeiGeneAddDtm(workMap, hikiMotoOpSvcKeiNo, hikiSakiGeneAddDtm)` // Set generation date/time to workMap |
| 4 | CALL | `setHikiSakiOpSvcKeiNo(workMap, hikiMotoOpSvcKeiNo, retOptionMsg.getString(EKK0361D010CBSMsg.OP_SVC_KEI_NO))` // Set inherited option service contract number |
| 5 | CALL | `setHikiSakiOpSvcKeiStat(workMap, hikiMotoOpSvcKeiNo, retOptionMsg.getString(EKK0361D010CBSMsg.OP_SVC_KEI_STAT))` // Set inherited option service contract status |

**Block 7** — FOR LOOP `(iterate over sub-option service contracts)` (L5563)

Loop through all sub-option service contracts attached to the original option. Each sub-option is processed for inheritance, with conditional skip logic based on contract status and service type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `for(int sbOpIdx = 0; sbOpIdx < retHikiMotoEKK0401B001.length; sbOpIdx++)` |

**Block 7.1** — FOR BODY `(extract sub-option data)` (L5566)

Extract sub-option service contract number, code, and status from the current iteration.

| # | Type | Code |
|---|------|------|
| 1 | SET | `hikiMotoSbOpSvcKeiNo = retHikiMotoEKK0401B001[sbOpIdx].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_NO)` // Sub-option service contract number |
| 2 | SET | `hikiMotoSbOpSvcCd = retHikiMotoEKK0401B001[sbOpIdx].getString(EKK0401B001CBSMsg1List.SBOP_SVC_CD)` // Sub-option service code |
| 3 | SET | `hikiMotoSbOpSvcKeiStat = retHikiMotoEKK0401B001[sbOpIdx].getString(EKK0401B001CBSMsg1List.SBOP_SVC_KEI_STAT)` // Sub-option service contract status |

**Block 7.2** — IF `[skip condition: cancelled/expired sub-option]` (L5583)

Determine whether to skip inheritance for sub-options in cancelled (920) or terminated (910) status. Exception: if the parent option contract was also terminated/cancelled AND shares the same detail number with the sub-option, inherit it anyway (this handles cascading termination from the parent option change/cancellation).

| # | Type | Code |
|---|------|------|
| 1 | SET | `hktgChk = true` // Inheritance check flag, default true |
| 2 | IF | `[SVC_KEI_STAT_910="910"] OR [SVC_KEI_STAT_920="920"]` // Sub-option status is terminated or cancelled |

**Block 7.2.1** — IF-TRUE `(skip inheritance for cancelled/expired)` (L5588)

When the sub-option is terminated or cancelled, set the check to false. Then verify if the parent option is also terminated/cancelled -- if so, check if both parent and sub-option share the same application detail number. If they do, it means the sub-option was terminated/cancelled as a cascading effect of the parent option change/cancellation, and should be inherited.

| # | Type | Code |
|---|------|------|
| 1 | SET | `hktgChk = false` // Skip inheritance |
| 2 | CALL | `hikiMotoOpSvcKeiStat = getHikiMotoOpSvcKeiStat(workMap, hikiMotoOpSvcKeiNo)` // Parent option status |
| 3 | IF | `hikiMotoOpSvcKeiStat equals hikiMotoSbOpSvcKeiStat` // Parent status equals sub-option status |

**Block 7.2.1.1** — IF-TRUE `(same status check)` (L5596)

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmDtlNoAtOpSvcKei = retHikiMotoEKK0351A010[0].getString(EKK0351A010CBSMsg1List.MSKM_DTL_NO)` // Application detail number of the option service contract |
| 2 | SET | `mskmDtlNoAtSbOpSvcKei = retHikiMotoEKK0401B001[sbOpIdx].getString(EKK0401B001CBSMsg1List.MSKM_DTL_NO)` // Application detail number of the sub-option service contract |
| 3 | IF | `mskmDtlNoAtOpSvcKei equals mskmDtlNoAtSbOpSvcKei` // Same application detail number |
| 4 | SET | `hktgChk = true` // Inherit despite cancelled/expired status |

**Block 7.3** — IF `[skip condition: PC wide plan not yet in service]` (L5609)

When the transfer is an option inheritance (`IDO_DIV_OPHKTGI="00003"`) and the sub-option is a PC Wide Plan (`D12`) but the sub-option status is below 100 (not yet in service), skip inheritance.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[IDO_DIV_OPHKTGI="00003"] AND [SBOP_SVC_CD_PC_WIDE_PLAN="D12"] AND hikiMotoSbOpSvcKeiStat compareTo "100" < 0` // Option inheritance, PC wide plan, not yet in service |
| 2 | SET | `hktgChk = false` // Skip inheritance |

**Block 7.4** — IF `[skip sub-option]` (L5614)

Skip processing of this sub-option if `hktgChk` is false.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!hktgChk` |
| 2 | EXEC | `continue` // Skip to next sub-option |

**Block 7.5** — PROCESSING `(get sub-option service info)` (L5620)

Retrieve detailed sub-option service contract information.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `infoMap = getSbOpSvcKeiInfo(handle, param, hikiMotoOpSvcKeiNo, hikiMotoSbOpSvcKeiNo)` |
| 2 | SET | `retHikiMotoEKK0401A010 = (CAANMsg[])infoMap.get(MAP_KEY_SBOP_SVC)` // Sub-option service contract inquiry messages |
| 3 | SET | `retHikiMotoEKK0411A010 = (CAANMsg[])infoMap.get(MAP_KEY_SBOP_SVC_ISP)` // Sub-option service contract <ISP> inquiry messages |

**Block 7.6** — IF `[MyHP parent option]` (L5628)

Determine if the original (parent) option service is a MyHP (home page) service. If yes, use the MyHP-specific mapper method with additional capacity data.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[OP_SVC_CD_MYHOMEPAGE="B002"]` == `retHikiMotoEKK0351A010[0].getString(EKK0351A010CBSMsg1List.OP_SVC_CD)` // Parent is MyHP |

**Block 7.6.1** — IF-TRUE `(MyHP path)` (L5630)

For MyHP parent options, get the additional capacity and use the MyHP-specific mapper.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `addCapa = this.getAddCapa(handle, param, workMap, retHikiMotoEKK0361A010)` // Get additional capacity for home page |
| 2 | CALL | `inputMap = mapper.editInMsgEKK0411D010MyHp(...)` // Set sub-option info with addCapa |

**Block 7.6.2** — IF-FALSE `(non-MyHP path)` (L5645)

For non-MyHP parent options, use the standard mapper without additional capacity.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `inputMap = mapper.editInMsgEKK0411D010(...)` // Set sub-option info without addCapa |

**Block 7.7** — CALL `(execute EKK0411D010 CBS)` (L5656)

Register the sub-option service contract <ISP> by invoking the CBS.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0411D010, inputMap)` // Register sub-option service contract <ISP> |

**Block 7.8** — PROCESSING `(extract response and populate output lists)` (L5658)

| # | Type | Code |
|---|------|------|
| 1 | SET | `sakiLastUpdDtm = retMsg.getString(EKK0411D010CBSMsg.UPD_DTM)` // Update date/time |
| 2 | SET | `hikiSakiSbOpSvcKeiNo.add(retMsg.getString(EKK0411D010CBSMsg.SBOP_SVC_KEI_NO))` // Inherited sub-option service contract number |
| 3 | SET | `hikiSakiSbOpSvcCd.add(retMsg.getString(EKK0411D010CBSMsg.SBOP_SVC_CD))` // Inherited sub-option service code |

**Block 7.9** — IF `[virus check sub-option detected]` (L5668)

Track whether any sub-option is a mail virus check service.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[SBOP_SVC_CD_MAIL_VIRUS_CHK="D03"]` == `hikiMotoSbOpSvcCd` // Sub-option is mail virus check |
| 2 | SET | `existsVirusCheck = true` // Virus check will be inherited |

**Block 8** — IF `[no sub-options exist]` (L5676)

When there are no sub-option service contracts attached to the original option, register a home page sub-option contract.

| # | Type | Code |
|---|------|------|
| 1 | IF | `retHikiMotoEKK0401B001 == null OR retHikiMotoEKK0401B001.length == 0` // No sub-options |
| 2 | CALL | `addMyHpSubOp(handle, param, workMap, mskmDtlNo, hikiSakiSeikyKeiNo, retHikiMotoEKK0351A010, retHikiMotoEKK0361A010, hikiSakiSbOpSvcKeiNo, hikiSakiSbOpSvcCd)` // Register home page sub-option |

**Block 9** — IF `[email + Family Pack, virus check not inherited]` (L5686)

When the original option is email, the customer has a Family Pack, and virus check was not inherited through the sub-option loop, register a standalone mail virus check.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[OP_SVC_CD_EMAIL="B001"]` == `hikiMotoOpSvcCd` AND `famiPackAri` AND `!existsVirusCheck` |
| 2 | CALL | `inputMap = mapper.editInMsgEKK0411D010(...)` // Set virus check registration input |
| 3 | CALL | `retMsg = (CAANMsg)runSc(handle, param, EKK0411D010, inputMap)` // Register virus check |
| 4 | SET | `sakiLastUpdDtm = retMsg.getString(EKK0411D010CBSMsg.UPD_DTM)` // Update timestamp |
| 5 | SET | `hikiSakiSbOpSvcKeiNo.add(retMsg.getString(EKK0411D010CBSMsg.SBOP_SVC_KEI_NO))` |
| 6 | SET | `hikiSakiSbOpSvcCd.add(retMsg.getString(EKK0411D010CBSMsg.SBOP_SVC_CD))` |
| 7 | SET | `addSodMap = new HashMap<String, Object>()` |
| 8 | SET | `addSodMap.put("chaf_sbopsvkei_no", retMsg.getString(EKK0411D010CBSMsg.SBOP_SVC_KEI_NO))` |
| 9 | SET | `addSodList.add(addSodMap)` // Add to SOD accumulator |

**Block 10** — IF `[status is "accepted"]` (L5730)

When the destination option service contract status is "010" (accepted), finalize the SOD (Service Order Data) parameter list.

| # | Type | Code |
|---|------|------|
| 1 | IF | `[SVC_KEI_STAT_010="010"]` == `hikiSakiSvcKeiStat` // Destination status is accepted |
| 2 | CALL | `sodCcInputList = createSODParam(hikiMotoOpSvcKeiNo, opSvkeiSodInfo, null, sodCcInputList, workMap)` // Finalize SOD info |

**Block 11** — RETURN `(return accumulated SOD info)` (L5742)

Return the list of SOD information for virus check registrations performed during this inheritance.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hikitsugi` | Field (Japanese) | Option inheritance / transfer -- the process of moving option services from a source service contract to a destination service contract |
| `hikiMoto` | Field (Japanese) | Source / original -- refers to the original (parent) service contract from which options are inherited |
| `hikiSaki` | Field (Japanese) | Destination -- refers to the target service contract receiving inherited options |
| `mskmDtlNo` | Field | Application detail number -- internal tracking ID for service contract applications |
| `opSvkeiNo` | Field | Option service contract number -- unique identifier for an option service contract |
| `sbOpSvcKeiNo` | Field | Sub-option service contract number -- identifier for a sub-option attached to a parent option |
| `svc_kei_ucwk_no` | Field | Service detail work number -- internal tracking ID for service contract line items |
| `ido_div` | Field | Displacement/division flag -- indicates the type of service change operation |
| `rsvAplyYmd` | Field | Reservation application year/month/day -- the effective date when the service change takes effect |
| `sodCcInputList` | Field | SOD (Service Order Data) input list -- carries service order data parameters for order processing |
| SOD | Acronym | Service Order Data -- telecom order fulfillment entity representing a service order line item |
| ISP | Business term | Internet Service Provider -- a type of option service contract covering internet connectivity |
| MyHP | Business term | My Homepage -- Fujitsu's home page hosting option service (code B002) |
| CBS | Acronym | Custom Business System -- the backend service execution engine invoked via `runSc` |
| SC | Acronym | Service Component -- the layer that executes database operations |
| EKK0361D010 | SC Code | Option service contract registration (ISP) -- CBS for registering option service contracts |
| EKK0411D010 | SC Code | Sub-option service contract registration (ISP) -- CBS for registering sub-option service contracts |
| EKK0351A010 | SC Code | Original option service contract inquiry -- retrieves option service contract data |
| EKK0361A010 | SC Code | Original option service contract inquiry (ISP) -- retrieves ISP option data |
| EKK0401B001 | SC Code | Sub-option service contract inquiry -- retrieves list of sub-options attached to an option |
| OP_SVC_CD_EMAIL | Constant | Option service code "B001" -- Email service |
| OP_SVC_CD_MYHOMEPAGE | Constant | Option service code "B002" -- My Homepage service |
| OP_SVC_CD_KOTEI_IP | Constant | Option service code "B004" -- Fixed Global IP Address service |
| OP_SVC_CD_MAILINGLIST | Constant | Option service code "B003" -- Mailing List service |
| OP_SVC_CD_MLTISE | Constant | Option service code "B015" -- Multi-section service |
| SBOP_SVC_CD_MAIL_VIRUS_CHK | Constant | Sub-option service code "D03" -- Mail Virus Check (anti-virus for email) |
| SBOP_SVC_CD_HP_CAPA | Constant | Sub-option service code "D04" -- Homepage Capacity |
| SBOP_SVC_CD_PC_WIDE_PLAN | Constant | Sub-option service code "D12" -- PC Wide Plan (broadband plan) |
| SVC_KEI_STAT_010 | Constant | Service contract status "010" -- Accepted (order accepted, active) |
| SVC_KEI_STAT_910 | Constant | Service contract status "910" -- Terminated (service contract ended) |
| SVC_KEI_STAT_920 | Constant | Service contract status "920" -- Cancelled (service contract cancelled) |
| IDO_DIV_OPHKTGI | Constant | Displacement division "00003" -- Option inheritance operation |
| famiPackAri | Field | Family Pack existence flag -- boolean indicating whether the customer has a Family Pack subscription |
| addCapa | Field | Additional capacity -- extra home page capacity for MyHP sub-option registration |
| kotenIP | Field (Japanese) | Fixed IP -- a dedicated IP address option service |
| sakiLastUpdDtm | Field | Destination last update date/time -- timestamp of the last update to the destination contract, carried as an instance field |
| hktgChk | Field (Japanese abbreviation) | Hikitsugi (inheritance) check flag -- internal boolean controlling whether a sub-option should be inherited |
| `chaf_sbopsvkei_no` | Field | SOD map key for inherited sub-option service contract number -- stored in addSodList for virus check registrations |
| UPD_DTM | Field | Update date/time -- timestamp of the last modification to a contract record |
| KK0351_GENE_ADD_DTM | Field | Generation/addition date/time of option service -- timestamp when the inherited option was generated |
| MAP_KEY_SBOP_SVC | Constant | Map key for sub-option service contract messages |
| MAP_KEY_SBOP_SVC_ISP | Constant | Map key for sub-option service contract <ISP> inquiry messages |
| `sodCcInputList` | Field | Service Order Data Common Component input list -- carries SOD data through the inheritance chain |
