Skip to content

Refactor ItemWin.w to use Business Entity pattern#2

Open
YorickKuindersma wants to merge 1 commit into
mainfrom
refactor/item-win-business-entity
Open

Refactor ItemWin.w to use Business Entity pattern#2
YorickKuindersma wants to merge 1 commit into
mainfrom
refactor/item-win-business-entity

Conversation

@YorickKuindersma
Copy link
Copy Markdown
Owner

Summary

Refactors ItemWin.w to replace legacy fat-client direct database access with the Business Entity architecture pattern as documented in doc/business-entity-pattern.md.

Changes

New Files

  • src/business/ItemDataset.i — Temp-table and dataset definition for the Item entity (ttItem, dsItem) with BEFORE-TABLE for change tracking
  • src/business/ItemEntity.cls — Business Entity class inheriting OpenEdge.BusinessLogic.BusinessEntity with:
    • GetItemByNumber() — Read operation using ReadData()
    • UpdateItem() — Update operation using UpdateData()
    • ValidateItem() — Validation logic (price != 0, total on-hand value <= 6000)

Modified Files

  • src/business/EntityFactory.cls — Added ItemEntity singleton management (GetItemEntity() method, cleanup in ResetInstances())
  • src/ItemWin.w — Refactored to:
    • Remove direct database FIND statements
    • Add USING statements for business entity classes
    • Include ItemDataset.i for dataset definitions
    • Use EntityFactory and ItemEntity for all data operations
    • Delegate validation to ItemEntity:ValidateItem()
    • Use TRACKING-CHANGES for update operations
    • Remove legacy database query definitions

What was removed from ItemWin.w

  • Direct FIND FIRST Item ... NO-LOCK / EXCLUSIVE-LOCK database access
  • Inline validation logic (moved to ItemEntity:ValidateItem())
  • Database query preprocessor definitions (INTERNAL-TABLES, QUERY-STRING, OPEN-QUERY)
  • Connected Databases reference

Resolves #1

- Create ItemDataset.i with temp-table definition for Item
- Create ItemEntity.cls with CRUD operations and validation
- Update EntityFactory.cls to include ItemEntity singleton
- Refactor ItemWin.w to use business entity layer instead of direct DB access

Resolves #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor ItemWin

1 participant