Class MergeUtility
- java.lang.Object
-
- org.apache.sling.provisioning.model.MergeUtility
-
public abstract class MergeUtility extends java.lang.Object
Utility for merging two models.- Since:
- 1.4
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MergeUtility.MergeOptions
Options for specifying some parts of the merge operation.
-
Constructor Summary
Constructors Constructor Description MergeUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
merge(Model base, Model additional)
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
-
-
-
Method Detail
-
merge
public static void merge(Model base, Model additional)
Merge the additional model into the base model.- Parameters:
base
- The base model.additional
- The additional model.
-
merge
public static void merge(Model base, Model additional, MergeUtility.MergeOptions options)
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
public static void mergeComments(Commentable base, Commentable additional)
Merge the comments- Parameters:
base
- The base model objectadditional
- The additional model object- Since:
- 1.9.0
-
-