|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.plugin.AbstractPlugin net.sf.basedb.plugins.AbstractFlatFileImporter net.sf.basedb.plugins.batchimport.AbstractItemImporter<Scan> net.sf.basedb.plugins.batchimport.ScanImporter
public class ScanImporter
Plug-in for importing scan items in a batch. The plug-in can create new items and updated existing items.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
Plugin.MainType |
Field Summary | |
---|---|
private static About |
about
|
private Mapper |
descriptionMapper
|
private static Set<GuiContext> |
guiContexts
|
protected static PluginParameter<String> |
hardwareColumnMapping
|
private Mapper |
hardwareMapper
|
protected static PluginParameter<String> |
hybridizationColumnMapping
|
private Mapper |
hybridizationMapper
|
protected static PluginParameter<String> |
imageDescriptionColumnMapping
|
private Mapper |
imageDescriptionMapper
|
protected static PluginParameter<String> |
imageFileColumnMapping
|
private Mapper |
imageFileMapper
|
protected static PluginParameter<String> |
imageFormatColumnMapping
|
private Mapper |
imageFormatMapper
|
protected static PluginParameter<String> |
imageNameColumnMapping
|
private Mapper |
imageNameMapper
|
protected static PluginParameter<String> |
imagePreviewColumnMapping
|
private Mapper |
imagePreviewMapper
|
private String |
imagesDirectory
|
private Mapper |
nameMapper
|
private Mapper |
protocolMapper
|
Fields inherited from class net.sf.basedb.plugins.batchimport.AbstractItemImporter |
---|
defaultsSection, descriptionColumnMapping, externalIdColumnMapping, identificationSection, internalIdColumnMapping, nameColumnMapping, optionalColumnMapping, permissionTemplateColumnMapping, protocolColumnMapping, requiredColumnMapping |
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc |
Constructor Summary | |
---|---|
ScanImporter()
|
Method Summary | |
---|---|
protected void |
addMoreColumnMappingParameters(List<PluginParameter<?>> parameters)
Adds column mappings for name, internalId, description, hybridization, protocol, hardware, image-file, image-name, image-format and image-description. |
protected void |
addMoreJobParameters(List<PluginParameter<?>> parameters)
Add parameter for "Image directory" directory where image files may be located. |
protected void |
createColumnMappers(FlatFileParser ffp,
boolean cropStrings)
Create mappers that can be used to extract data values from the file that is currently being parsed by the ffp FlatFileParser . |
protected Scan |
createItem(DbControl dc,
FlatFileParser.Data data)
Create a new item and populate it with data from the current line. |
protected ItemQuery<Scan> |
createItemQuery()
Calls Scan.getQuery() . |
About |
getAbout()
Get information about the plugin, such as name, version, authors, etc. |
Set<GuiContext> |
getGuiContexts()
Get a set containing all items that the plugin handles. |
protected IdMethod[] |
getIdMethods()
Useable methods are: PropertyIdMethod.NAME
InternalIdMethod.INTERNAL_ID
FallbackIdMethod.NAME_OR_ID
|
protected void |
updateItem(DbControl dc,
Scan scan,
FlatFileParser.Data data)
Update an item with data from the current line. |
protected void |
updateMultiLineItem(DbControl dc,
Scan scan,
FlatFileParser.Data data,
int multiLineNum)
Update an item with data from a multi-line entry. |
Methods inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter |
---|
addErrorHandler, checkColumnMapping, checkColumnMapping, continueWithNextFileAfterError, doImport, finish, getCharset, getCharset, getCharsetParameter, getDecimalSeparator, getDecimalSeparatorParameter, getErrorHandler, getErrorOption, getFileIterator, getMainType, getMapper, getNumberFormat, getNumBytes, getPrimaryLocationFilter, getProgress, getSignalHandler, getTotalFileSize, handleHeader, handleSection, isImportable, isImportable, log, log, log, log, run, start, wrapInputStream |
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
checkInterrupted, cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
done, getMainType, getPermissions, init, run |
Field Detail |
---|
private static final Set<GuiContext> guiContexts
private static final About about
protected static final PluginParameter<String> hardwareColumnMapping
protected static final PluginParameter<String> hybridizationColumnMapping
protected static final PluginParameter<String> imageFileColumnMapping
protected static final PluginParameter<String> imageNameColumnMapping
protected static final PluginParameter<String> imageFormatColumnMapping
protected static final PluginParameter<String> imagePreviewColumnMapping
protected static final PluginParameter<String> imageDescriptionColumnMapping
private Mapper nameMapper
private Mapper descriptionMapper
private Mapper protocolMapper
private Mapper hardwareMapper
private Mapper hybridizationMapper
private Mapper imageFileMapper
private Mapper imageNameMapper
private Mapper imageFormatMapper
private Mapper imagePreviewMapper
private Mapper imageDescriptionMapper
private String imagesDirectory
Constructor Detail |
---|
public ScanImporter()
Method Detail |
---|
public About getAbout()
Plugin
About
objectpublic Set<GuiContext> getGuiContexts()
InteractivePlugin
Item.REPORTER
.
This information is used by client applications to put the plugin
in the proper place in the user interface.
Set
containing Item
:s, or null
if the plugin is not concerned about itemsprotected IdMethod[] getIdMethods()
getIdMethods
in class AbstractItemImporter<Scan>
protected void addMoreColumnMappingParameters(List<PluginParameter<?>> parameters)
addMoreColumnMappingParameters
in class AbstractItemImporter<Scan>
parameters
- The list of parameters to add the column
mapping parameters toprotected void addMoreJobParameters(List<PluginParameter<?>> parameters)
addMoreJobParameters
in class AbstractItemImporter<Scan>
parameters
- The list of parameters to add the column
mapping parameters toprotected ItemQuery<Scan> createItemQuery()
Scan.getQuery()
.
createItemQuery
in class AbstractItemImporter<Scan>
protected void createColumnMappers(FlatFileParser ffp, boolean cropStrings)
AbstractItemImporter
ffp
FlatFileParser
.
This method is called during initialisation of the plug-in when the
FlatFileParser.parseHeaders()
has successfully found the start of
data. Use the AbstractFlatFileImporter.getMapper(FlatFileParser, String, Integer, Mapper)
to create column mappers. Example:
nameMapper = getMapper(ffp, job.getValue("nameColumnMapping"), cropStrings ? Nameable.MAX_NAME_LENGTH : null, null);
createColumnMappers
in class AbstractItemImporter<Scan>
ffp
- The parser that is parsing the data filecropStrings
- If strings that are too long to fit in the database
should be cropped or not (=generate an error)protected Scan createItem(DbControl dc, FlatFileParser.Data data)
AbstractItemImporter
DbControl.saveItem(BasicItem)
. This is done automatically
by the core implementation.
BioSource bs = BioSource.getNew(dc); // Set properties; see example on updateItem method return bs;
If the current data line doesn't have data for all required
properties, this method should throw an InvalidUseOfNullException
exception.
This method is called during import when current item can be found and if the user has selected to create missing item.
createItem
in class AbstractItemImporter<Scan>
dc
- The DbControl to use for database accessdata
- The current data line
protected void updateItem(DbControl dc, Scan scan, FlatFileParser.Data data)
AbstractItemImporter
if (nameMapper != null) item.setName(nameMapper.getValue(data)); if (descriptionMapper != null) item.setDescription(descriptionMapper.getValue(data)); ...This method is called during import to update an existing item.
updateItem
in class AbstractItemImporter<Scan>
dc
- The DbControl to use for database accessscan
- The item to updatedata
- The current data lineprotected void updateMultiLineItem(DbControl dc, Scan scan, FlatFileParser.Data data, int multiLineNum)
AbstractItemImporter
updateMultiLineItem
in class AbstractItemImporter<Scan>
dc
- The DbControl to use for database accessscan
- The item to updatedata
- The current data linemultiLineNum
- The number of the multi-line entry, starting with 1
for the first multi-line
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |