Common Refactoring Patterns
Common Refactoring Patterns
Overview
This page documents common refactoring patterns applied to all 5 modules during migration from Okapi to Eureka:
mod-entities-links
mod-kb-ebsco-java
mod-notes
mod-quick-marc
mod-search
Special Case: mod-kb-ebsco-java has additional unique changes (see there).
1. Granular Capabilities Update
Why This Changed?
Replaced wildcard *.all
permissions with granular capabilities. This change was necessary because *.all
was not consistently working (on Eureka).
Before & After Comparison
// BEFORE (Okapi - mod-notes example)
* table userPermissions
| name |
| 'notes.all' |
| 'configuration.entries.collection.get' |
| 'configuration.entries.item.post' |
| 'configuration.entries.item.delete' |
// AFTER (Eureka - mod-notes example)
* table userPermissions
| name |
| 'configuration.entries.collection.get' |
| 'configuration.entries.item.delete' |
| 'configuration.entries.item.post' |
| 'note.links.collection.get' |
| 'note.links.collection.put' |
| 'note.types.collection.get' |
| 'note.types.item.delete' |
| 'note.types.item.get' |
| 'note.types.item.post' |
| 'note.types.item.put' |
| 'notes.collection.get' |
| 'notes.item.get' |
| 'notes.item.post' |
| 'notes.item.put' |
2. x-okapi-tenant Header Enforcement
Critical Change
All requests MUST now include the tenant header for proper Eureka routing.
// BEFORE (Missing tenant header)
* def headersUser = {
'Content-Type': 'application/json',
'x-okapi-token': '#(okapitokenUser)',
'Accept': 'application/json'
}
// AFTER (With tenant header)
* def headersUser = {
'Content-Type': 'application/json',
'x-okapi-token': '#(okapitoken)',
'x-okapi-tenant': '#(testTenant)',
'Accept': '*/*'
}
Validation Checklist
Confirm all wildcard
*.all
permissions removedVerify
x-okapi-tenant
exists in 100% of requests
, multiple selections available,
Related content
Common Refactoring pattern
Common Refactoring pattern
More like this
Common Refactoring Patterns. Folijet team.
Common Refactoring Patterns. Folijet team.
More like this
Common Refactoring Patterns. Corsair team.
Common Refactoring Patterns. Corsair team.
More like this
Common Refactoring Patterns. Firebird team.
Common Refactoring Patterns. Firebird team.
More like this
edge-fqm: Refactoring guide
edge-fqm: Refactoring guide
Read with this
mod-fqm-manager: Refactoring guide
mod-fqm-manager: Refactoring guide
Read with this