Changeset 4107
- Timestamp:
- Jan 29, 2008, 2:52:55 PM (15 years ago)
- Location:
- trunk/src/plugins/core/net/sf/basedb/plugins
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/AbstractFlatFileImporter.java
r4102 r4107 57 57 import net.sf.basedb.core.signal.ThreadSignalHandler; 58 58 59 import net.sf.basedb.plugins.util.Parameters; 59 60 import net.sf.basedb.util.NumberFormatUtil; 60 61 import net.sf.basedb.util.error.ClassMapErrorHandler; … … 277 278 Enumerates all available character sets. 278 279 @see #getCharsetParameter(String, String, String) 280 @deprecated Use {@link Parameters#charsetParameter(String, String, String)} 279 281 */ 280 282 protected static final StringParameterType charsetType = … … 284 286 /** 285 287 Type for selecting decimal separator. 288 @deprecated Use {@link Parameters#decimalSeparatorParameter(String, String, String)} 286 289 */ 287 290 protected static final StringParameterType decimalSeparatorType = … … 345 348 /** 346 349 Section definition for grouping error handling options. 347 */ 348 protected static final PluginParameter<String> errorSection = new PluginParameter<String>( 349 "errorSection", 350 "Error handling", 351 "Select how errors should be handled by the plugin.", 352 null 353 ); 354 355 protected static final PluginParameter<String> defaultErrorParameter = new PluginParameter<String>( 356 "defaultError", 357 "Default error handling", 358 "The default way to handle an error when no other error handling options have been " + 359 "specified to take care of specific exceptions.\n\n"+ 360 "skip = Skip the current data line and continue\n"+ 361 "fail = Stop with an error message (default)", 362 new StringParameterType(255, "fail", true, 1, 0, 0, 363 Arrays.asList( new String[] { "skip", "fail"} )) 364 ); 365 366 protected static final PluginParameter<String> stringTooLongErrorParameter = new PluginParameter<String>( 367 "stringTooLongError", 368 "String too long", 369 "How to handle errors that are caused by too long string values. If no value is specified the " + 370 "default error handling is used.\n\n"+ 371 "crop = Crop the string to the maximum allowed length\n"+ 372 "skip = Skip the current data line and continue\n"+ 373 "fail = Stop with an error message", 374 new StringParameterType(255, null, false, 1, 0, 0, 375 Arrays.asList( new String[] { "crop", "skip", "fail"} )) 376 ); 377 378 protected static final PluginParameter<String> invalidUseOfNullErrorParameter = new PluginParameter<String>( 379 "invalidUseOfNullError", 380 "Missing a required value", 381 "How to handle errors that are caused by missing a required value. If no value is specified the " + 382 "default error handling is used.\n\n"+ 383 "skip = Skip the current data line and continue\n"+ 384 "fail = Stop with an error message", 385 new StringParameterType(255, null, false, 1, 0, 0, 386 Arrays.asList( new String[] { "skip", "fail"} )) 387 ); 388 389 protected static final PluginParameter<String> numberOutOfRangeErrorParameter = new PluginParameter<String>( 390 "numberOutOfRangeError", 391 "Numeric value out of range", 392 "How to handle errors that are caused by numbers that are either too small or too big. If no value is specified the " + 393 "default error handling is used.\n\n"+ 394 "skip = Skip the current data line and continue\n"+ 395 "fail = Stop with an error message", 396 new StringParameterType(255, null, false, 1, 0, 0, 397 Arrays.asList( new String[] { "skip", "fail"} )) 398 ); 399 400 protected static final PluginParameter<String> numberFormatErrorParameter = new PluginParameter<String>( 401 "numberFormatError", 402 "Invalid numeric value", 403 "How to handle errors that are caused by strings that can't be converted to a numeric value. " + 404 "If no value is specified the default error handling is used.\n\n"+ 405 "null = Insert a null value and continue\n"+ 406 "skip = Skip the current data line and continue\n"+ 407 "fail = Stop with an error message", 408 new StringParameterType(255, null, false, 1, 0, 0, 409 Arrays.asList( new String[] { "null", "skip", "fail"} )) 410 ); 350 @see Parameters#errorSection(String, String) 351 */ 352 protected static final PluginParameter<String> errorSection = 353 Parameters.errorSection(null, null); 354 355 /** 356 @see Parameters#defaultError(String, String, String, String...) 357 */ 358 protected static final PluginParameter<String> defaultErrorParameter = 359 Parameters.defaultError(null, null, null); 360 361 /** 362 @see Parameters#stringTooLongError(String, String, String, String...) 363 */ 364 protected static final PluginParameter<String> stringTooLongErrorParameter = 365 Parameters.stringTooLongError(null, null, null); 366 367 /** 368 @see Parameters#invalidUseOfNullError(String, String, String, String...) 369 */ 370 protected static final PluginParameter<String> invalidUseOfNullErrorParameter = 371 Parameters.invalidUseOfNullError(null, null, null); 372 373 /** 374 @see Parameters#numberOutOfRangeError(String, String, String, String...) 375 */ 376 protected static final PluginParameter<String> numberOutOfRangeErrorParameter = 377 Parameters.numberOutOfRangeError(null, null, null); 378 379 /** 380 @see Parameters#numberFormatError(String, String, String, String...) 381 */ 382 protected static final PluginParameter<String> numberFormatErrorParameter = 383 Parameters.numberFormatError(null, null, null); 411 384 412 385 private long fileSize; … … 858 831 { 859 832 String charset = null; 860 if (job != null) charset = (String)job.getValue( CHARSET);833 if (job != null) charset = (String)job.getValue(Parameters.CHARSET_PARAMETER); 861 834 if (charset == null && configuration != null) 862 835 { 863 charset = (String)configuration.getValue( CHARSET);836 charset = (String)configuration.getValue(Parameters.CHARSET_PARAMETER); 864 837 } 865 838 if (charset == null) charset = Config.getCharset(); … … 877 850 { 878 851 String ds = null; 879 if (job != null) ds = (String)job.getValue( DECIMAL_SEPARATOR);852 if (job != null) ds = (String)job.getValue(Parameters.DECIMAL_SEPARATOR_PARAMETER); 880 853 if (ds == null && configuration != null) 881 854 { 882 ds = (String)configuration.getValue( DECIMAL_SEPARATOR);855 ds = (String)configuration.getValue(Parameters.DECIMAL_SEPARATOR_PARAMETER); 883 856 } 884 857 return ds; … … 911 884 The name of the parameter that asks for the character set. 912 885 @see #getCharsetParameter(String, String, String) 913 */ 914 protected static final String CHARSET = "charset"; 886 @deprecated Use {@link Parameters#CHARSET_PARAMETER} 887 */ 888 protected static final String CHARSET = Parameters.CHARSET_PARAMETER; 915 889 916 890 /** … … 926 900 @param defaultValue The default value for the character set or null to use 927 901 the system default 902 @deprecated USe {@link Parameters#charsetParameter(String, String, String)} 928 903 */ 929 904 protected PluginParameter<String> getCharsetParameter(String label, String description, String defaultValue) 930 905 { 931 if (label == null) label = "Character set"; 932 if (description == null) description = "The character set used in the file, if not specified the default character set is used " + 933 "(" + Config.getCharset() + ")."; 934 if (defaultValue == null) defaultValue = Config.getCharset(); 935 return new PluginParameter<String>( 936 CHARSET, label, description, defaultValue, charsetType 937 ); 906 return Parameters.charsetParameter(label, description, defaultValue); 938 907 } 939 908 … … 941 910 The name of the parameter that asks for the decimal separator. 942 911 @see #getCharsetParameter(String, String, String) 943 */ 944 protected static final String DECIMAL_SEPARATOR = "decimalSeparator"; 912 @deprecated Use {@link Parameters#DECIMAL_SEPARATOR_PARAMETER} 913 */ 914 protected static final String DECIMAL_SEPARATOR = Parameters.DECIMAL_SEPARATOR_PARAMETER; 945 915 946 916 /** … … 957 927 @param defaultValue The default value for the decimal separator 958 928 @since 2.2 929 @deprecated Use {@link Parameters#decimalSeparatorParameter(String, String, String)} 959 930 */ 960 931 protected PluginParameter<String> getDecimalSeparatorParameter(String label, String description, String defaultValue) 961 932 { 962 if (label == null) label = "Decimal separator"; 963 if (description == null) 964 { 965 description = "The decimal separator used in numeric values, " + 966 "if not specified dot is assumed."; 967 } 968 return new PluginParameter<String>( 969 DECIMAL_SEPARATOR, label, description, defaultValue, decimalSeparatorType 970 ); 933 return Parameters.decimalSeparatorParameter(label, description, defaultValue); 971 934 } 972 935 -
trunk/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java
r4015 r4107 79 79 import net.sf.basedb.core.query.Orders; 80 80 import net.sf.basedb.core.query.Restrictions; 81 import net.sf.basedb.plugins.util.Parameters; 81 82 import net.sf.basedb.util.error.ClassMapErrorHandler; 82 83 import net.sf.basedb.util.error.ErrorHandler; … … 467 468 storeValue(wrapper, request, minDataColumnsParameter); 468 469 storeValue(wrapper, request, maxDataColumnsParameter); 469 storeValue(wrapper, request, ri.getParameter( CHARSET));470 storeValue(wrapper, request, ri.getParameter( DECIMAL_SEPARATOR));470 storeValue(wrapper, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 471 storeValue(wrapper, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 471 472 472 473 // Column mappings … … 876 877 parameters.add(minDataColumnsParameter); 877 878 parameters.add(maxDataColumnsParameter); 878 parameters.add( getCharsetParameter(null, null, getCharset()));879 parameters.add( getDecimalSeparatorParameter(null, null, getDecimalSeparator()));879 parameters.add(Parameters.charsetParameter(null, null, getCharset())); 880 parameters.add(Parameters.decimalSeparatorParameter(null, null, getDecimalSeparator())); 880 881 881 882 // Mappings for Name and External ID -
trunk/src/plugins/core/net/sf/basedb/plugins/IlluminaRawDataImporter.java
r4095 r4107 82 82 import net.sf.basedb.core.query.Restriction; 83 83 import net.sf.basedb.core.query.Restrictions; 84 import net.sf.basedb.plugins.util.Parameters; 84 85 import net.sf.basedb.util.error.SimpleErrorHandler; 85 86 import net.sf.basedb.util.parser.ColumnMapper; … … 289 290 290 291 storeValue(job, request, fileParameter); 291 storeValue(job, request, ri.getParameter( CHARSET));292 storeValue(job, request, ri.getParameter( DECIMAL_SEPARATOR));292 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 293 storeValue(job, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 293 294 294 295 // Associations … … 671 672 672 673 parameters.add(fileParameter); 673 parameters.add(getCharsetParameter(null, null, null)); 674 parameters.add(getDecimalSeparatorParameter(null, null, (String)job.getValue(DECIMAL_SEPARATOR))); 675 674 parameters.add(Parameters.charsetParameter(null, null, null)); 675 parameters.add(Parameters.decimalSeparatorParameter(null, null, 676 (String)job.getValue(Parameters.DECIMAL_SEPARATOR_PARAMETER))); 677 676 678 // parameters for scan, protocol, software and array design 677 679 dc = sc.newDbControl(); -
trunk/src/plugins/core/net/sf/basedb/plugins/PlateFlatFileImporter.java
r3679 r4107 58 58 import net.sf.basedb.core.query.Hql; 59 59 import net.sf.basedb.core.query.Orders; 60 import net.sf.basedb.plugins.util.Parameters; 60 61 import net.sf.basedb.util.Coordinate; 61 62 import net.sf.basedb.util.MD5; … … 317 318 storeValue(configuration, request, minDataColumnsParameter); 318 319 storeValue(configuration, request, maxDataColumnsParameter); 319 storeValue(configuration, request, ri.getParameter( CHARSET));320 storeValue(configuration, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 320 321 321 322 // Column mappings … … 345 346 storeValue(job, request, plateTypeParameter); 346 347 storeValue(job, request, fileParameter); 347 storeValue(job, request, ri.getParameter( CHARSET));348 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 348 349 349 350 // Error handling parameters … … 524 525 parameters.add(minDataColumnsParameter); 525 526 parameters.add(maxDataColumnsParameter); 526 parameters.add( getCharsetParameter(null, null, null));527 parameters.add(Parameters.charsetParameter(null, null, null)); 527 528 528 529 // Column mappings … … 567 568 parameters.add(plateTypeParameter); 568 569 parameters.add(fileParameter); 569 parameters.add(getCharsetParameter(null, null, (String)configuration.getValue(CHARSET))); 570 parameters.add(Parameters.charsetParameter(null, null, 571 (String)configuration.getValue(Parameters.CHARSET_PARAMETER))); 570 572 parameters.add(plateNamePrefixParameter); 571 573 parameters.add(reporterPrefixParameter); -
trunk/src/plugins/core/net/sf/basedb/plugins/PrintMapFlatFileImporter.java
r4080 r4107 62 62 import net.sf.basedb.core.plugin.Request; 63 63 import net.sf.basedb.core.plugin.Response; 64 import net.sf.basedb.plugins.util.Parameters; 64 65 import net.sf.basedb.util.error.SimpleErrorHandler; 65 66 import net.sf.basedb.util.parser.FlatFileParser; … … 263 264 } 264 265 storeValue(job, request, fileParameter); 265 storeValue(job, request, ri.getParameter( CHARSET));266 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 266 267 storeValue(job, request, arrayDesignParameter); 267 268 … … 543 544 ); 544 545 parameters.add(fileParameter); 545 parameters.add( getCharsetParameter(null, null, null));546 parameters.add(Parameters.charsetParameter(null, null, null)); 546 547 547 548 // Error handling parameters -
trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java
r4097 r4107 64 64 import net.sf.basedb.core.plugin.Request; 65 65 import net.sf.basedb.core.plugin.Response; 66 import net.sf.basedb.plugins.util.Parameters; 66 67 import net.sf.basedb.util.Enumeration; 67 68 import net.sf.basedb.util.error.SimpleErrorHandler; … … 452 453 storeValue(configuration, request, minDataColumnsParameter); 453 454 storeValue(configuration, request, maxDataColumnsParameter); 454 storeValue(configuration, request, ri.getParameter( CHARSET));455 storeValue(configuration, request, ri.getParameter( DECIMAL_SEPARATOR));455 storeValue(configuration, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 456 storeValue(configuration, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 456 457 457 458 // Column mappings … … 479 480 storeValue(job, request, rawBioAssayParameter); 480 481 storeValue(job, request, fileParameter); 481 storeValue(job, request, ri.getParameter( CHARSET));482 storeValue(job, request, ri.getParameter( DECIMAL_SEPARATOR));482 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 483 storeValue(job, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 483 484 484 485 // Annotations … … 826 827 } 827 828 828 parameters.add(getCharsetParameter(null, null, (String)configuration.getValue(CHARSET))); 829 parameters.add(getDecimalSeparatorParameter(null, null, (String)configuration.getValue(DECIMAL_SEPARATOR))); 829 parameters.add(Parameters.charsetParameter(null, null, 830 (String)configuration.getValue(Parameters.CHARSET_PARAMETER))); 831 parameters.add(Parameters.decimalSeparatorParameter(null, null, 832 (String)configuration.getValue(Parameters.DECIMAL_SEPARATOR_PARAMETER))); 830 833 831 834 // Annotations section … … 937 940 parameters.add(minDataColumnsParameter); 938 941 parameters.add(maxDataColumnsParameter); 939 parameters.add( getCharsetParameter(null, null, null));940 parameters.add( getDecimalSeparatorParameter(null, null, null));942 parameters.add(Parameters.charsetParameter(null, null, null)); 943 parameters.add(Parameters.decimalSeparatorParameter(null, null, null)); 941 944 942 945 // Column mappings -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterFlatFileImporter.java
r4076 r4107 65 65 import net.sf.basedb.core.plugin.GuiContext; 66 66 67 import net.sf.basedb.plugins.util.Parameters; 67 68 import net.sf.basedb.util.error.SimpleErrorHandler; 68 69 import net.sf.basedb.util.parser.ConfigureByExample; … … 321 322 storeValue(configuration, request, minDataColumnsParameter); 322 323 storeValue(configuration, request, maxDataColumnsParameter); 323 storeValue(configuration, request, ri.getParameter( CHARSET));324 storeValue(configuration, request, ri.getParameter( DECIMAL_SEPARATOR));324 storeValue(configuration, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 325 storeValue(configuration, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 325 326 326 327 // Column mappings … … 353 354 } 354 355 storeValue(job, request, fileParameter); 355 storeValue(job, request, ri.getParameter( CHARSET));356 storeValue(job, request, ri.getParameter( DECIMAL_SEPARATOR));356 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 357 storeValue(job, request, ri.getParameter(Parameters.DECIMAL_SEPARATOR_PARAMETER)); 357 358 storeValue(job, request, ri.getParameter("mode")); 358 359 … … 753 754 754 755 parameters.add(modeParameter); 755 parameters.add(getCharsetParameter(null, null, (String)configuration.getValue(CHARSET))); 756 parameters.add(getDecimalSeparatorParameter(null, null, (String)configuration.getValue(DECIMAL_SEPARATOR))); 756 parameters.add(Parameters.charsetParameter(null, null, 757 (String)configuration.getValue(Parameters.CHARSET_PARAMETER))); 758 parameters.add(Parameters.decimalSeparatorParameter(null, null, 759 (String)configuration.getValue(Parameters.DECIMAL_SEPARATOR_PARAMETER))); 757 760 758 761 parameters.add(errorSection); … … 810 813 parameters.add(minDataColumnsParameter); 811 814 parameters.add(maxDataColumnsParameter); 812 parameters.add( getCharsetParameter(null, null, null));813 parameters.add( getDecimalSeparatorParameter(null, null, null));815 parameters.add(Parameters.charsetParameter(null, null, null)); 816 parameters.add(Parameters.decimalSeparatorParameter(null, null, null)); 814 817 815 818 // Column mappings -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterMapFlatFileImporter.java
r4097 r4107 62 62 import net.sf.basedb.core.plugin.Request; 63 63 import net.sf.basedb.core.plugin.Response; 64 import net.sf.basedb.plugins.util.Parameters; 64 65 import net.sf.basedb.util.error.SimpleErrorHandler; 65 66 import net.sf.basedb.util.parser.ConfigureByExample; … … 445 446 storeValue(configuration, request, minDataColumnsParameter); 446 447 storeValue(configuration, request, maxDataColumnsParameter); 447 storeValue(configuration, request, ri.getParameter( CHARSET));448 storeValue(configuration, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 448 449 449 450 // Column mappings … … 471 472 storeValue(job, request, arrayDesignParameter); 472 473 storeValue(job, request, fileParameter); 473 storeValue(job, request, ri.getParameter( CHARSET));474 storeValue(job, request, ri.getParameter(Parameters.CHARSET_PARAMETER)); 474 475 475 476 // Error handling parameters … … 706 707 ); 707 708 parameters.add(fileParameter); 708 parameters.add(getCharsetParameter(null, null, (String)configuration.getValue(CHARSET))); 709 parameters.add(Parameters.charsetParameter(null, null, 710 (String)configuration.getValue(Parameters.CHARSET_PARAMETER))); 709 711 710 712 // Error handling parameters … … 745 747 parameters.add(minDataColumnsParameter); 746 748 parameters.add(maxDataColumnsParameter); 747 parameters.add( getCharsetParameter(null, null, null));749 parameters.add(Parameters.charsetParameter(null, null, null)); 748 750 749 751 // Column mappings
Note: See TracChangeset
for help on using the changeset viewer.