Class CalendarSyncUidUpgradePlugin
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
EXO-89497 added SYNC_UID together with the guard in
CalendarDAO.create that mints one for every new calendar. It did not
migrate what was already stored, and nothing since can: the service copies
the stored value back over whatever a caller passes, so a null stays null,
and the DAO mints only on create. A calendar older than that commit would
therefore never carry an anchor.
That matters because the anchor is what an integration binds to — the CalDAV connector deliberately binds by it rather than by id, since an id does not survive a restore that renumbers. A calendar with no anchor is excluded from synchronisation entirely, and the calendar this hits hardest is the user's default one, which holds most of their events.
A fresh database needs none of this. Every deployment upgrading across EXO-89497 does, because every user has a default calendar created long before it.
-
Field Summary
Fields inherited from class org.exoplatform.commons.upgrade.UpgradeProductPlugin
asyncUpgradeExecution, executeOnlyOnce, OLD_PRODUCT_GROUP_ID, oldProductGroupId, PRODUCT_GROUP_ID, productGroupId, targetVersion, UPGRADE_COMPLETED_STATUS, UPGRADE_PLUGIN_ASYNC, UPGRADE_PLUGIN_ENABLE, UPGRADE_PLUGIN_EXECUTE_ONCE_PARAMETER, UPGRADE_PLUGIN_EXECUTION_ORDER, UPGRADE_PLUGIN_TARGET_PARAMETERFields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
ConstructorsConstructorDescriptionCalendarSyncUidUpgradePlugin(org.exoplatform.commons.persistence.impl.EntityManagerService entityManagerService, org.exoplatform.container.xml.InitParams initParams) -
Method Summary
Modifier and TypeMethodDescriptionintmintAnchor(long id) Writes an anchor onto one calendar.nextPage()One page of calendars still missing an anchor.voidprocessUpgrade(String oldVersion, String newVersion) Mints an anchor for every calendar lacking one.booleanshouldProceedToUpgrade(String newVersion, String previousVersion) Whether this upgrade has anything to do.Methods inherited from class org.exoplatform.commons.upgrade.UpgradeProductPlugin
afterUpgrade, beforeUpgrade, equals, getPluginExecutionOrder, getProductGroupId, getTargetVersion, getValue, hashCode, isAsyncUpgradeExecution, isEnabled, isExecuteOnlyOnce, shouldProceedToUpgrade, storeValueForPluginMethods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Constructor Details
-
CalendarSyncUidUpgradePlugin
public CalendarSyncUidUpgradePlugin(org.exoplatform.commons.persistence.impl.EntityManagerService entityManagerService, org.exoplatform.container.xml.InitParams initParams) - Parameters:
entityManagerService- the shared entity managerinitParams- the plugin's declared parameters
-
-
Method Details
-
shouldProceedToUpgrade
Whether this upgrade has anything to do.A first installation is skipped: its calendars are all created through the DAO that already mints anchors, so there is nothing older to repair.
- Overrides:
shouldProceedToUpgradein classorg.exoplatform.commons.upgrade.UpgradeProductPlugin- Parameters:
newVersion- the version being upgraded topreviousVersion- the version being upgraded from, blank on a first installation- Returns:
- true when this is an upgrade rather than an installation
-
processUpgrade
Mints an anchor for every calendar lacking one.- Specified by:
processUpgradein classorg.exoplatform.commons.upgrade.UpgradeProductPlugin- Parameters:
oldVersion- the version being upgraded fromnewVersion- the version being upgraded to
-
nextPage
One page of calendars still missing an anchor.- Returns:
- their identifiers, empty when none are left
-
mintAnchor
public int mintAnchor(long id) Writes an anchor onto one calendar.- Parameters:
id- the calendar to repair- Returns:
- 1 when it was given one, 0 when it already had one
-