# Business Logic - KKW00101SFLogic.init() [863 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | eo.web.webview.KKW00101SF.KKW00101SFLogic |
| Layer | Service / Web Logic (Webview layer, extends JCCWebBusinessLogic) |
| Module | KKW00101SF (Package: eo.web.webview.KKW00101SF) |

## 1. Role

### KKW00101SFLogic.init()

This method is the primary entry-point initialization handler for the KKW00101SF screen - the central service application (shinnyou) screen where customers apply for K-Opticom telecom services including eo Hikari fiber internet, eo Mobile, eo TV, eo Electricity, and related bundled offerings. The method performs a comprehensive screen setup that:

1. **Retrieves session data** including screen transfer source information and retained contract numbers passed from previous screens (e.g., mansion search, application inquiry, or temporary application screens).

2. **Handles screen restoration** (dmen-rn) - when the user navigates back from a child screen, this branch re-queries all display data from the persisted session to reconstruct the form state.

3. **Processes retention (horyu) data** - when a retention number is present, it fetches retained service contract information and performs cancellation-warning checks for services that share the same line.

4. **Dispatches to a multi-phase data gathering engine** - builds a parameter map targeting the KKSV0079 mapper, which in turn calls 30+ set/get CC/SC methods to populate combo box lists, service contract details, payment methods, usage location info, pricing plans, promotion codes, smart-link endpoints, and home appliance types.

5. **Branches by application type** (mskmGetCd: 0=new, 1=from inquiry, 2=service addition) and application flag (MSKM_FLG), selectively enabling or disabling data retrieval for contract history, equipment delivery status, input support workflow, and hybrid-fiber availability checks.

6. **Routes to screen-specific sub-initializers** (initKKW00101 through initKKW00117, initKKW00119) to configure screen-specific UI elements.

7. **Performs post-initialization data processing** - includes mansion-specific editing (hkrmn, hhs-cschpsb-mans), smart value display, promotion checks, VDSL display flags, and skill provider combo editing.

