# Business Logic — KKW05601SFLogic.getTikanStr() [174 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05601SF.KKW05601SFLogic` |
| Layer | Service Logic (Web View Layer) |
| Module | `KKW05601SF` (Package: `eo.web.webview.KKW05601SF`) |

## 1. Role

### KKW05601SFLogic.getTikanStr()

This method determines which **notification timing message** to display when the system notifies the user about the start of port-in (tonai/to-kan) registration. It operates within the broader context of telecom service contract management, specifically handling number portability (Hikaken / 光電話・移転トーキ) operations where a customer transfers their phone number to or from K-Opticom. The method implements a **conditional routing/dispatch pattern**: it evaluates the operation division type, the service contract status, and the specific timing trigger to select the appropriate message string — either a "registration completed" message ("登録完了"), a "cancellation" message ("光電話の解約"), or an empty string (no message). The three primary trigger categories it handles are: (1) port-in registration (移転先登録), (2) port-out cancellation (移転元解約), and (3) service suspension (休止). This method plays a central role in the user interface messaging logic for the port-in setup screen (KKW05601SF), allowing operators to see context-appropriate status messages based on the current state of the service contract and related work orders.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getTikanStr bean"])
    START --> SET_PARAM["Set paramBean { bean }"]
    SET_PARAM --> GET_IDO["Get idoDiv from bean.sendMessageString(IDO_DIV)"]
    GET_IDO --> GET_SVC_BEAN["Get svcUtwkBean = getSvcKeiUcwkBean(paramBean)"]
    GET_SVC_BEAN --> GET_SVC_STAT["Get svcUtwkStat = svcUtwkBean.sendMessageString(SVC_KEI_UCWK_STAT)"]
    GET_SVC_STAT --> CHECK_KYUSHI["Check kyushiRev = isKyushiRev(bean)"]
    CHECK_KYUSHI --> GET_TOKI["Get tokiAddCd = getPullDownSelectCd(...)"]
    GET_TOKI --> CHECK_IDO_DIV{"idoDiv equals IDO_DIV_VALUE_00046<br/>00046"}

    CHECK_IDO_DIV -- false --> RETURN_EMPTY["Return empty string"]

    CHECK_IDO_DIV -- true --> CHECK_SVC_STAT1{"svcUtwkStat equals SVC_KEI_STAT_100<br/>100 Service Provision"}

    CHECK_SVC_STAT1 -- false --> CHECK_SVC_STAT910{"svcUtwkStat equals SVC_KEI_STAT_910<br/>910 Terminated"}

    CHECK_SVC_STAT1 -- true --> CHECK_TOKI_1{"tokiAddCd equals ITENSAKI_ADD_TOKI<br/>1 Port-in Registration"}

    CHECK_TOKI_1 -- true --> RETURN_Touroku1["Return TOKI_STA_MSG_CHG_STR_TOUROKU Registered"]

    CHECK_TOKI_1 -- false --> CHECK_TOKI_2{"tokiAddCd equals ITENMOTO_DSL_TOKI<br/>2 Port-out Cancellation"}

    CHECK_TOKI_2 -- true --> GET_ADCHG_LIST["Get adchgList bean.getDataBeanArray(EKK2091A010DETAILLIST)"]
    CHECK_TOKI_2 -- false --> CHECK_SVC_STAT910

    GET_ADCHG_LIST --> GET_ADCHG["Get adchg = adchgList.getDataBean(0)"]
    GET_ADCHG --> GET_ADCHG_STAT["Get adchgStat = adchg.sendMessageString(ADCHG_STAT_16)"]
    GET_ADCHG_STAT --> GET_KOJIAK_LIST["Get kojiakList bean.getDataBeanArray(EKU0011A010DETAILLIST)"]
    GET_KOJIAK_LIST --> GET_KOJIAK["Get kojiak = kojiakList.getDataBean(0)"]
    GET_KOJIAK --> GET_KOJIAK_STAT["Get kojiakStat = kojiak.sendMessageString(KOJIAK_STAT_19)"]
    GET_KOJIAK_STAT --> CHECK_KOJIAK_STAT120{"kojiakStat equals KOJIAK_STAT_120<br/>120 Registered"}

    CHECK_KOJIAK_STAT120 -- true --> GET_MANS_KOJIAK["Set kojiakStat = kojiak.sendMessageString(MANS_KOJIAK_STAT_CD_19)"]
    CHECK_KOJIAK_STAT120 -- false --> GET_SVC_U_TWK_NO

    GET_MANS_KOJIAK --> GET_SVC_U_TWK_NO["Get svcUtwkNo bean.sendMessageString(SVC_KEI_UCWK_NO)"]
    GET_SVC_U_TWK_NO --> GET_ADCHG_LIST_2["Get adchgListChbfSkbtNoList bean.getDataBeanArray(EKK2101B002DETAILLIST)"]
    GET_ADCHG_LIST_2 --> GET_ADCHG_LIST_2_A["Get adchgListChbfSkbtNo = adchgListChbfSkbtNoList.getDataBean(0)"]
    GET_ADCHG_LIST_2_A --> GET_CHBF["Get chbfSkbtNo adchgListChbfSkbtNo.sendMessageString(CHBF_SKBT_NO_15)"]
    GET_CHBF --> GET_CHAF["Get chafSkbtNo adchgListChbfSkbtNo.sendMessageString(CHAF_SKBT_NO_15)"]
    GET_CHAF --> GET_ITNTOKI["Get itntokiStaYmd bean.sendMessageString(ITNTOKI_STA_YMD)"]

    GET_ITNTOKI --> CHECK_INSTANT{"adchgStat=ADCHG_STAT_REG AND svcUtwkStat=100<br/>AND kojiakStat=KOJIAK_STAT_200<br/>AND opeDate equals itntokiStaYmd<br/>AND svcUtwkNo matches chbf/chaf"}

    CHECK_INSTANT -- true --> RETURN_Touroku2["Return TOKI_STA_MSG_CHG_STR_TOUROKU Registered"]
    CHECK_INSTANT -- false --> RETURN_KAIYAKU["Return TOKI_STA_MSG_CHG_STR_KAIYAKU Cancellation"]

    CHECK_SVC_STAT910 -- true --> CHECK_TOKI_2B{"tokiAddCd equals ITENMOTO_DSL_TOKI<br/>2 Port-out Cancellation"}
    CHECK_SVC_STAT910 -- false --> CHECK_SVC_STAT210

    CHECK_TOKI_2B -- true --> RETURN_Touroku3["Return TOKI_STA_MSG_CHG_STR_TOUROKU Registered"]
    CHECK_TOKI_2B -- false --> CHECK_SVC_STAT210

    CHECK_SVC_STAT210{"svcUtwkStat equals SVC_KEI_STAT_210<br/>210 Suspended"}

    CHECK_SVC_STAT210 -- true --> CHECK_TOKI_3{"tokiAddCd equals PAUSE_TOKI<br/>3 Suspension"}
    CHECK_SVC_STAT210 -- false --> RETURN_EMPTY

    CHECK_TOKI_3 -- true --> RETURN_Touroku4["Return TOKI_STA_MSG_CHG_STR_TOUROKU Registered"]
    CHECK_TOKI_3 -- false --> RETURN_EMPTY
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The service form bean carrying all screen data for the port-in registration setup operation. Contains the operation division type (`IDO_DIV`), service contract details, address change records, work order records, and various date fields. This is the primary data exchange object between the screen controller and the business logic layer. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW05601SFLogic.getSvcKeiUcwkBean` | KKW05601SFLogic | - | Retrieves the service contract detail bean from the form data |
| R | `KKW05601SFLogic.isKyushiRev` | KKW05601SFLogic | - | Checks whether a suspension reservation exists (used for business context but result stored and not actively branched on) |
| R | `KKW05601SFLogic.getPullDownSelectCd` | KKW05601SFLogic | - | Resolves the pull-down selection code for timing trigger category |
| R | `X31SDataBeanAccess.sendMessageString` | X31SDataBeanAccess | - | Reads string values from the bean for fields: IDO_DIV, SVC_KEI_UCWK_STAT_04, SVC_KEI_UCWK_NO, ADCHG_STAT_16, KOJIAK_STAT_19, CHBF_SKBT_NO_15, CHAF_SKBT_NO_15, ITNTOKI_STA_YMD, MANS_KOJIAK_STAT_CD_19 |
| R | `X31SDataBeanAccess.getDataBeanArray` | X31SDataBeanAccess | - | Reads data bean arrays for: EKK2091A010DETAILLIST (address change details), EKU0011A010DETAILLIST (work order details), EKK2101B002DETAILLIST (pre-change identification number list) |
| R | `X31SDataBeanAccessArray.getDataBean` | OneStopDataBeanAccessArray | - | Extracts individual bean from data bean arrays at index 0 |
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Retrieves the current operation date for comparison with the intended port-in start date |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Sends message string requests to retrieve field values from beans |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `getOpeDate` [R], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `getDataBean` [R], `getDataBean` [R], `getDataBean` [R], `getDataBean` [R], `getDataBeanArray` [R], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW05601SF | `dispMessageTokiTiming()` -> `getTikanStr(bean)` | `getOpeDate [R]`, `sendMessageString [-]`, `getDataBean [R]`, `getDataBeanArray [R]` |

## 6. Per-Branch Detail Blocks

**Block 1** — PREPARATION (L2447)

> Initialize local state: wrap the bean in an array, then read all necessary values from the bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramBean = { bean }` // Create single-element bean array for delegation |
| 2 | SET | `idoDiv = bean.sendMessageString(IDO_DIV, DATABEAN_GET_VALUE)` // Read operation division type [-> JKKCommonConst.IDO_DIV_VALUE_00046 = "00046" Port-in notification timing] |
| 3 | CALL | `svcUtwkBean = getSvcKeiUcwkBean(paramBean)` // Get service contract detail bean |
| 4 | SET | `svcUtwkStat = svcUtwkBean.sendMessageString(SVC_KEI_UCWK_STAT_04, DATABEAN_GET_VALUE)` // Read service contract status [-> JKKCommonConst.SVC_KEI_STAT_100 = "100" Service Provision, SVC_KEI_STAT_910 = "910" Terminated, SVC_KEI_STAT_210 = "210" Suspended] |
| 5 | SET | `kyushiRev = isKyushiRev(bean)` // Check for suspension reservation (stored but not used as a branch condition in current code) |
| 6 | SET | `tokiAddCd = getPullDownSelectCd(...)` // Read timing trigger category [-> ITENSAKI_ADD_TOKI = "1" Port-in Registration, ITENMOTO_DSL_TOKI = "2" Port-out Cancellation, PAUSE_TOKI = "3" Suspension] |

