# Business Logic — JKKWrisvcAutoAplyGetSvcInfoCC.editInEKK0081A010() [57 LOC]

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

## 1. Role

### JKKWrisvcAutoAplyGetSvcInfoCC.editInEKK0081A010()

This method performs the **upper-mapping processing** (上りマッピング処理) for the Service Contract Unique Inquiry — it constructs the inbound request message (`CAANMsg`) destined for the EKK0081A010 Service Component that queries a single service contract record. It acts as a **data transformation bridge**: reading incoming request parameters and operational context from the inbound parameter map, then assembling a typed CBS message template with properly mapped fields. The method follows a **builder pattern**, incrementally populating a `CAANMsg` template with control data (operator ID, operation date/time), a static template identifier, a function code, and three domain-specific fields drawn from the input map (service contract number, generation/addition datetime, reservation application date). It is a **shared utility** called by the parent `getSvcInfo()` method within the same class, which aggregates auto-applied discount service information. The method itself performs **no external service calls or database access** — it is purely a message-assembly step that prepares data for downstream CBS invocation. It handles null/empty-safety via explicit conditional branches for each field, ensuring the downstream service always receives either a valid value or an explicit null marker.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInEKK0081A010(params, fixedText, strSvKeiNo)"])
    CREATE_TEMPLATE["Create CAANMsg template for EKK0081A010"]
    SET_TEMPLATE_ID["Set TEMPLATEID = \"EKK0081A010\""]
    SET_FUNC_CODE["Set FUNC_CODE = \"2\""]
    GET_OPERATOR_ID["Get OPERATOR_ID from control map"]
    SET_OPERATOR["Set OPERATOR_ID_KEY"]
    GET_OPE_DATE["Get OPE_DATE from control map"]
    SET_OPE_DATE["Set OPERATE_DATE_KEY"]
    GET_OPE_TIME["Get OPE_TIME from control map"]
    SET_OPE_TIME["Set OPERATE_DATETIME_KEY"]
    GET_INMAP["Get input map from param using fixedText"]
    CHECK_SV_KEI_NO["strSvKeiNo is empty string?"]
    SET_SVC_KEI_NO["Set KEY_SVC_KEI_NO = strSvKeiNo"]
    SET_SVC_KEI_NO_NULL["Set KEY_SVC_KEI_NO = null"]
    CHECK_GENE_ADD_DTM["inMap == null OR key_gene_add_dtm == null OR empty?"]
    SET_GENE_ADD_DTM["Set KEY_GENE_ADD_DTM = key_gene_add_dtm"]
    SET_GENE_ADD_DTM_NULL["Set KEY_GENE_ADD_DTM = null"]
    CHECK_RSV_APLY_YMD["inMap == null OR key_rsv_aply_ymd == null OR empty?"]
    SET_RSV_APLY_YMD["Set KEY_RSV_APLY_YMD = key_rsv_aply_ymd"]
    SET_RSV_APLY_YMD_NULL["Set KEY_RSV_APLY_YMD = null"]
    RETURN_TEMPLATE["Return template CAANMsg"]

    START --> CREATE_TEMPLATE --> SET_TEMPLATE_ID --> SET_FUNC_CODE --> GET_OPERATOR_ID --> SET_OPERATOR --> GET_OPE_DATE --> SET_OPE_DATE --> GET_OPE_TIME --> SET_OPE_TIME --> GET_INMAP --> CHECK_SV_KEI_NO
    CHECK_SV_KEI_NO -- "Yes (empty)" --> SET_SVC_KEI_NO_NULL
    CHECK_SV_KEI_NO -- "No (has value)" --> SET_SVC_KEI_NO
    SET_SVC_KEI_NO_NULL --> CHECK_GENE_ADD_DTM
    SET_SVC_KEI_NO --> CHECK_GENE_ADD_DTM
    CHECK_GENE_ADD_DTM -- "Yes (null/missing/empty)" --> SET_GENE_ADD_DTM_NULL
    CHECK_GENE_ADD_DTM -- "No (valid)" --> SET_GENE_ADD_DTM
    SET_GENE_ADD_DTM_NULL --> CHECK_RSV_APLY_YMD
    SET_GENE_ADD_DTM --> CHECK_RSV_APLY_YMD
    CHECK_RSV_APLY_YMD -- "Yes (null/missing/empty)" --> SET_RSV_APLY_YMD_NULL
    CHECK_RSV_APLY_YMD -- "No (valid)" --> SET_RSV_APLY_YMD
    SET_RSV_APLY_YMD_NULL --> RETURN_TEMPLATE
    SET_RSV_APLY_YMD --> RETURN_TEMPLATE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The inbound request parameter container carrying both control-map data (operator ID, operation date, operation time) and the domain-specific input map (retrieved via `fixedText` as key). This is the primary data source for all template population. |
| 2 | `fixedText` | `String` | A key string used to retrieve a `HashMap` of input data from the `param` object. The returned map (`inMap`) contains fields such as `key_gene_add_dtm` and `key_rsv_aply_ymd` that describe the service contract record attributes. |
| 3 | `strSvKeiNo` | `String` | The service contract number (サービス契約番号) — the unique identifier of the service contract being queried. An empty string results in a null value being set on the template for `KEY_SVC_KEI_NO`, while a non-empty value is passed through directly. |

**External state / instance fields read:** None. This method is fully stateless — it reads only from parameters and creates a new local `CAANMsg` object.

## 4. CRUD Operations / Called Services

This method performs **pure message assembly** with no external service or database calls. All operations are local `template.set()` / `template.setNull()` calls on the in-memory `CAANMsg` object. The pre-computed evidence table (which lists `getData`, `setNull`, etc. from other classes) does **not** apply to this method — those belong to other methods in `JKKWrisvcAutoAplyGetSvcInfoCC`.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (local) | `CAANMsg.set()` | - | - (in-memory template) | Sets field values on the EKK0081A010 CBS message template. |
| (local) | `CAANMsg.setNull()` | - | - (in-memory template) | Sets a null marker on the EKK0081A010 CBS message template when the source value is missing or empty. |
| (local) | `param.getControlMapData()` | - | - (in-memory control map) | Reads operator ID, operation date, and operation time from the control map portion of the request. |
| (local) | `param.getData()` | - | - (in-memory parameter map) | Retrieves the domain-specific input map (`HashMap`) keyed by `fixedText`. |

**Note:** The upstream caller `getSvcInfo()` is responsible for invoking the actual CBS `EKK0081A010` Service Component that performs the database query. This method only prepares the inbound request message for that CBS call.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JKKWrisvcAutoAplyGetSvcInfoCC.getSvcInfo()` | `getSvcInfo()` -> `editInEKK0081A010(param, fixedText, strSvKeiNo)` | `CAANMsg returned [local assembly]` |

**Upstream context:** The `getSvcInfo()` method within the same class is the direct caller. It orchestrates the retrieval of auto-applied discount service information by invoking `editInEKK0081A010` to build the query request message, then uses the returned `CAANMsg` to invoke the underlying CBS. No direct screen or batch entry points are within the call graph of this method — it is a **private helper** that operates entirely within the common component layer.

**Terminal operations from this method:** `CAANMsg.set()` (multiple fields), `CAANMsg.setNull()` (multiple fields), `param.getControlMapData()` (3 calls), `param.getData()` (1 call). All are local in-memory operations — no SC-level or DB-level terminal operations originate from this method itself.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Initialize CAANMsg template `(L320)`

> Creates the CBS message template for service component EKK0081A010.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template = new CAANMsg(EKK0081A010CBSMsg.class.getName())` | Create a new CAANMsg template targeting the EKK0081A010 CBS message type. |

**Block 2** — [SET] Set template identifier `(L323)`

> Assigns the template ID field of the CBS message.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0081A010CBSMsg.TEMPLATEID, "EKK0081A010")` [-> TEMPLATEID="templateID"] | Sets the template ID to "EKK0081A010" — identifies this as a service contract unique inquiry message. |

**Block 3** — [SET] Set function code `(L326)`

> Assigns the function code field.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EKK0081A010CBSMsg.FUNC_CODE, "2")` [-> FUNC_CODE="functionCode"] | Sets function code to "2" (default). Specifies the operation type for the CBS. |

**Block 4** — [SET] Copy operator ID from control map `(L329-L330)`

