Class CheckDefinition

java.lang.Object
com.e1c.g5.v8.dt.internal.check.derived.CheckDefinition
All Implemented Interfaces:
ICheckDefinition

public final class CheckDefinition extends Object implements ICheckDefinition
Defines the check with the set of metainformation/processing logic The definition allows to define:
  • The unique identifier of the check
  • The set of check parameters
  • The check complexity
  • The check default severity
  • The reaction of the check on the model data changes with a set of context collectors
  • The data for the visual representation of the check in the check preferences management UI
  • Constructor Details

    • CheckDefinition

      public CheckDefinition()
      Constructs a check definition instance
  • Method Details

    • addCheckedLanguageObjects

      public void addCheckedLanguageObjects(Set<org.eclipse.emf.ecore.EClass> targetTypes)
      Description copied from interface: ICheckDefinition
      Adds a set of target language object types that will be searched within the module and supplied as contexts in subsequen calls of ICheck.check(Object, ICheckResultAcceptor, ICheckParameters, org.eclipse.core.runtime.IProgressMonitor) In order for the check to support language object validation, at least one checked object type should be supplied (usually it's a MODULE itself)
      Specified by:
      addCheckedLanguageObjects in interface ICheckDefinition
      Parameters:
      targetTypes - The set of target object types. May not be null
    • addCheckedModelObjects

      public void addCheckedModelObjects(org.eclipse.emf.ecore.EClass topObjectEClass, boolean topIsTarget, Set<org.eclipse.emf.ecore.EClass> containmentObjectEClasses)
      Description copied from interface: ICheckDefinition
      Defines a rebuild scope collector for the given type of the top object. All scope collectors associated with non-top model objects will be ignored during the work of the checking infrastructure. The developer should register at least one rebuild scope collector in order for the check to be able to participate in the model check process.
      Specified by:
      addCheckedModelObjects in interface ICheckDefinition
      Parameters:
      topObjectEClass - The EClass of the top object, may not be null
      topIsTarget - The flag that defines the participation of the top object itself in the check
      containmentObjectEClasses - The set of EClass'es of contained objects that are checked during the check process. May be not null
    • addDelegatedTypes

      public void addDelegatedTypes(Class<?>... checkedTypes)
      Description copied from interface: ICheckDefinition
      Adds types of objects provided by the delegating checks (see the ICheckResultAcceptor.delegateChecks(Iterable)) that are being handled by this check
      Specified by:
      addDelegatedTypes in interface ICheckDefinition
      Parameters:
      checkedTypes - The set object types that are delegated. May not be empty
    • addModelAssociationContextCollector

      public void addModelAssociationContextCollector(OnModelObjectAssociationContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass)
      Description copied from interface: ICheckDefinition
      Adds a collector of check contexts that is used to schedule the check in case of a new object with a given EClass is being added to the configuration.
      This collector will be called only in case if the corresponding EClass is either a top object EClass being declared via the ICheckDefinition.addCheckedModelObjects(EClass, boolean, Set) call or a containment object EClass being declared via the same method. This is done to prevent inefficient collectors to be registered with the check Multiple calls of this method for the same EClass are allowed, all collectors will be combined
      Specified by:
      addModelAssociationContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add. May not be null
      targetEClass - The EClass of an added object to track. May not be null
    • addGenericModelAssociationContextCollector

      public void addGenericModelAssociationContextCollector(OnModelObjectAssociationContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass, org.eclipse.emf.ecore.EClass... targetTopObjectEClasses)
      Description copied from interface: ICheckDefinition
      Adds a collector of check contexts that is used to schedule the check in case of a new object with a given EClass is being added to the configuration.
      Multiple calls of this method for the same EClass are allowed, all collectors will be combined
      Specified by:
      addGenericModelAssociationContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add. May not be null
      targetEClass - The EClass of an added object to track. May not be null
      targetTopObjectEClasses - Defines target top object EClass'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-object EClass These EClass'es must be declared via the ICheckDefinition.addCheckedModelObjects(EClass, boolean, Set) beforehand. May be empty in case of the targetEClass is a top-level object EClass
    • addModelRemovalContextCollector

      public void addModelRemovalContextCollector(OnModelObjectRemovalContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass)
      Description copied from interface: ICheckDefinition
      Adds a collector of check contexts that is used to schedule the check in case of an existing object with a given EClass is being removed from the configuration.
      This collector will be called only in case if the corresponding EClass is either a top object EClass being declared via the ICheckDefinition.addCheckedModelObjects(EClass, boolean, Set) call or a containment object EClass being declared via the same method. This is done to prevent inefficient collectors to be registered with the check Multiple calls of this method for the same EClass are allowed, all collectors are being collected
      Specified by:
      addModelRemovalContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add. May not be null
      targetEClass - The EClass of an added object to track. May not be null
    • addModelFeatureChangeContextCollector

      public void addModelFeatureChangeContextCollector(OnModelFeatureChangeContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass)
      Description copied from interface: ICheckDefinition
      Adds a collector of check contexts that is used to schedule the check in case of a feature changes of the EClass objects.
      This collector will be called only in case if the corresponding EClass is either a top object EClass being declared via the ICheckDefinition.addCheckedModelObjects(EClass, boolean, Set) call or a containment object EClass being declared via the same method. This is done to prevent inefficient collectors to be registered with the check Multiple calls of this method for the same EClass are allowed, all collectors are being collected
      Specified by:
      addModelFeatureChangeContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add. May not be null
      targetEClass - The EClass of an object which changed features we are going to track. May not be null
    • addGenericModelFeatureChangeContextCollector

      public void addGenericModelFeatureChangeContextCollector(OnModelFeatureChangeContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass, org.eclipse.emf.ecore.EClass... targetTopObjectEClasses)
      Description copied from interface: ICheckDefinition
      Adds a collector of check contexts that is used to schedule the check in case of a feature changes of the EClass objects.
      Multiple calls of this method for the same EClass are allowed, all collectors are being collected
      Specified by:
      addGenericModelFeatureChangeContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add. May not be null
      targetEClass - The EClass of an object which changed features we are going to track. May not be null
      targetTopObjectEClasses - Defines target top object EClass'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-object EClass These EClass'es must be declared via the ICheckDefinition.addCheckedModelObjects(EClass, boolean, Set) beforehand. May be empty in case of the targetEClass is a top-level object EClass
    • addParameterDefinition

      public void addParameterDefinition(CheckParameterDefinition checkParameterDescription)
      Description copied from interface: ICheckDefinition
      Adds a new parameter definition to the check configuration. See CheckParameterDefinition for details. Accepts only uniquely named parameters.
      Specified by:
      addParameterDefinition in interface ICheckDefinition
      Parameters:
      checkParameterDescription - The CheckParameterDefinition to add. May not be null
    • getCheckedContainmentEClasses

      public Set<org.eclipse.emf.ecore.EClass> getCheckedContainmentEClasses(org.eclipse.emf.ecore.EClass topObjectEClass)
      Gets the set of checked EClass'es for the given top object EClass.
      Parameters:
      topObjectEClass - The top object EClass. May not be null
      Returns:
      The set of checked object EClass'es. May not be null
    • getComplexity

      public CheckComplexity getComplexity()
      Gets the check complexity
      Returns:
      The check complexity. May not be null
    • getDefaultSeverity

      public IssueSeverity getDefaultSeverity()
      Gets the default issue severity
      Returns:
      The default issue severity as defined in the configuration. May not be null
    • getDelegateApplicabilityFilter

      public IDelegateApplicabilityFilter getDelegateApplicabilityFilter()
      Gets an additional fiter for the delegated check applicability
      Returns:
      The filter (if any). May be null
    • getDescription

      public String getDescription()
      Gets the check description to show in the check preferences
      Returns:
      The description of the check. May be null to indicate that the default description isn't defined via the check itself
    • getIssueType

      public IssueType getIssueType()
      Gets the issue type for issues being created by this check
      Returns:
      The issue type. May not be null
    • getLanguageResourceChangeContextCollector

      public OnLanguageResourceChangesContextCollector getLanguageResourceChangeContextCollector()
      Returns:
      The collector. May be null in case if the check doesn't participate in the resource change revalidation cycle with custom check context definition
    • getModelFeatureChangeContextCollectors

      public Collection<CheckDefinition.ContextCollectorWithTopObjectFilter<OnModelFeatureChangeContextCollector>> getModelFeatureChangeContextCollectors(org.eclipse.emf.ecore.EClass type)
      Gets defined OnModelFeatureChangeContextCollector's for the given EClass, if any
      Returns:
      The collection of collectors. May be empty in case if the check doesn't participate in the object change revalidation cycle. Never null
    • getModelObjectAssociationContextCollectors

      public Collection<CheckDefinition.ContextCollectorWithTopObjectFilter<OnModelObjectAssociationContextCollector>> getModelObjectAssociationContextCollectors(org.eclipse.emf.ecore.EClass type)
      Gets defined OnModelObjectAssociationContextCollector's for the given EClass, if any
      Returns:
      The collection of collectors. May be empty in case if the check doesn't participate in the object association revalidation cycle. Never null
    • getModelObjectRemovalContextCollectors

      public Collection<OnModelObjectRemovalContextCollector> getModelObjectRemovalContextCollectors(org.eclipse.emf.ecore.EClass type)
      Gets defined OnModelObjectRemovalContextCollector's for the given EClass, if any
      Returns:
      The collection of collectors. May be empty in case if the check doesn't participate in the object association revalidation cycle. Never null
    • getParameterDefinitions

      public Map<String,CheckParameterDefinition> getParameterDefinitions()
      Gets the parameter definition map for this check
      Returns:
      The CheckParameterDefinition mapped to their names. May not be null
    • getSupportedDelegateTypes

      public Collection<Class<?>> getSupportedDelegateTypes()
      Gets the set of delegated model types being supported by this definition
      Returns:
      The set of delegated model types. May not be null
    • getModelCheckTargetEClasses

      public Collection<org.eclipse.emf.ecore.EClass> getModelCheckTargetEClasses()
      Gets target EClass'es for model checks
      Returns:
      The set of EClass'es. May be empty
    • getResourceCheckTargetEClasses

      public Collection<org.eclipse.emf.ecore.EClass> getResourceCheckTargetEClasses()
      Gets target EClass'es for resource checks
      Returns:
      The set of EClass'es. May be empty
    • getContextCollectorTargets

      public Collection<org.eclipse.emf.ecore.EClass> getContextCollectorTargets()
      Gets top level target EClass'es for the context collection
      Returns:
      The set of top object EClass'es
    • getSupportedTopObjectEClasses

      public Collection<org.eclipse.emf.ecore.EClass> getSupportedTopObjectEClasses()
      Gets the set of supported top obect EClass'es that are handled by this definition
      Returns:
      The set of supported top object EClass'es. May not be null
    • getTargetLanguageObjectTypes

      public Set<org.eclipse.emf.ecore.EClass> getTargetLanguageObjectTypes()
      Gets the set of EClass'es that participate in the language module validation cycle. The corresponding check must be called only for objects of these types (in case if they are present within the module)
      Returns:
      The set of supported language object types. May not be null
    • getTitle

      public String getTitle()
      Gets the title of the check
      Returns:
      The check title. May be null
    • isCheckTarget

      public boolean isCheckTarget(org.eclipse.emf.ecore.EClass topObjectEClass)
      Checks if the given top object (defined by the EClass) is defined as a check target by this check
      Parameters:
      topObjectEClass - Top object EClass, may not be null
      Returns:
      True if the top object is a check target itself
    • isEnabled

      public boolean isEnabled()
      Checks if the check is enabled
      Returns:
      True if the check is enabled by default
    • isProtectedObjectCheckEnabled

      public boolean isProtectedObjectCheckEnabled()
      Checks if this definition enables the protected object check mode for the corresonding check
      Returns:
      True if the protected object check mode enabled
    • isCriticalDataIntegrityCheck

      public boolean isCriticalDataIntegrityCheck()
      Checks if this definition describes the critical data integrity check
      Returns:
      True if the check is a critical integrity check
    • setComplexity

      public void setComplexity(CheckComplexity complexity)
      Description copied from interface: ICheckDefinition
      Sets the complexity of the check. The check could be either normal (so not time/resource consuming) or complex. All normal checks are performed first followed by complex ones. In case if not set, the system automatically marks this check as normal
      Specified by:
      setComplexity in interface ICheckDefinition
      Parameters:
      complexity - The complexity to set. May not be null
    • setDefaultSeverity

      public void setDefaultSeverity(IssueSeverity severity)
      Description copied from interface: ICheckDefinition
      Sets the default severity of issues produced by this check. The issue has a default severity of IssueSeverity.MINOR in case if not set during the check configuration
      Specified by:
      setDefaultSeverity in interface ICheckDefinition
      Parameters:
      severity - The severity to set. May not be null
    • setDelegateApplianceFilter

      public void setDelegateApplianceFilter(IDelegateApplicabilityFilter filter)
      Description copied from interface: ICheckDefinition
      Sets an optional filter for any contexts for checks that delegated checking to subsidiary checks. See the IDelegateApplicabilityFilter for details
      Specified by:
      setDelegateApplianceFilter in interface ICheckDefinition
      Parameters:
      filter - The filter to set. May not be null
    • setDescription

      public void setDescription(String description)
      Description copied from interface: ICheckDefinition
      Sets the dispayable description of the check. May be left unitialized, in this case the system will check the corresponding resource with external description of the check. Please see the ICheckDefinition#setDescriptionStoreBundleIdentifier(String) for details
      Specified by:
      setDescription in interface ICheckDefinition
      Parameters:
      description - The description to set. May not be null
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: ICheckDefinition
      Sets the default enablement status for the check. In case if the check is expensive/situational, the developer could state that it should be enabled manually by the client to be able to perform. By default all checks are enabled
      Specified by:
      setEnabled in interface ICheckDefinition
      Parameters:
      enabled - True if the check is enabled by default, false otherwise
    • setIssueType

      public void setIssueType(IssueType issueType)
      Description copied from interface: ICheckDefinition
      Sets the type of issues this check is able to generate. May be left unitialized, in this case the issue type will be set to IssueType.WARNING
      Specified by:
      setIssueType in interface ICheckDefinition
      Parameters:
      issueType - The type of the issue. May not be null
    • setLanguageResourceChangeContextCollector

      public void setLanguageResourceChangeContextCollector(OnLanguageResourceChangesContextCollector collector)
      Description copied from interface: ICheckDefinition
      Adds a context collector that reacts on languge/resource changes. The developer could use these collectors to schedule checks that depends on the language module/resource state.
      Specified by:
      setLanguageResourceChangeContextCollector in interface ICheckDefinition
      Parameters:
      collector - The collector to add, may not be null
    • setTitle

      public void setTitle(String title)
      Description copied from interface: ICheckDefinition
      Sets the dispayable title of the check. May be left unitialized, in this case the title of the check will be taken from the check identifier
      Specified by:
      setTitle in interface ICheckDefinition
      Parameters:
      title - The title to set. May not be null
    • enableProtectedObjectCheck

      public void enableProtectedObjectCheck()
      Description copied from interface: ICheckDefinition
      Enables protected object check for the corresponding check. Checks aren't checking protected objects by default
      Specified by:
      enableProtectedObjectCheck in interface ICheckDefinition
    • markAsCriticalDataIntegrityCheck

      public void markAsCriticalDataIntegrityCheck()
      Description copied from interface: ICheckDefinition
      Marks the configured check as a critical data integrity check. Any marker being produced by such check is treated as a blocker for data exchange processes, like IB publication
      Specified by:
      markAsCriticalDataIntegrityCheck in interface ICheckDefinition
    • isTopObjectTarget

      public boolean isTopObjectTarget(org.eclipse.emf.ecore.EClass supportedType)
      Checks if the provided EClass is a top-level object target for the check
      Parameters:
      supportedType - The type to check. May not be null
      Returns:
      True if the type is a handled top-level object type