**Block 2** — IF Branch (IDO_DIV == 00046) `(idoDiv equals IDO_DIV_VALUE_00046)` (L2460)

> This is the active branch. It handles port-in/number portability notification timing operations. All three sub-branches below exist within this block.

**Block 2.1** — IF Branch (SVC_KEI_STAT == 100) `(svcUtwkStat equals SVC_KEI_STAT_100)` (L2470)

> Handles the case where the service contract is in "Service Provision" status (結末済またはサービス提供中).

**Block 2.1.1** — IF Branch (TOKI_ADD_CD == 1) `(tokiAddCd equals ITENSAKI_ADD_TOKI)` (L2476)

> Handles the "port-in registration" trigger type. When a port-in registration triggers the notification, the method returns the "registration completed" message immediately.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return TOKI_STA_MSG_CHG_STR_TOUROKU` // "登録完了" (Registration Completed) |

**Block 2.1.2** — IF Branch (TOKI_ADD_CD == 2) `(tokiAddCd equals ITENMOTO_DSL_TOKI)` (L2483)

> Handles the "port-out cancellation" trigger type. This is the most complex sub-branch — it checks whether an **instant port-in cancellation** scenario is occurring by cross-referencing address change status, work order status, operation date, and service contract number consistency.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `adchgList = bean.getDataBeanArray(EKK2091A010DETAILLIST)` // Get address change detail list bean array |
| 2 | CALL | `adchg = adchgList.getDataBean(0)` // Get first address change detail record |
| 3 | SET | `adchgStat = adchg.sendMessageString(ADCHG_STAT_16, DATABEAN_GET_VALUE)` // Get address change status [-> ADCHG_STAT_REG = "Registered" status constant] |
| 4 | CALL | `kojiakList = bean.getDataBeanArray(EKU0011A010DETAILLIST)` // Get work order detail list bean array |
| 5 | CALL | `kojiak = kojiakList.getDataBean(0)` // Get first work order detail record |
| 6 | SET | `kojiakStat = kojiak.sendMessageString(KOJIAK_STAT_19, DATABEAN_GET_VALUE)` // Get work order status [-> KOJIAK_STAT_120 = "120" Registered, KOJIAK_STAT_200 = "200" Work Completed] |
| 7 | IF | `JKKCommonConst.KOJIAK_STAT_120.equals(kojiakStat)` // If work order status is "Registered" (登録済) |

**Block 2.1.2.1** — Nested IF (KOJIAK_STAT == 120) (L2495)

> If the work order status is "Registered", override with the "mansion work order status code" to use the work order status instead.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kojiakStat = kojiak.sendMessageString(MANS_KOJIAK_STAT_CD_19, DATABEAN_GET_VALUE)` // Override to mansion work order status code [-> MANS_KOJIAK_STAT_CD_19 = mansion work order status code] |

