Interface DeltaGeneration
Provide means to determine which parts of a site (project) should be re-generated respecting the changes between two revisions. This is only supported for projects where useRelease()
istrue
Create an instance via DeploymentUtil.createDeltaGeneration(context)
, then use the fluent api to configure the instance and finally call calculateChangeSet()
and configure thegenerate task from this change set ( changeSet.configureGenerateTask(generateTask
).
Set the dependency rules
if you want others than the default dependency rules
to be obeyed:
deltaGeneration.dependencyRules
(EnumSet.of(DependencyRule.PROPAGATE_PAGE_CHANGES_CASCADING
, ..));
Level rules
describe which part of a site should be generated if there are changesin the rendered navigation.
After configuration the change set is calculated:
ChangeSet
changeSet = deltaGeneration.calculateChangeSet()
;
Then configure the next generate task so that the calculated change set is generated:
changeSet. configureGenerateTask()
.
- Since:
- 5.0.26
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Change set wrapping the calculated changes of aDeltaGeneration
.static interface
Info describing a deleted page. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Set<DependencyRule>
Default dependency rules, containing:PROPAGATE_PAGE_CHANGES
PROPAGATE_SECTION_CHANGES
PROPAGATE_MEDIA_CHANGES_TO_PAGESTORE
PROPAGATE_MEDIA_CHANGES_TO_SITESTORE
UPDATE_PAGEREF_WHEN_ENTITY_HAS_CHANGED
static final String
Property name containing the revision id of last delta generation process (typeLong
). -
Method Summary
Modifier and TypeMethodDescription@NotNull DeltaGeneration.ChangeSet
Calculate the change set based on the current settings.@NotNull DeltaGeneration
dependencyRules
(@NotNull EnumSet<DependencyRule> dependencyRules) The dependency rules which will be obeyed whencalculating the change set
.int
getLevelRule
(int level) Get the depth of the level to re-generate when a folder at the provided level has changed.@NotNull DeltaGeneration
levelRule
(int navLevelMin, int navLevelMax) A level rule which will be obeyed whencalculating the change set
.
-
Field Details
-
DELTA_GENERATION_LAST_EXECUTION
Property name containing the revision id of last delta generation process (typeLong
). This is stored as(persistent) variable in the schedule context
andis overridden when configuring a new delta generation. A backup of the (old) value is then available as(non-persistent) schedule property
. There is no value available for the first execution of a new schedule entry (i.e.schedulContext.getVariableValue(DELTA_GENERATION_LAST_EXECUTION) == null
).- Since:
- 5.0.26
- See Also:
-
DEFAULT_DEPENDENCY_RULES
Default dependency rules, containing:- Since:
- 5.0.26
-
-
Method Details
-
dependencyRules
@NotNull @NotNull DeltaGeneration dependencyRules(@NotNull @NotNull EnumSet<DependencyRule> dependencyRules) The dependency rules which will be obeyed whencalculating the change set
.- Parameters:
dependencyRules
- Dependency rules to obey when calculating the change set.- Returns:
- The current instance (to allow fluent calls).
- Since:
- 5.0.26
-
levelRule
A level rule which will be obeyed whencalculating the change set
.
A level rule matches navigation changes between levelnavLevelMin
andnavLevelMax
(inclusive). Level counting starts with zero, so either parameter should be at least zero, andnavLevelMin
should be equal or less thannavLevelMax
.
If a site store folder in the given range has changed then the corresponding sub tree starting at levelnavLevelMin
is marked as "should be re-generated".
You can add multiple level rules if they do not overlap (overlaps will result in anIllegalArgumentException
.
Example:
If the main navigation which is displayed on every page includes level 0 and 1, you should add the level rule [0, 1]. This would force a full generate process for any change in the top two site store levels by adding, changing or removing a top or second level navigation point. If you have also a second level navigation displaying level 2 to 4, you should add a level rule [2, 4], so that any change in the navigation of level 2, 3, and 4 will force generating the entire sub tree containing this change, starting at level 2. Example code for this isChangeSet
changeSet =DeploymentUtil.createDeltaGeneration(context)
.levelRule(0, 1) .levelRule(2, 4) ... .calculateChangeSet()
;- Parameters:
navLevelMin
- Min level of the rule to add, should be not be greater thannavLevelMax
, zero denotes the root level.navLevelMax
- Max level of the rule to add, should be not be less thannavLevelMin
, zero denotes the root level.- Returns:
- The current instance (to allow fluent calls).
- Throws:
IllegalArgumentException
- Thrown ifnavLevelMin > navLevelMax
or if there is already a level rule declared for the providedrange.- Since:
- 5.0.26
- See Also:
-
getLevelRule
int getLevelRule(int level) Get the depth of the level to re-generate when a folder at the provided level has changed.If no explicit level rule for the requested level has been specified, then
-1
will be returned.If a
level rule
has been specified for the requested level, than the"minimum level" for the corresponding rule is returned. E.g. for "level rule 1 - 3" and a requested level of 1, 2, or 3 the returned level is1
.- Parameters:
level
- Level (i.e. distance from root).- Returns:
- The level of the folder to re-generate when a node at the provided level has changed or
-1
ifno level rule was set for the provided level. - Since:
- 5.0.26
- See Also:
-
calculateChangeSet
Calculate the change set based on the current settings.- Returns:
- The calculated change set.
- Since:
- 5.0.26
-