Interface ICheckRepository

  • All Superinterfaces:
    com.e1c.g5.v8.dt.internal.check.ICheckMetadataManager

    public interface ICheckRepository
    extends com.e1c.g5.v8.dt.internal.check.ICheckMetadataManager
    Unified check repository. Provides access to all registered checks and their metadata (settings, parameters, etc) It's a public service and may be used as a standard EDT lifecycle-aware service
    • Method Detail

      • addChangeListener

        void addChangeListener​(ICheckSettingsChangeListener listener)
        Adds check settings change listener
        Parameters:
        listener - The listener to add, not null
      • applyChanges

        void applyChanges​(Collection<ICheckSettings> checkSettings,
                          org.eclipse.core.resources.IProject project)
        Apply changes to the currently active settings profile
        Parameters:
        checkSettings - The set of changed settings to apply. May not be null
        project - The target project for the profile settings update. May not be null
      • deleteSettingsProfile

        void deleteSettingsProfile​(String profileName,
                                   org.eclipse.core.resources.IProject project)
        Deletes the settings profile with the given name (if exists). In case of active profile removal - select the firts available profile as active one. The last profile may be removed as well. In this case the default one will be recreated
        Parameters:
        profileName - The name of the profile to remove. May not be null
        project - The target projet for the profile removal. May not be null
      • duplicateSettingsProfile

        void duplicateSettingsProfile​(String profileName,
                                      String newProfileName,
                                      org.eclipse.core.resources.IProject project)
        Duplicates the settings profile. Creates a new profile with same settings as provided with a given name
        Parameters:
        profileName - The source profile name to duplicate. May not be null
        newProfileName - The name for the a new profile. May not be null
        project - The target projet for the profile duplcication. May not be null
      • exportSettingsProfile

        void exportSettingsProfile​(String profileName,
                                   Path destinationPath,
                                   org.eclipse.core.resources.IProject project)
        Export check settings profile as a file to an external destination
        Parameters:
        profileName - The name of the profile to export. May not be null
        destinationPath - The destination path to export file to. May not be null
        project - The project which profile should be exported. May not be null
      • getActiveSettingsProfile

        String getActiveSettingsProfile​(org.eclipse.core.resources.IProject project)
        Gets an active settings profile name for the given project
        Parameters:
        project - The project to get the settings profile name for. May not be null
        Returns:
        The name of the profile. Never null
      • getApplicableDelegates

        Collection<CheckUid> getApplicableDelegates​(Class<?> targetObjectClass,
                                                    Object sourceObject,
                                                    IDtProject dtProject)
        Gets applicable delegate checks for the given context, if any
        Parameters:
        targetObjectClass - The target object Class to get delegates for. May not be null
        sourceObject - Source object which check was delegated in a form of some derived delegated model. Used to filter out all inapproprite data sources. May not be null
        dtProject - The target project. May not be null
        Returns:
        The set of applicables checks. May not be null
      • getAvailableSettingsProfiles

        Collection<String> getAvailableSettingsProfiles​(org.eclipse.core.resources.IProject project)
        Gets the set of available check settings profiles for the project
        Parameters:
        project - The project to get settings profiles for. May not be null
        Returns:
        The collection of available profile names. May not be null
      • getCheck

        ICheck getCheck​(CheckUid checkId,
                        IDtProject dtProject)
        Gets the check using its UID and corresponding project settings
        Parameters:
        checkId - The check UID to get the check by. May not be null
        dtProject - The target project. May not be null
        Returns:
        The target check if exists. May not be null
      • getChecks

        Collection<CheckUid> getChecks​(Predicate<ICheckDescription> filter)
        Gets UIDs of registered checks being filtered by the provided predicate
        Parameters:
        filter - The filter based on ICheckDescription data. May not be null. Checks that match the predicate are being returned
        Returns:
        The collection of matching check uids. May not be null. May be empty
      • getCheck

        Map<CheckUid,​ICheck> getCheck​(String checkId,
                                            IDtProject project)
        Gets the set of checks using their public identifier. In case if there is no conflicts in check ids the only check will be returned
        Parameters:
        checkId - The identifier of the check. May not be null
        Returns:
        The checks mapped to their internal unique identifier, if exists. May not be null
        Throws:
        IllegalStateException - In case if the required check isn't registered in the repository
      • getCheckParameters

        ICheckParameters getCheckParameters​(CheckUid checkId,
                                            org.eclipse.core.resources.IProject project)
        Returns the immutable view of check execution parameters by names.
        Parameters:
        project - The target project. May not be null
        checkId - check id, not null
        Returns:
        check execution parameters by names, not null.
      • getCheckProcessPreferences

        ICheckProcessPreferences getCheckProcessPreferences()
        Gets the check process preferences
        Returns:
        The set of user-defined preferences that affects the check process. May not be null
      • getCheckUidForCheckId

        Set<CheckUid> getCheckUidForCheckId​(String checkId,
                                            org.eclipse.core.resources.IProject project)
        Gets all applicable check unique identifiers by the check id and the given project
        Parameters:
        checkId - The identifier of the check. May not be null
        project - The target project. May not be null
        Returns:
        The set of check UIDs. May not be null
      • getCustomizedSettingsFromProfile

        Map<CheckUid,​ICheckSettings> getCustomizedSettingsFromProfile​(String profileName,
                                                                            org.eclipse.core.resources.IProject project)
        Gets the user-changed settings of the given profile. All default settings are ignored
        Parameters:
        profileName - The target profile name. May not be null
        project - The target project. May not be null
        Returns:
        The user-changed settings mapped to respective check identifiers. May not be null
      • getDefaultSettings

        ICheckSettings getDefaultSettings​(CheckUid checkUid,
                                          org.eclipse.core.resources.IProject project)
        Get default settings for the given check (as defined in the check itself)
        Parameters:
        checkUid - The identifier of the target check. May not be null
        project - The target project. May not be null
        Returns:
        The default settings of the check. May be null in case if the check is absent
      • getDefaultSettingsForProfile

        Map<CheckUid,​ICheckSettings> getDefaultSettingsForProfile​(String value,
                                                                        org.eclipse.core.resources.IProject project)
        Get alll default settings for all registereds check (as defined in the check itself)
        Parameters:
        project - The target project. May not be null
        Returns:
        The default settings of checks mapped to their check identifiers. May not be null
      • getRootElements

        Collection<INamedElement> getRootElements​(org.eclipse.core.resources.IProject project)
        Returns top level elements.
        Returns:
        top level elements, not null
      • getSettings

        ICheckSettings getSettings​(CheckUid checkUid,
                                   org.eclipse.core.resources.IProject project)
        Returns check settings using for given project, taking the current active provide user-changed settings into the account
        Parameters:
        checkUid - check id, not null
        project - project, null if none
        Returns:
        check settings, not null
        Throws:
        NoSuchElementException - if none.
      • getShortUid

        String getShortUid​(CheckUid checkUid,
                           IDtProject dtProject)
        Gets the short UID for the given CheckUid and the project
        Parameters:
        checkUid - The target check UID. May not be null
        dtProject - The target project. May not be null
        Returns:
        The short UID of the check. May not be null
        Throws:
        IllegalStateException - In case if the given CheckUID isn't registered
      • getShortUid

        String getShortUid​(CheckUid checkUid,
                           org.eclipse.core.resources.IProject project)
        Gets the short UID for the given CheckUid and the project
        Parameters:
        checkUid - The target check UID. May not be null
        project - The target project. May not be null
        Returns:
        The short UID of the check. May not be null
        Throws:
        IllegalStateException - In case if the given CheckUID isn't registered
      • getUidForShortUid

        CheckUid getUidForShortUid​(String shortUid,
                                   org.eclipse.core.resources.IProject project)
        Converts short check UID into the full check UID for the given project based on the previously registered checks
        Parameters:
        shortUid - The short UID to convert. May not be null
        project - The target project. May not be null
        Returns:
        The full UID of the check. May be null in case if the short UID is a stale one or non-uid
      • getUidForShortUid

        CheckUid getUidForShortUid​(String shortUid,
                                   IDtProject project)
        Converts short check UID into the full check UID for the given project based on the previously registered checks
        Parameters:
        shortUid - The short UID to convert. May not be null
        project - The target DT project. May not be null
        Returns:
        The full UID of the check. May be null in case if the short UID is a stale one or non-uid
      • importSettingsProfile

        void importSettingsProfile​(Path path,
                                   org.eclipse.core.resources.IProject project)
        Imports an external settings profile into the project's set of profiles
        Parameters:
        path - The path to the profile. May not be null
        project - The target project. May not be null
      • removeChangeListener

        void removeChangeListener​(ICheckSettingsChangeListener listener)
        Removes check settings change listener.
        Parameters:
        listener - the listener, not null
      • renameSettingsProfile

        void renameSettingsProfile​(String currentProfileName,
                                   String newProfileName,
                                   org.eclipse.core.resources.IProject project)
        Renames the settings profile using the provided name.
        Parameters:
        currentProfileName - Current name of the profile. May not be null
        newName - The new name of the profile. May not be null
        project - The target project. May not be null
      • setActiveSettingsProfile

        void setActiveSettingsProfile​(String profileName,
                                      Collection<ICheckSettings> checkSettings,
                                      org.eclipse.core.resources.IProject project)
        Sets an active profile for the given project. The name should be received via the getAvailableSettingsProfiles(IProject). Does nothing in case of supplying of arbitrary name
        Parameters:
        profileName - The name of the profile. May not be null
        project - The target project. May not be null
      • setCheckProvider

        void setCheckProvider​(ICheckProvider checkProvider)
        Sets the external check provider Used by the testing ifrastructure, shouln't be used by clients
        Parameters:
        checkProvider - The check provider to set. May not be null
      • toUid

        Set<CheckUid> toUid​(String checkId,
                            org.eclipse.core.resources.IProject project)
        Translates check-provided identifier into the internal unique identifier of check. Could return more then one identifier in case of the check id conflict.
        Parameters:
        checkId - The check identifier. May not be null
        project - The project to get the check UID for. May not be null
        Returns:
        The set of UIDs, may not be null
      • validateParameterValue

        String validateParameterValue​(String value,
                                      String parameterName,
                                      ICheckSettings checkSettings)
        Validates the given value for the appliance to the chosen parameter.
        Parameters:
        value - The value to validate. May be null
        parameterName - The parameter name. May not be null
        checkSettings - The target check settings. May not be null
        Returns:
        The validation message if any. null if the parameter value is a valid one
      • validateProfileName

        boolean validateProfileName​(String newProfileName)
        Validates that the profile name matches the standard
        Parameters:
        newProfileName - The name to validate. May not be null
        Returns:
        True if the profile name is valid