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 TypeMethodDescriptionvoidaddCheckedLanguageObjects(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)voidaddCheckedModelObjects(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.voidaddDelegatedTypes(Class<?>... checkedTypes) Adds types of objects provided by the delegating checks (see theICheckResultAcceptor.delegateChecks(Iterable)) that are being handled by this checkvoidaddGenericModelAssociationContextCollector(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 givenEClassis being added to the configuration.
Multiple calls of this method for the sameEClassare allowed, all collectors will be combinedvoidaddGenericModelFeatureChangeContextCollector(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 theEClassobjects.
Multiple calls of this method for the sameEClassare allowed, all collectors are being collectedvoidaddModelAssociationContextCollector(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 givenEClassis being added to the configuration.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing declared via the same method.voidaddModelFeatureChangeContextCollector(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 theEClassobjects.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing declared via the same method.voidaddModelRemovalContextCollector(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 givenEClassis being removed from the configuration.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing declared via the same method.voidaddParameterDefinition(CheckParameterDefinition checkParameterDescription) Adds a new parameter definition to the check configuration.voidEnables 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 checkbooleanisCheckTarget(org.eclipse.emf.ecore.EClass topObjectEClass) Checks if the given top object (defined by the EClass) is defined as a check target by this checkbooleanChecks if this definition describes the critical data integrity checkbooleanChecks if the check is enabledbooleanChecks if this definition enables the protected object check mode for the corresonding checkbooleanisTopObjectTarget(org.eclipse.emf.ecore.EClass supportedType) Checks if the providedEClassis a top-level object target for the checkvoidMarks the configured check as a critical data integrity check.voidsetComplexity(CheckComplexity complexity) Sets the complexity of the check.voidsetDefaultSeverity(IssueSeverity severity) Sets the default severity of issues produced by this check.voidSets an optional filter for any contexts for checks that delegated checking to subsidiary checks.voidsetDescription(String description) Sets the dispayable description of the check.voidsetEnabled(boolean enabled) Sets the default enablement status for the check.voidsetIssueType(IssueType issueType) Sets the type of issues this check is able to generate.voidAdds a context collector that reacts on languge/resource changes.voidSets the dispayable title of the check.
-
Constructor Details
-
CheckDefinition
public CheckDefinition()Constructs a check definition instance
-
-
Method Details
-
addCheckedLanguageObjects
Description copied from interface:ICheckDefinitionAdds 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:
addCheckedLanguageObjectsin 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:ICheckDefinitionDefines 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:
addCheckedModelObjectsin interfaceICheckDefinition- Parameters:
topObjectEClass- TheEClassof the top object, may not benulltopIsTarget- 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:ICheckDefinitionAdds types of objects provided by the delegating checks (see theICheckResultAcceptor.delegateChecks(Iterable)) that are being handled by this check- Specified by:
addDelegatedTypesin 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:ICheckDefinitionAdds a collector of check contexts that is used to schedule the check in case of a new object with a givenEClassis being added to the configuration.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing 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 sameEClassare allowed, all collectors will be combined- Specified by:
addModelAssociationContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add. May not benulltargetEClass- TheEClassof 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:ICheckDefinitionAdds a collector of check contexts that is used to schedule the check in case of a new object with a givenEClassis being added to the configuration.
Multiple calls of this method for the sameEClassare allowed, all collectors will be combined- Specified by:
addGenericModelAssociationContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add. May not benulltargetEClass- TheEClassof an added object to track. May not benulltargetTopObjectEClasses- Defines target top objectEClass'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-objectEClassTheseEClass'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:ICheckDefinitionAdds a collector of check contexts that is used to schedule the check in case of an existing object with a givenEClassis being removed from the configuration.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing 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 sameEClassare allowed, all collectors are being collected- Specified by:
addModelRemovalContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add. May not benulltargetEClass- TheEClassof an added object to track. May not benull
-
addModelFeatureChangeContextCollector
public void addModelFeatureChangeContextCollector(OnModelFeatureChangeContextCollector collector, org.eclipse.emf.ecore.EClass targetEClass) Description copied from interface:ICheckDefinitionAdds a collector of check contexts that is used to schedule the check in case of a feature changes of theEClassobjects.
This collector will be called only in case if the correspondingEClassis either a top objectEClassbeing declared via theICheckDefinition.addCheckedModelObjects(EClass, boolean, Set)call or a containment objectEClassbeing 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 sameEClassare allowed, all collectors are being collected- Specified by:
addModelFeatureChangeContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add. May not benulltargetEClass- TheEClassof 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:ICheckDefinitionAdds a collector of check contexts that is used to schedule the check in case of a feature changes of theEClassobjects.
Multiple calls of this method for the sameEClassare allowed, all collectors are being collected- Specified by:
addGenericModelFeatureChangeContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add. May not benulltargetEClass- TheEClassof an object which changed features we are going to track. May not benulltargetTopObjectEClasses- Defines target top objectEClass'es the collector may be applied to. In case if empty the targetEClass parameter is treated as a top-objectEClassTheseEClass'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:ICheckDefinitionAdds a new parameter definition to the check configuration. SeeCheckParameterDefinitionfor details. Accepts only uniquely named parameters.- Specified by:
addParameterDefinitionin interfaceICheckDefinition- Parameters:
checkParameterDescription- TheCheckParameterDefinitionto 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
nullto 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
nullin 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
CheckParameterDefinitionmapped 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:ICheckDefinitionSets 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:
setComplexityin interfaceICheckDefinition- Parameters:
complexity- The complexity to set. May not benull
-
setDefaultSeverity
Description copied from interface:ICheckDefinitionSets 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:
setDefaultSeverityin interfaceICheckDefinition- Parameters:
severity- The severity to set. May not benull
-
setDelegateApplianceFilter
Description copied from interface:ICheckDefinitionSets an optional filter for any contexts for checks that delegated checking to subsidiary checks. See theIDelegateApplicabilityFilterfor details- Specified by:
setDelegateApplianceFilterin interfaceICheckDefinition- Parameters:
filter- The filter to set. May not benull
-
setDescription
Description copied from interface:ICheckDefinitionSets 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:
setDescriptionin interfaceICheckDefinition- Parameters:
description- The description to set. May not benull
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:ICheckDefinitionSets 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:
setEnabledin interfaceICheckDefinition- Parameters:
enabled- True if the check is enabled by default, false otherwise
-
setIssueType
Description copied from interface:ICheckDefinitionSets 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:
setIssueTypein interfaceICheckDefinition- Parameters:
issueType- The type of the issue. May not benull
-
setLanguageResourceChangeContextCollector
public void setLanguageResourceChangeContextCollector(OnLanguageResourceChangesContextCollector collector) Description copied from interface:ICheckDefinitionAdds 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:
setLanguageResourceChangeContextCollectorin interfaceICheckDefinition- Parameters:
collector- The collector to add, may not benull
-
setTitle
Description copied from interface:ICheckDefinitionSets 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:
setTitlein interfaceICheckDefinition- Parameters:
title- The title to set. May not benull
-
enableProtectedObjectCheck
public void enableProtectedObjectCheck()Description copied from interface:ICheckDefinitionEnables protected object check for the corresponding check. Checks aren't checking protected objects by default- Specified by:
enableProtectedObjectCheckin interfaceICheckDefinition
-
markAsCriticalDataIntegrityCheck
public void markAsCriticalDataIntegrityCheck()Description copied from interface:ICheckDefinitionMarks 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:
markAsCriticalDataIntegrityCheckin interfaceICheckDefinition
-
isTopObjectTarget
public boolean isTopObjectTarget(org.eclipse.emf.ecore.EClass supportedType) Checks if the providedEClassis 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
-