**Block 2.1.2.2** — IF condition (Instant Port-In Cancellation Check) (L2502)

> Complex conditional check: all of the following must be true simultaneously for this to qualify as an "instant" port-in cancellation scenario:
> - Address change status equals "Registered" (ADCHG_STAT_REG)
> - Service contract status equals "100" (Service Provision)
> - Work order status equals "200" (Work Completed)
> - Operation date equals the intended port-in start date (itntokiStaYmd)
> - Service contract number matches pre-change identification number(s) — handles both single-number and dual-direction number port scenarios (双方双向番号対応, ANK-4494-00-00)

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcUtwkNo = bean.sendMessageString(SVC_KEI_UCWK_NO, DATABEAN_GET_VALUE)` // Get service contract number |
| 2 | CALL | `adchgListChbfSkbtNoList = bean.getDataBeanArray(EKK2101B002DETAILLIST)` // Get pre-change identification number list |
| 3 | CALL | `adchgListChbfSkbtNo = adchgListChbfSkbtNoList.getDataBean(0)` // Get first record |
| 4 | SET | `chbfSkbtNo = adchgListChbfSkbtNo.sendMessageString(CHBF_SKBT_NO_15, DATABEAN_GET_VALUE)` // Get pre-change identification number (変更前識別番号) [-> CHBF_SKBT_NO_15 = pre-change ID number] |
| 5 | SET | `chafSkbtNo = adchgListChbfSkbtNo.sendMessageString(CHAF_SKBT_NO_15, DATABEAN_GET_VALUE)` // Get post-change identification number (変更後識別番号) [-> CHAF_SKBT_NO_15 = post-change ID number] |
| 6 | SET | `itntokiStaYmd = bean.sendMessageString(ITNTOKI_STA_YMD, DATABEAN_GET_VALUE)` // Get intended port-in start date |
| 7 | SET | `opeDate = JCCWebCommon.getOpeDate(this, null)` // Get current operation date |
| 8 | IF | `ADCHG_STAT_REG.equals(adchgStat) && SVC_KEI_STAT_100.equals(svcUtwkStat) && KOJIAK_STAT_200.equals(kojiakStat) && opeDate.equals(itntokiStaYmd) && ((svcUtwkNo.equals(chbfSkbtNo) && svcUtwkNo.equals(chafSkbtNo)) || svcUtwkNo.equals(chbfSkbtNo))` |

**Block 2.1.2.2.1** — True: Instant Port-In Cancellation Detected (L2506)

> All conditions met — this is an immediate port-in cancellation scenario where all identifiers match.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return TOKI_STA_MSG_CHG_STR_TOUROKU` // "登録完了" (Registration Completed) |

