# Business Logic — JBSbatKKintrjhAdd.setDchskmstInfo() [56 LOC]

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

## 1. Role

### JBSbatKKintrjhAdd.setDchskmstInfo()

This method assembles a 31-element parameter array for registering delivery service master table (`DCHSKMST`) records into the batch data insertion pipeline. It serves as a **data builder/factory** that transforms five input identifiers into a fully-populated parameter bundle, each slot corresponding to a column in the delivery service management master table. The method follows a **routing-dispatch pattern** — it receives the calling context's system ID, delivery service code, and search contract criteria, then fills every column with appropriate values: system-generated items (sequence number, timestamps, user IDs), business constants (status code, application juncture, addition opportunity code, management flag), passed-through parameters (system ID, delivery service code, search details), and hardcoded defaults (empty strings for unused columns, `20991231` as a far-future end date, and extraction count set to zero). Its **role in the larger system** is to decouple the calling method (`createSvcStaTgInf`) from the physical layout of the `DCHSKMST` insertion row, so that column mapping changes (such as the v22.00.00 migration from hardcoded strings to constant references) require modification in only one place.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDchskmstInfo(params)"])
    START --> STEP1["Step 1: Get system date/time stamp
JCCBatCommon.getSysDateTimeStamp()"]
    STEP1 --> STEP2["Step 2: Get next sequence
JBSbatOracleSeqUtil.getNextSeq(SEQ_DCHSKMST_NO)"]
    STEP2 --> STEP3["Step 3: Pad sequence to 12 digits
JBSbatStringUtil.padNumFormString()"]
    STEP3 --> STEP4["Step 4: Initialize String[31] array
setParam = new String[31]"]
    STEP4 --> STEP5["Step 5: Populate all 31 fields
[0] seq_no
[1] sysDate
[2] CD00808_DCHSKMST_STAT_010 (status) = '010'
[3] empty
[4] sysid
[5] dchskmCd
[6] '0' (extraction count)
[7] searchJkn_mskmDtlNo
[8] CD00403_APLY_JUN_1 (apply juncture) = '1'
[9] opeDate
[10] opeDate
[11] '20991231' (far-future end date)
[12] searchJkn_idodiv
[13] empty
[14] searchJkn_intrCd
[15] empty
[16] CD00874_DCHSKMST_ADD_OPTY_CD_1 (add opportunity) = '1'
[17] empty
[18] sysDate
[19] batchUserId
[20] sysDate
[21] batchUserId
[22] empty
[23] empty
[24] MK_FLG_YK (mgmt flag) = '0'
[25] empty
[26] empty
[27] empty
[28] empty
[29] empty
[30] empty"]
    STEP5 --> END_NODE(["Return setParam String[]"])
```

**Processing Flow Summary:**

1. **Step 1** — Retrieve the current system date/time stamp. This is a flat operation: call `JCCBatCommon.getSysDateTimeStamp()` and store in `sysDate`.

2. **Step 2–3** — Acquire the next value from database sequence `SEQ_DCHSKMST_NO` via `JBSbatOracleSeqUtil.getNextSeq()`, using the connection from `super.commonItem.getConnection()`. Then pad the numeric sequence value to a 12-digit zero-padded string via `JBSbatStringUtil.padNumFormString()`.

3. **Step 4** — Allocate a new `String[31]` array. Each index maps to a column of the delivery service master table insert row.

4. **Step 5** — Populate all 31 positions. Several fields were updated in v22.00.00 to replace hardcoded literals with named constants from `JBSbatKKConst`:
   - `[2]`: Changed from `"010"` to `CD00808_DCHSKMST_STAT_010 = "010"` (delivery service master status code)
   - `[8]`: Changed from `"1"` to `CD00403_APLY_JUN_1 = "1"` (application juncture code)
   - `[16]`: Changed from `"1"` to `CD00874_DCHSKMST_ADD_OPTY_CD_1 = "1"` (delivery service addition opportunity code)
   - `[24]`: Changed from `"0"` to `MK_FLG_YK = "0"` (management flag)

5. **Return** — The populated array is returned to the caller for batch insert into the `DCHSKMST` table.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `sysid` | `String` | System ID — identifies which system or subsystem the delivery service registration originates from. Used as a traceable audit field in the delivery service master record. |
| 2 | `dchskmCd` | `String` | Delivery Service Master Code — the unique business code identifying a specific delivery service type or product offering (e.g., FTTH, broadband, managed service). Maps to the delivery service master table key. |
| 3 | `searchJkn_mskmDtlNo` | `String` | Search Contract Service Detail Number — the internal reference number for a contracted service line item detail. Used to trace which contracted service line the delivery service record pertains to. |
| 4 | `searchJkn_idodiv` | `String` | Search Contract Service Type Division — classifies the type or division of the contracted service (e.g., new contract, change, renewal). Determines downstream routing and processing rules. |
| 5 | `searchJkn_intrCd` | `String` | Search Contract Intraclass Code — identifies the intraclass or category within the contract type (e.g., FTTH intraclass, mail intraclass). Used for granular classification and reporting. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `super.commonItem.getConnection()` | `Connection` | Database connection object from the common item context, used to query the database sequence. |
| `super.opeDate` | `String` | Operation date — inherited from the parent class; used for both create and update timestamp fields. |
| `super.batchUserId` | `String` | Batch job user ID — inherited from the parent class; used as the operator ID for both creation and modification records. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCBatCommon.getSysDateTimeStamp` | - | - | Calls `getSysDateTimeStamp` in `JCCBatCommon` to retrieve current system date/time stamp. |
| R | `JBSbatOracleSeqUtil.getNextSeq` | - | `SEQ_DCHSKMST_NO` (database sequence) | Calls `getNextSeq` to acquire the next value of the delivery service master sequence. |
| - | `JBSbatStringUtil.padNumFormString` | - | - | Calls `padNumFormString` to zero-pad the sequence number to 12 digits. |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `padNumFormString` [-], `getNextSeq` [R], `getSysDateTimeStamp` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JBSbatKKintrjhAdd.createSvcStaTgInf() | `createSvcStrTgInf` -> `setDchskmstInfo(sysid, dchskmCd, searchJkn_mskmDtlNo, searchJkn_idodiv, searchJkn_intrCd)` | `padNumFormString` [-], `getNextSeq` [R] `SEQ_DCHSKMST_NO`, `getSysDateTimeStamp` [R] |

**Call chain detail:** The method is a private utility called from `JBSbatKKintrjhAdd.createSvcStaTgInf()` (line 1194) within the same class. The caller passes the five parameters derived from its own context (system ID, delivery service code, and search contract criteria) and stores the returned `String[]` in `setParam_dchskmst` for subsequent batch insertion.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] (Get system date/time) (L1480)

> Retrieve the current system date and time stamp for use in audit fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sysDate = JCCBatCommon.getSysDateTimeStamp()` // システム日付を取得 (Get system date/time) |

**Block 2** — [SET] (Acquire and pad sequence number) (L1482)

> Fetch the next value from the `SEQ_DCHSKMST_NO` database sequence and zero-pad it to 12 digits. The connection is obtained from the common item context.

| # | Type | Code |
|---|------|------|
| 1 | SET | `seq_no = JBSbatStringUtil.padNumFormString(JBSbatOracleSeqUtil.getNextSeq(super.commonItem.getConnection(), "SEQ_DCHSKMST_NO"), 12)` // シーケンス採番 (Sequence number assignment) |

**Block 3** — [SET] (Initialize 31-element array) (L1484)

> Allocate the parameter array that maps one-to-one with the delivery service master table columns.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam = new String[31]` |

**Block 4** — [SET] (Populate index 0–1: sequence and timestamp) (L1487–1488)

> Fill the first two slots with the generated sequence number and system timestamp.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[0] = seq_no` // Primary key / sequence |
| 2 | SET | `setParam[1] = sysDate` // Creation timestamp |

**Block 5** — [SET] (Populate index 2: status code) (L1490–1491)

> v22.00.00 change: replaced hardcoded `"010"` with named constant. Delivery service master status code set to initial/active status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[2] = JBSbatKKConst.CD00808_DCHSKMST_STAT_010` [-> CD00808_DCHSKMST_STAT_010="010"] // 抽出項目設定の登録用 (For data extraction item setting registration) |

**Block 6** — [SET] (Populate index 3: empty placeholder) (L1492)

> Reserved/unused field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[3] = ""` |

**Block 7** — [SET] (Populate index 4–5: sysid and delivery service code) (L1493–1494)

> Pass through the calling context's system ID and delivery service code directly into the parameter array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[4] = sysid` |
| 2 | SET | `setParam[5] = dchskmCd` |

**Block 8** — [SET] (Populate index 6: extraction count) (L1495)

> Hardcoded to `"0"` — the number of extractions (抽出回数).

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[6] = "0"` // 抽出回数 (Extraction count) |

**Block 9** — [SET] (Populate index 7: contract service detail number) (L1496)

> Pass through the search contract service detail number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[7] = searchJkn_mskmDtlNo` |

**Block 10** — [SET] (Populate index 8: application juncture) (L1498–1499)

> v22.00.00 change: replaced hardcoded `"1"` with named constant. Application juncture code indicating the point of application.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[8] = JBSbatKKConst.CD00403_APLY_JUN_1` [-> CD00403_APLY_JUN_1="1"] // 抽出項目設定の登録用 (For data extraction item setting registration) |

**Block 11** — [SET] (Populate index 9–10: operation date) (L1500–1501)

> Fill both create-date and update-date fields with the inherited operation date from the parent context.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[9] = super.opeDate` |
| 2 | SET | `setParam[10] = super.opeDate` |

**Block 12** — [SET] (Populate index 11: far-future end date) (L1502)

> Hardcoded to `20991231` — a conventional far-future end date representing "no expiration."

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[11] = "20991231"` |

**Block 13** — [SET] (Populate index 12–15: search contract criteria) (L1503–1506)

> Pass through the remaining search contract criteria: service type division, intraclass code. Some fields left empty as placeholders.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[12] = searchJkn_idodiv` |
| 2 | SET | `setParam[13] = ""` |
| 3 | SET | `setParam[14] = searchJkn_intrCd` |
| 4 | SET | `setParam[15] = ""` |

**Block 14** — [SET] (Populate index 16: addition opportunity code) (L1508–1509)

> v22.00.00 change: replaced hardcoded `"1"` with named constant. Delivery service addition opportunity code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[16] = JBSbatKKConst.CD00874_DCHSKMST_ADD_OPTY_CD_1` [-> CD00874_DCHSKMST_ADD_OPTY_CD_1="1"] // 抽出項目設定の登録用 (For data extraction item setting registration) |

**Block 15** — [SET] (Populate index 17: empty placeholder) (L1510)

> Reserved/unused field.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[17] = ""` |

**Block 16** — [SET] (Populate index 18–21: timestamps and user IDs) (L1511–1514)

> Fill creation/last-update timestamps and batch user IDs. This section follows a standard pattern: sysDate at even indices, batchUserId at odd indices.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[18] = sysDate` |
| 2 | SET | `setParam[19] = super.batchUserId` |
| 3 | SET | `setParam[20] = sysDate` |
| 4 | SET | `setParam[21] = super.batchUserId` |

**Block 17** — [SET] (Populate index 22–23: empty placeholders) (L1515–1516)

> Reserved/unused fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[22] = ""` |
| 2 | SET | `setParam[23] = ""` |

**Block 18** — [SET] (Populate index 24: management flag) (L1518–1519)

> v22.00.00 change: replaced hardcoded `"0"` with named constant. Management flag set to standard/non-ignored status.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[24] = JBSbatKKConst.MK_FLG_YK` [-> MK_FLG_YK="0"] // 抽出項目設定の登録用 (For data extraction item setting registration) |

**Block 19** — [SET] (Populate index 25–30: empty placeholders) (L1520–1525)

> Six reserved/unused fields all set to empty strings.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setParam[25] = ""` |
| 2 | SET | `setParam[26] = ""` |
| 3 | SET | `setParam[27] = ""` |
| 4 | SET | `setParam[28] = ""` |
| 5 | SET | `setParam[29] = ""` |
| 6 | SET | `setParam[30] = ""` |

**Block 20** — [RETURN] (Return populated array) (L1528)

> Return the fully-populated 31-element parameter array to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return setParam` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `dchskmCd` | Field | Delivery Service Master Code — the unique business code identifying a specific delivery service product (e.g., FTTH, broadband). Maps to the delivery service management master table key. |
| `searchJkn_mskmDtlNo` | Field | Search Contract Service Detail Number — internal reference number for a contracted service line item detail. |
| `searchJkn_idodiv` | Field | Search Contract Service Type Division — classifies the type of contracted service (new, change, renewal). |
| `searchJkn_intrCd` | Field | Search Contract Intraclass Code — granular category within the contract type for classification and reporting. |
| `sysid` | Field | System ID — identifies the originating system or subsystem for audit and routing purposes. |
| `sysDate` | Field | System Date/Time Stamp — current system date/time acquired at call time, used for creation/last-modified timestamps. |
| `opeDate` | Field | Operation Date — inherited operation date from the parent class context, used as the effective date for the batch operation. |
| `batchUserId` | Field | Batch User ID — inherited identifier of the batch job user/operator, used for audit trail (creator and modifier). |
| `seq_no` | Field | Sequence Number — system-generated unique identifier padded to 12 digits, derived from database sequence `SEQ_DCHSKMST_NO`. |
| `setParam` | Field | Parameter Array — a 31-element String array representing the complete column values for one row of the delivery service master table insert. |
| `SEQ_DCHSKMST_NO` | Constant | Database sequence name — Oracle sequence used to generate unique delivery service master record IDs. |
| `CD00808_DCHSKMST_STAT_010` | Constant | Delivery Service Master Status Code — value `"010"`, represents the initial/active status of a delivery service master record. |
| `CD00403_APLY_JUN_1` | Constant | Application Juncture Code — value `"1"`, indicates the point of application in the contract lifecycle. |
| `CD00874_DCHSKMST_ADD_OPTY_CD_1` | Constant | Delivery Service Addition Opportunity Code — value `"1"`, indicates the opportunity type for adding a delivery service. |
| `MK_FLG_YK` | Constant | Management Flag — value `"0"`, indicates standard (non-excluded/non-ignored) record status. |
| `DCHSKMST` | Table | Delivery Service Master Table — the database table storing delivery service master records. The table tracks service delivery configurations including status, opportunity codes, timestamps, and audit fields. |
| `v22.00.00` | Version | Version 22.00.00 — a major code release that migrated hardcoded string literals to named constants in `JBSbatKKConst` for maintainability and consistency. |
| JCCBatCommon | Class | Common Batch Utility Class — provides shared batch services including system date/time stamp retrieval. |
| JBSbatOracleSeqUtil | Class | Oracle Sequence Utility Class — provides database sequence number acquisition methods. |
| JBSbatStringUtil | Class | String Utility Class — provides string formatting methods including zero-padding. |
| JBSbatKKConst | Class | KK Constants Class — central repository of named string constants used throughout the batch application (e.g., status codes, flags, type codes). |
| テーブルへの登録情報作成 | Comment | Register information creation for table — the Javadoc description of this method's purpose. |
| 抽出項目設定 | Comment | Data extraction item setting — the business concept describing the configuration of data fields extracted for delivery service registration. |
| システム日付を取得 | Comment | Get system date/time — Japanese comment describing the system timestamp acquisition step. |
| シーケンス採番 | Comment | Sequence number assignment — Japanese comment describing the database sequence acquisition step. |
| 抽出回数 | Comment | Extraction count — Japanese comment describing the hardcoded zero value at index 6. |
| 変更開始/変更終了 | Comment | Change start/end — Japanese comments marking the boundaries of the v22.00.00 migration section. |
