Class RedirectCleaningService
java.lang.Object
sk.iway.iwcm.components.redirects.RedirectCleaningService
Analyzes unconditional exact redirects and executes the resulting immutable
cleaning plan.
Regular-expression redirects and redirects with either a
publication date or a validity end date are ignored.
Analysis selects preferred targets, breaks cycles, compresses chains, and
removes duplicates without recursive traversal or per-row database queries.
Every named domain is analyzed independently. Redirects with a
null
or empty domain form one additional independent domain scope.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult counters returned after executing a cleaning plan. -
Constructor Summary
ConstructorsConstructorDescriptionRedirectCleaningService(RedirectsRepository redirectsRepository) Creates the redirect cleaning service. -
Method Summary
Modifier and TypeMethodDescriptionsk.iway.iwcm.components.redirects.RedirectCleaningPlananalyze(int currentDomainId, boolean includeUnnamed) Loads exact redirects accessible from the selected domain and prepares a cleaning plan without modifying the database.execute(sk.iway.iwcm.components.redirects.RedirectCleaningPlan plan) Executes exactly the actions stored in a previously analyzed plan.
-
Constructor Details
-
RedirectCleaningService
Creates the redirect cleaning service.- Parameters:
redirectsRepository- repository used to load and modify redirects
-
-
Method Details
-
analyze
public sk.iway.iwcm.components.redirects.RedirectCleaningPlan analyze(int currentDomainId, boolean includeUnnamed) Loads exact redirects accessible from the selected domain and prepares a cleaning plan without modifying the database.- Parameters:
currentDomainId- selected application domain IDincludeUnnamed- whether the independent unnamed scope is included alongside the selected named domain- Returns:
- immutable cleaning plan
-
execute
@Transactional(transactionManager="webjet2022TransactionManager") public RedirectCleaningService.ExecutionResult execute(sk.iway.iwcm.components.redirects.RedirectCleaningPlan plan) Executes exactly the actions stored in a previously analyzed plan. Updates and deletes are grouped into batches of at most 500 identifiers. Records no longer accessible from the analyzed domain are skipped by repository queries.- Parameters:
plan- immutable plan to execute- Returns:
- counts of updated, deleted, and skipped records
-