# Business Logic — JKKKikiIchiranKkUpdCC.getKanriBasho() [94 LOC]

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

## 1. Role

### JKKKikiIchiranKkUpdCC.getKanriBasho()

This method resolves and assigns location identification data for equipment (set-top boxes, routers, ONUs, etc.) used in telecom service provision. In the K-Opticom customer base system, when equipment is registered or modified for a service contract, the system must determine **where** that equipment will be stored or deployed — in a warehouse, at a subcontractor's site, or at a pre-registration office. The method acts as a **routing dispatcher**: it reads the provision type (Teikyo SbtCd) and the management location identifier (KariBashoSbtCd), then populates a result map (`mapBasho`) with the appropriate combination of warehouse codes, shelf codes, subcontractor codes, and office codes.

The method implements a **conditional routing pattern** with two primary branches based on the provision type. When the provision type is "Mochikomi" (Holding / Internal, code `"03"`), the method clears all location fields to empty strings, because internally held equipment does not require storage or deployment location assignment. For all other provision types, the method further branches based on the management location identifier (KariBashoSbtCd) into three sub-categories: Warehouse (code `"1"`), Subcontractor (code `"2"`), and Pre-registration Office (code `"3"`). In each sub-case, the method populates the corresponding location fields while clearing the others, and additionally resolves the warehouse code and shelf code through delegated helper methods (`getSokoCode`, `getSokoDanaCode`).

This method is a **shared utility** called during the equipment change update workflow (`execUpdateKktkSvckei`), ensuring that downstream service contract information updates (via SC `EKK0341C230`) receive properly resolved location data for the equipment being registered or modified.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getKanriBasho"])

    START --> INIT["Create mapBasho HashMap"]

    INIT --> GET1["Get kariBashoSbtCd from ccMsg.kriplace_skcd"]
    INIT --> GET2["Get tkSbtCd from ccMsg.kktk_sbt_cd"]

    GET1 --> COND1{TEIKYO_SBT_MOCHIKOMI equals tkSbtCd?}
    GET2 --> COND1

    COND1 -->|"Yes"| MOCHI_BRANCH["Branch: Provision type is Mochikomi"]
    COND1 -->|"No"| OTHER_BRANCH["Branch: Provision type is not Mochikomi"]

    MOCHI_BRANCH --> SET1["mapBasho.put(kiki_sti_ji_kriplace_skcd, empty)"]
    SET1 --> SET2["mapBasho.put(kiki_hkat_shitei_soko_cd, empty)"]
    SET2 --> SET3["mapBasho.put(kiki_hkat_shitei_skdn_cd, empty)"]
    SET3 --> SET4["mapBasho.put(kiki_sti_ji_kocomp_cd, empty)"]
    SET4 --> SET5["mapBasho.put(kiki_sti_ji_kocomp_slf_cd, empty)"]
    SET5 --> SET6["mapBasho.put(kiki_sti_ji_ytkskof_cd, empty)"]
    SET6 --> SET7["mapBasho.put(kiki_sti_ji_ytkskof_slf_cd, empty)"]
    SET7 --> RETURN1["Return mapBasho"]

    OTHER_BRANCH --> SOKO_CALL["Call getSokoCode(ccMsg)"]
    SOKO_CALL --> DANA_CALL["Call getSokoDanaCode(edk0451a010cbsMsg)"]
    DANA_CALL --> COND2{Empty or KRIPLACE_SKCD_SOKO equals kariBashoSbtCd?}

    COND2 -->|"Yes"| SOKO_SET1["mapBasho.put(kiki_sti_ji_kriplace_skcd, empty)"]
    SOKO_SET1 --> SOKO_SET2["mapBasho.put(kiki_hkat_shitei_soko_cd, sokoCode)"]
    SOKO_SET2 --> SOKO_SET3["mapBasho.put(kiki_hkat_shitei_skdn_cd, tanaCode)"]
    SOKO_SET3 --> COND_KOJI{KRIPLACE_SKCD_KOJI equals kariBashoSbtCd?}

    COND_KOJI -->|"Yes"| KOJI_SET1["mapBasho.put(kiki_sti_ji_kocomp_cd, sokoCode)"]
    KOJI_SET1 --> KOJI_SET2["mapBasho.put(kiki_sti_ji_kocomp_slf_cd, tanaCode)"]
    KOJI_SET1 --> COND_OFFICE{KRIPLACE_SKCD_OFFICE equals kariBashoSbtCd?}

    COND_KOJI -->|"No"| KOJI_EMPTY1["mapBasho.put(kiki_sti_ji_kocomp_cd, empty)"]
    KOJI_EMPTY1 --> KOJI_EMPTY2["mapBasho.put(kiki_sti_ji_kocomp_slf_cd, empty)"]
    KOJI_EMPTY2 --> COND_OFFICE

    COND_OFFICE -->|"Yes"| OFFICE_SET1["mapBasho.put(kiki_sti_ji_ytkskof_cd, sokoCode)"]
    OFFICE_SET1 --> OFFICE_SET2["mapBasho.put(kiki_sti_ji_ytkskof_slf_cd, tanaCode)"]
    OFFICE_SET1 --> RETURN2["Return mapBasho"]

    COND_OFFICE -->|"No"| OFFICE_EMPTY1["mapBasho.put(kiki_sti_ji_ytkskof_cd, empty)"]
    OFFICE_EMPTY1 --> OFFICE_EMPTY2["mapBasho.put(kiki_sti_ji_ytkskof_slf_cd, empty)"]
    OFFICE_EMPTY2 --> RETURN2

    RETURN1 --> END(["End"])
    RETURN2 --> END(["End"])
