Class MergeUtility
java.lang.Object
org.apache.sling.provisioning.model.MergeUtility
Utility for merging two models.
- Since:
- 1.4
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Options for specifying some parts of the merge operation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Merge the additional model into the base model.static void
merge
(Model base, Model additional, MergeUtility.MergeOptions options) Merge the additional model into the base model.static void
mergeComments
(Commentable base, Commentable additional) Merge the comments
-
Constructor Details
-
MergeUtility
public MergeUtility()
-
-
Method Details
-
merge
Merge the additional model into the base model.- Parameters:
base
- The base model.additional
- The additional model.
-
merge
Merge the additional model into the base model.Merging is performed feature by feature. Each feature is treated separately. If the base model does not have a feature from the additional model, the complete feature is added. If the base model has a feature which is not in the additional model, the feature is left as is.
For each feature, the following actions are performed:
- If either the base feature or the additional feature has a version, then the one with the higher version is used, the other one is skipped. A missing version is considered the lowest possible version.
- The feature type of the base feature is set to the type of the additional feature.
- All additional sections of the additional feature are added to the base feature.
- All variables from the additional feature are set on the base feature, overriding values if already present.
- Each run mode of the additional feature is merged into the base feature.
- Parameters:
base
- The base model.additional
- The additional model.options
- The merge options
-
mergeComments
Merge the comments- Parameters:
base
- The base model objectadditional
- The additional model object- Since:
- 1.9.0
-