Changeset 2154


Ignore:
Timestamp:
01/23/07 10:36:08 (13 years ago)
Author:
melissa
Message:

Obey the dataset ID, if specified. If the dataset ID is not null, then the
imported image(s) will be added to that dataset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/ome/upload/OMEUploader.java

    r2149 r2154  
    226226 
    227227      String id = closePixels(image.toString()); 
    228       uploadMetadata(f.getMetadataStore(file), id.trim()); 
     228      uploadMetadata(f.getMetadataStore(file), id.trim(), dataset); 
    229229 
    230230      return bytesUploaded; 
     
    361361        if (close) { 
    362362          id = closePixels(id).trim(); 
    363           uploadMetadata(store, id); 
     363          uploadMetadata(store, id, dataset); 
    364364        } 
    365365 
     
    374374      if (close) { 
    375375        id = closePixels(id).trim(); 
    376         uploadMetadata(store, id); 
     376        uploadMetadata(store, id, dataset); 
    377377      } 
    378378      return bytes; 
     
    690690    throws UploadException 
    691691  { 
     692    uploadMetadata(store, id, null);  
     693  } 
     694 
     695  /** 
     696   * Parse and upload the given MetadataStore and link it to the 
     697   * given OMEIS ID.  The image is then placed in the given dataset. 
     698   */ 
     699  private void uploadMetadata(MetadataStore store, String id, Integer dataset) 
     700    throws UploadException 
     701  { 
    692702    OMEXMLMetadataStore xml = (OMEXMLMetadataStore) store; 
    693703 
     
    793803    image.setDefaultPixels(pixels); 
    794804    df.update(image); 
     805   
     806    // link image to the appropriate dataset 
     807    if (dataset != null) { 
     808      DatasetManager dm = (DatasetManager) rs.getService(DatasetManager.class); 
     809      Dataset d = (Dataset) df.createNew(Dataset.class); 
     810      ((MappedDTO) d).setNew(false); 
     811      d.setID(dataset.intValue()); 
     812      Vector imgs = new Vector(); 
     813      imgs.add(image); 
     814      dm.addImagesToDataset(d, imgs); 
     815      df.update(d); 
     816      df.update(image); 
     817    } 
    795818  } 
    796819 
Note: See TracChangeset for help on using the changeset viewer.