Package com.e1c.g5.v8.dt.check
Interface ICheckDefinition
-
public interface ICheckDefinition
Defines the check's operational metada. The developer can/should provide the following information via this interface:
- Define
EClass
'es of BSL language model that are being validated by this check (if any) in case of language module change/import/clean rebuild - Add model context collectors (see the
OnModelFeatureChangeContextCollector
or OnModelObjectAssociationContextCollector for details) which is called on model object association or feature change events - Add language context collectors (see the
OnLanguageResourceChangesContextCollector
for details) which is called on language module creation or change events - Define parameters of the check, which will be available for editing via the check management page in the EDT
- Change the complexity of the check to help the ACC to improve the effectiveness of checks
- Set the check default complexity and enablement
- Set the descriptive information for check
Please note that the check uses the following scheme to define the descriptive information for the check:
- The title of the check should be defined via the check itself, using the
CheckDescription#CheckDescription(String, String, String, IssueType, boolean, IssueSeverity, String, java.util.Map)
constructor. The standard Eclipse localized strings could be used to define the multi-language titles - The check developer may specify the default description of the check via the check itself using the
CheckDescription#CheckDescription(String, String, String, IssueType, boolean, IssueSeverity, String, java.util.Map)
constructor. Same approach to localization as with title - The check developer may specify localizations (preferred method) as a set of external html files stored in the following structure:
- The root resource folder is a 'check.descriptions' (the name of the folder, not the structure) residing in the root 'src' folder of the check supplying bundle. Please note that the folder should be in the bundle that defines the extension that registers the target check
- The root resource folder may contains a set of locale-specific subfolders. Names should match the
Locale.getLanguage()
convention to be eligible by the EDT - The localized description should be placed in the file with the name matching the following pattern <checkId>.html, where <checkId> is an unique identifier of the target check
- The localized description which is placed in the locale-specific subfolder will be used for the corresponding locale. In order to define the default localization the developer should place the localization file in the 'check.descriptions' folder
- Different localization have the following priority (from highest to lowest): locale-specific file > default file > in-check description
- Define
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
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 includeTop, Set<org.eclipse.emf.ecore.EClass> containedObjectEClasses)
Defines a rebuild scope collector for the given type of the top object.void
addDelegatedTypes(Class<?>... delegatedTypes)
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 theaddCheckedModelObjects(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 theaddCheckedModelObjects(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 theaddCheckedModelObjects(EClass, boolean, Set)
call or a containment objectEClass
being declared via the same method.void
addParameterDefinition(CheckParameterDefinition checkParameterDefinition)
Adds a new parameter definition to the check configuration.void
enableProtectedObjectCheck()
Enables protected object check for the corresponding check.void
markAsCriticalDataIntegrityCheck()
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
setDelegateApplianceFilter(IDelegateApplicabilityFilter filter)
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
setLanguageResourceChangeContextCollector(OnLanguageResourceChangesContextCollector collector)
Adds a context collector that reacts on languge/resource changes.void
setTitle(String title)
Sets the dispayable title of the check.
-
-
-
Method Detail
-
addCheckedLanguageObjects
void 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)- Parameters:
targetTypes
- The set of target object types. May not benull
-
addModelAssociationContextCollector
void 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 theaddCheckedModelObjects(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- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an added object to track. May not benull
-
addGenericModelAssociationContextCollector
void 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 combined- 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 theaddCheckedModelObjects(EClass, boolean, Set)
beforehand. May be empty in case of the targetEClass is a top-level objectEClass
-
addModelFeatureChangeContextCollector
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 theaddCheckedModelObjects(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- 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
void 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 collected- 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 theaddCheckedModelObjects(EClass, boolean, Set)
beforehand. May be empty in case of the targetEClass is a top-level objectEClass
-
addModelRemovalContextCollector
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 theaddCheckedModelObjects(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- Parameters:
collector
- The collector to add. May not benull
targetEClass
- TheEClass
of an added object to track. May not benull
-
addParameterDefinition
void addParameterDefinition(CheckParameterDefinition checkParameterDefinition)
Adds a new parameter definition to the check configuration. SeeCheckParameterDefinition
for details. Accepts only uniquely named parameters.- Parameters:
checkParameterDefinition
- TheCheckParameterDefinition
to add. May not benull
- Throws:
IllegalArgumentException
- in case of adding of parameter descriptions with same names
-
addCheckedModelObjects
void addCheckedModelObjects(org.eclipse.emf.ecore.EClass topObjectEClass, boolean includeTop, Set<org.eclipse.emf.ecore.EClass> containedObjectEClasses)
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.- Parameters:
topObjectEClass
- TheEClass
of the top object, may not benull
includeTop
- The flag that defines the participation of the top object itself in the checkcontainedObjectEClasses
- The set ofEClass
'es of contained objects that are checked during the check process. May be notnull
-
setComplexity
void setComplexity(CheckComplexity complexity)
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- Parameters:
complexity
- The complexity to set. May not benull
-
setDefaultSeverity
void setDefaultSeverity(IssueSeverity severity)
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- Parameters:
severity
- The severity to set. May not benull
-
setDescription
void setDescription(String description)
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- Parameters:
description
- The description to set. May not benull
-
setEnabled
void setEnabled(boolean enabled)
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- Parameters:
enabled
- True if the check is enabled by default, false otherwise
-
setIssueType
void setIssueType(IssueType issueType)
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
- Parameters:
issueType
- The type of the issue. May not benull
-
setLanguageResourceChangeContextCollector
void setLanguageResourceChangeContextCollector(OnLanguageResourceChangesContextCollector collector)
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.- Parameters:
collector
- The collector to add, may not benull
-
setTitle
void setTitle(String title)
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- Parameters:
title
- The title to set. May not benull
-
addDelegatedTypes
void addDelegatedTypes(Class<?>... delegatedTypes)
Adds types of objects provided by the delegating checks (see theICheckResultAcceptor.delegateChecks(Iterable)
) that are being handled by this check- Parameters:
delegatedTypes
- The set object types that are delegated. May not be empty
-
setDelegateApplianceFilter
void setDelegateApplianceFilter(IDelegateApplicabilityFilter filter)
Sets an optional filter for any contexts for checks that delegated checking to subsidiary checks. See theIDelegateApplicabilityFilter
for details- Parameters:
filter
- The filter to set. May not benull
-
enableProtectedObjectCheck
void enableProtectedObjectCheck()
Enables protected object check for the corresponding check. Checks aren't checking protected objects by default
-
markAsCriticalDataIntegrityCheck
void markAsCriticalDataIntegrityCheck()
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
-
-