> Reads the operator ID from the control map and places it into the template.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `operatorId = param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` [-> OPERATOR_ID="operatorId"] | Retrieves the logged-in operator's ID from the control map. |
| 2 | SET | `template.set(JCMConstants.OPERATOR_ID_KEY, operatorId)` [-> OPERATOR_ID_KEY="operatorId"] | Sets the operator ID on the CBS template for audit/traceability. |

**Block 5** — [SET] Copy operation date from control map `(L333-L334)`

> Reads the operation date from the control map.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `operateDate = param.getControlMapData(SCControlMapKeys.OPE_DATE)` [-> OPE_DATE="operateDate"] | Retrieves the operation date from the control map. |
| 2 | SET | `template.set(JCMConstants.OPERATE_DATE_KEY, operateDate)` [-> OPERATE_DATE_KEY="operateDate"] | Sets the operation date on the CBS template. |

**Block 6** — [SET] Copy operation time from control map `(L337-L338)`

> Reads the operation time from the control map.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `operateDateTime = param.getControlMapData(SCControlMapKeys.OPE_TIME)` [-> OPE_TIME="operateTime"] | Retrieves the operation time from the control map. |
| 2 | SET | `template.set(JCMConstants.OPERATE_DATETIME_KEY, operateDateTime)` [-> OPERATE_DATETIME_KEY="operateTime"] | Sets the operation time on the CBS template. |

**Block 7** — [SET] Retrieve input data map `(L340)`

> Extracts the domain-specific input map keyed by `fixedText`.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `inMap = (HashMap)param.getData(fixedText)` | Casts the retrieved data to HashMap. Contains service contract attributes from the caller. |

**Block 8** — [IF/ELSE] Check service contract number `(L343-L350)`

> Condition: `[strSvKeiNo equals empty string]` (L343)

> Maps the service contract number into the template. If the input is empty, sets null to signal a missing value to the downstream CBS. This corresponds to the field: サービス契約一致照会 - KEDNサービス契約番号 (Service Contract Unique Inquiry - KEDN Service Contract Number).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `"".equals(strSvKeiNo)` [Condition: empty string check] | Branch on whether the service contract number is provided. |
| 2 | SET (true branch) | `template.setNull(EKK0081A010CBSMsg.KEY_SVC_KEI_NO)` [-> KEY_SVC_KEI_NO="serviceContractNumber"] | Sets null for KEY_SVC_KEI_NO — service contract number is missing. |
| 3 | SET (else branch) | `template.set(EKK0081A010CBSMsg.KEY_SVC_KEI_NO, strSvKeiNo)` [-> KEY_SVC_KEI_NO="serviceContractNumber"] | Sets the service contract number value — used to query the specific contract. |

**Block 9** — [IF/ELSE] Check generation/addition datetime `(L354-L361)`

> Condition: `[inMap == null OR inMap.get("key_gene_add_dtm") == null OR inMap.get("key_gene_add_dtm") equals empty string]` (L354)

> Maps the KEDN generation registration datetime. If the input map is absent, or the key is null/empty, sets null on the template. This corresponds to the field: KEDN世代登録年月日時刻 (KEDN Generation Registration DateTime).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `inMap == null \|\| inMap.get("key_gene_add_dtm") == null \|\| "".equals(inMap.get("key_gene_add_dtm"))` | Branch on whether the generation/addition datetime is available in the input map. |
| 2 | SET (true branch) | `template.setNull(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM)` [-> KEY_GENE_ADD_DTM="generationAddDateTime"] | Sets null for KEY_GENE_ADD_DTM — datetime is missing or the input map itself is null. |
| 3 | SET (else branch) | `template.set(EKK0081A010CBSMsg.KEY_GENE_ADD_DTM, (String)inMap.get("key_gene_add_dtm"))` | Casts and sets the generation/addition datetime string. |

**Block 10** — [IF/ELSE] Check reservation application date `(L364-L371)`

> Condition: `[inMap == null OR inMap.get("key_rsv_aply_ymd") == null OR inMap.get("key_rsv_aply_ymd") equals empty string]` (L364)