**Block 2.1.2.2.2** — Else: Normal Port-Out Cancellation (L2510)

> Conditions not met — this is a regular port-out cancellation scenario.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return TOKI_STA_MSG_CHG_STR_KAIYAKU` // "光電話の解約" (Fiber Phone Cancellation) |

**Block 2.1.3** — IF Branch (SVC_KEI_STAT == 910) `(svcUtwkStat equals SVC_KEI_STAT_910)` (L2516)

> Handles the case where the service contract is in "Terminated" status (解除済). When the port-out cancellation trigger is set, return the "registration completed" message.

| # | Type | Code |
|---|------|------|
| 1 | IF | `ITENMOTO_DSL_TOKI.equals(tokiAddCd)` // Port-out cancellation trigger |

**Block 2.1.3.1** — True: Port-Out Cancellation on Terminated Contract (L2518)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return TOKI_STA_MSG_CHG_STR_TOUROKU` // "登録完了" (Registration Completed) |

**Block 2.2** — IF Branch (SVC_KEI_STAT == 210) `(svcUtwkStat equals SVC_KEI_STAT_210)` (L2522)

> Handles the case where the service contract is in "Suspended / Intermitted" status (休止・中断中). The comment notes that the typical case landing here is "suspended" (休止中). When the suspension trigger is set, return the "registration completed" message.

