Package net.sf.basedb.plugins.util
Class Parameters
java.lang.Object
net.sf.basedb.plugins.util.Parameters
Utility class for creating some useful plug-in parameters.
- Version:
- 2.6
- Author:
- nicklas
- Last modified
- $Date: 2019-03-08 15:31:06 +0100 (fre, 08 mars 2019) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the parameter that is created bycharsetParameter(String, String, String, boolean)
private static final StringParameterType
Enumerates all available character sets.private static final StringParameterType
Enumerates all available character sets and also inlcude fallback type.static final String
The name of the parameter that asks is created bychildDescriptionParameter(String, String, String)
static final String
The name of the parameter that is created bychildNameParameter(String, String, String)
static final String
The name of the parameter created bydateFormatError(String, String, String, String...)
.static final String
The name of the parameter that is created bydateFormatParameter(String, String, String)
static final String
The name of the parameter that is created bydecimalSeparatorParameter(String, String, String)
static final String
The name of the parameter created bydefaultError(String, String, String, String...)
.static final String
The name of the parameter that is created bylogFileParameter(String, String, String)
static final String
The name of the parameter created byerrorSection(String, String)
.protected static final PluginParameter<String>
Section definition for grouping error handling options.static final String
The name of the parameter created byinvalidUseOfNullError(String, String, String, String...)
.static final String
The name of the parameter that is created bylogFileParameter(String, String, String)
static final String
The name of the parameter created bynumberFormatError(String, String, String, String...)
.static final String
The name of the parameter created bynumberOutOfRangeError(String, String, String, String...)
.static final String
The name of the parameter created bystringTooLongError(String, String, String, String...)
.static final String
The name of the parameter that is created bytimestampFormatParameter(String, String, String)
static final String
The name of the parameter that asks created bytransformationNameParameter(String, String, String)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final PluginParameter<String>
charsetParameter
(String title, String description, String defaultValue) static final PluginParameter<String>
charsetParameter
(String title, String description, String defaultValue, boolean includeFallbackTypes) Parameter definition that asks for the character encoding used in the file that is imported.static PluginParameter<String>
childDescriptionParameter
(String label, String description, String defaultValue) Create a plugin parameter that asks for the description of the child bioassay set.static PluginParameter<String>
childNameParameter
(String label, String description, String defaultValue) Create a plugin parameter that asks for the name of the child bioassay set.static <T> PluginParameter<T>
cloneParameter
(PluginParameter<T> pp, T defaultValue) Clone a plug-in parameter but give it a different default value.static final PluginParameter<String>
dateFormatError
(String title, String description, String defaultValue, String... options) Create the parameter for handling invalid dates/timestamps.static final PluginParameter<String>
dateFormatParameter
(String title, String description, String defaultValue) Parameter definition that asks for the format used by date values when parsed from strings.static final PluginParameter<String>
decimalSeparatorParameter
(String title, String description, String defaultValue) Parameter definition that asks for the decimal separator used by numeric values when parsed from strings.static final PluginParameter<String>
defaultError
(String title, String description, String defaultValue, String... options) Create the default error handling parameter.static PluginParameter<Boolean>
dryRunParameter
(String title, String description, Boolean defaultValue) Parameter definition that enable/disable dry-run of a plug-in.static final PluginParameter<String>
errorSection
(String title, String description) Create a parameter starting an error section.static final PluginParameter<String>
invalidUseOfNullError
(String title, String description, String defaultValue, String... options) Create the parameter for handling required but missing values.static PluginParameter<String>
logFileParameter
(String title, String description, String defaultValue) Parameter definition that asks for the path to a log file that a plug-in can use for logging detailed information about it's progress.static final PluginParameter<String>
numberFormatError
(String title, String description, String defaultValue, String... options) Create the parameter for handling invalid numbers.static final PluginParameter<String>
numberOutOfRangeError
(String title, String description, String defaultValue, String... options) Create the parameter for handling numeric values that are outside the allowed range.static final PluginParameter<String>
stringTooLongError
(String title, String description, String defaultValue, String... options) Create the parameter for handling too long strings.static final PluginParameter<String>
timestampFormatParameter
(String title, String description, String defaultValue) Parameter definition that asks for the format used by timestamp values when parsed from strings.static PluginParameter<String>
transformationNameParameter
(String label, String description, String defaultValue) Create a plugin parameter that asks for the name of the transformation.
-
Field Details
-
errorSection
Section definition for grouping error handling options. -
ERROR_SECTION
The name of the parameter created byerrorSection(String, String)
.- See Also:
-
DEFAULT_ERROR
The name of the parameter created bydefaultError(String, String, String, String...)
.- See Also:
-
STRING_TOO_LONG_ERROR
The name of the parameter created bystringTooLongError(String, String, String, String...)
.- See Also:
-
NUMBER_FORMAT_ERROR
The name of the parameter created bynumberFormatError(String, String, String, String...)
.- See Also:
-
DATE_FORMAT_ERROR
The name of the parameter created bydateFormatError(String, String, String, String...)
.- See Also:
-
INVALID_USE_OF_NULL_ERROR
The name of the parameter created byinvalidUseOfNullError(String, String, String, String...)
.- See Also:
-
NUMBER_OUT_OF_RANGE_ERROR
The name of the parameter created bynumberOutOfRangeError(String, String, String, String...)
.- See Also:
-
CHARSET_PARAMETER
The name of the parameter that is created bycharsetParameter(String, String, String, boolean)
- See Also:
-
charsetType
Enumerates all available character sets. -
charsetWithFallbacksType
Enumerates all available character sets and also inlcude fallback type.- Since:
- 3.15
- See Also:
-
DECIMAL_SEPARATOR_PARAMETER
The name of the parameter that is created bydecimalSeparatorParameter(String, String, String)
- See Also:
-
DATE_FORMAT_PARAMETER
The name of the parameter that is created bydateFormatParameter(String, String, String)
- Since:
- 2.8
- See Also:
-
TIMESTAMP_FORMAT_PARAMETER
The name of the parameter that is created bytimestampFormatParameter(String, String, String)
- Since:
- 2.16
- See Also:
-
LOGFILE_PARAMETER
The name of the parameter that is created bylogFileParameter(String, String, String)
- Since:
- 2.8
- See Also:
-
DRY_RUN_PARAMETER
The name of the parameter that is created bylogFileParameter(String, String, String)
- Since:
- 2.8
- See Also:
-
CHILD_NAME
The name of the parameter that is created bychildNameParameter(String, String, String)
- Since:
- 2.15
- See Also:
-
CHILD_DESCRIPTION
The name of the parameter that asks is created bychildDescriptionParameter(String, String, String)
- Since:
- 2.15
- See Also:
-
TRANSFORMATION_NAME
The name of the parameter that asks created bytransformationNameParameter(String, String, String)
- Since:
- 2.15
- See Also:
-
-
Constructor Details
-
Parameters
public Parameters()
-
-
Method Details
-
errorSection
Create a parameter starting an error section.- Parameters:
title
- The title of the section, or null for the default (Error handling)description
- A description, or null for the default- Returns:
- A new plug-in parameter
-
defaultError
public static final PluginParameter<String> defaultError(String title, String description, String defaultValue, String... options) Create the default error handling parameter.- Parameters:
title
- The title for the parameter or null for the default (Default error handling)description
- The description or null for the defaultdefaultValue
- The default value or null to use "fail"options
- Options to select from, if null or empty, the "fail" and "skip" are used- Returns:
- A new plug-in parameter
-
stringTooLongError
public static final PluginParameter<String> stringTooLongError(String title, String description, String defaultValue, String... options) Create the parameter for handling too long strings.- Parameters:
title
- The title for the parameter or null for the default (String too long)description
- The description or null for the defaultdefaultValue
- The default value or null to use the default error handlingoptions
- Options to select from, if null or empty, the "crop", "fail" and "skip" are used- Returns:
- A new plug-in parameter
-
numberFormatError
public static final PluginParameter<String> numberFormatError(String title, String description, String defaultValue, String... options) Create the parameter for handling invalid numbers.- Parameters:
title
- The title for the parameter or null for the default (Invalid numeric value)description
- The description or null for the defaultdefaultValue
- The default value or null to use the default error handlingoptions
- Options to select from, if null or empty, the "null", "fail" and "skip" are used- Returns:
- A new plug-in parameter
-
dateFormatError
public static final PluginParameter<String> dateFormatError(String title, String description, String defaultValue, String... options) Create the parameter for handling invalid dates/timestamps.- Parameters:
title
- The title for the parameter or null for the default (Invalid date)description
- The description or null for the defaultdefaultValue
- The default value or null to use the default error handlingoptions
- Options to select from, if null or empty, the "null", "fail" and "skip" are used- Returns:
- A new plug-in parameter
- Since:
- 2.16
-
invalidUseOfNullError
public static final PluginParameter<String> invalidUseOfNullError(String title, String description, String defaultValue, String... options) Create the parameter for handling required but missing values.- Parameters:
title
- The title for the parameter or null for the default (Missing a required value)description
- The description or null for the defaultdefaultValue
- The default value or null to use the default error handlingoptions
- Options to select from, if null or empty, the "fail" and "skip" are used- Returns:
- A new plug-in parameter
-
numberOutOfRangeError
public static final PluginParameter<String> numberOutOfRangeError(String title, String description, String defaultValue, String... options) Create the parameter for handling numeric values that are outside the allowed range.- Parameters:
title
- The title for the parameter or null for the default (Numeric value out of range)description
- The description or null for the defaultdefaultValue
- The default value or null to use the default error handlingoptions
- Options to select from, if null or empty, the "fail" and "skip" are used- Returns:
- A new plug-in parameter
-
charsetParameter
public static final PluginParameter<String> charsetParameter(String title, String description, String defaultValue) -
charsetParameter
public static final PluginParameter<String> charsetParameter(String title, String description, String defaultValue, boolean includeFallbackTypes) Parameter definition that asks for the character encoding used in the file that is imported. This can be both a job parameter and a configuration parameter. The implementation first checks in the job parameter and if not found in the configuration parameter. If still not found the default charset is used as specified byConfig.getCharset()
.- Parameters:
title
- The title to use for the parameter or null to use the default label (Character set)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default value for the character set or null to use the system defaultincludeFallbackTypes
- TRUE to include UTF-8 fallback types in the list, FALSE to not- Since:
- 3.15
-
decimalSeparatorParameter
public static final PluginParameter<String> decimalSeparatorParameter(String title, String description, String defaultValue) Parameter definition that asks for the decimal separator used by numeric values when parsed from strings. If no specific value is used number parsing is done by Float.valueOf or Double.valueOf.- Parameters:
title
- The title to use for the parameter or null to use the default title (Decimal separator)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default value for the decimal separator
-
dateFormatParameter
public static final PluginParameter<String> dateFormatParameter(String title, String description, String defaultValue) Parameter definition that asks for the format used by date values when parsed from strings. SeeSimpleDateFormat
for more info about template values.- Parameters:
title
- The title to use for the parameter or null to use the default title (Date format)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default value for the date format- Since:
- 2.8
-
timestampFormatParameter
public static final PluginParameter<String> timestampFormatParameter(String title, String description, String defaultValue) Parameter definition that asks for the format used by timestamp values when parsed from strings. SeeSimpleDateFormat
for more info about template values.- Parameters:
title
- The title to use for the parameter or null to use the default title (Timestamp format)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default value for the timestamp format- Since:
- 2.16
-
logFileParameter
public static PluginParameter<String> logFileParameter(String title, String description, String defaultValue) Parameter definition that asks for the path to a log file that a plug-in can use for logging detailed information about it's progress.- Parameters:
title
- The title to use for the parameter or null to use the default title (Log file)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default path- Since:
- 2.8
-
dryRunParameter
public static PluginParameter<Boolean> dryRunParameter(String title, String description, Boolean defaultValue) Parameter definition that enable/disable dry-run of a plug-in. A dry run should do everything the plug-in normally does, except that the result should not be committed to the database. A dry-run should be combined with a log file (seelogFileParameter(String, String, String)
.- Parameters:
title
- The title to use for the parameter or null to use the default title (Dry run)description
- The description to use for the parameter or null to use the default descriptiondefaultValue
- The default value- Since:
- 2.8
-
cloneParameter
Clone a plug-in parameter but give it a different default value.- Parameters:
pp
- The plug-in parameter to clonedefaultValue
- The new default value- Returns:
- The cloned plug-in parameter
- Since:
- 2.15
-
childNameParameter
public static PluginParameter<String> childNameParameter(String label, String description, String defaultValue) Create a plugin parameter that asks for the name of the child bioassay set.- Parameters:
label
- The label to use for the parameter or null to use the default label (Child name)description
- The description to use for the parameter or null to use the default description (The name of the child bioassay set)defaultValue
- The default value for the child name or null to use the default value (New bioassay set)- Returns:
- A plugin parameter
- Since:
- 2.15
-
childDescriptionParameter
public static PluginParameter<String> childDescriptionParameter(String label, String description, String defaultValue) Create a plugin parameter that asks for the description of the child bioassay set.- Parameters:
label
- The label to use for the parameter or null to use the default label (Child description)description
- The description to use for the parameter or null to use the default description (An optional description of the child bioassay set)defaultValue
- The default value for the child name or null to not use any default value- Returns:
- A plugin parameter
- Since:
- 2.15
-
transformationNameParameter
public static PluginParameter<String> transformationNameParameter(String label, String description, String defaultValue) Create a plugin parameter that asks for the name of the transformation.- Parameters:
label
- The label to use for the parameter or null to use the default label (Transformation name)description
- The description to use for the parameter or null to use the default description (The name of the transformation)defaultValue
- The default value for the transformation name or null to not use any default- Returns:
- A plugin parameter
- Since:
- 2.15
-