> Maps the KEDN reservation application date. If missing, sets null on the template. This corresponds to the field: KEDN予約適用年月日（未設定の場合、運用日付設定）(KEDN Reservation Application Date — if not set, operation date is used).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `inMap == null \|\| inMap.get("key_rsv_aply_ymd") == null \|\| "".equals(inMap.get("key_rsv_aply_ymd"))` | Branch on whether the reservation application date is available in the input map. |
| 2 | SET (true branch) | `template.setNull(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD)` [-> KEY_RSV_APLY_YMD="reservationApplicationDate"] | Sets null for KEY_RSV_APLY_YMD — date is missing or the input map itself is null. |
| 3 | SET (else branch) | `template.set(EKK0081A010CBSMsg.KEY_RSV_APLY_YMD, (String)inMap.get("key_rsv_aply_ymd"))` | Casts and sets the reservation application date string. |

**Block 11** — [RETURN] Return assembled template `(L373)`

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | RETURN | `return template;` | Returns the fully assembled CAANMsg template to the caller (`getSvcInfo()`), which will pass it to the CBS for execution. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `editInEKK0081A010` | Method | Upper-mapping (inbound mapping) processing for Service Contract Unique Inquiry. Builds the request message for CBS EKK0081A010. |
| `EKK0081A010` | CBS Code | Service Contract Unique Inquiry Service Component — queries a single service contract record. |
| `CAANMsg` | Type | Common Application ANdMsg — the message envelope used for inter-component communication in the K-Opticom platform. |
| `IRequestParameterReadWrite` | Type | Interface for reading and writing request parameters, providing access to control map data and domain-specific data maps. |
| `fixedText` | Field | Input map key — used to retrieve the HashMap containing service contract attributes from the request parameter. |
| `strSvKeiNo` | Field | Service contract number (サービス契約番号) — unique identifier for a service contract line item. |
| `key_gene_add_dtm` | Field | KEDN generation registration datetime (KEDN世代登録年月日時刻) — timestamp when the service contract was generated/registered in the KEDN system. |
| `key_rsv_aply_ymd` | Field | KEDN reservation application date (KEDN予約適用年月日) — date when the reservation takes effect. If not set, the operation date is used as a fallback. |
| `svc_kei_no` | Field | Service contract number (サービス契約番号) — mapped from `strSvKeiNo` into the CBS message as KEY_SVC_KEI_NO. |
| `gene_add_dtm` | Field | Generation/addition datetime (世代登録年月日時刻) — when the service contract record was created in the system. |
| `rsv_aply_ymd` | Field | Reservation application date (予約適用年月日) — the effective date of the service reservation. |
| KEDN | Acronym | Service detail management number (サービス詳細管理番号) — internal tracking identifier for service contract details in the K-Opticom system. |
| CBS | Acronym | Common Business Service — the service component layer that handles data persistence and business logic execution. |
| SC | Acronym | Service Component — a business logic module in the Fujitsu Futurity platform architecture. |
| OPERATOR_ID_KEY | Constant | Control map key for operator/employee ID — the user performing the operation. |
| OPERATE_DATE_KEY | Constant | Control map key for operation date — the business date of the transaction. |
| OPERATE_DATETIME_KEY | Constant | Control map key for operation time — the time portion of the transaction. |
| OPE_DATE | Constant | Control map key alias for operation date (`SCControlMapKeys.OPE_DATE`). |
| OPE_TIME | Constant | Control map key alias for operation time (`SCControlMapKeys.OPE_TIME`). |
| OPERATOR_ID | Constant | Control map key alias for operator ID (`SCControlMapKeys.OPERATOR_ID`). |
| FUNC_CODE | Constant | Function code field on the CBS message. Value "2" indicates the default operation mode. |
| TEMPLATEID | Constant | Template identifier field on the CBS message. Value "EKK0081A010" identifies the message type. |
| 上りマッピング処理 | Japanese term | Upper-mapping processing — transforming inbound request data into the format expected by the CBS layer. |
| サービス契約一意照会 | Japanese term | Service Contract Unique Inquiry — the business operation of looking up a single service contract record by its number. |
| 割引サービス自動適用 | Japanese term | Discount Service Auto-Application — the broader business domain this component belongs to, dealing with automatic application of discounted rates to service contracts. |
| AbstractCommonComponent | Type | Base class for common components in the Fujitsu Futurity platform, providing shared utility methods for business components. |
| RequestParameterException | Type | Exception thrown when request parameter data cannot be read or processed correctly. |

---
