uk.ac.cisban.rod.dao.specifics
Class ManageLogs

java.lang.Object
  extended by uk.ac.cisban.rod.dao.specifics.ManageLogs

public class ManageLogs
extends java.lang.Object

Handles connections to the database in the adding and modification of LogEvents.

Author:
Morgan Taschuk

Constructor Summary
ManageLogs(DAO dao)
          Main constructor.
 
Method Summary
 ActionApplication addInoculation(java.lang.Long actionApplicationId, java.util.Set<Inoculation> logs, java.util.Map<java.lang.String,java.lang.Exception> exceptionMap, java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
          Adds a set of Inoculation logs to an existing ActionApplication.
 ActionApplication addSpotting(java.lang.Long actionApplicationId, java.util.Collection<Spotting> logs, java.util.Map<java.lang.String,java.lang.Exception> exceptionMap, java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
          Adds a set of Spotting logs to an existing ActionApplication.
 boolean canAddSpotting(java.util.Map<java.lang.String,java.lang.Exception> exceptionMap, javax.jdo.PersistenceManager pm, java.lang.Long sPlatePosition, java.lang.Long dPlatePosition)
          Checks if the Spotting can be added to the database.
 java.util.Collection<Image> loadImagesBrief(java.util.List<java.lang.String> nonMappedPlates, java.lang.String barcodeString)
          Loads the collection of images associated with a Barcode without retrieving the individual ImageSpots (hence the "Brief").
 java.util.Collection<LogEvent> loadLogs(java.lang.Long actionAppId)
          Loads the LogEvents of an ActionApplication, given the AA's PK.
 java.util.Collection<LogEventMapping> loadSpots(java.util.Collection<java.lang.String> sourceBarcodes, long aAppId)
          Accesses the spot log for the given source barcodes based on ActionApplication id.
 java.util.Collection<java.lang.Exception> threadImageLogs(java.lang.Long actionApplicationId, java.util.Collection<Image> logs)
          Enters the image logs each in individual threads to improve performance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManageLogs

public ManageLogs(DAO dao)
Main constructor.

Parameters:
dao -
Method Detail

loadLogs

public java.util.Collection<LogEvent> loadLogs(java.lang.Long actionAppId)
                                        throws QueryNotFoundException
Loads the LogEvents of an ActionApplication, given the AA's PK. Can be a Spotting, an Inoculation, or ImageSpot. For each LogEvent, loads the source (and destination, for Spotting and Inoculation) plate barcode and plate position.

Parameters:
actionAppId - primary key of the ActionApplication
Returns:
a collection of the LogEvents associated with the ActionApplication
Throws:
QueryNotFoundException - if the ActionApplication with that PK cannot be found

loadImagesBrief

public java.util.Collection<Image> loadImagesBrief(java.util.List<java.lang.String> nonMappedPlates,
                                                   java.lang.String barcodeString)
                                            throws QueryNotFoundException
Loads the collection of images associated with a Barcode without retrieving the individual ImageSpots (hence the "Brief"). The Barcode is located based on the barcodeValue.

Parameters:
nonMappedPlates - a collection that holds the Barcodes that do not have associated images. Intended to be re-used with several calls to this method for error-checking purposes.
barcodeString - the barcodeValue of the plate
Returns:
a Collection of Images (can be several from different times) of this barcoded Plate
Throws:
QueryNotFoundException - if the Barcode cannot be found based on the parameter

loadSpots

public java.util.Collection<LogEventMapping> loadSpots(java.util.Collection<java.lang.String> sourceBarcodes,
                                                       long aAppId)
                                                throws QueryNotFoundException
Accesses the spot log for the given source barcodes based on ActionApplication id.

Parameters:
sourceBarcodes - barcodes that occur in the sourcePlatePosition of Spotting
aAppId - the ActionApplication id
Returns:
a collection of mappings from the given source barcodes to a number of destination barcodes
Throws:
QueryNotFoundException - if the Barcodes or ActionApplication cannot be found

addInoculation

public ActionApplication addInoculation(java.lang.Long actionApplicationId,
                                        java.util.Set<Inoculation> logs,
                                        java.util.Map<java.lang.String,java.lang.Exception> exceptionMap,
                                        java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
Adds a set of Inoculation logs to an existing ActionApplication.

Parameters:
actionApplicationId - the primary key of the ActionApplication
logs - the set of Inoculation logs to add to the ActionApplication
exceptionMap - a Map of Exceptions that occurred during this operation
barcodeSubs -
Returns:
the ActionApplication with the added Inoculation logs
See Also:
DAO#applyAction(long, long)

addSpotting

public ActionApplication addSpotting(java.lang.Long actionApplicationId,
                                     java.util.Collection<Spotting> logs,
                                     java.util.Map<java.lang.String,java.lang.Exception> exceptionMap,
                                     java.util.Map<java.lang.String,java.lang.String> barcodeSubs)
Adds a set of Spotting logs to an existing ActionApplication. This method presumes that all Barcodes and Plates in the logs actually exist!

Parameters:
actionApplicationId - the primary key of the ActionApplication
logs - the set of Spotting logs to add to the ActionApplication
exceptionMap - a Map of Exceptions that occurred during this operation
barcodeSubs -
Returns:
the ActionApplication with the added Spotting logs
See Also:
DAO#applyAction(long, long)

canAddSpotting

public boolean canAddSpotting(java.util.Map<java.lang.String,java.lang.Exception> exceptionMap,
                              javax.jdo.PersistenceManager pm,
                              java.lang.Long sPlatePosition,
                              java.lang.Long dPlatePosition)
Checks if the Spotting can be added to the database.

Parameters:
exceptionMap - a Map of Exceptions that occurred during this operation
pm - the persistence manager
sPlatePosition - the source PlatePosition
dPlatePosition - the destination PlatePosition
Returns:
whether the Spotting can be added to the database

threadImageLogs

public java.util.Collection<java.lang.Exception> threadImageLogs(java.lang.Long actionApplicationId,
                                                                 java.util.Collection<Image> logs)
Enters the image logs each in individual threads to improve performance.

Parameters:
actionApplicationId - the DB id of the ActionApplication to add the image logs to
logs - the images to add
Returns:
a collection of the exceptions that occurred while working


Copyright © 2010. All Rights Reserved.