```

**Constant Resolution:**

| Constant Name | Value | Business Meaning |
|--------------|-------|-----------------|
| `TEIKYO_SBT_MOCHIKOMI` | `"03"` | Provision type "Holding" (Internal) — equipment held by the operator itself, not assigned for external deployment |
| `KRIPLACE_SKCD_SOKO` | `"1"` | Management location type "Warehouse" — equipment is stored in an operator warehouse |
| `KRIPLACE_SKCD_KOJI` | `"2"` | Management location type "Subcontractor" — equipment deployed to a construction subcontractor site |
| `KRIPLACE_SKCD_OFFICE` | `"3"` | Management location type "Pre-registration Office" — equipment assigned to a pre-registration office |
| `DEFAULT_SOKO_CD` | `"000001"` | Default warehouse code — used when no warehouse info is provided |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `ccMsg` | `HashMap<String, Object>` | Interface message map carrying equipment registration context. Contains `kriplace_skcd` (management location identifier code), `kktk_sbt_cd` (provision type code), and `soko_info` (warehouse information) among other fields. Determines which branching path the method follows. |
| 2 | `edk0451a010cbsMsg` | `CAANMsg` | CBS (Component-Based Service) message from the equipment handling agreement interface (`EDK0451A010`). Contains the equipment handling specification including the `shelf_cd` (shelf code), which is used to resolve the warehouse shelf location for the equipment. |

**Instance/External State Read:**
None — this method is stateless and does not access any instance fields directly. All external state is passed through parameters or resolved via called helper methods.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKKikiIchiranKkUpdCC.getNullToStr` | JKKKikiIchiranKkUpdCC | - | Null-safe string extraction — returns empty string if source value is null. Used to safely extract `kriplace_skcd` and `kktk_sbt_cd` from `ccMsg`. (Inherited from `AbstractCommonComponent`) |
| R | `JKKKikiIchiranKkUpdCC.getSokoCode` | JKKKikiIchiranKkUpdCC | - | Warehouse code resolution — reads `soko_info` from `ccMsg`, returns `DEFAULT_SOKO_CD` (`"000001"`) if blank. |
| R | `JKKKikiIchiranKkUpdCC.getSokoDanaCode` | JKKKikiIchiranKkUpdCC | - | Shelf code resolution — reads `shelf_cd` from `EDK0451A010CBSMsg` (equipment handling agreement), returns empty string if null or blank. |

### Called Methods Analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getNullToStr` (helper) | JKKKikiIchiranKkUpdCC | - | Null-safe extraction — utility method that prevents NullPointerException by returning empty string for null inputs. |
| R | `getSokoCode` | JKKKikiIchiranKkUpdCC | - | Reads warehouse code (`soko_info` field) from `ccMsg`. If blank, returns default warehouse code `"000001"`. No database access — purely map-based resolution. |
| R | `getSokoDanaCode` | JKKKikiIchiranKkUpdCC | - | Reads shelf code (`shelf_cd` field) from the equipment handling CBS message (`EDK0451A010CBSMsg`). Returns empty string if the message is null or the shelf code is blank. No database access. |

