refactor(reindex): convert ReindexEntry to Immutables value object (#34934)#35391
refactor(reindex): convert ReindexEntry to Immutables value object (#34934)#35391fabrizzio-dotCMS merged 4 commits intomainfrom
Conversation
…34934) Replaces the mutable POJO with a @Value.Immutable abstract class using @value.Style(init = "set*") to preserve the existing builder API surface. Equals/hashCode match the original semantics (identToIndex, priority, delete, serverId) via @Value.Auxiliary on id, lastResult, and timeEntered. Updates both creation sites in ReindexQueueFactory to use ImmutableReindexEntry.builder(). Refs: #34934 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @fabrizzio-dotCMS's task in 2m 26s —— View job PR Review
Overall the conversion is clean and the Immutables setup is correct. A few issues worth addressing: 1.
|
…yle(init = "set*") @value.Style(init = "set*") generated setIsDelete() for isDelete(), not setDelete() — causing CI compilation failure. Remove the style annotation and adopt Immutables default fluent naming (id/identToIndex/isDelete…). Remove dead toString() override (Immutables generates its own). Update ReindexQueueFactory call sites and ReindexQueueAPITest accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getFailedReindexRecords() selects failed entries without dist_action — those records are never deletes, so false is the correct default. Using @Value.Default preserves the .isDelete(boolean) setter in the builder so mapToReindexEntry() can still set true for DELETE actions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…) factory - Add @OverRide toString() that preserves the original log format: IndexJournal [id=..., identToIndex=..., priority=..., delete=..., serverId=...] - Replace direct ImmutableReindexEntry.builder() calls in ReindexQueueFactory with ReindexEntry.builder() to keep the generated class encapsulated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
ReindexEntryfrom a mutable POJO to a@Value.Immutableabstract classidentToIndex,priority,delete,serverId) via@Value.Auxiliaryonid,lastResult, andtimeEnteredReindexQueueFactoryto useImmutableReindexEntry.builder()...build()serverIdwas never set anywhere in production code — now correctly documented as@NullableisReindex()anderrorCount()preserved as concrete methods on the abstract classtoString()preserved with identical format to the originalNotes
mock(ReindexEntry.class)inReindexQueueAPITestcontinues to work — Mockito supports abstract classesImmutableReindexEntryis generated by the Immutables annotation processor at compile timeTest plan
./mvnw install -pl :dotcms-core -DskipTests— verifies annotation processor generatesImmutableReindexEntry./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dit.test=ReindexQueueAPITest./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dit.test=ReindexAPITestRefs: #34934
🤖 Generated with Claude Code
This PR fixes: #34934