Class RepositoryCloneStrategyUtils


  • public class RepositoryCloneStrategyUtils
    extends Object
    Utility class to assist defining the Git repository cloning strategy
    • Constructor Detail

      • RepositoryCloneStrategyUtils

        public RepositoryCloneStrategyUtils()
    • Method Detail

      • getCloneStrategy

        @NotNull
        public static @NotNull String getCloneStrategy​(@NotNull
                                                       @NotNull Map<String,​Object> config,
                                                       @NotNull
                                                       @NotNull String useFullClonesKey,
                                                       @NotNull
                                                       @NotNull String useRemoteAgentCacheKey,
                                                       @NotNull
                                                       @NotNull String useShallowClonesKey)
        Determines the clone strategy based on the provided configuration map
        Parameters:
        config - A map containing configuration settings
        useFullClonesKey - Key for the full clones setting
        useRemoteAgentCacheKey - Key for the remote agent cache setting
        useShallowClonesKey - Key for the shallow clones setting
        Returns:
        The clone strategy as a string
      • setCloneStrategy

        public static void setCloneStrategy​(@NotNull
                                            @NotNull ActionParametersMap actionParametersMap,
                                            @NotNull
                                            @NotNull Map<String,​String> cfgMap,
                                            @NotNull
                                            @NotNull String cloneStrategyKey,
                                            @NotNull
                                            @NotNull String cloneStrategyFullCloneKey,
                                            @NotNull
                                            @NotNull String useRemoteAgentCacheKey,
                                            @NotNull
                                            @NotNull String useShallowClonesKey)
        Sets the clone strategy in the given configuration map based on the provided action parameters
        Parameters:
        actionParametersMap - The map containing action parameters, including the clone strategy
        cfgMap - The configuration map to be updated with the proper clone strategy settings
        cloneStrategyKey - Key for the clone strategy setting
        cloneStrategyFullCloneKey - Key for the full clone strategy setting
        useRemoteAgentCacheKey - Key for the remote agent cache setting
        useShallowClonesKey - Key for the shallow clones setting
      • getCloneStrategyOptions

        @NotNull
        public static @NotNull List<NameValuePair> getCloneStrategyOptions​(@NotNull
                                                                           @NotNull com.atlassian.sal.api.message.I18nResolver i18nResolver,
                                                                           @NotNull
                                                                           @NotNull String useFullClonesKey,
                                                                           @NotNull
                                                                           @NotNull String useShallowClonesKey)
        Retrieves a list of clone strategy options as NameValuePair objects
        Parameters:
        i18nResolver - The i18n resolver for localisation
        useFullClonesKey - The default clone strategy none key
        useShallowClonesKey - Key for the shallow clones
        Returns:
        A list of NameValuePair objects representing each clone strategy option