**Design Pattern:** This method implements a **routing/dispatch pattern** with multiple conditional phases. It also uses the **delegation pattern**, where most heavy data retrieval is delegated to mapper classes (KKSV0079, KKSV0537, KKSV0730) which in turn call CC/SC service components. The method acts as an **orchestrator** in the larger system, coordinating data flow across dozens of sub-services before returning control to the presentation layer.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["init() Entry"])
    JAC["setSelfScreenID(this)"]
    BEAN["getServiceFormBean() -> dataBean"]
    SES["getSessionData() -> sessionDataMap"]
    KAI["getKaisenUseKeiNoNetFromSessionData(sessionDataMap)"]

    START --> JAC --> BEAN --> SES --> KAI

    IR["isDmenRn() ?"]
    IR_YES["Yes: Screen Restoration"]
    IR_NO["No: Normal Flow"]

    KAI --> IR

    IR_YES --> IR_SET1["paramMap.put(TELEGRAM_INFO_USECASE_ID, KKSV0730)"]
    IR_SET1 --> IR_OPE["getOpeDate()"]
    IR_OPE --> IR_MAPPERS["KKSV0730/0079 Mapper: set*CC/SC"]
    IR_MAPPERS --> IR_INVOKE["invokeService(paramMap, dataMap, outputMap)"]
    IR_INVOKE --> IR_GET["KKSV0730/0079 Mapper: get*CC/SC"]
    IR_GET --> IR_INIT["initKKW00115()"]
    IR_INIT --> RET_TRUE1["return true"]

    IR_NO --> HORYU["horyuOutputMap = new HashMap()"]
    HORYU --> PDING_CHK["PDING_NO is set ?"]

    PDING_CHK_YES["Yes: Retention number exists"]
    PDING_CHK_NO["No: No retention number"]

    PDING_CHK --> PDING_CHK_YES
    PDING_CHK --> PDING_CHK_NO

    PDING_CHK_YES --> PDING_SET["paramMap.put(TELEGRAM_INFO_USECASE_ID, KKSV0537)"]
    PDING_SET --> PDING_MAPPER["KKSV0537 Mapper: set*SC"]
    PDING_MAPPER --> PDING_INVOKE["invokeService(paramMap, dataMap, horyuOutputMap)"]
    PDING_INVOKE --> PDING_GET["getAddMskm()"]
    PDING_GET --> PDING_KAISEN["RIYO_KAISEN == RIYO_KAISEN_SAME ?"]

    PK_SAME["Same: Same-line usage"]
    PK_DIFF["Different: Skip warning"]

    PDING_KAISEN --> PK_SAME
    PDING_KAISEN --> PK_DIFF

    PK_SAME --> PK_SAME_GET["getKKSV053705SC() / getKKSV053706SC()"]
    PK_SAME_GET --> PK_SAME_WARN["addPageErrInfo(EKBD600)"]
    PK_DIFF --> COMBO["setComboData()"]
    PK_SAME_WARN --> COMBO

    COMBO --> MSDK_CHK["MSKM_NO or PARAM_SVC_NO set ?"]

    MSDK0["mskmGetCd = 0: New application"]
    MSDK1["mskmGetCd = 1: From inquiry screen"]
    MSDK2["mskmGetCd = 2: Service addition"]

    MSDK_CHK --> MSDK0
    MSDK_CHK --> MSDK1
    MSDK_CHK --> MSDK2

    MSDK0 --> MAIN_SET["paramMap.put(TELEGRAM_INFO_USECASE_ID, KKSV0079)"]
    MSDK1 --> MAIN_SET
    MSDK2 --> MAIN_SET

    MAIN_SET --> MAIN_MAPPER["KKSV0079 Mapper: set*CC/SC (30+ methods)"]
    MAIN_MAPPER --> MAIN_INVOKE["invokeService(paramMap, dataMap, outputMap)"]

    MAIN_INVOKE --> INV_ERR["catch Exception"]
    INV_ERR --> INV_ERR_CANCEL["cancel_zumi_svc_err == EA ?"]
    INV_ERR_SET["Set defaults + EKB1040_JW message"]
    INV_ERR_THROW["throw svcErr"]

    INV_ERR_CANCEL --> INV_ERR_SET
    INV_ERR_CANCEL --> INV_ERR_THROW

    INV_ERR_SET --> RET_TRUE2["return true"]

    INV_ERR_THROW --> GET_SCREEN["getScreenInfo(SESSION_KEY_MSKMDATA)"]
    GET_SCREEN --> GET_ID["getScreenId(this) -> screenId"]
    GET_ID --> GET_MAPPERS["Mapper: get*CC/SC (set results)"]
    GET_MAPPERS --> MSKM_FORM["mskmFormCd = MSKM_FORM_CD_TEL ?"]
    TEL_CHOICE["Set telephone dropdown"]

    MSKM_FORM --> TEL_CHOICE
    MSKM_FORM --> GET_MORE["getKKSV007918CC, getKKSV007901CC"]
    TEL_CHOICE --> GET_MORE

    GET_MORE --> GET_OTHER["getKKSV007905SC (same-location services)"]
    GET_OTHER --> IS_MANSION["isMansionMezon and not KKW00101 ?"]
    IS_MANSION --> MANSION_GET["getKKSV007912CC (mansion search)"]
    IS_MANSION --> EDIT_KAIS["editKaisenSamePlcEoElec()"]
    MANSION_GET --> EDIT_KAIS

    EDIT_KAIS --> SET_DV["setDefaultValue()"]
    SET_DV --> PING_FLG["pdingAddSvcFlg check"]

    PING_MS["mskmGetCd = 1: contract/payment lookups"]
    PING_ADD["pdingAddSvcFlg: contract/payment lookups"]

    PING_FLG --> PING_MS
    PING_FLG --> PING_ADD

    PING_MS --> AFTER_GET["Additional get*CC/SC: plans, coupons, branch"]
    PING_ADD --> GET_21["getKKSV007921CC, getKKSV007923CC"]
    AFTER_GET --> GET_21

    GET_21 --> ADD_FLG["MSKM_FLG == MSKM_FLG_TSUIKA ?"]
    ADD_FLG --> ADD_LOOK["Addition-specific lookups"]
    ADD_FLG --> DEFAULT_TAB["Default tab: confirmation, construction"]

    ADD_LOOK --> TAB_DEFAULT
    DEFAULT_TAB --> TAB_DEFAULT

    TAB_DEFAULT --> INIT_FUKA["initFuka() / initKiki() / initSameEquipReMskm()"]
    INIT_FUKA --> SMART_DISP["setSmartValueDispFlg()"]
    SMART_DISP --> PREV_SCD["getScreenId(this) -> previousScreenId"]

    PREV_SCD --> PREV_KKW125["previousScreenId == KKW12503 ?"]
    PREV_SET["setTratCdInfo() / copyBackupToDspItem()"]
    PREV_REPLACE["replaceTratCdInfo()"]

    PREV_KKW125 --> PREV_SET
    PREV_KKW125 --> PAYWAY_DEF["PAYWAY_SHS_NM_STI = true"]
    PREV_SET --> PAYWAY_DEF

    PAYWAY_DEF --> PDING_RET["PDING_NO set? (retention)"]
    PDING_RET_SET["Set jukyo type, get retention data"]
    PDING_RET --> PDING_RET_SET
    PDING_RET --> NO_PDING

    PDING_RET_SET --> PDING_DATE["Set opeDate, mskm YMD"]
    PDING_DATE --> PDING_SEARCH["searchAnkenNoAjax() / searchCustNmAjax()"]
    PDING_SEARCH --> PREV_NEXT["previousScreenId == KKW12701 or 12702 ?"]
    PREV_NEXT --> PREV_REPLACE

    NO_PDING["No retention: skip"]
    NO_PDING --> PREV_NEXT
    PREV_NEXT --> HIKARI_CHK["isHikariHybrid()"]

    HIKARI_CHK --> PROMPT_CHK["checkTokuskStat() if promotion"]
    PROMPT_CHK --> KIKI_DISP["setKikiDispFlg()"]

    KIKI_DISP --> MANS_UM["setMansionOyaKikiUm()"]
    MANS_UM --> MT_API["KKSV007932CC: MT management API"]
    MT_API --> HKRMN["judgeHkrmn() / judgeHhs_Cschpsb_Mans()"]

    HKRMN --> HKRMN_EDIT["editHkrmnComboBox()"]
    HKRMN_EDIT --> AGENT_JP["searchAgntMkmUkEostfUserIdAjax()"]
    AGENT_JP --> EDG_TEG["editTegakSvcList() / editSelectRenban()"]

    EDG_TEG --> VDSL_SET["VDSL/TEL1 display flag checks"]
    VDSL_SET --> SCM_JGS["chgScmJgs() / editScComboBox()"]

    SCM_JGS --> SCREEN_ROUTE["screenId branch: initKKW001xx()"]

    SCREEN_ROUTE --> RET_TRUE3["return true"]

    RET_TRUE1 --> END(["End"])
    RET_TRUE2 --> END
    RET_TRUE3 --> END
