Package org.biouno.unochoice.util
Class Utils
java.lang.Object
org.biouno.unochoice.util.Utils
Utility methods.
- Since:
- 0.23
- Author:
- Bruno P. Kinoshita
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateRandomParameterName(String prefix, String suffix) Creates a random parameter name.static StringescapeDisabled(Object obj) Escapes the parameter value, removing the :disabled suffix.static StringescapeSelected(Object obj) Escapes the parameter value, removing the :selected suffix.static StringEscapes the parameter value, removing the :selected and :disabled suffixes.static ProjectfindProjectByParameterUUID(String parameterUUID) Find the current project give its parameter UUID.static Map<BuildWrapper,List<ParameterDefinition>> getBuildWrapperParameterDefinitions(Project<?, ?> project) Get parameter definitions associated withBuildWrappers of the givenProject.Get a map with the global node properties.static Project<?,?> getProjectByName(String projectName) Deprecated.static List<ParameterDefinition>getProjectParameterDefinitions(Project<?, ?> project) Get the parameter definitions for the given project.Helped method to return the system environment variables.static booleanisDisabled(Object obj) Checks whether a parameter value contains the :disabled suffix, returningtrueif it does,falseotherwise.static booleanisSelected(Object obj) Checks whether a parameter value contains the :selected suffix, returningtrueif it does,falseotherwise.
-
Field Details
-
LOGGER
-
-
Method Details
-
isSelected
Checks whether a parameter value contains the :selected suffix, returningtrueif it does,falseotherwise.- Parameters:
obj- parameter value- Returns:
trueif the parameter name contains the :selected suffixfalseotherwise.
-
escapeSelected
Escapes the parameter value, removing the :selected suffix.- Parameters:
obj- parameter value- Returns:
- escaped parameter value
-
isDisabled
Checks whether a parameter value contains the :disabled suffix, returningtrueif it does,falseotherwise.- Parameters:
obj- parameter value- Returns:
trueif the parameter name contains the :disabled suffixfalseotherwise.
-
escapeDisabled
Escapes the parameter value, removing the :disabled suffix.- Parameters:
obj- parameter value- Returns:
- escaped parameter value
-
escapeSelectedAndDisabled
Escapes the parameter value, removing the :selected and :disabled suffixes.- Parameters:
obj- parameter value- Returns:
- escaped parameter value
-
createRandomParameterName
@NonNull public static String createRandomParameterName(@Nullable String prefix, @Nullable String suffix) Creates a random parameter name.- Parameters:
prefix- parameter prefixsuffix- parameter suffix- Returns:
- random parameter name
-
getSystemEnv
Helped method to return the system environment variables. The main advantage over calling the System.getenv method directly, is that we can mock this call (System is final).- Returns:
- System environment variables as map
-
getProjectByName
Deprecated.The choice is arbitrary if there are multiple matches; useItem.getFullName()andJenkins.getItemByFullName(String, Class)instead.Get project in Jenkins given its name.- Parameters:
projectName- project name in Jenkins- Returns:
- Project or
nullif none with this name - Since:
- 1.3
-
findProjectByParameterUUID
Find the current project give its parameter UUID.- Parameters:
parameterUUID- parameter UUID- Returns:
nullif the current project cannot be found- Since:
- 1.3
-
getProjectParameterDefinitions
@NonNull public static List<ParameterDefinition> getProjectParameterDefinitions(@NonNull Project<?, ?> project) Get the parameter definitions for the given project.- Parameters:
project- the project for which the parameter definitions should be found- Returns:
- parameter definitions or an empty list
- Since:
- 1.3
-
getGlobalNodeProperties
Get a map with the global node properties.- Returns:
- map with global node properties
- Since:
- 1.6
-
getBuildWrapperParameterDefinitions
@NonNull public static Map<BuildWrapper,List<ParameterDefinition>> getBuildWrapperParameterDefinitions(@NonNull Project<?, ?> project) Get parameter definitions associated withBuildWrappers of the givenProject.- Parameters:
project- the project for which the parameter definitions should be found- Returns:
- Map
-
Item.getFullName()andJenkins.getItemByFullName(String, Class)instead.