# Business Logic — JBSbatKKFmtcelSodUpdInfCst.getSysId() [16 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKFmtcelSodUpdInfCst` |
| Layer | Service (Batch Service Component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKFmtcelSodUpdInfCst.getSysId()

This method retrieves the unique system identifier (SYSID) for a service contract from the `KK_T_SVC_KEI` (Service Contract) database table. It is a private utility method within the FrameCell SOD (Service Order Data) update information extraction batch service. The method accepts a service contract number (`svcKeiNo`) as its sole parameter, constructs a database query using the `KK_SELECT_023` SQL definition, and executes a read operation against the service contract table. If a matching record is found, the SYSID value is returned; otherwise, an empty string is returned. This method plays a supporting role in generating log messages during contract suspension handling — specifically, it is invoked by `getLogMsgKojiStop()` when the SYSID has not yet been obtained, ensuring that the service contract's system identifier is always available for operational logging. The method implements a straightforward delegation pattern, encapsulating the database read logic behind a clean interface that hides SQL execution details from its callers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getSysId(svcKeiNo)"])
    STEP1["Create paramList (JBSbatCommonDBInterface)"]
    STEP2["Set svcKeiNo into paramList"]
    STEP3["Set opeDate into paramList"]
    STEP4["selectBySqlDefine on db_KK_T_SVC_KEI with KK_SELECT_023"]
    STEP5["selectNext on db_KK_T_SVC_KEI"]
    COND{svcKei != null?}
    STEP6["GetString SYSID from svcKei"]
    RET_SYS["Return SYSID"]
    RET_EMPTY["Return empty string"]
    END_NODE(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> COND
    COND -- "true" --> STEP6 --> RET_SYS --> END_NODE
    COND -- "false" --> RET_EMPTY --> END_NODE
```

**Conditional Branch Analysis:**

| # | Condition | Branch | Business Meaning |
|---|-----------|--------|-----------------|
| 1 | `svcKei != null` | **True** | A matching service contract record was found in the database. The SYSID field is extracted and returned to the caller. |
| 2 | `svcKei != null` | **False** | No matching service contract record was found for the given `svcKeiNo`. An empty string is returned as a fallback, allowing the caller to handle the missing data gracefully. |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `svcKeiNo` | `String` | Service Contract Number — the unique identifier for a service contract record. This value is used as the primary lookup key to find the corresponding row in the `KK_T_SVC_KEI` (Service Contract) table. It typically carries a formatted numeric/alphanumeric string assigned by the telecom billing system to uniquely identify each customer's service agreement. |

**Instance fields read by this method:**

| Field Name | Type | Business Description |
|------------|------|---------------------|
| `db_KK_T_SVC_KEI` | `JBSbatSQLAccess` | Database access object for the `KK_T_SVC_KEI` (Service Contract) table. Initialized by the parent class to perform SQL queries against the service contract table. |
| `opeDate` | `String` (inherited) | Operating date — the current processing date for the batch job. Used as a secondary query parameter alongside `svcKeiNo` in the database lookup. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `JBSbatCommonDBInterface()` | - | - | Creates a new database interface parameter object to hold query parameters (`svcKeiNo` and `opeDate`). |
| SET | `paramList.setValue(String)` | - | - | Sets the service contract number into the parameter object. |
| SET | `paramList.setValue(String)` | - | - | Sets the operating date (`opeDate`) into the parameter object. |
| R | `db_KK_T_SVC_KEI.selectBySqlDefine()` | - | `KK_T_SVC_KEI` | Executes the SQL defined by `KK_SELECT_023` against the service contract table, using the prepared parameters. The SQL definition `KK_T_SVC_KEI_KK_SELECT_023` has the constant value `"KK_SELECT_023"` as defined in `JKKBatConst.java`. |
| R | `db_KK_T_SVC_KEI.selectNext()` | - | `KK_T_SVC_KEI` | Fetches the next row from the query result set. Returns a `JBSbatCommonDBInterface` representing one service contract record, or `null` if no record exists. |
| R | `svcKei.getString(String)` | - | - | Extracts the SYSID string value from the retrieved service contract record. The column key is `JBSbatKK_T_SVC_KEI.SYSID` with resolved value `"SYSID"`. |

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKFmtcelSodUpdInfCst` | `JBSbatKKFmtcelSodUpdInfCst.getLogMsgKojiStop()` -> `getSysId(svcKeiNo)` | `getString [R] KK_T_SVC_KEI` |
| 2 | Batch: `JBSbatKKMansIfSksi` | `JBSbatKKMansIfSksi.insertCust()` -> `JKKBatNumberParts.getSysId(this.commonItem)` | `getSysId [-] commonItem` |

**Notes:**
- **Caller #1** (`getLogMsgKojiStop`): This is an internal caller within the same class. It iterates over service contract changes (additions, cancellations, transfers) and calls `getSysId` only when the SYSID has not yet been obtained (i.e., `sysId` is empty). The returned SYSID is appended to a log message string.
- **Caller #2** (`insertCust`): This is a different method with the same name `getSysId` in the `JKKBatNumberParts` class — it is a sequence number generator, not the same method. It is listed by the code graph as a method match.

**Terminal operations from this method:** `getString [R]`, `getString [R]` — two read operations on the service contract table.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Initialization and Parameter Setup)` (L622)

> Creates the database query parameter object and populates it with the lookup key and operating date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramList = new JBSbatCommonDBInterface()` |
| 2 | SET | `paramList.setValue(svcKeiNo)` // Sets the service contract number as the primary lookup key |
| 3 | SET | `paramList.setValue(opeDate)` // Sets the operating date as the secondary query parameter [-> `opeDate` is an inherited instance field representing the batch processing date] |

**Block 2** — [CALL] `[Database Query Execution]` (L627)

> Executes the SQL query defined by `KK_SELECT_023` against the service contract table to find the record matching the given service contract number.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_SVC_KEI.selectBySqlDefine(paramList, KK_T_SVC_KEI_KK_SELECT_023)` [-> `KK_T_SVC_KEI_KK_SELECT_023` constant value is `"KK_SELECT_023"` per `JKKBatConst.java`] |
| 2 | CALL | `svcKei = db_KK_T_SVC_KEI.selectNext()` // Fetches the first matching record from the query result |

**Block 3** — [IF] `(svcKei != null)` `(Record Found)` (L628)

> Checks whether the database query returned a matching service contract record.

**Block 3.1** — [IF branch: TRUE] `(Record exists)` (L629)

> A matching service contract record was found. Extract and return its SYSID.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return svcKei.getString(JBSbatKK_T_SVC_KEI.SYSID)` [-> `JBSbatKK_T_SVC_KEI.SYSID` constant value is `"SYSID"`; returns the system identifier from the service contract record] |

**Block 3.2** — [ELSE branch: FALSE] `(Record not found)` (L631)

> No matching service contract record was found for the given `svcKeiNo`. Return an empty string as a fallback, allowing the caller to handle the missing data gracefully.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return ""` // Empty string returned when the service contract record does not exist |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svcKeiNo` | Field | Service Contract Number — the unique identifier for a customer's service contract in the K-Opticom telecom system. Used to look up service agreement details. |
| `opeDate` | Field | Operating Date — the current processing date for the batch job, typically formatted as a numeric date string (e.g., `20130901`). |
| SYSID | Field | System ID — a unique system-generated identifier for a service contract record. Used internally by the telecom system to track and reference service agreements across subsystems. |
| KK_T_SVC_KEI | Table | Service Contract — the main database table storing service contract information. Contains fields such as service contract number, generation date, service state, service code, and SYSID. |
| KK_SELECT_023 | Constant | SQL definition key for querying the service contract table. The resolved value is `"KK_SELECT_023"`. The SQL query selects a service contract record by its contract number and operating date. |
| JBSbatCommonDBInterface | Class | Common database interface — a framework class used to hold query parameters and result sets for SQL operations. |
| JBSbatSQLAccess | Class | SQL access framework class — provides database query execution methods (`selectBySqlDefine`, `selectNext`) used to interact with database tables. |
| FrameCell | Business term | K-Opticom's proprietary telecom service management system platform for handling service orders, provisioning, and customer management. |
| SOD | Acronym | Service Order Data — the broader order fulfillment domain covering service activation, modification, and cancellation orders. |
| JBSbatKKFmtcelSodUpdInfCst | Class | FrameCell SOD Update Information Extraction Service Component — a batch service that extracts and processes update information for FrameCell service orders. |
| getLogMsgKojiStop | Method | Log message generation for contract suspension — the caller method that builds operational log messages when a service contract is suspended. |
| サービス契約 | Japanese term | Service Contract — a customer's subscribed service agreement in the telecom system. |
| 運用日 | Japanese term | Operating Date — the business processing date used as a query parameter for date-based lookups. |