```

**Flow Summary:** The method follows a clear phased approach:
1. **Session retrieval** - setSelfScreenID, getDataBean, getSessionData
2. **Conditional screen restoration** - if isDmenRn, re-query KKSV0730/0079 and return
3. **Retention processing** - if PDING_NO set, query KKSV0537 for retention data and check cancellation warnings
4. **Application type determination** - mskmGetCd=0/1/2 based on MSKM_NO and PARAM_SVC_NO presence
5. **Main data gathering** - KKSV0079 mapper with 30+ set*CC/SC methods, invokeService
6. **Exception handling** - if EA status, set defaults and return with error message; otherwise continue
7. **Result processing** - persist outputMap to session, retrieve via get*CC/SC methods
8. **Application-type sub-queries** - contract details, payment methods, pricing plans, coupons, branch data
9. **UI element initialization** - defaults, combos, flags, smart value display
10. **Post-processing** - mansion editing, VDSL flags, skill provider editing
11. **Screen routing** - initKKW001xx() for current screenId, then return true

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none - no method parameters) | - | - |

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

| Source | Description |
|--------|-------------|
| `this.sessionDataMap` | Session data from getSessionData() - contains transferred screen IDs, retention numbers, mansion contract info |
| `dataBean` (X31SDataBeanAccess) | Service form bean carrying application type, service numbers, retention numbers, mansion info, and UI state |
| `JCCWebCommon` | Utility for getting operation dates and screen IDs |
| `JCCBatCommon.invokeService` | Core service invocation mechanism dispatching paramMap to CC/SC layer |
| `getScreenId(this)` | Current screen ID used for routing (KKW00101, KKW00103, etc.) |
| `JCCWebCommon.getScreenInfo(this)` | Screen info map from session for persistence across processing phases |
| `JKKScreenConst.SCREEN_ID_*` | Screen ID constants used for branching logic (KKW00101-KKW00117, KKW12503, KKW12701, KKW12702) |
| `KKW00101SFConst.*` | ~60+ constant field names for bean property keys (PDING_NO, RIYO_KAISEN, MSKM_NO, etc.) |

## 4. CRUD Operations / Called Services

All operations are **Read (R)** or **Write (W)** - this method performs data gathering and screen state setup. No Create/Update/Delete database operations occur directly.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Gets current operation date from system |
| R | `JCCWebCommon.getScreenId` | JCCWebCommon | - | Retrieves current/previous screen ID |
| R | `JCCWebCommon.getScreenInfo` | JCCWebCommon | - | Reads screen info map from session storage |
| W | `JCCWebCommon.setScreenInfo` | JCCWebCommon | - | Persists outputMap screen state back to session |
| R | `JCCBatCommon.invokeService` | JCCBatCommon | - | Invokes service layer via paramMap/dataMap pattern |
| R | `KKSV0730 Mapper set/getKKSV073001CC` | KKSV0730 | - | Mansion search form data and results (restoration flow) |
| R | `KKSV0537 Mapper set/getKKSV053701-07*` | KKSV0537 | - | Retention info: content, contracts, phone numbers, setting codes, promotion codes, brand type |
| R | `KKSV0079 Mapper setKKSV007909CC` | KKSV0079 | - | New-application initial display: combos, work params, plans, payment plans |
| R | `KKSV0079 Mapper setKKSV007907SC` | KKSV0079 | - | Smart-link endpoint information list |
| R | `KKSV0079 Mapper setKKSV007927SC` | KKSV0079 | - | Home appliance type list (streaming media player) |
| R | `KKSV0079 Mapper setKKSV007934SC` | KKSV0079 | - | NTT deregistration data (2024 NTT opposition support) |
| R | `KKSV0079 Mapper setKKSV007905SC` | KKSV0079 | - | Same-location service contract list |
| R | `KKSV0079 Mapper setKKSV007912CC` | KKSV0079 | - | Mansion search data |
| R | `KKSV0079 Mapper setKKSV007901CC` | KKSV0079 | - | Application service contract detail list |
| R | `KKSV0079 Mapper setKKSV007902CC` | KKSV0079 | - | Contract holder information |
| R | `KKSV0079 Mapper setKKSV007903CC` | KKSV0079 | - | Payment method information |
| R | `KKSV0079 Mapper setKKSV007904CC` | KKSV0079 | - | eo Hikari internet information |
| R | `KKSV0079 Mapper setKKSV007905CC` | KKSV0079 | - | eo Hikari phone information |
| R | `KKSV0079 Mapper setKKSV007906CC` | KKSV0079 | - | eo Hikari TV information |
| R | `KKSV0079 Mapper setKKSV007908CC` | KKSV0079 | - | eo Mobile information |
| R | `KKSV0079 Mapper setKKSV007910CC` | KKSV0079 | - | Special (tokki) information |
| R | `KKSV0079 Mapper setKKSV007911CC` | KKSV0079 | - | Promotion/discount information |
| R | `KKSV0079 Mapper setKKSV007913-16CC` | KKSV0079 | - | Temporary facility settings (net/phone/TV/mobile) |
| R | `KKSV0079 Mapper setKKSV007907CC` | KKSV0079 | - | Usage location information |
| R | `KKSV0079 Mapper setKKSV007906SC` | KKSV0079 | - | Pricing plan fixed unit price list (STB main contract) |
| R | `KKSV0079 Mapper setKKSV007901SC` | KKSV0079 | - | Equipment delivery supplier latest info |
| R | `KKSV0079 Mapper setKKSV007903SC` | KKSV0079 | - | Application screen input support workflow |
| R | `KKSV0079 Mapper setKKSV007904SC` | KKSV0079 | - | Hikari hybrid eligibility check |
| R | `KKSV0079 Mapper setKKSV007908SC` | KKSV0079 | - | Address change confirmation criteria |
| R | `KKSV0079 Mapper setKKSV007917CC` | KKSV0079 | - | Mansion search (service addition source) |
| R | `KKSV0079 Mapper setKKSV007918CC` | KKSV0079 | - | Application info |
| R | `KKSV0079 Mapper setKKSV007919CC` | KKSV0079 | - | eo electricity contract signature (SYSID) |
| R | `KKSV0079 Mapper setKKSV007925SC` | KKSV0079 | - | Discount service unit price list |
| R | `KKSV0079 Mapper setKKSV007920CC` | KKSV0079 | - | Internal-use line accounting |
| R | `KKSV0079 Mapper setKKSV007923CC` | KKSV0079 | - | Terminal supplementary operation |
| R | `KKSV0079 Mapper setKKSV007928SC` | KKSV0079 | - | Tiered service list search |
| R | `KKSV0079 Mapper setKKSV007929SC` | KKSV0079 | - | Business parameter management |
| R | `KKSV0079 Mapper setKKSV007930SC` | KKSV0079 | - | CX strategy WG content tab |
| R | `KKSV0079 Mapper setKKSV007931CC` | KKSV0079 | - | Application check screen transfer |
| R | `KKSV0079 Mapper setKKSV007932CC` | KKSV0079 | - | MT management information |
| R | `KKSV0079 Mapper setKKSV007937SC` | KKSV0079 | - | TypeN additional condition data |
| R | `KKSV0079 Mapper setKKSV007933CC` | KKSV0079 | - | Coupon code information |
| R | `KKSV0079 Mapper setKKSV007936CC` | KKSV0079 | - | Brand type determination |
| R | `KKSV0079 Mapper getKKSV007909CC` | KKSV0079 | - | Initial display results (combos) |
| R | `KKSV0079 Mapper getKKSV007901CC` | KKSV0079 | - | Application service contract details |
| R | `KKSV0079 Mapper getKKSV007901CC_SvcAdd` | KKSV0079 | - | Contract details (service addition) |
| R | `KKSV0079 Mapper getKKSV007902CC` | KKSV0079 | - | Contract holder information |
| R | `KKSV0079 Mapper getKKSV007903CC` | KKSV0079 | - | Payment method information |
| R | `KKSV0079 Mapper getKKSV007904CC` | KKSV0079 | - | eo Hikari internet info |
| R | `KKSV0079 Mapper getKKSV007905CC` | KKSV0079 | - | eo Hikari phone info |
| R | `KKSV0079 Mapper getKKSV007906CC` | KKSV0079 | - | eo Hikari TV info |
| R | `KKSV0079 Mapper getKKSV007907CC` | KKSV0079 | - | Usage location information |
| R | `KKSV0079 Mapper getKKSV007908CC` | KKSV0079 | - | eo Mobile information |
| R | `KKSV0079 Mapper getKKSV007910CC` | KKSV0079 | - | Special information |
| R | `KKSV0079 Mapper getKKSV007911CC` | KKSV0079 | - | Promotion/discount information |
| R | `KKSV0079 Mapper getKKSV007905SC` | KKSV0079 | - | Same-location service contract list |
| R | `KKSV0079 Mapper getKKSV007901SC` | KKSV0079 | - | Equipment delivery supplier info |
| R | `KKSV0079 Mapper getKKSV007903SC` | KKSV0079 | - | Input support workflow |
| R | `KKSV0079 Mapper getKKSV007904SC` | KKSV0079 | - | Hikari hybrid eligibility |
| R | `KKSV0079 Mapper getKKSV007906SC` | KKSV0079 | - | Pricing plan (STB main contract) |
| R | `KKSV0079 Mapper getKKSV007920CC` | KKSV0079 | - | Internal-use line accounting |
| R | `KKSV0079 Mapper getKKSV007921CC` | KKSV0079 | - | NTT cancellation support |
| R | `KKSV0079 Mapper getKKSV007922CC` | KKSV0079 | - | Additional source service info |
| R | `KKSV0079 Mapper getKKSV007923CC` | KKSV0079 | - | Terminal supplementary operation |
| R | `KKSV0079 Mapper getKKSV007925SC` | KKSV0079 | - | Discount service unit price list |
| R | `KKSV0079 Mapper getKKSV007926SC` | KKSV0079 | - | Business parameter consent list |
| R | `KKSV0079 Mapper getKKSV007928SC` | KKSV0079 | - | Tiered service list |
| R | `KKSV0079 Mapper getKKSV007929SC` | KKSV0079 | - | Business parameter management |
| R | `KKSV0079 Mapper getKKSV007930SC` | KKSV0079 | - | CX strategy WG content tab |
| R | `KKSV0079 Mapper getKKSV007931CC` | KKSV0079 | - | Application check screen transfer |
| R | `KKSV0079 Mapper getKKSV007933CC` | KKSV0079 | - | Coupon code information |
| R | `KKSV0079 Mapper getKKSV007934SC` | KKSV0079 | - | NTT deregistration data |
| R | `KKSV0079 Mapper getKKSV007936CC` | KKSV0079 | - | Brand type determination |
| R | `KKSV0079 Mapper getKKSV007937SC` | KKSV0079 | - | TypeN additional condition data |

**Utility methods (non-CRUD):**
| SC / CBS | Description |
|----------|-------------|
| `JCCBatCommon.isNull` | Null checking utility |
| `JFUKariMskmDelMappingUtil.isMskmType` | Checks mansion type |
| `JCCWebCommon.setMessageInfo` | Sets error/info messages for display |
| `JKKGetDataUtil.isNull` | Null checking utility for bean data |
| `JKKWebCommon.convertIndex` | Converts code to dropdown index |
| `JKKWebCommon.getPullDownIndex` | Gets dropdown selection index |
| `JKKWebCommon.isMskmType` | Checks if data is mansion/mezon type |
| `JKKWebCommon.isHikariHybrid` | Checks if service is Hikari hybrid |
| `JKKWebCommon.isDspTel1VdslHsk` | Checks TEL1 VDSL display flag |
| `JKKWebCommon.isActiveVdsl` | Checks VDSL active flag |
| `JKKWebCommon.isDspNetVdslHsk` | Checks NET VDSL display flag |
| `JKKKeiNewCmnLogicUtil.judgeHkrmn` | Judges whether mansion is light-enabled |
| `JKKKeiNewCmnLogicUtil.judgeHhs_Cschpsb_Mans` | Judges if mansion supports fiber cross-connect |
