Changeset 1745
- Timestamp:
- Jan 9, 2006, 4:08:57 PM (18 years ago)
- 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 246 246 247 247 /** 248 Adds features to an ArrayDesignBlock. Please describe missing parameters.248 This recursive method adds features to an ArrayDesignBlock. 249 249 250 250 @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 252 256 */ 253 257 private void addFeatures( DbControl dbc, … … 286 290 { 287 291 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 297 293 { 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); 299 310 } 300 311 } -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/ArrayTypePlateTransfer.java
r1734 r1745 67 67 private ArrayTypeTransfer arrayTypeT = null; 68 68 69 // TODO - Is this documentation text okay?70 69 /** 70 Constructs a new ArrayTypePlateTransfer. Requires a previously finished ReporterTransfer. 71 71 72 @param arrayTypeT A finished {@link ReporterTransfer} 72 73 */ -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/CommonItemTransfer.java
r1734 r1745 31 31 import java.sql.ResultSet; 32 32 33 // TODO - Fix stray COMMON_ITEM_COLUMNS34 33 /** 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/> 36 38 This class provides methods to set these values on new CommonItems in BASE 2. 37 39 -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/FileTransfer.java
r1734 r1745 82 82 83 83 /** 84 Saves a File item storing BASE 1 filename and location in the description.85 Description includes the following:86 <p>87 Filename:Path:Description88 </p>89 90 @param file <code>File</file>91 @param path <code>String</code> full path to the base 1 file92 */93 protected void saveFilePath( File file, String path )94 {95 String description = file.getDescription();96 97 String filename = file.getName();98 99 try100 {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 /**116 84 Physically transfers a file. Retries to upload the file three times or until the md5sum is correct. 117 85 … … 162 130 163 131 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 167 134 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 174 136 @return md5sum or null if no file exists 175 137 */ … … 229 191 protected String md5sum( String fileLocation ) 230 192 { 231 232 193 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 */ 237 200 protected String removeForbiddenCharacters( String in ) 238 201 { -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/RawBioAssayDataTransfer.java
r1734 r1745 182 182 int rawBioAssayId = rs.getInt(1); 183 183 184 log("createItem", "RawBioAssay '" + rawBioAssayId + "'");185 186 184 DbControl dc = newDbControl(); 187 185 … … 191 189 192 190 boolean hasArrayDesign = ad != null ? true : false; 191 192 log("createItem", "RawBioAssay '" + rawBioAssayId + "' " + (hasArrayDesign ? "has " : "no ") + "Array Design"); 193 193 194 194 if( rawBioAssay != null ) … … 346 346 347 347 348 // TODO - Stray reference Transfer#prepareStatement(String). The349 // prepareStatement handling obviously has changed, but the350 // documentation has not.351 348 /** 352 349 Recursive run over a SQL query defined by a prepared statement and LIMIT values from and size. … … 356 353 @param size <code>int</code> indicating number of rows to include. 357 354 @param batcher RawDataBatcher used in this transfer. 358 @see Transfer#prepareStatement(String) 355 @param hasArrayDesign (Currently not used) 356 @see Transfer#prepareStatementFromString(String) 359 357 */ 360 358 protected void runRawBioAssay( PreparedStatement ps, int from, int size, RawDataBatcher batcher, boolean hasArrayDesign ) … … 419 417 } 420 418 421 if( rd != null )419 try 422 420 { 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 ); 439 422 } 440 423 catch(Exception e) 424 { 425 log("runRawBioAssay ", e); // No such feature 426 } 427 441 428 progress.increase(); 442 429 } … … 451 438 { 452 439 // Last run 453 log("runRawBioAssay", "Flushing last data");454 455 440 batcher.flushInsert(); 456 441 -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/SharedItemTransfer.java
r1734 r1745 114 114 115 115 116 // TODO - Fix the documentation here.117 116 /** 118 117 Changes group and world permissions for this item. … … 120 119 @param dc <code>DbControl</code> 121 120 @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 125 125 */ 126 126 protected void chmod( DbControl dc, SharedItem item, int groupId, int groupAccess, int worldAccess ) … … 198 198 /** 199 199 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 200 204 */ 201 205 protected void chown(DbControl dc, OwnedItem item, int base1UserId ) … … 219 223 220 224 /** 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 223 230 */ 224 231 protected void setSharedItemData( DbControl dc, SharedItem item, ResultSet rs ) -
trunk/src/clients/migrate/net/sf/basedb/clients/migrate/Transfer.java
r1734 r1745 112 112 113 113 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()}. 117 116 Set to true by {@link Transfer#initIdMap(int)}. 118 117 */ … … 341 340 342 341 343 // TODO - Stray reference Transfer#prepareStatement(String). The344 // prepareStatement handling obviously has changed, but the345 // documentation has not.346 342 /** 347 343 Recursive run over a SQL query defined by a prepared statement and LIMIT values from and size. … … 351 347 @param from <code>int</code> indicating start position of the ResultSet. 352 348 @param size <code>int</code> indicating number of rows to include. 353 @see Transfer#prepareStatement (String)349 @see Transfer#prepareStatementFromString(String) 354 350 */ 355 351 protected void run( PreparedStatement ps, int from, int size ) … … 358 354 try 359 355 { 360 361 356 int parameters = ps.getParameterMetaData().getParameterCount(); 362 357 … … 376 371 while( rs.next() ) 377 372 { 378 379 373 rowCount++; 380 374 … … 383 377 if( item != null ) 384 378 { 385 386 379 WrappedItem<BasicItem> wi = new WrappedItem<BasicItem>( item, rs.getInt(1), rowCount ); 387 380 388 381 itemList.add(wi); 389 390 }391 else392 {393 394 log("run", "createItem returned null");395 396 }397 398 progress.increase();399 400 }401 402 dc.close();403 404 // Reset our ResultSet405 rs.beforeFirst();406 407 processItemList(rs);408 409 rs.close();410 411 if( rowCount >0 && rowCount == size )412 {413 414 // Fetch next batch415 run( ps, from + size, size );416 417 }418 else419 {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). The444 // prepareStatement handling obviously has changed, but the445 // documentation has not.446 /**447 Run over a SQL query defined by a prepared statement448 If this method is called directly from a child transfer, remember to call {@link #startProgress(int)} before you call this method449 450 @param ps <code>PreparedStatement</code>451 @see Transfer#prepareStatement(String)452 */453 protected void run( PreparedStatement ps )454 {455 456 try457 {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 481 382 } 482 383 else … … 486 387 487 388 progress.increase(); 488 489 389 } 490 390 … … 498 398 rs.close(); 499 399 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 500 410 } 501 411 catch( SQLException e ) 502 412 { 503 504 413 stop("run failed with an SQLException", e); 505 506 414 } 507 415 catch( BaseException e ) 508 416 { 509 510 417 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 521 483 /** 522 484 For each row in the prepared statement {@link #createItem(ResultSet)} is called. … … 525 487 The prepared statement must include '.. LIMIT ?,?'. 526 488 527 @see #prepareStatement (String)489 @see #prepareStatementFromFile(String) 528 490 */ 529 491 protected void runUnBatched( PreparedStatement ps, int from, int size ) … … 610 572 611 573 612 private void mapItemList( 574 private void mapItemList() 613 575 { 614 576 for( WrappedItem wi : itemList )
Note: See TracChangeset
for help on using the changeset viewer.