**Note:** This method performs **no direct CRUD operations** against any entity or database table. It is a pure data routing/transformation method that populates a `HashMap` with location identification codes derived from input parameters and helper method calls.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `JKKKikiIchiranKkUpdCC.execUpdateKktkSvckei` | `execUpdateKktkSvckei` → `getKanriBasho(ccMsg, edk0451a010cbsMsg)` | `getSokoDanaCode [R]`, `getSokoCode [R]`, `getNullToStr [R]`, `getNullToStr [R]` |

**Description:** The method `execUpdateKktkSvckei` is the equipment service contract update method within the same common component class. It calls `getKanriBasho` to resolve location data before passing the result to the `EKK0341C230` (Equipment Provision Service Contract Information Update) SC for persistence. The result map `mapBasho` values (`kiki_hkat_shitei_soko_cd`, `kiki_hkat_shitei_skdn_cd`) are passed as parameters to the CBS update call, which ultimately writes to the `KK_T_EKK0341` (Equipment Provision Service Contract) entity/table.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (L908)
Initialize the result map and extract input values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho = new HashMap<String, String>()` // Result container |
| 2 | SET | `kariBashoSbtCd = getNullToStr((String)ccMsg.get("kriplace_skcd"))` // Extract management location identifier code (L910) |
| 3 | SET | `tkSbtCd = getNullToStr((String)ccMsg.get("kktk_sbt_cd"))` // Extract provision type code (L912) |

**Block 2** — [IF] `(TEIKYO_SBT_MOCHIKOMI.equals(tkSbtCd))` → `TEIKYO_SBT_MOCHIKOMI = "03" (Provision type: Holding/Internal)` (L915)
When the provision type is "Mochikomi" (Holding), all location fields are cleared to empty strings because internally held equipment does not require storage or deployment location tracking.

> Business description: Equipment classified as "Holding" (Mochikomi) is managed internally by the operator and does not need to be associated with any warehouse, shelf, subcontractor, or pre-registration office. All six location fields in the output map are set to empty strings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KRIPLACE_SKCD, "")` // Management location identifier code (L918) |
| 2 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SOKO_CD, "")` // Equipment handling designated warehouse code (L920) |
| 3 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SKDN_CD, "")` // Equipment handling designated warehouse shelf code (L921) |
| 4 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_CD, "")` // Equipment designated subcontractor code (L923) |
| 5 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_SLF_CD, "")` // Equipment designated subcontractor shelf code (L924) |
| 6 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_CD, "")` // Equipment designated pre-registration office code (L926) |
| 7 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_SLF_CD, "")` // Equipment designated pre-registration office shelf code (L927) |
| 8 | RETURN | `return mapBasho` |

**Block 3** — [ELSE] (Not Mochikomi — L931)
All other provision types require location assignment. The method resolves warehouse and shelf codes, then branches further by management location type.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sokoCode = getSokoCode(ccMsg)` // Resolve warehouse code (L934) |
| 2 | SET | `tanaCode = getSokoDanaCode(edk0451a010cbsMsg)` // Resolve shelf code (L936) |

**Block 3.1** — [IF] `("".equals(kariBashoSbtCd) || KRIPLACE_SKCD_SOKO.equals(kariBashoSbtCd))` → `KRIPLACE_SKCD_SOKO = "1" (Management location: Warehouse)` (L939)
When the management location is a warehouse (or blank, defaulting to warehouse), populate warehouse-related fields.

> Business description: The equipment is stored in an operator warehouse. The management location identifier is cleared (since warehouse type is identified by the code "1"), and the warehouse code and shelf code are set to the resolved values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KRIPLACE_SKCD, "")` // Management location identifier cleared (L942) |
| 2 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SOKO_CD, sokoCode)` // Warehouse code set (L943) |
| 3 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SKDN_CD, tanaCode)` // Shelf code set (L944) |

**Block 3.2** — [ELSE] (Not Warehouse) (L946)
When the management location is NOT a warehouse, the management location identifier code itself is preserved, and warehouse/shelf fields are cleared.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KRIPLACE_SKCD, kariBashoSbtCd)` // Management location identifier preserved (L949) |
| 2 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SOKO_CD, "")` // Warehouse code cleared (L950) |
| 3 | SET | `mapBasho.put(TMP_KIKI_HKAT_SHITEI_SKDN_CD, "")` // Shelf code cleared (L951) |

**Block 3.3** — [IF] `KRIPLACE_SKCD_KOJI.equals(kariBashoSbtCd)` → `KRIPLACE_SKCD_KOJI = "2" (Management location: Subcontractor)` (L956)
When the management location is a subcontractor site, populate subcontractor-related fields using the already-resolved warehouse code and shelf code.

