2.17.2: 2011-06-17

net.sf.basedb.plugins.util
Class Parameters

java.lang.Object
  extended by net.sf.basedb.plugins.util.Parameters

public class Parameters
extends Object

Utility class for creating some useful plug-in parameters.

Version:
2.6
Author:
nicklas
Last modified
$Date: 2011-02-16 14:49:40 +0100 (Wed, 16 Feb 2011) $

Field Summary
static String CHARSET_PARAMETER
          The name of the parameter that is created by charsetParameter(String, String, String)
private static StringParameterType charsetType
          Enumerates all available character sets.
static String CHILD_DESCRIPTION
          The name of the parameter that asks is created by childDescriptionParameter(String, String, String)
static String CHILD_NAME
          The name of the parameter that is created by childNameParameter(String, String, String)
static String DATE_FORMAT_ERROR
          The name of the parameter created by dateFormatError(String, String, String, String...).
static String DATE_FORMAT_PARAMETER
          The name of the parameter that is created by dateFormatParameter(String, String, String)
static String DECIMAL_SEPARATOR_PARAMETER
          The name of the parameter that is created by decimalSeparatorParameter(String, String, String)
static String DEFAULT_ERROR
          The name of the parameter created by defaultError(String, String, String, String...).
static String DRY_RUN_PARAMETER
          The name of the parameter that is created by logFileParameter(String, String, String)
static String ERROR_SECTION
          The name of the parameter created by errorSection(String, String).
protected static PluginParameter<String> errorSection
          Section definition for grouping error handling options.
static String INVALID_USE_OF_NULL_ERROR
          The name of the parameter created by invalidUseOfNullError(String, String, String, String...).
static String LOGFILE_PARAMETER
          The name of the parameter that is created by logFileParameter(String, String, String)
static String NUMBER_FORMAT_ERROR
          The name of the parameter created by numberFormatError(String, String, String, String...).
static String NUMBER_OUT_OF_RANGE_ERROR
          The name of the parameter created by numberOutOfRangeError(String, String, String, String...).
static String STRING_TOO_LONG_ERROR
          The name of the parameter created by stringTooLongError(String, String, String, String...).
static String TIMESTAMP_FORMAT_PARAMETER
          The name of the parameter that is created by timestampFormatParameter(String, String, String)
static String TRANSFORMATION_NAME
          The name of the parameter that asks created by transformationNameParameter(String, String, String)
 
Constructor Summary
Parameters()
           
 
Method Summary
static PluginParameter<String> charsetParameter(String title, String description, String defaultValue)
          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 PluginParameter<String> dateFormatError(String title, String description, String defaultValue, String... options)
          Create the parameter for handling invalid dates/timestamps.
static 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 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 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 PluginParameter<String> errorSection(String title, String description)
          Create a parameter starting an error section.
static 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 PluginParameter<String> numberFormatError(String title, String description, String defaultValue, String... options)
          Create the parameter for handling invalid numbers.
static 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 PluginParameter<String> stringTooLongError(String title, String description, String defaultValue, String... options)
          Create the parameter for handling too long strings.
static 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorSection

protected static final PluginParameter<String> errorSection
Section definition for grouping error handling options.


ERROR_SECTION

public static final String ERROR_SECTION
The name of the parameter created by errorSection(String, String).

See Also:
Constant Field Values

DEFAULT_ERROR

public static final String DEFAULT_ERROR
The name of the parameter created by defaultError(String, String, String, String...).

See Also:
Constant Field Values

STRING_TOO_LONG_ERROR

public static final String STRING_TOO_LONG_ERROR
The name of the parameter created by stringTooLongError(String, String, String, String...).

See Also:
Constant Field Values

NUMBER_FORMAT_ERROR

public static final String NUMBER_FORMAT_ERROR
The name of the parameter created by numberFormatError(String, String, String, String...).

See Also:
Constant Field Values

DATE_FORMAT_ERROR

public static final String DATE_FORMAT_ERROR
The name of the parameter created by dateFormatError(String, String, String, String...).

See Also:
Constant Field Values

INVALID_USE_OF_NULL_ERROR

public static final String INVALID_USE_OF_NULL_ERROR
The name of the parameter created by invalidUseOfNullError(String, String, String, String...).

See Also:
Constant Field Values

NUMBER_OUT_OF_RANGE_ERROR

public static final String NUMBER_OUT_OF_RANGE_ERROR
The name of the parameter created by numberOutOfRangeError(String, String, String, String...).

See Also:
Constant Field Values

CHARSET_PARAMETER

public static final String CHARSET_PARAMETER
The name of the parameter that is created by charsetParameter(String, String, String)

See Also:
Constant Field Values

charsetType

private static final StringParameterType charsetType
Enumerates all available character sets.

See Also:
charsetParameter(String, String, String)

DECIMAL_SEPARATOR_PARAMETER

public static final String DECIMAL_SEPARATOR_PARAMETER
The name of the parameter that is created by decimalSeparatorParameter(String, String, String)

See Also:
Constant Field Values

DATE_FORMAT_PARAMETER

public static final String DATE_FORMAT_PARAMETER
The name of the parameter that is created by dateFormatParameter(String, String, String)

Since:
2.8
See Also:
Constant Field Values

TIMESTAMP_FORMAT_PARAMETER

public static final String TIMESTAMP_FORMAT_PARAMETER
The name of the parameter that is created by timestampFormatParameter(String, String, String)

Since:
2.16
See Also:
Constant Field Values

LOGFILE_PARAMETER

public static final String LOGFILE_PARAMETER
The name of the parameter that is created by logFileParameter(String, String, String)

Since:
2.8
See Also:
Constant Field Values

DRY_RUN_PARAMETER

public static final String DRY_RUN_PARAMETER
The name of the parameter that is created by logFileParameter(String, String, String)

Since:
2.8
See Also:
Constant Field Values

CHILD_NAME

public static final String CHILD_NAME
The name of the parameter that is created by childNameParameter(String, String, String)

Since:
2.15
See Also:
Constant Field Values

CHILD_DESCRIPTION

public static final String CHILD_DESCRIPTION
The name of the parameter that asks is created by childDescriptionParameter(String, String, String)

Since:
2.15
See Also:
Constant Field Values

TRANSFORMATION_NAME

public static final String TRANSFORMATION_NAME
The name of the parameter that asks created by transformationNameParameter(String, String, String)

Since:
2.15
See Also:
Constant Field Values
Constructor Detail

Parameters

public Parameters()
Method Detail

errorSection

public static final PluginParameter<String> errorSection(String title,
                                                         String description)
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 default
defaultValue - 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 default
defaultValue - The default value or null to use the default error handling
options - 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 default
defaultValue - The default value or null to use the default error handling
options - 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 default
defaultValue - The default value or null to use the default error handling
options - 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 default
defaultValue - The default value or null to use the default error handling
options - 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 default
defaultValue - The default value or null to use the default error handling
options - 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)
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 by Config.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 description
defaultValue - The default value for the character set or null to use the system default

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 description
defaultValue - 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. See SimpleDateFormat 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 description
defaultValue - 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. See SimpleDateFormat 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 description
defaultValue - 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 description
defaultValue - 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 (see logFileParameter(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 description
defaultValue - The default value
Since:
2.8

cloneParameter

public static <T> PluginParameter<T> cloneParameter(PluginParameter<T> pp,
                                                    T defaultValue)
Clone a plug-in parameter but give it a different default value.

Parameters:
pp - The plug-in parameter to clone
defaultValue - 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

2.17.2: 2011-06-17