Class CheckDefinition
java.lang.Object
com.e1c.g5.v8.dt.internal.check.derived.CheckDefinition
- All Implemented Interfaces:
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCheckedLanguageObjects
(Set<org.eclipse.emf.ecore.EClass> targetTypes) Adds a set of target language object types that will be searched within the module and supplied as contexts in subsequen calls ofICheck.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)void
addCheckedModelObjects
(org.eclipse.emf.ecore.EClass topObjectEClass, boolean topIsTarget, Set<org.eclipse.emf.ecore.EClass> containmentObjectEClasses) Defines a rebuild scope collector for the given type of the top object.void
addDelegatedTypes
(Class<?>... checkedTypes) Adds types of objects provided by the delegating checks (see theICheckResultAcceptor.delegateChecks(Iterable)
) that are being handled by this checkvoid
addGenericModelAssociationContextCollector
(OnModelObjectAssociationContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass, org.eclipse.emf.ecore.EClass... targetTopObjectEClasses) Adds a collector of check contexts that is used to schedule the check in case of a new object with a givenEClass
is being added to the configuration.
Multiple calls of this method for the sameEClass
are allowed, all collectors will be combinedvoid
addGenericModelFeatureChangeContextCollector
(OnModelFeatureChangeContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass, org.eclipse.emf.ecore.EClass... targetTopObjectEClasses) Adds a collector of check contexts that is used to schedule the check in case of a feature changes of theEClass
objects.
Multiple calls of this method for the sameEClass
are allowed, all collectors are being collectedvoid
addModelAssociationContextCollector
(OnModelObjectAssociationContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass) Adds a collector of check contexts that is used to schedule the check in case of a new object with a givenEClass
is being added to the configuration.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
being declared via the same method.void
addModelFeatureChangeContextCollector
(OnModelFeatureChangeContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass) Adds a collector of check contexts that is used to schedule the check in case of a feature changes of theEClass
objects.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
being declared via the same method.void
addModelRemovalContextCollector
(OnModelObjectRemovalContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass) Adds a collector of check contexts that is used to schedule the check in case of an existing object with a givenEClass
is being removed from the configuration.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
being declared via the same method.void
addParameterDefinition
(CheckParameterDefinition checkParameterDescription) Adds a new parameter definition to the check configuration.void
Enables protected object check for the corresponding check.Set<org.eclipse.emf.ecore.EClass>
getCheckedContainmentEClasses
(org.eclipse.emf.ecore.EClass topObjectEClass) Gets the set of checkedEClass
'es for the given top objectEClass
.Gets the check complexityCollection<org.eclipse.emf.ecore.EClass>
Gets top level targetEClass
'es for the context collectionGets the default issue severityGets an additional fiter for the delegated check applicabilityGets the check description to show in the check preferencesGets the issue type for issues being created by this checkGets definedOnLanguageResourceChangesContextCollector
, if anyCollection<org.eclipse.emf.ecore.EClass>
Gets targetEClass
'es for model checksCollection<CheckDefinition.ContextCollectorWithTopObjectFilter<OnModelFeatureChangeContextCollector>>
getModelFeatureChangeContextCollectors
(org.eclipse.emf.ecore.EClass type) Gets definedOnModelFeatureChangeContextCollector
's for the givenEClass
, if anyCollection<CheckDefinition.ContextCollectorWithTopObjectFilter<OnModelObjectAssociationContextCollector>>
getModelObjectAssociationContextCollectors
(org.eclipse.emf.ecore.EClass type) Gets definedOnModelObjectAssociationContextCollector
's for the givenEClass
, if anygetModelObjectRemovalContextCollectors
(org.eclipse.emf.ecore.EClass type) Gets definedOnModelObjectRemovalContextCollector
's for the givenEClass
, if anyGets the parameter definition map for this checkCollection<org.eclipse.emf.ecore.EClass>
Gets targetEClass
'es for resource checksCollection<Class<?>>
Gets the set of delegated model types being supported by this definitionCollection<org.eclipse.emf.ecore.EClass>
Gets the set of supported top obectEClass
'es that are handled by this definitionSet<org.eclipse.emf.ecore.EClass>
Gets the set ofEClass
'es that participate in the language module validation cycle.getTitle()
Gets the title of the checkboolean
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 checkboolean
Checks if this definition describes the critical data integrity checkboolean
Checks if the check is enabledboolean
Checks if this definition enables the protected object check mode for the corresonding checkboolean
isTopObjectTarget
(org.eclipse.emf.ecore.EClass supportedType) Checks if the providedEClass
is a top-level object target for the checkvoid
Marks the configured check as a critical data integrity check.void
setComplexity
(CheckComplexity complexity) Sets the complexity of the check.void
setDefaultSeverity
(IssueSeverity severity) Sets the default severity of issues produced by this check.void
Sets an optional filter for any contexts for checks that delegated checking to subsidiary checks.void
setDescription
(String description) Sets the dispayable description of the check.void
setEnabled
(boolean enabled) Sets the default enablement status for the check.void
setIssueType
(IssueType issueType) Sets the type of issues this check is able to generate.void
Adds a context collector that reacts on languge/resource changes.void
Sets the dispayable title of the check.
-
Constructor Details
-
CheckDefinition
public CheckDefinition()Constructs a check definition instance
-
-
Method Details
-
addCheckedLanguageObjects
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 ofICheck.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 interfaceICheckDefinition
- Parameters:
targetTypes
- The set of target object types. May not benull
-
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 interfaceICheckDefinition
- Parameters:
topObjectEClass
- TheEClass
of the top object, may not benull
topIsTarget
- The flag that defines the participation of the top object itself in the checkcontainmentObjectEClasses
- The set ofEClass
'es of contained objects that are checked during the check process. May be notnull
-
addDelegatedTypes
Description copied from interface:ICheckDefinition
Adds types of objects provided by the delegating checks (see theICheckResultAcceptor.delegateChecks(Iterable)
) that are being handled by this check- Specified by:
addDelegatedTypes
in interfaceICheckDefinition
- 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 givenEClass
is being added to the configuration.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
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 sameEClass
are allowed, all collectors will be combined- Specified by:
addModelAssociationContextCollector
in interfaceICheckDefinition
- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an added object to track. May not benull
-
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 givenEClass
is being added to the configuration.
Multiple calls of this method for the sameEClass
are allowed, all collectors will be combined- Specified by:
addGenericModelAssociationContextCollector
in interfaceICheckDefinition
- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an added object to track. May not benull
targetTopObjectEClasses
- Defines target top objectEClass
'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-objectEClass
TheseEClass
'es must be declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
beforehand. May be empty in case of the targetEClass is a top-level objectEClass
-
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 givenEClass
is being removed from the configuration.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
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 sameEClass
are allowed, all collectors are being collected- Specified by:
addModelRemovalContextCollector
in interfaceICheckDefinition
- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an added object to track. May not benull
-
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 theEClass
objects.
This collector will be called only in case if the correspondingEClass
is either a top objectEClass
being declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
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 sameEClass
are allowed, all collectors are being collected- Specified by:
addModelFeatureChangeContextCollector
in interfaceICheckDefinition
- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an object which changed features we are going to track. May not benull
-
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 theEClass
objects.
Multiple calls of this method for the sameEClass
are allowed, all collectors are being collected- Specified by:
addGenericModelFeatureChangeContextCollector
in interfaceICheckDefinition
- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an object which changed features we are going to track. May not benull
targetTopObjectEClasses
- Defines target top objectEClass
'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-objectEClass
TheseEClass
'es must be declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)
beforehand. May be empty in case of the targetEClass is a top-level objectEClass
-
addParameterDefinition
Description copied from interface:ICheckDefinition
Adds a new parameter definition to the check configuration. SeeCheckParameterDefinition
for details. Accepts only uniquely named parameters.- Specified by:
addParameterDefinition
in interfaceICheckDefinition
- Parameters:
checkParameterDescription
- TheCheckParameterDefinition
to add. May not benull
-
getCheckedContainmentEClasses
public Set<org.eclipse.emf.ecore.EClass> getCheckedContainmentEClasses(org.eclipse.emf.ecore.EClass topObjectEClass) Gets the set of checkedEClass
'es for the given top objectEClass
.- Parameters:
topObjectEClass
- The top objectEClass
. May not benull
- Returns:
- The set of checked object
EClass
'es. May not benull
-
getComplexity
Gets the check complexity- Returns:
- The check complexity. May not be
null
-
getDefaultSeverity
Gets the default issue severity- Returns:
- The default issue severity as defined in the configuration. May not be
null
-
getDelegateApplicabilityFilter
Gets an additional fiter for the delegated check applicability- Returns:
- The filter (if any). May be
null
-
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
Gets the issue type for issues being created by this check- Returns:
- The issue type. May not be
null
-
getLanguageResourceChangeContextCollector
Gets definedOnLanguageResourceChangesContextCollector
, if any- 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 definedOnModelFeatureChangeContextCollector
's for the givenEClass
, 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 definedOnModelObjectAssociationContextCollector
's for the givenEClass
, 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 definedOnModelObjectRemovalContextCollector
's for the givenEClass
, 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
Gets the parameter definition map for this check- Returns:
- The
CheckParameterDefinition
mapped to their names. May not benull
-
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
Gets targetEClass
'es for model checks- Returns:
- The set of
EClass
'es. May be empty
-
getResourceCheckTargetEClasses
Gets targetEClass
'es for resource checks- Returns:
- The set of
EClass
'es. May be empty
-
getContextCollectorTargets
Gets top level targetEClass
'es for the context collection- Returns:
- The set of top object
EClass
'es
-
getSupportedTopObjectEClasses
Gets the set of supported top obectEClass
'es that are handled by this definition- Returns:
- The set of supported top object
EClass
'es. May not benull
-
getTargetLanguageObjectTypes
Gets the set ofEClass
'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
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 objectEClass
, may not benull
- 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
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 interfaceICheckDefinition
- Parameters:
complexity
- The complexity to set. May not benull
-
setDefaultSeverity
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 interfaceICheckDefinition
- Parameters:
severity
- The severity to set. May not benull
-
setDelegateApplianceFilter
Description copied from interface:ICheckDefinition
Sets an optional filter for any contexts for checks that delegated checking to subsidiary checks. See theIDelegateApplicabilityFilter
for details- Specified by:
setDelegateApplianceFilter
in interfaceICheckDefinition
- Parameters:
filter
- The filter to set. May not benull
-
setDescription
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 theICheckDefinition#setDescriptionStoreBundleIdentifier(String)
for details- Specified by:
setDescription
in interfaceICheckDefinition
- Parameters:
description
- The description to set. May not benull
-
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 interfaceICheckDefinition
- Parameters:
enabled
- True if the check is enabled by default, false otherwise
-
setIssueType
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 toIssueType.WARNING
- Specified by:
setIssueType
in interfaceICheckDefinition
- Parameters:
issueType
- The type of the issue. May not benull
-
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 interfaceICheckDefinition
- Parameters:
collector
- The collector to add, may not benull
-
setTitle
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 interfaceICheckDefinition
- Parameters:
title
- The title to set. May not benull
-
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 interfaceICheckDefinition
-
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 interfaceICheckDefinition
-
isTopObjectTarget
public boolean isTopObjectTarget(org.eclipse.emf.ecore.EClass supportedType) Checks if the providedEClass
is a top-level object target for the check- Parameters:
supportedType
- The type to check. May not benull
- Returns:
- True if the type is a handled top-level object type
-