> Business description: For equipment deployed to a subcontractor, the warehouse code and shelf code from the resolution step are repurposed as the subcontractor code and subcontractor shelf code. This reflects the business logic that a subcontractor's location is tracked through the warehouse/shelf hierarchy.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_CD, sokoCode)` // Subcontractor code = warehouse code (L959) |
| 2 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_SLF_CD, tanaCode)` // Subcontractor shelf code = shelf code (L960) |

**Block 3.3.1** — [ELSE] (Not Subcontractor) (L962)

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_CD, "")` // Subcontractor code cleared (L965) |
| 2 | SET | `mapBasho.put(TMP_KIKI_STI_JI_KOCOMP_SLF_CD, "")` // Subcontractor shelf code cleared (L966) |

**Block 3.4** — [IF] `KRIPLACE_SKCD_OFFICE.equals(kariBashoSbtCd)` → `KRIPLACE_SKCD_OFFICE = "3" (Management location: Pre-registration Office)` (L969)
When the management location is a pre-registration office, populate office-related fields.

> Business description: For equipment assigned to a pre-registration office (where customers pick up equipment), the warehouse code and shelf code are used as the office code and office shelf code, following the same hierarchy-based tracking pattern as the subcontractor case.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_CD, sokoCode)` // Pre-registration office code = warehouse code (L972) |
| 2 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_SLF_CD, tanaCode)` // Pre-registration office shelf code = shelf code (L973) |

**Block 3.4.1** — [ELSE] (Not Pre-registration Office) (L975)

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_CD, "")` // Pre-registration office code cleared (L978) |
| 2 | SET | `mapBasho.put(TMP_KIKI_STI_JI_YTKSKOF_SLF_CD, "")` // Pre-registration office shelf code cleared (L979) |

**Block 4** — [RETURN] (L982)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return mapBasho` // Return populated location map to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kriplace_skcd` | Field | Management location identification code — identifies whether equipment is managed at a warehouse (1), subcontractor site (2), or pre-registration office (3) |
| `kktk_sbt_cd` | Field | Provision type code — classifies the type of service provision (e.g., "03" = Mochikomi/Holding) |
| `soko_info` | Field | Warehouse information — used to resolve the warehouse code for equipment storage location |
| `shelf_cd` | Field | Shelf code — physical shelf location within a warehouse where equipment is stored |
| TEIKYO_SBT_MOCHIKOMI | Constant | Provision type "Holding" (code `"03"`) — equipment held by the operator, not deployed externally |
| KRIPLACE_SKCD_SOKO | Constant | Management location code for Warehouse (code `"1"`) |
| KRIPLACE_SKCD_KOJI | Constant | Management location code for Subcontractor (code `"2"`) |
| KRIPLACE_SKCD_OFFICE | Constant | Management location code for Pre-registration Office (code `"3"`) |
| `kiki_sti_ji_kriplace_skcd` | Field | Temporary equipment-designated management location identifier code |
| `kiki_hkat_shitei_soko_cd` | Field | Equipment handling designated warehouse code |
| `kiki_hkat_shitei_skdn_cd` | Field | Equipment handling designated warehouse shelf code |
| `kiki_sti_ji_kocomp_cd` | Field | Equipment designated subcontractor code |
| `kiki_sti_ji_kocomp_slf_cd` | Field | Equipment designated subcontractor shelf code |
| `kiki_sti_ji_ytkskof_cd` | Field | Equipment designated pre-registration office code |
| `kiki_sti_ji_ytkskof_slf_cd` | Field | Equipment designated pre-registration office shelf code |
| DEFAULT_SOKO_CD | Constant | Default warehouse code (`"000001"`) — used when no warehouse information is provided |
| `execUpdateKktkSvckei` | Method | Equipment service contract update method — the caller of `getKanriBasho` in the equipment change workflow |
| EDK0451A010 | CBS | Equipment handling agreement service — CBS interface for equipment handling specifications |
| EKK0341C230 | SC | Equipment provision service contract information update — service component that persists the updated contract data including location fields |
| Mochikomi | Japanese term | Holding / Internal — equipment retained by the operator for internal management, not assigned for deployment |
| Soko | Japanese term | Warehouse — operator's storage facility for telecom equipment |
| Koji | Japanese term | Construction / Subcontractor — external construction company site where equipment is deployed |
| Yutakisk | Japanese term | Pre-registration office — customer-facing office where equipment is prepared before customer pickup |
