Changeset 1745


Ignore:
Timestamp:
Jan 9, 2006, 4:08:57 PM (18 years ago)
Author:
Gregory Vincic
Message:

Cleaned up comments

Location:
trunk/src/clients/migrate/net/sf/basedb/clients/migrate
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/ArrayBlockTransfer.java

    r1734 r1745  
    246246
    247247  /**
    248      Adds features to an ArrayDesignBlock. Please describe missing parameters.
     248     This recursive method adds features to an ArrayDesignBlock.
    249249
    250250     @param dbc {@link DbControl} used to transfer this item
    251      @param arrayDesignBlock <code>ArrayDesignBlock</code> from which to create a FeatureData
     251     @param arrayDesignBlock <code>ArrayDesignBlock</code> from which to create FeatureData
     252     @param ps PreparedStatement used to fetch features from Base 1
     253     @param from Position in the result set to start reading from. Normally this is 0 when you call it.
     254     @param size Number of rows to read from specified position
     255     @param featureBatcher FeatureBatcher used for saving this set of FeatureData
    252256  */
    253257  private void addFeatures( DbControl dbc,
     
    286290        {
    287291
    288           Plate plate = mappedPlateT.getPlateById( dbc, plateId );
    289 
    290           int col = rs.getInt(10) - 1;
    291 
    292           int row = rs.getInt(11) - 1;
    293 
    294           Well well = plate.getWell( row, col );
    295 
    296           if( well != null )
     292          try
    297293          {
    298             featureData = featureBatcher.newFeature( arrayDesignBlock, well );
     294            Plate plate = mappedPlateT.getPlateById( dbc, plateId );
     295
     296            int col = rs.getInt(10) - 1;
     297
     298            int row = rs.getInt(11) - 1;
     299
     300            Well well = plate.getWell( row, col );
     301
     302            if( well != null )
     303            {
     304              featureData = featureBatcher.newFeature( arrayDesignBlock, well );
     305            }
     306          }
     307          catch( BaseException e )
     308          {
     309            log("addFeatures", e);
    299310          }
    300311        }
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/ArrayTypePlateTransfer.java

    r1734 r1745  
    6767  private ArrayTypeTransfer arrayTypeT = null;
    6868
    69   // TODO - Is this documentation text okay?
    7069  /**
     70     Constructs a new ArrayTypePlateTransfer. Requires a previously finished ReporterTransfer.
     71
    7172     @param arrayTypeT A finished {@link ReporterTransfer}
    7273  */
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/CommonItemTransfer.java

    r1734 r1745  
    3131import java.sql.ResultSet;
    3232
    33 // TODO - Fix stray COMMON_ITEM_COLUMNS
    3433/**
    35    Common items have a specific set of columns in Base 1 se {@link COMMON_ITEM_COLUMNS}.
     34   Common items have a specific set of columns in Base 1. The columns must be in the following order
     35   <br/>
     36   id, owner, gid, groupAccess, worldAccess, name, descr, removed
     37   <br/>
    3638   This class provides methods to set these values on new CommonItems in BASE 2.
    3739
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/FileTransfer.java

    r1734 r1745  
    8282
    8383  /**
    84      Saves a File item storing BASE 1 filename and location in the description.
    85      Description includes the following:
    86      <p>
    87      Filename:Path:Description
    88      </p>
    89 
    90      @param file <code>File</file>
    91      @param path <code>String</code> full path to the base 1 file
    92   */
    93   protected void saveFilePath( File file, String path )
    94   {
    95     String description = file.getDescription();
    96 
    97     String filename    = file.getName();
    98 
    99     try
    100     {
    101 
    102       file.setDescription( filename + DELIMITER + path + DELIMITER + description );         
    103 
    104     }
    105     catch( Exception e )
    106     {
    107 
    108       stop( "saveFilePath", e );
    109 
    110     }
    111 
    112   }
    113 
    114 
    115   /**
    11684     Physically transfers a file. Retries to upload the file three times or until the md5sum is correct.
    11785
     
    162130
    163131
    164   // TODO - Is this documentation okay, e.g. 'param' section is bad.
    165   /**
    166      Calculates MD5sum for a file and is used to calculate MD5 sum for base 1 files before transfer.
     132  /**
     133     Calculates MD5sum for a file
    167134     
    168      Example:
    169      <p>
    170      String hexMD5string = md5sum( "/tmp/file.txt" )
    171      </p>
    172      
    173      @param path <code>String</code> full path to the file
     135     @param file <code>java.io.File</code> to calculate the md5sum on
    174136     @return md5sum or null if no file exists
    175137  */
     
    229191  protected String md5sum( String fileLocation )
    230192  {
    231 
    232193    return md5sum( new java.io.File(fileLocation) );
    233 
    234   }
    235 
    236 
     194  }
     195
     196
     197  /**
     198     Removes forbidden characters for file or directory names.
     199  */
    237200  protected String removeForbiddenCharacters( String in )
    238201  {
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java

    r1734 r1745  
    182182    int rawBioAssayId = rs.getInt(1);
    183183
    184     log("createItem", "RawBioAssay '" + rawBioAssayId + "'");
    185 
    186184    DbControl dc = newDbControl();
    187185
     
    191189
    192190    boolean hasArrayDesign = ad != null ? true : false;
     191
     192    log("createItem", "RawBioAssay '" + rawBioAssayId + "' " + (hasArrayDesign ? "has " : "no ") + "Array Design");
    193193
    194194    if( rawBioAssay != null )
     
    346346
    347347
    348   // TODO - Stray reference Transfer#prepareStatement(String). The
    349   // prepareStatement handling obviously has changed, but the
    350   // documentation has not.
    351348  /**
    352349     Recursive run over a SQL query defined by a prepared statement and LIMIT values from and size.
     
    356353     @param size <code>int</code> indicating number of rows to include.
    357354     @param batcher RawDataBatcher used in this transfer.
    358      @see Transfer#prepareStatement(String)
     355     @param hasArrayDesign (Currently not used)
     356     @see Transfer#prepareStatementFromString(String)
    359357  */
    360358  protected void runRawBioAssay( PreparedStatement ps, int from, int size, RawDataBatcher batcher, boolean hasArrayDesign )
     
    419417        }
    420418
    421         if( rd != null )
     419        try
    422420        {
    423           try
    424           {
    425 
    426             if( hasArrayDesign )
    427             {
    428               batcher.insert( rd );
    429             }
    430             else
    431             {
    432               batcher.insert(rd, reporterData.getExternalId() );
    433             }
    434           }
    435           catch(Exception e)
    436           {
    437             // No such feature
    438           }
     421          batcher.insert( rd );
    439422        }
    440 
     423        catch(Exception e)
     424        {
     425          log("runRawBioAssay ", e); // No such feature
     426        }
     427       
    441428        progress.increase();
    442429      }
     
    451438      {
    452439        // Last run
    453         log("runRawBioAssay", "Flushing last data");
    454 
    455440        batcher.flushInsert();
    456441
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/SharedItemTransfer.java

    r1734 r1745  
    114114
    115115
    116   // TODO - Fix the documentation here.
    117116  /**
    118117     Changes group and world permissions for this item.
     
    120119     @param dc <code>DbControl</code>
    121120     @param item <code>SharedItem</code> for which permissions should be set
    122      @param ownerId <code>int</code> Base 1 owner
    123      @param groupId <code>int</code> Base 1 group
    124      @param access  <code>int</code> groupAccess
     121     @param groupId <code>int</code> Base 1 group id
     122     @param groupAccess <code>int</code> Base 1 groupAccess value
     123     @param ownerId <code>int</code> Id of a Base 1 owner
     124
    125125  */
    126126  protected void chmod( DbControl dc, SharedItem item, int groupId, int groupAccess, int worldAccess )
     
    198198  /**
    199199     Changes owner of the Ownable Item using the BASE 2 userId.
     200
     201     @param dc DbControl used to retrieve the corresponding User
     202     @param item OwnedItem for which ownership should be changed
     203     @param base1UserId Id of a Base 1 user
    200204  */
    201205  protected void chown(DbControl dc, OwnedItem item, int base1UserId )
     
    219223
    220224  /**
    221      @param item <code>CommonItem</code>
    222      @param rs <code>ResultSet</code>
     225     Sets SharedItem data values.
     226
     227     @param dc DbControl used to retrieve the item
     228     @param item <code>CommonItem</code> for which to set data values
     229     @param rs <code>ResultSet</code> used to get values from
    223230  */
    224231  protected void setSharedItemData( DbControl dc, SharedItem item, ResultSet rs )
  • trunk/src/clients/migrate/net/sf/basedb/clients/migrate/Transfer.java

    r1734 r1745  
    112112
    113113  protected ArrayList<WrappedItem<BasicItem>> itemList = null;
    114   // TODO - Stray link to Transfer#mapIds(Query)
    115   /**
    116      If true base1 id is saved in the description and later maped back with {@link Transfer#mapIds(Query)}.
     114  /**
     115     If true base1 id is saved in the description and later maped back with {@link Transfer#mapItemList()}.
    117116     Set to true by {@link Transfer#initIdMap(int)}.
    118117  */
     
    341340
    342341
    343   // TODO - Stray reference Transfer#prepareStatement(String). The
    344   // prepareStatement handling obviously has changed, but the
    345   // documentation has not.
    346342  /**
    347343     Recursive run over a SQL query defined by a prepared statement and LIMIT values from and size.
     
    351347     @param from <code>int</code> indicating start position of the ResultSet.
    352348     @param size <code>int</code> indicating number of rows to include.
    353      @see Transfer#prepareStatement(String)
     349     @see Transfer#prepareStatementFromString(String)
    354350  */
    355351  protected void run( PreparedStatement ps, int from, int size )
     
    358354    try
    359355    {
    360 
    361356      int parameters = ps.getParameterMetaData().getParameterCount();
    362357
     
    376371      while( rs.next() )
    377372      {
    378        
    379373        rowCount++;
    380374
     
    383377        if( item != null )
    384378        {
    385 
    386379          WrappedItem<BasicItem> wi = new WrappedItem<BasicItem>( item, rs.getInt(1), rowCount );
    387380
    388381          itemList.add(wi);
    389 
    390         }
    391         else
    392         {
    393 
    394           log("run", "createItem returned null");
    395 
    396         }
    397 
    398         progress.increase();
    399 
    400       }
    401 
    402       dc.close();
    403 
    404       // Reset our ResultSet
    405       rs.beforeFirst();
    406 
    407       processItemList(rs);
    408 
    409       rs.close();
    410 
    411       if( rowCount >0 && rowCount == size )
    412       {
    413 
    414         // Fetch next batch
    415         run( ps, from + size, size );
    416 
    417       }
    418       else
    419       {
    420 
    421         progress.stop();
    422 
    423       }
    424 
    425     }
    426     catch( SQLException e )
    427     {
    428 
    429       stop("run failed with an SQLException", e);
    430 
    431     }
    432     catch( BaseException e )
    433     {
    434              
    435       stop("run", e );
    436 
    437     }
    438 
    439   }
    440 
    441 
    442 
    443   // TODO - Stray reference Transfer#prepareStatement(String). The
    444   // prepareStatement handling obviously has changed, but the
    445   // documentation has not.
    446   /**
    447      Run over a SQL query defined by a prepared statement
    448      If this method is called directly from a child transfer, remember to call {@link #startProgress(int)} before you call this method
    449 
    450      @param ps <code>PreparedStatement</code>
    451      @see Transfer#prepareStatement(String)
    452   */
    453   protected void run( PreparedStatement ps )
    454   {   
    455 
    456     try
    457     {
    458 
    459       int rowCount = 0;
    460 
    461       ResultSet rs = ps.executeQuery();
    462 
    463       itemList = new ArrayList<WrappedItem<BasicItem>>();
    464 
    465       DbControl dc = newDbControl();
    466 
    467       while( rs.next() )
    468       {
    469        
    470         rowCount++;
    471 
    472         BasicItem item  = createItem( dc, rs );
    473 
    474         if( item != null )
    475         {
    476 
    477           WrappedItem<BasicItem> wi = new WrappedItem<BasicItem>( item, rs.getInt(1), rowCount );
    478 
    479           itemList.add(wi);
    480 
    481382        }
    482383        else
     
    486387
    487388        progress.increase();
    488 
    489389      }
    490390
     
    498398      rs.close();
    499399
     400      if( rowCount >0 && rowCount == size )
     401      {
     402        // Fetch next batch
     403        run( ps, from + size, size );
     404      }
     405      else
     406      {
     407        progress.stop();
     408      }
     409
    500410    }
    501411    catch( SQLException e )
    502412    {
    503 
    504413      stop("run failed with an SQLException", e);
    505 
    506414    }
    507415    catch( BaseException e )
    508416    {
    509              
    510417      stop("run", e );
    511 
    512     }
    513 
    514   }
    515 
    516 
    517 
    518   // TODO - Stray reference Transfer#prepareStatement(String). The
    519   // prepareStatement handling obviously has changed, but the
    520   // documentation has not.
     418    }
     419  }
     420
     421
     422  /**
     423     Run over a SQL query defined by a prepared statement.
     424     If this method is called directly from a child transfer, remember to call {@link #startProgress(int)} before you call this method
     425
     426     @param ps <code>PreparedStatement</code>
     427     @see Transfer#prepareStatementFromFile(String)
     428  */
     429  protected void run( PreparedStatement ps )
     430  {   
     431
     432    try
     433    {
     434      int rowCount = 0;
     435
     436      ResultSet rs = ps.executeQuery();
     437
     438      itemList = new ArrayList<WrappedItem<BasicItem>>();
     439
     440      DbControl dc = newDbControl();
     441
     442      while( rs.next() )
     443      {
     444        rowCount++;
     445
     446        BasicItem item  = createItem( dc, rs );
     447
     448        if( item != null )
     449        {
     450          WrappedItem<BasicItem> wi = new WrappedItem<BasicItem>( item, rs.getInt(1), rowCount );
     451
     452          itemList.add(wi);
     453        }
     454        else
     455        {
     456          log("run", "createItem returned null");
     457        }
     458
     459        progress.increase();
     460      }
     461
     462      dc.close();
     463
     464      // Reset our ResultSet
     465      rs.beforeFirst();
     466
     467      processItemList(rs);
     468
     469      rs.close();
     470    }
     471    catch( SQLException e )
     472    {
     473      stop("run failed with an SQLException", e);
     474    }
     475    catch( BaseException e )
     476    {
     477      stop("run", e );
     478    }
     479  }
     480
     481
     482
    521483  /**
    522484     For each row in the prepared statement {@link #createItem(ResultSet)} is called.
     
    525487     The prepared statement must include '.. LIMIT ?,?'.
    526488
    527      @see #prepareStatement(String)
     489     @see #prepareStatementFromFile(String)
    528490  */
    529491  protected void runUnBatched( PreparedStatement ps, int from, int size )
     
    610572
    611573
    612   private void mapItemList( )
     574  private void mapItemList()
    613575  {
    614576    for( WrappedItem wi : itemList )
Note: See TracChangeset for help on using the changeset viewer.