|
3.0.2: 2012-01-25 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.plugins.AbstractFlatFileImporter
net.sf.basedb.plugins.batchimport.AbstractItemImporter<I>
public abstract class AbstractItemImporter<I extends BasicItem>
An abstract base class for plug-ins that import items in batch. This class implements job configuration, file parsing, logging, error handling, etc. Actual implementations have to provide item-specific parts, such as:
InteractivePlugin.getGuiContexts()
method.
getIdMethods()
addMoreColumnMappingParameters(List)
createItemQuery()
createColumnMappers(FlatFileParser, boolean)
createItem(DbControl, FlatFileParser.Data)
updateItem(DbControl, BasicItem, FlatFileParser.Data)
and updateMultiLineItem(DbControl, BasicItem, FlatFileParser.Data, int)
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
Plugin.MainType |
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc |
Constructor Summary | |
---|---|
AbstractItemImporter()
|
Method Summary | ||
---|---|---|
protected void |
addMoreColumnMappingParameters(List<PluginParameter<?>> parameters)
Add column mapping parameters for item-specific properties. |
|
protected void |
addMoreErrorParameters(List<PluginParameter<?>> parameters)
Add extra parameters to the "Error handling" section that the subclass needs. |
|
protected void |
addMoreJobParameters(List<PluginParameter<?>> parameters)
Add extra job parameters that the subclass needs. |
|
protected void |
addMoreParsingParameters(List<PluginParameter<?>> parameters)
Add extra parameters to the "Parser settings" section that the subclass needs. |
|
protected void |
begin(FlatFileParser ffp)
Setup error handling and pre-load some of the configuration options. |
|
protected void |
beginData()
Setup column mapping. |
|
void |
configure(GuiContext context,
Request request,
Response response)
Configure the plugin. |
|
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 abstract I |
createItem(DbControl dc,
FlatFileParser.Data data)
Create a new item and populate it with data from the current line. |
|
protected abstract ItemQuery<I> |
createItemQuery()
Create a new query that returns items of the importable type. |
|
protected void |
doneWithItem(DbControl dc,
I item,
int numMultiLines)
Called when the importer is finished with an item. |
|
protected void |
end(boolean success)
Called just after the last line of the file has been parsed, or immediately after an error has ocurred. |
|
protected ArrayBatch |
findArrayBatch(DbControl dc,
IdMethod idMethod,
String identifier)
Find an array batch with a given identifier. |
|
protected ArrayDesign |
findArrayDesign(DbControl dc,
IdMethod idMethod,
String identifier)
Find an array design with a given identifier. |
|
protected ArraySlide |
findArraySlide(DbControl dc,
IdMethod idMethod,
String identifier)
Find an array slide with a given identifier. |
|
protected BioPlate |
findBioPlate(DbControl dc,
IdMethod idMethod,
String identifier)
Find a bioplate with a given identifier. |
|
protected BioPlateType |
findBioPlateType(DbControl dc,
IdMethod idMethod,
String identifier)
Find a bioplate type with a given identifier. |
|
protected BioSource |
findBioSource(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findBioSource(DbControl, IdMethod, String, ItemSubtype) with
a null item subtype. |
|
protected BioSource |
findBioSource(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a biosource with a given identifier. |
|
protected BioWell |
findBioWell(DbControl dc,
BioPlate plate,
String row,
String column)
Find a well on a bioplate. |
|
protected DataFileType |
findDataFileType(DbControl dc,
IdMethod idMethod,
String identifier)
Find a data file type with a given identifier. |
|
protected DerivedBioAssay |
findDerivedBioAssay(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a derived bioassay with a given identifier. |
|
protected Extract |
findExtract(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findSample(DbControl, IdMethod, String, ItemSubtype)
with a null subtype. |
|
protected Extract |
findExtract(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find an extract with a given identifier. |
|
protected Hardware |
findHardware(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findHardware(DbControl, IdMethod, String, ItemSubtype) with
a null item subtype. |
|
protected Hardware |
findHardware(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a hardware with a given identifier. |
|
protected PhysicalBioAssay |
findHybridization(DbControl dc,
IdMethod idMethod,
String identifier)
Find a hybridization with a given identifier. |
|
protected ItemSubtype |
findItemSubtype(DbControl dc,
IdMethod idMethod,
Item mainType,
String identifier)
Find an item subtype with a given identifier. |
|
protected ItemSubtype |
findItemSubtype(DbControl dc,
Item mainItemType,
FlatFileParser.Data data)
Try to find subtype from the given file data. |
|
protected Extract |
findLabeledExtract(DbControl dc,
IdMethod idMethod,
String identifier)
Find a labled extract with a given identifier. |
|
protected PermissionTemplate |
findPermissionTemplate(DbControl dc,
IdMethod idMethod,
String identifier)
Find a permission template with a given identifier. |
|
protected PhysicalBioAssay |
findPhysicalBioAssay(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a physical bioassay with a given identifier. |
|
protected PlateGeometry |
findPlateGeometry(DbControl dc,
IdMethod idMethod,
String identifier)
Find a plate geometry with a given identifier. |
|
protected Platform |
findPlatform(DbControl dc,
IdMethod idMethod,
String identifier)
Find a platform with a given identifier. |
|
protected Protocol |
findProtocol(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findProtocol(DbControl, IdMethod, String, ItemSubtype) with
a null item subtype. |
|
protected Protocol |
findProtocol(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a protocol with a given identifier. |
|
protected RawDataType |
findRawDataType(DbControl dc,
Platform platform,
PlatformVariant variant,
String identifier)
Find a matching raw data type. |
|
protected
|
findReferencedItem(DbControl dc,
IdMethod idMethod,
ItemQuery<T> query,
String identifier,
int subtypeId,
boolean ignoreNotFound)
Find a referenced item. |
|
protected
|
findReferencedItemWithSubtype(DbControl dc,
IdMethod idMethod,
ItemQuery<T> query,
String identifier,
ItemSubtype subtype,
boolean ignoreNotFound)
Find a referenced item with a subtype. |
|
protected Sample |
findSample(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findSample(DbControl, IdMethod, String, ItemSubtype)
with a null subtype. |
|
protected Sample |
findSample(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a sample with a given identifier. |
|
protected Software |
findSoftware(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findSoftware(DbControl, IdMethod, String, ItemSubtype) with
a null item subtype. |
|
protected Software |
findSoftware(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a software with a given identifier. |
|
protected Tag |
findTag(DbControl dc,
IdMethod idMethod,
String identifier)
Same as findTag(DbControl, IdMethod, String, ItemSubtype) with
a null item subtype. |
|
protected Tag |
findTag(DbControl dc,
IdMethod idMethod,
String identifier,
ItemSubtype subtype)
Find a tag with a given identifier. |
|
protected PlatformVariant |
findVariant(DbControl dc,
Platform platform,
IdMethod idMethod,
String identifier)
Find a platform variant with a given identifier. |
|
protected RequestInformation |
getConfigureOptionsParameters(GuiContext context)
|
|
protected RequestInformation |
getConfigureParserParameters(GuiContext context,
boolean forJob)
|
|
protected IdMethod |
getIdMethod(String method)
Get the id method to use for finding items. |
|
protected IdMethod[] |
getIdMethods()
Get an array with all identification methods that can be used to find items. |
|
protected FlatFileParser |
getInitializedFlatFileParser()
Create and initialise a flat file parser by setting all regular expressions and other options. |
|
protected FlatFileParser |
getInitializedFlatFileParser(ParameterValues parameters)
|
|
protected Item |
getItemForSubtypes()
Does the importer want to use item subtypes when importing? |
|
private Pattern |
getPattern(ParameterValues parameters,
String name)
|
|
protected Platform |
getProjectDefaultPlatform(DbControl dc)
Get the default platform of the currently active project. |
|
protected RawDataType |
getProjectDefaultRawDataType(DbControl dc)
Get the default raw data type of the currently active project. |
|
protected PlatformVariant |
getProjectDefaultVariant(DbControl dc)
Get the default platform variant of the currently active project. |
|
RequestInformation |
getRequestInformation(GuiContext context,
String command)
This method will return the RequestInformation for a given command, i.e. |
|
protected String |
getSuccessMessage(int skippedLines)
Called if the parsing was successful to let the subclass generate a simple message that is sent back to the core and user interface. |
|
protected void |
handleData(FlatFileParser.Data data)
Called by the parser for every line in the file that is a data line. |
|
protected
|
initReferenceQuery(DbControl dc,
IdMethod idMethod,
ItemQuery<T> query,
boolean subtype)
Initialise a query that is used to find referenced items. |
|
String |
isInContext(GuiContext context,
Object item)
Check if the plugin can be used on the specified object. |
|
protected Date |
parseDate(String date)
Parse a string to a date using the date format specified by the 'Date format' parameter. |
|
boolean |
requiresConfiguration()
Return TRUE, since the implementation requires it for finding the regular expressions used by the FlatFileParser . |
|
protected FileSetMember |
setOrAddFile(FileStoreEnabled item,
DataFileType fileType,
File file)
Set or add a file to a file set. |
|
protected void |
setUpErrorHandling()
Don't use AbstractFlatFileImporter to handle errors. |
|
boolean |
supportsConfigurations()
Returns TRUE, since that is how the plugins used to work before this method was introduced. |
|
protected abstract void |
updateItem(DbControl dc,
I item,
FlatFileParser.Data data)
Update an item with data from the current line. |
|
protected void |
updateItemSubtype(DbControl dc,
Subtypable item,
FlatFileParser.Data data)
If a mapping for item subtype has been specified or if a single subtype was selected for item identification in this job, this method is will update the subtype on the item. |
|
protected void |
updateMultiLineItem(DbControl dc,
I item,
FlatFileParser.Data data,
int multiLineNum)
Update an item with data from a multi-line entry. |
|
protected void |
updatePermissions(DbControl dc,
Shareable item,
FlatFileParser.Data data,
boolean merge)
If a mapping for a permission template has been specified for the job, this method is automatically called. |
Methods inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter |
---|
addErrorHandler, checkColumnMapping, checkColumnMapping, continueWithNextFileAfterError, doImport, finish, getCharset, getCharset, getDecimalSeparator, getErrorHandler, getErrorOption, getFileIterator, getMainType, getMapper, getNumberFormat, getNumBytes, getProgress, getSignalHandler, getTotalFileSize, handleHeader, handleSection, isImportable, isImportable, log, log, log, log, run, start, wrapInputStream |
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin |
---|
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.InteractivePlugin |
---|
getGuiContexts |
Methods inherited from interface net.sf.basedb.core.plugin.Plugin |
---|
done, getMainType, getPermissions, init, run |
Field Detail |
---|
private static final String CONFIGURE_OPTIONS
protected static final StringParameterType optionalColumnMapping
protected static final StringParameterType requiredColumnMapping
protected static final PluginParameter<String> defaultsSection
protected static final PluginParameter<String> identificationSection
protected static final PluginParameter<String> internalIdColumnMapping
protected static final PluginParameter<String> nameColumnMapping
protected static final PluginParameter<String> subtypeColumnMapping
protected static final PluginParameter<String> descriptionColumnMapping
protected static final PluginParameter<String> externalIdColumnMapping
protected static final PluginParameter<String> protocolColumnMapping
protected static final PluginParameter<String> permissionTemplateColumnMapping
private static final PluginParameter<String> itemNotFoundErrorParameter
private static final PluginParameter<String> itemExistsErrorParameter
private static final PluginParameter<String> multipleItemsFoundErrorParameter
private static final PluginParameter<String> referenceNotFoundErrorParameter
private static final PluginParameter<String> multipleReferencesFoundErrorParameter
private static final PluginParameter<String> noWritePermissionToItemErrorParameter
private static final PluginParameter<String> noUsePermissionToReferenceErrorParameter
private DbControl dc
private FlatFileParser ffp
private DateFormatter dateFormatter
private IdMethod idMethod
private String idMapping
private Mapper idMapper
private Mapper permissionTemplateMapper
private Mapper subtypeMapper
private ItemSubtype selectedSubtype
private ItemQuery<I extends BasicItem> itemQuery
private String lastIdentifier
private I extends BasicItem lastItem
private int numMultiLines
private boolean skippedLast
private boolean dryRun
private ClassMapErrorHandler errorHandler
private boolean cropStrings
private boolean createNotFoundItems
private boolean failIfNotFoundItems
private boolean updateExistingItems
private boolean failIfItemExists
private boolean failIfMultipleFoundItems
private boolean failIfNotFoundReference
private boolean failIfMultipleFoundReferences
private boolean failIfNoWritePermissionToItem
private boolean failIfNoUsePermissionToReference
private int numUpdated
private int numCreated
private int numError
private int numNotFound
private int numExisted
private ItemQuery<ItemSubtype> subtypeQuery
private ItemQuery<Protocol> protocolQuery
private ItemQuery<Tag> tagQuery
private ItemQuery<Hardware> hardwareQuery
private ItemQuery<Software> softwareQuery
private ItemQuery<Platform> platformQuery
private ItemQuery<PlatformVariant> variantQuery
private ItemQuery<DataFileType> fileTypeQuery
private ItemQuery<PermissionTemplate> permissionTemplateQuery
private ItemQuery<BioSource> bioSourceQuery
private ItemQuery<Sample> sampleQuery
private ItemQuery<Extract> extractQuery
private ItemQuery<Extract> labeledExtractQuery
private ItemQuery<BioPlate> bioPlateQuery
private ItemQuery<ArraySlide> arraySlideQuery
private ItemQuery<PhysicalBioAssay> hybQuery
private ItemQuery<PhysicalBioAssay> physicalBioAssayQuery
private ItemQuery<DerivedBioAssay> derivedBioAssayQuery
private ItemQuery<ArrayDesign> designQuery
private ItemQuery<ArrayBatch> batchQuery
private ItemQuery<PlateGeometry> geometryQuery
private ItemQuery<BioPlateType> bioPlateTypeQuery
private Set<String> fileCache
private Map<String,BasicItem> itemCache
private RequestInformation configureParser
private RequestInformation configureOptions
Constructor Detail |
---|
public AbstractItemImporter()
Method Detail |
---|
public boolean requiresConfiguration()
AbstractFlatFileImporter
FlatFileParser
. If this
method is overridden and returns FALSE, the subclass must also override
the AbstractFlatFileImporter.getInitializedFlatFileParser()
method and provide a
parser with all regular expressions and other options set.
requiresConfiguration
in interface Plugin
requiresConfiguration
in class AbstractFlatFileImporter
public boolean supportsConfigurations()
AbstractPlugin
supportsConfigurations
in interface Plugin
supportsConfigurations
in class AbstractPlugin
public String isInContext(GuiContext context, Object item)
InteractivePlugin
BasicItem
or BasicData
object, or null if called from
a list context. A client application should only call this method for
contexts matching one of
the contexts in the set returned by the InteractivePlugin.getGuiContexts()
method. For GuiContext.Type.ITEM
contexts an item
of the correct type should be passed as a parameter.
The plug-in can response with a null value indicating success, a warning-level message or throw an exception to indicate an error-level message. Client application should normally only show error-level messages to users, unless the user has requested to see warning messages.
NOTE! Before BASE 2.4 all messages were treated as error-level messages.
isInContext
in interface InteractivePlugin
context
- The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
item
- The currently active item, it's type should match the
GuiContext.getItem()
type, or null if the context is a list
context
Null
if the plugin can use that item, or
a warning-level message explaining why the plugin can't be usedpublic void configure(GuiContext context, Request request, Response response)
InteractivePlugin
InteractivePlugin.getRequestInformation(GuiContext, String)
.
configure
in interface InteractivePlugin
context
- The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
request
- Request object with the command and parametersresponse
- Response object in for the plugin to response
throughpublic RequestInformation getRequestInformation(GuiContext context, String command) throws BaseException
InteractivePlugin
RequestInformation
for a given command, i.e.
the list of parameters and some nice help text.
getRequestInformation
in interface InteractivePlugin
context
- The current context of the client application,
it is one of the values found in set returned by InteractivePlugin.getGuiContexts()
command
- The command
RequestInformation
for the command
BaseException
- if there is an errorprotected FlatFileParser getInitializedFlatFileParser() throws BaseException
AbstractFlatFileImporter
AbstractPlugin.job
or AbstractPlugin.configuration
settings. If a subclass doesn't store the
parameters there it must override this method and initialise the parser. Note that
this method is called once for each file returned by the
AbstractFlatFileImporter.getFileIterator()
and that a new parser is needed for each file.
getInitializedFlatFileParser
in class AbstractFlatFileImporter
BaseException
protected void setUpErrorHandling()
setUpErrorHandling
in class AbstractFlatFileImporter
protected void begin(FlatFileParser ffp)
begin
in class AbstractFlatFileImporter
AbstractFlatFileImporter.end(boolean)
protected void beginData()
beginData
in class AbstractFlatFileImporter
protected void handleData(FlatFileParser.Data data) throws BaseException
AbstractFlatFileImporter
handleData
in class AbstractFlatFileImporter
BaseException
protected void end(boolean success)
AbstractFlatFileImporter
AbstractFlatFileImporter.begin(FlatFileParser)
method here.
Note that this metod is called once for every file returned by the
AbstractFlatFileImporter.getFileIterator()
iterator.
end
in class AbstractFlatFileImporter
success
- TRUE if the file was parsed successfully, FALSE otherwiseAbstractFlatFileImporter.begin(FlatFileParser)
protected String getSuccessMessage(int skippedLines)
AbstractFlatFileImporter
178 reporters imported successfully
.
The default implementation always return null. Note that this method is called
once for every file returned by AbstractFlatFileImporter.getFileIterator()
.
getSuccessMessage
in class AbstractFlatFileImporter
skippedLines
- The number of data lines that were skipped due to errorsprotected IdMethod[] getIdMethods()
PropertyIdMethod.NAME
, InternalIdMethod.INTERNAL_ID
and
FallbackIdMethod.NAME_OR_ID
ID methods. Subclasses that import
items that can use other ID methods, should override this method.
protected void addMoreJobParameters(List<PluginParameter<?>> parameters)
parameters
- The list of parameters to add the column
mapping parameters toprotected void addMoreParsingParameters(List<PluginParameter<?>> parameters)
parameters
- The list of parameters to add the column
mapping parameters toprotected void addMoreColumnMappingParameters(List<PluginParameter<?>> parameters)
nameColumnMapping
and descriptionColumnMapping
. This
method is called during configuration of the plug-in.
parameters
- The list of parameters to add the column
mapping parameters toprotected void addMoreErrorParameters(List<PluginParameter<?>> parameters)
parameters
- The list of parameters to add the column
mapping parameters toprotected abstract ItemQuery<I> createItemQuery()
getQuery()
should
be returned, eg. Sample.getQuery()
.
protected Item getItemForSubtypes()
protected void createColumnMappers(FlatFileParser ffp, boolean cropStrings)
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);
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 abstract I createItem(DbControl dc, FlatFileParser.Data data)
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.
dc
- The DbControl to use for database accessdata
- The current data line
protected abstract void updateItem(DbControl dc, I item, FlatFileParser.Data data)
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.
dc
- The DbControl to use for database accessitem
- The item to updatedata
- The current data lineprotected void updateMultiLineItem(DbControl dc, I item, FlatFileParser.Data data, int multiLineNum)
dc
- The DbControl to use for database accessitem
- The item to updatedata
- The current data linemultiLineNum
- The number of the multi-line entry, starting with 1
for the first multi-lineprotected void doneWithItem(DbControl dc, I item, int numMultiLines)
dc
- The DbControl to use for database accessitem
- The item to updatenumMultiLines
- The number of the multi-line entries, starting with 1
for the first multi-line (0 for single-line entries)protected void updatePermissions(DbControl dc, Shareable item, FlatFileParser.Data data, boolean merge)
dc
- A DbControl used to lookup the permission templateitem
- The item to updatedata
- Data from the filemerge
- TRUE to merge the permissions, FALSE to replace the permissionsprotected void updateItemSubtype(DbControl dc, Subtypable item, FlatFileParser.Data data)
dc
- A DbControl used to lookup the subtypeitem
- The item to updatedata
- Data from the fileprotected ItemSubtype findItemSubtype(DbControl dc, Item mainItemType, FlatFileParser.Data data)
dc
- A DbControl used to lookup the subtypemainItemType
- The main item type of the subtypedata
- Data from the file
protected IdMethod getIdMethod(String method)
getIdMethods()
for a method
with the given name. If no method can be found PropertyIdMethod.NAME
is returned.
protected Date parseDate(String date)
Mapper
interface doesn't
supports it.
protected ItemSubtype findItemSubtype(DbControl dc, IdMethod idMethod, Item mainType, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier for the subtypemainType
- The main item type for the subtype
protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier)
findProtocol(DbControl, IdMethod, String, ItemSubtype)
with
a null item subtype.
protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no protocol is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The protocol subtype, or null if the type doesn't matter
protected Tag findTag(DbControl dc, IdMethod idMethod, String identifier)
findTag(DbControl, IdMethod, String, ItemSubtype)
with
a null item subtype.
protected Tag findTag(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no hardware is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The tag subtype, or null if the type doesn't matter
protected Hardware findHardware(DbControl dc, IdMethod idMethod, String identifier)
findHardware(DbControl, IdMethod, String, ItemSubtype)
with
a null item subtype.
protected Hardware findHardware(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no hardware is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The hardware subtype, or null if the type doesn't matter
protected Software findSoftware(DbControl dc, IdMethod idMethod, String identifier)
findSoftware(DbControl, IdMethod, String, ItemSubtype)
with
a null item subtype.
protected Software findSoftware(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no software is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The software subtype, or null if the type doesn't matter
protected Platform findPlatform(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected Platform getProjectDefaultPlatform(DbControl dc)
protected PlatformVariant getProjectDefaultVariant(DbControl dc)
protected PlatformVariant findVariant(DbControl dc, Platform platform, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessplatform
- If given, searched only variants of this platformidentifier
- The identifier protocol
protected RawDataType getProjectDefaultRawDataType(DbControl dc)
protected DataFileType findDataFileType(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected PermissionTemplate findPermissionTemplate(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier for the template
protected BioSource findBioSource(DbControl dc, IdMethod idMethod, String identifier)
findBioSource(DbControl, IdMethod, String, ItemSubtype)
with
a null item subtype.
protected BioSource findBioSource(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no biosource is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The biosource subtype, or null if the type doesn't matter
protected Sample findSample(DbControl dc, IdMethod idMethod, String identifier)
findSample(DbControl, IdMethod, String, ItemSubtype)
with a null subtype.
protected Sample findSample(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no sample is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The sample subtype, or null if the type doesn't matter
protected Extract findExtract(DbControl dc, IdMethod idMethod, String identifier)
findSample(DbControl, IdMethod, String, ItemSubtype)
with a null subtype.
protected Extract findExtract(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no extract is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The extract subtype, or null if the type doesn't matter
protected Extract findLabeledExtract(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! A labeled extract is an extract with a subtype Extract.LABELED
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected BioPlate findBioPlate(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected BioWell findBioWell(DbControl dc, BioPlate plate, String row, String column)
dc
- The DbControl to use for database accessplate
- The plate to look onrow
- The row coordinate in alphabetic or 1-based valuescolumn
- The column coordinate in alphabetic or 1-based values
protected ArraySlide findArraySlide(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected PhysicalBioAssay findHybridization(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! A hybridization is a physical bioassay with a subtype PhysicalBioAssay.HYBRIDIZATION
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected PhysicalBioAssay findPhysicalBioAssay(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no bioassay is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The bioassay subtype, or null if the type doesn't matter
protected DerivedBioAssay findDerivedBioAssay(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
NOTE! If this method is called with a non-null item subtype parameter and no bioassay is found the query will be retried without any subtype.
dc
- The DbControl to use for database accessidentifier
- The identifier protocolsubtype
- The bioassay subtype, or null if the type doesn't matter
protected ArrayDesign findArrayDesign(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected ArrayBatch findArrayBatch(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected PlateGeometry findPlateGeometry(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected BioPlateType findBioPlateType(DbControl dc, IdMethod idMethod, String identifier)
NOTE! The first time this method is called a query object is initialised
using the IdMethod.prepareQuery(DbControl, ItemQuery)
method.
Subsequent calls uses the same query. Thus, this method should always be
called with the same id method object, otherwise the result is undefined.
dc
- The DbControl to use for database accessidentifier
- The identifier protocol
protected RawDataType findRawDataType(DbControl dc, Platform platform, PlatformVariant variant, String identifier)
PlatformVariant.getRawDataType()
Platform.getRawDataType()
RawDataTypes.getRawDataType(String)
RawDataTypes.getRawDataTypes()
getProjectDefaultRawDataType(DbControl)
failIfMultipleFoundReferences
and failIfNotFoundReference
) determine if an exception is thrown
or not.
platform
- The current platform or null to not use a platform for lookupvariant
- The current platform variant or null to not use a variant for lookupidentifier
- The 'id' or 'name' of a raw data type, or null to not use this
for lookup
protected FileSetMember setOrAddFile(FileStoreEnabled item, DataFileType fileType, File file)
FileSet.setMember(File, DataFileType)
is used to add the file to the file set (which will replace all other files of
the same file type. If this method is called more times then
FileSet.addMember(File, DataFileType)
is used so that already added
files are preserved.
If the file is null the first time, all files of the given file types are removed.
If the file is null after the first time, this call is ignored.
item
- The item to set/add a file tofileType
- The type of the filefile
- The file, or null
protected <T extends BasicItem> ItemQuery<T> initReferenceQuery(DbControl dc, IdMethod idMethod, ItemQuery<T> query, boolean subtype)
IdMethod.prepareQuery(DbControl, ItemQuery)
and
then adds Include
options: MINE, IN_PROJECT, SHARED and OTHERS.
dc
- A DbControl used for database accessidMethod
- The identification method to usequery
- The query to initialisedsubtype
- If TRUE a restriction for subtype is added to the query
protected <T extends BasicItem> T findReferencedItemWithSubtype(DbControl dc, IdMethod idMethod, ItemQuery<T> query, String identifier, ItemSubtype subtype, boolean ignoreNotFound)
findReferencedItem(DbControl, IdMethod, ItemQuery, String, int, boolean)
method two times. First, with a query limited to return items of the given subtype,
then a second time without the limit. The query must have been created by
the initReferenceQuery(DbControl, IdMethod, ItemQuery, boolean)
method with
TRUE for the last parameter. If the subtype parameter is null the first query is
skipped.
protected <T extends BasicItem> T findReferencedItem(DbControl dc, IdMethod idMethod, ItemQuery<T> query, String identifier, int subtypeId, boolean ignoreNotFound)
itemCache
.
If no item is found in the cache it uses the query and id method
(IdMethod.find(DbControl, ItemQuery, String)
) to look for the item.
The result of the lookup is stored in the cache (even if no item is found).
dc
- A DbControl used for database accessidMethod
- The identification methodquery
- identifier
- ignoreNotFound
- TRUE to ignore not found errors
ItemNotFoundException
- If no item is found and the error handling is set to
fail for this condition
BaseException
- If multiple items are found and the error handling is set to
fail for this conditionprivate Pattern getPattern(ParameterValues parameters, String name) throws BaseException
BaseException
protected FlatFileParser getInitializedFlatFileParser(ParameterValues parameters) throws BaseException
BaseException
protected RequestInformation getConfigureParserParameters(GuiContext context, boolean forJob)
protected RequestInformation getConfigureOptionsParameters(GuiContext context)
|
3.0.2: 2012-01-25 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |