When a report or list page has both an Entity-based version (existing, slower) and a DTO-based version (optimized, per DTO Implementation Guidelines), expose them as two separate navigation entries rather than a toggle inside one page.
- Separate navigation entries for Entity and DTO versions
- Example: "Transfer Reports (Entity)" and "Transfer Reports (DTO)"
- Double the navigation buttons, but clearer separation of concerns
- Each page has single purpose - either Entity OR DTO, not both
- Simple Fill button on each page - no switching within page
- Entity page: Contains only entity-based Fill button and entity-specific actions
- DTO page: Contains only DTO-based Fill button and DTO-specific actions
- No cross-navigation buttons within pages - navigation choice made at menu level
- Clear page headers indicating which approach (Entity vs DTO)
- Original page:
feature_name.xhtml(Entity-based for backward compatibility) - DTO page:
feature_name_dto.xhtml(DTO-based, optimized) - Navigation labels: "Feature Name" and "Feature Name (DTO - Recommended)"
- DTO approach should be the default where applicable
- Label DTO version clearly in navigation to indicate it's the recommended approach
- Maintain entity version for backward compatibility and business logic needs
Navigation Configuration (pharmacy_analytics.xhtml):
<!-- Entity Version - Traditional -->
<p:commandButton rendered="#{configOptionApplicationController.getBooleanValueByKey('Pharmacy Analytics - Show Transfer Issue by Bill')}"
value="Transfer Issue by Bill (Entity)"
action="#{reportsTransfer.navigateToTransferIssueByBill}"
ajax="false"
icon="fa fa-file-export"
class="w-100"/>
<!-- DTO Version - Recommended (defaults to enabled) -->
<p:commandButton rendered="#{configOptionApplicationController.getBooleanValueByKey('Pharmacy Analytics - Show Transfer Issue by Bill (DTO)', true)}"
value="Transfer Issue by Bill (DTO - Fast)"
action="/pharmacy/reports/disbursement_reports/pharmacy_report_transfer_issue_bill_dto?faces-redirect=true"
ajax="false"
icon="fa fa-rocket"
class="w-100 ui-button-success"
title="High-performance DTO-based report - Recommended"/>Configuration Key Pattern:
- Entity version:
'Feature Name'(existing configuration) - DTO version:
'Feature Name (DTO)'withtrueas default value - This allows administrators to disable DTO versions if needed while defaulting to enabled
Resulting Navigation Menu Structure:
Pharmacy Analytics → Disbursement Reports
├── Transfer Issue by Bill (Entity) → pharmacy_report_transfer_issue_bill.xhtml
└── Transfer Issue by Bill (DTO - Fast) → pharmacy_report_transfer_issue_bill_dto.xhtml
Entity Page Content:
- Single "Fill" button →
fillDepartmentTransfersIssueByBillEntity() - Excel/Print buttons specific to entity data
- Uses
#{reportsTransfer.transferBills}for data binding
DTO Page Content:
- Single "Fill" button →
fillDepartmentTransfersIssueByBillDto() - Excel/Print buttons specific to DTO data
- Uses
#{reportsTransfer.transferIssueDtos}for data binding
Controller Structure:
// Keep both properties for backward compatibility
private List<Bill> transferBills; // For entity approach
private List<PharmacyTransferIssueDTO> transferIssueDtos; // For DTO approach
// Separate methods for each approach
public void fillDepartmentTransfersIssueByBillEntity() { ... }
public void fillDepartmentTransfersIssueByBillDto() { ... }
// Navigation control method
public boolean isTransferIssueDtoEnabled() { return true; }Benefits of Navigation-Level Selection:
- Clear user choice before entering report
- No switching confusion within pages
- Easy configuration control via controller methods
- Gradual migration path - can disable DTO option if needed
- Performance awareness - users can choose fast DTO version consciously