public class SampleImporter extends AbstractItemImporter<Sample>
Plugin.MainType
Modifier and Type | Field and Description |
---|---|
protected static PluginParameter<java.lang.String> |
bioPlateColumnMapping
Column mapping parameter for the bioplate
|
private Mapper |
bioPlateMapper |
protected static PluginParameter<java.lang.String> |
bioWellColColumnMapping
Column mapping parameter for the biowell's column
|
private Mapper |
bioWellColMapper |
protected static PluginParameter<java.lang.String> |
bioWellRowColumnMapping
Column mapping parameter for the biowell's row
|
private Mapper |
bioWellRowMapper |
protected static PluginParameter<java.lang.String> |
createdColumnMapping
Column mapping parameter for the sample creation date.
|
private Mapper |
createdMapper |
private DefaultItemFunction<Protocol> |
defaultPrototolFunction |
private Mapper |
descriptionMapper |
private Mapper |
externalIdMapper |
private static java.util.Set<GuiContext> |
guiContexts |
private Mapper |
nameMapper |
protected static PluginParameter<java.lang.String> |
originalQuantityColumnMapping
Column mapping parameter for the original quantity.
|
private Mapper |
originalQuantityMapper |
protected static PluginParameter<java.lang.String> |
parentColumnMapping
Column mapping parameter for the parent (biosource OR sample)
|
private Mapper |
parentMapper |
protected static PluginParameter<java.lang.String> |
parentTypeColumnMapping
Column mapping parameter for the parent type.
|
private Mapper |
parentTypeMapper |
private Mapper |
protocolMapper |
protected static PluginParameter<java.lang.String> |
usedQuantityColumnMapping
Column mapping parameter for the used quantity from the parent.
|
private Mapper |
usedQuantityMapper |
defaultsSection, descriptionColumnMapping, externalIdColumnMapping, identificationSection, internalIdColumnMapping, nameColumnMapping, optionalColumnMapping, permissionTemplateColumnMapping, protocolColumnMapping, requiredColumnMapping, subtypeColumnMapping
complexMappings, dataFooterRegexpParameter, dataHeaderRegexpParameter, dataSplitterRegexpParameter, defaultErrorParameter, errorSection, fileParameter, fileType, headerRegexpParameter, ignoreRegexpParameter, invalidUseOfNullErrorParameter, mappingSection, maxDataColumnsParameter, minDataColumnsParameter, numberFormatErrorParameter, numberOutOfRangeErrorParameter, numDataColumnsType, optionalRegexpType, parserSection, requiredRegexpType, sectionRegexpParameter, stringTooLongErrorParameter, trimQuotesParameter
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
Constructor and Description |
---|
SampleImporter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addMoreColumnMappingParameters(java.util.List<PluginParameter<?>> parameters)
Adds column mappings for name, externalId, description,
protocol, creation date, original quantity, pooled, parent
and used quantity from parent.
|
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 Sample |
createItem(DbControl dc,
FlatFileParser.Data data)
Create a new item and populate it with data from the current line.
|
protected ItemQuery<Sample> |
createItemQuery()
Calls
Sample.getQuery() . |
java.util.Set<GuiContext> |
getGuiContexts()
Get a set containing all items that the plugin handles.
|
protected IdMethod[] |
getIdMethods()
|
protected Item |
getItemForSubtypes()
Does the importer want to use item subtypes when importing?
|
protected void |
updateItem(DbControl dc,
Sample sample,
FlatFileParser.Data data)
Update an item with data from the current line.
|
protected void |
updateMultiLineItem(DbControl dc,
Sample sample,
FlatFileParser.Data data,
int multiLineNum)
If the sample is pooled, add the parent sample.
|
addMoreErrorParameters, addMoreJobParameters, addMoreParsingParameters, begin, beginData, configure, doneWithItem, end, findArrayBatch, findArrayDesign, findArraySlide, findBioPlate, findBioPlateType, findBioSource, findBioSource, findBioWell, findDataFileType, findDerivedBioAssay, findExtract, findExtract, findFileServer, findHardware, findHardware, findHybridization, findItemSubtype, findItemSubtype, findLabeledExtract, findPermissionTemplate, findPhysicalBioAssay, findPlateGeometry, findPlatform, findProtocol, findProtocol, findRawDataType, findReferencedItem, findReferencedItemWithSubtype, findSample, findSample, findSoftware, findSoftware, findTag, findTag, findVariant, getConfigureOptionsParameters, getConfigureParserParameters, getDefaultItemFunction, getIdMethod, getInitializedFlatFileParser, getInitializedFlatFileParser, getProjectDefaultPlatform, getProjectDefaultRawDataType, getProjectDefaultVariant, getRequestInformation, getSuccessMessage, handleData, initReferenceQuery, isInContext, parseDate, requiresConfiguration, setOrAddFile, setUpErrorHandling, supportsConfigurations, updateItemSubtype, updatePermissions
addErrorHandler, checkColumnMapping, checkColumnMapping, continueWithNextFileAfterError, doImport, finish, getCharset, getCharset, getDecimalSeparator, getErrorHandler, getErrorOption, getFileIterator, getMainType, getMapper, getMapper, getNumberFormat, getNumBytes, getProgress, getSignalHandler, getTotalFileSize, handleHeader, handleSection, isImportable, isImportable, log, log, log, log, run, start, wrapInputStream
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, log, log, storeValue, storeValue, storeValues, validateRequestParameters
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
done, getMainType, getPermissions, init, run
private static final java.util.Set<GuiContext> guiContexts
protected static final PluginParameter<java.lang.String> createdColumnMapping
protected static final PluginParameter<java.lang.String> originalQuantityColumnMapping
protected static final PluginParameter<java.lang.String> parentTypeColumnMapping
protected static final PluginParameter<java.lang.String> parentColumnMapping
protected static final PluginParameter<java.lang.String> usedQuantityColumnMapping
protected static final PluginParameter<java.lang.String> bioPlateColumnMapping
protected static final PluginParameter<java.lang.String> bioWellRowColumnMapping
protected static final PluginParameter<java.lang.String> bioWellColColumnMapping
private Mapper nameMapper
private Mapper descriptionMapper
private Mapper externalIdMapper
private Mapper originalQuantityMapper
private Mapper createdMapper
private Mapper protocolMapper
private DefaultItemFunction<Protocol> defaultPrototolFunction
private Mapper parentTypeMapper
private Mapper parentMapper
private Mapper usedQuantityMapper
private Mapper bioPlateMapper
private Mapper bioWellRowMapper
private Mapper bioWellColMapper
public java.util.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<Sample>
protected Item getItemForSubtypes()
AbstractItemImporter
getItemForSubtypes
in class AbstractItemImporter<Sample>
protected void addMoreColumnMappingParameters(java.util.List<PluginParameter<?>> parameters)
addMoreColumnMappingParameters
in class AbstractItemImporter<Sample>
parameters
- The list of parameters to add the column
mapping parameters toprotected ItemQuery<Sample> createItemQuery()
Sample.getQuery()
.createItemQuery
in class AbstractItemImporter<Sample>
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<Sample>
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 Sample 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<Sample>
dc
- The DbControl to use for database accessdata
- The current data lineprotected void updateItem(DbControl dc, Sample sample, 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<Sample>
dc
- The DbControl to use for database accesssample
- The item to updatedata
- The current data lineprotected void updateMultiLineItem(DbControl dc, Sample sample, FlatFileParser.Data data, int multiLineNum)
updateMultiLineItem
in class AbstractItemImporter<Sample>
dc
- The DbControl to use for database accesssample
- The item to updatedata
- The current data linemultiLineNum
- The number of the multi-line entry, starting with 1
for the first multi-line