Class PartBasedContextCollectorBuilder


  • public class PartBasedContextCollectorBuilder
    extends Object
    A convenience class allowing to describe behavior of a scope collector using a set of simple rules and then build an instance of IScopeCollector in compliance with these rules.
    See the usage example below.
     ICaseSpecificScopeCollector onFeatureBChangeScopeCollector = ...
    
     IScopeCollector scopeCollector =
         new ScopeCollectorBuilder(SOME_OBJECT_TYPE)
             .onAssociation().compute(PART_A, PART_B)
             .onChange(FEATURE_A)
                 .compute(PART_B)
                 .flowChildren(FEATURE_C).compute(PART_A, PART_B)
             .onChange(FEATURE_B).compute(onFeatureBChangeScopeCollector)
             .build();
     
    See Also:
    IContextCollector, ICaseSpecificContextCollector
    • Constructor Detail

      • PartBasedContextCollectorBuilder

        public PartBasedContextCollectorBuilder​(String segmentId,
                                                org.eclipse.emf.ecore.EClass supportedType)
        Constructs a new instance for the given BM object type.
        Parameters:
        segmentId - The default DD segment to be used for scope collection.
        supportedType - the BM object type to build scope collector for. Cannot be null.
    • Method Detail

      • build

        public IContextCollector build()
        Builds a scope collector instance in compliance with the previously specified rule set.
        Returns:
        the built scope collector
      • compute

        public PartBasedContextCollectorBuilder compute​(ICaseSpecificContextCollector customContextCollector)
        Says that in case of the previously specified event, the given custom scope collector must be invoked to define which parts of the previously specified object must be computed.
        Custom context collectors cannot be combined with standard ones (defined via other compute***(..) methods) or other custom context collectors. Use AggregatingContextCollector instead.
        Parameters:
        customContextCollector - the custom scope collector. Cannot be null.
        Returns:
        the reference to the current builder for method chaining
      • compute

        public PartBasedContextCollectorBuilder compute​(String... partIds)
        Says that in case of the previously specified event, the given parts of the previously specified object must be computed.
        Standard context collecting rules cannot be combined with custom ones (defined via compute(ICaseSpecificContextCollector) method).
        Parameters:
        partIds - the IDs of the derived data parts to compute
        Returns:
        the reference to the current builder for method chaining
      • computeInSegment

        public PartBasedContextCollectorBuilder computeInSegment​(String segmentId,
                                                                 String... partIds)
        Schedules async re-computation of the DD segment with the given set of parts.
        Standard context collecting rules cannot be combined with custom ones (defined via compute(ICaseSpecificContextCollector) method).
        Parameters:
        partIds - The set of parts for the re-computation.
        Returns:
        the reference to the current builder for method chaining
      • flowChildren

        public PartBasedContextCollectorBuilder flowChildren​(org.eclipse.emf.ecore.EReference reference)
        Says that in case of the previously specified event derived data must be computed for the children of the context object.
        Parameters:
        reference - a reference to the children
        Returns:
        the reference to the current builder for method chaining
      • flowCollectionAffectedElements

        public PartBasedContextCollectorBuilder flowCollectionAffectedElements()
        Says that in case of the previously specified event derived data must be computed for the affected elements of collection.
        Returns:
        the reference to the current builder for method chaining
      • flowCollectionRemovedElements

        public PartBasedContextCollectorBuilder flowCollectionRemovedElements()
        Says that in case of the previously specified event derived data must be computed for the removed elements of collection.
        Returns:
        the reference to the current builder for method chaining
      • flowContainer

        public PartBasedContextCollectorBuilder flowContainer()
        Says that in case of the previously specified event derived data must be computed for the direct container of the context object.
        Returns:
        the reference to the current builder for method chaining
      • flowContainer

        public PartBasedContextCollectorBuilder flowContainer​(int distance)
        Says that in case of the previously specified event derived data must be computed for the container of the context object.
        Parameters:
        distance - the distance to the container. If distance is 1, it means that the derived data must be computed for the direct container, if 2, for the container of the container, and so on
        Returns:
        the reference to the current builder for method chaining
      • onAssociation

        public PartBasedContextCollectorBuilder onAssociation()
        Says to start a rule of derived data computation in case on object association.
        Returns:
        the reference to the current builder for method chaining
      • onChange

        public PartBasedContextCollectorBuilder onChange​(org.eclipse.emf.ecore.EStructuralFeature feature)
        Says to start a rule of derived data computation in case of given feature change.
        Parameters:
        feature - the feature
        Returns:
        the reference to the current builder for method chaining
      • onChange

        public PartBasedContextCollectorBuilder onChange​(org.eclipse.emf.ecore.EStructuralFeature... features)
        Collects scope on change of any feature from the provided set. This is a convinience method to define similar scope collecting rules.
        Parameters:
        features - The set of features.
        Returns:
        the reference to the current builder for method chaining
      • onFullRebuild

        public PartBasedContextCollectorBuilder onFullRebuild()
        Says to start a rule of derived data computation in case of full object rebuild request.
        Returns:
        the reference to the current builder for method chaining
      • onBinaryChange

        public PartBasedContextCollectorBuilder onBinaryChange()
        Says to start a rule of derived data computation in case of binary attachment change.
        Returns:
        the reference to the current builder for method chaining
      • onRemoval

        public PartBasedContextCollectorBuilder onRemoval()
        Says to start a rule of derived data computation in case of object removal.
        Returns:
        the reference to the current builder for method chaining
      • segment

        public PartBasedContextCollectorBuilder segment​(String segmentId)
        Sets active DD segments for the current builder. All next scope definitions are being collected for this segment.
        Parameters:
        segmentId - The DD segment to set. Cannot be null
        Returns:
        the reference to the current builder for method chaining