| # | Type | Code |
|---|------|------|
| 1 | IF | `PAUSE_TOKI.equals(tokiAddCd)` // Suspension trigger [-> PAUSE_TOKI = "3" Suspension] |

**Block 2.2.1** — True: Suspension Trigger on Suspended Contract (L2524)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return TOKI_STA_MSG_CHG_STR_TOUROKU` // "登録完了" (Registration Completed) |

**Block 3** — ELSE/FALLTHROUGH (L2529)

> If none of the above conditions match, or if the operation division type is not 00046 (port-in notification timing), return an empty string (no message to display).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return ""` // Empty string — no message to display |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `idoDiv` | Field | Operation division code — classifies the type of service contract operation being performed |
| `IDO_DIV_VALUE_00046` | Constant | Operation division code "00046" — Fiber Phone / Number Portability, Port-In Notification Timing (光電話・移転トーキ設定) |
| `svcUtwkStat` | Field | Service contract detail status — the current state of the service contract |
| `SVC_KEI_STAT_100` | Constant | Service contract status "100" — Service Provision (サービス提供中) or Completed (結末済) |
| `SVC_KEI_STAT_910` | Constant | Service contract status "910" — Terminated (解除済) |
| `SVC_KEI_STAT_210` | Constant | Service contract status "210" — Suspended / Interim Suspension (休止・中断中) |
| `tokiAddCd` | Field | Timing trigger registration category code — classifies what type of notification timing triggered this method |
| `ITENSAKI_ADD_TOKI` | Constant | Trigger type "1" — Port-in Registration (移転先登録によるトーキ) |
| `ITENMOTO_DSL_TOKI` | Constant | Trigger type "2" — Port-out Cancellation (移転元解約によるトーキ) |
| `PAUSE_TOKI` | Constant | Trigger type "3" — Suspension (休止によるトーキ) |
| `TOKI_STA_MSG_CHG_STR_TOUROKU` | Constant | Display message "登録完了" (Registration Completed) |
| `TOKI_STA_MSG_CHG_STR_KAIYAKU` | Constant | Display message "光電話の解約" (Fiber Phone Cancellation) |
| `kyushiRev` | Field | Suspension reservation flag — indicates whether a suspension reservation exists |
| `adchgStat` | Field | Address change status — the current status of the address change record |
| `ADCHG_STAT_REG` | Constant | Address change status constant — "Registered" status |
| `adchg` | Field | Address change detail bean — data bean containing address change record information |
| `EKK2091A010DETAILLIST` | Constant | Data bean array key for address change detail list (住所変更明細一覧照会) |
| `kojiakStat` | Field | Work order status — the current status of the work order record |
| `KOJIAK_STAT_120` | Constant | Work order status "120" — Registered (登録済) |
| `KOJIAK_STAT_200` | Constant | Work order status "200" — Work Completed (工事完了済) |
| `KOJIAK_STAT_19` | Constant | Field identifier for work order status code in the EKU0011A010 bean |
| `MANS_KOJIAK_STAT_CD_19` | Constant | Field identifier for mansion work order status code — used as fallback when KOJIAK_STAT_120 matches |
| `EKU0011A010DETAILLIST` | Constant | Data bean array key for work order detail list (工事案件一覧照会明細) |
| `svcUtwkNo` | Field | Service contract detail number — the unique identifier for the service contract |
| `EKK2101B002DETAILLIST` | Constant | Data bean array key for pre-change identification number list (変更前識別番号一覧照会) |
| `chbfSkbtNo` | Field | Pre-change identification number (変更前識別番号) — the old identifier before the port |
| `chafSkbtNo` | Field | Post-change identification number (変更後識別番号) — the new identifier after the port |
| `CHBF_SKBT_NO_15` | Constant | Field identifier for pre-change identification number in the bean |
| `CHAF_SKBT_NO_15` | Constant | Field identifier for post-change identification number in the bean |
| `itntokiStaYmd` | Field | Intended port-in start date (移転トーキ開始年月日) — the planned date for port-in to begin |
| `getOpeDate` | Method | Retrieves the current business operation date (operational date for the system) |
| `getSvcKeiUcwkBean` | Method | Retrieves the service contract detail bean from the form data, specified by transfer destination service contract number |
| `isKyushiRev` | Method | Checks whether a suspension reservation exists for the given bean |
| `getPullDownSelectCd` | Method | Resolves pull-down selection codes for screen display configuration |
| `getXxxDataBeanArray` | Method | Reads a data bean array from the main bean by key |
| `getDataBean(0)` | Method | Extracts the first record (index 0) from a data bean array |
| `sendMessageString` | Method | Retrieves a string value from a data bean by field name |
| `X31SDataBeanAccess` | Class | X31 framework data bean access class — primary data exchange object for screen form data |
| `X31SDataBeanAccessArray` | Class | X31 framework data bean array class — collection of data bean access objects |
| Databean | Technical term | Framework concept where screen data is stored in structured beans accessible by field name |
| Hikaken (光電話・移転) | Business term | Fiber Phone Number Portability — the process of transferring a phone number between telecom providers |
| Port-in (移転先登録) | Business term | Registering a port-in request at the destination provider (K-Opticom receiving the number) |
| Port-out (移転元解約) | Business term | Cancelling service at the origin provider as part of number porting out |
| Instant Port-In (即時トーキ) | Business term | A scenario where the port-in start date is the same as the current operation date, with all records registered and matching identifiers |
| Mansion Work Order (マンション工事案件) | Business term | Work order for apartment building (mansion) fiber installation — used when standard work order status is "Registered" |
| 双方 (Sooho) | Business term | Dual-direction number port — bidirectional porting scenario supporting both directions (ANK-4494-00-00 update) |
