Changeset 5729
- Timestamp:
- Sep 8, 2011, 3:35:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/DerivedBioAssay.java
r5697 r5729 102 102 permission checking and database access 103 103 @param bioAssay The parent physical bioassay 104 @param job The job that created the new bioassay 104 105 @return A new DerivedBioAssay item 105 106 */ 106 public static DerivedBioAssay getNew(DbControl dc, PhysicalBioAssay bioAssay )107 public static DerivedBioAssay getNew(DbControl dc, PhysicalBioAssay bioAssay, Job job) 107 108 { 108 109 if (bioAssay == null) throw new InvalidUseOfNullException("bioAssay"); … … 113 114 dbas.getData().setPhysicalBioAssay(bioAssay.getData()); 114 115 dbas.getData().setEntryDate(new Date()); 116 dbas.getData().setJob(job == null ? null : job.getData()); 115 117 return dbas; 116 118 } … … 121 123 permission checking and database access 122 124 @param parent The parent bioassay 125 @param job The job that created the new bioassay 123 126 @return A new DerivedBioAssay item 124 127 */ 125 public static DerivedBioAssay getNew(DbControl dc, DerivedBioAssay parent )128 public static DerivedBioAssay getNew(DbControl dc, DerivedBioAssay parent, Job job) 126 129 { 127 130 if (parent == null) throw new InvalidUseOfNullException("parent"); … … 134 137 dbas.getData().setExtract(parent.getData().getExtract()); 135 138 dbas.getData().setEntryDate(new Date()); 139 dbas.getData().setJob(job == null ? null : job.getData()); 136 140 return dbas; 137 141 } -
trunk/src/core/net/sf/basedb/core/plugin/AbstractAnalysisPlugin.java
r5610 r5729 30 30 import net.sf.basedb.core.BioAssaySet; 31 31 import net.sf.basedb.core.DbControl; 32 import net.sf.basedb.core.DerivedBioAssay; 32 33 import net.sf.basedb.core.DynamicSpotQuery; 33 34 import net.sf.basedb.core.Experiment; … … 75 76 76 77 /** 78 GuiContext = [Item.DERIVEDBIOASSAY, GuiContext.Type.ITEM] 79 @since 3.0 80 */ 81 protected static final GuiContext CONTEXT_DERIVEDBIOASSAY = 82 new GuiContext(Item.DERIVEDBIOASSAY, GuiContext.Type.ITEM); 83 84 /** 77 85 The default gui contexts where it makes sense to use an analysis plugin. 78 86 Override for the {@link InteractivePlugin#getGuiContexts()} method to … … 108 116 109 117 /** 110 The source parameter .118 The source parameter for bioassay set. 111 119 @see #getSourceBioAssaySetParameter(String, String) 112 120 */ 113 private PluginParameter<BioAssaySet> sourceParameter = null; 121 private PluginParameter<BioAssaySet> sourceBioAssaySetParameter = null; 122 123 124 /** 125 The parameter type for the source derived bioassay. 126 @since 3.0 127 */ 128 private static final ItemParameterType<DerivedBioAssay> sourceDerivedBioAssayType = 129 new ItemParameterType<DerivedBioAssay>(DerivedBioAssay.class, null, true, 1, null); 130 131 132 /** 133 The source parameter for derived bioassay. 134 @see #getSourceDerivedBioAssayParameter(String, String) 135 @since 3.0 136 */ 137 private PluginParameter<DerivedBioAssay> sourceDerivedBioAssayParameter = null; 138 114 139 115 140 /** … … 148 173 } 149 174 /** 150 Check that the item is a bioassayset and that the logged in user has151 permission to use the current experiment.175 Check that the item is a bioassayset/derived bioassay and that the 176 logged in user has permission to use the current item. 152 177 @param context Current guicontext 153 178 @param item The item to check. 154 @return null if the item is a bioassayset, an error message otherwise179 @return null if the item is a valid item, an error message otherwise 155 180 @throws net.sf.basedb.core.PermissionDeniedException If the logged in user dosen't have 156 181 permission to use the Experiment … … 176 201 } 177 202 } 203 else if (context.equals(CONTEXT_DERIVEDBIOASSAY)) 204 { 205 if (item == null) 206 { 207 message = "The object is null"; 208 } 209 else if (!(item instanceof DerivedBioAssay)) 210 { 211 message = "The object is not a DerivedBioAssay: " + item; 212 } 213 else 214 { 215 DerivedBioAssay dba = (DerivedBioAssay)item; 216 dba.checkPermission(Permission.USE); 217 } 218 } 178 219 else 179 220 { … … 206 247 protected PluginParameter<BioAssaySet> getSourceBioAssaySetParameter(String label, String description) 207 248 { 208 if (source Parameter == null)249 if (sourceBioAssaySetParameter == null) 209 250 { 210 251 if (label == null) label = "Source bioassay set"; 211 252 if (description == null) description = "The bioassay set that is used as the data source for this job."; 212 source Parameter = new PluginParameter<BioAssaySet>253 sourceBioAssaySetParameter = new PluginParameter<BioAssaySet> 213 254 ( 214 255 SOURCE_BIOASSAYSET, label, description, sourceBioAssaySetType 215 256 ); 216 257 } 217 return sourceParameter; 218 } 258 return sourceBioAssaySetParameter; 259 } 260 261 protected static final String SOURCE_DERIVEDBIOASSAY = "source"; 262 263 /** 264 Get a plugin parameter that asks for a derived bioassay to use as data source for 265 the plugin. Calling this method multiple times return the same plugin parameter object. 266 The label and description for the first call is always used. 267 268 @param label The parameter label, or null to use the default (Source bioassay) 269 @param description The parameter description, or null to use the default 270 (The derived bioassay that is used as the data source for this job.) 271 */ 272 protected PluginParameter<DerivedBioAssay> getSourceDerivedBioAssayParameter(String label, String description) 273 { 274 if (sourceDerivedBioAssayParameter == null) 275 { 276 if (label == null) label = "Source bioassay"; 277 if (description == null) description = "The derived bioassay set that is used as the data source for this job."; 278 sourceDerivedBioAssayParameter = new PluginParameter<DerivedBioAssay> 279 ( 280 SOURCE_DERIVEDBIOASSAY, label, description, sourceDerivedBioAssayType 281 ); 282 } 283 return sourceDerivedBioAssayParameter; 284 } 285 219 286 220 287 protected static final String SOURCE_BIOASSAYS = "bioAssays"; … … 398 465 399 466 /** 467 Get the current source derived bioassay. We first check the job's parameter 468 values with the {@link #getSourceDerivedBioAssay(DbControl)} method. If this 469 returns null we check the information in the current context: 470 <code>SessionControl.getCurrentContext(Item.DERIVEDBIOASSAY)</code>. Note 471 that this information is normally only available during the configuration 472 phase of a plugin, not during the execution phase. 473 474 @param dc The DbControl to use for database access 475 @return The current derived bioassay or null 476 @see #getSourceBioAssaySet(DbControl) 477 @since 3.0 478 */ 479 protected DerivedBioAssay getCurrentDerivedBioAssay(DbControl dc) 480 { 481 DerivedBioAssay current = getSourceDerivedBioAssay(dc); 482 if (current == null) 483 { 484 int currentId = sc.getCurrentContext(Item.DERIVEDBIOASSAY).getId(); 485 if (currentId != 0) current = DerivedBioAssay.getById(dc, currentId); 486 } 487 return current; 488 } 489 490 /** 491 Get the derived bioassay that is used as the source for the plugin. 492 The source bioassay is only available in the execution phase 493 if the plugin has saved it as a job parameter during the configuration 494 of a job. 495 496 @return The source derived bioassay or null 497 @see #getSourceDerivedBioAssayParameter(String, String) 498 @since 3.0 499 */ 500 protected DerivedBioAssay getSourceDerivedBioAssay(DbControl dc) 501 { 502 DerivedBioAssay source = (DerivedBioAssay)job.getValue(SOURCE_DERIVEDBIOASSAY); 503 if (source != null) source = DerivedBioAssay.getById(dc, source.getId()); 504 return source; 505 } 506 507 508 /** 400 509 Generate a name for the transformation based on the plugin and it's 401 510 configuration. The name is created by taking the name of the plugin from the -
trunk/src/plugins/core/core-plugins.xml
r5696 r5729 483 483 </plugin-definition> 484 484 485 <plugin-definition id="ManualDerivedBioAssayCreator"> 486 <about> 487 <name>Manual derived bioassay creator</name> 488 <description> 489 This plug-in allows a user to manually register an external 490 analysis procedure that has happened outside of BASE and to 491 register the parameters used and the output files that was 492 generated. Before this plug-in can be used a configuration 493 that represents the external tool must be created. The 494 configuration will be used to register possible parameters 495 and output files. 496 </description> 497 </about> 498 <plugin-class>net.sf.basedb.plugins.ManualDerivedBioAssayCreator</plugin-class> 499 <settings> 500 <property name="everyone-use">1</property> 501 <property name="immediate-execution">1</property> 502 </settings> 503 </plugin-definition> 504 485 505 <plugin-definition id="BioSourceImporter"> 486 506 <about> -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/DerivedBioAssayImporter.java
r5719 r5729 306 306 { 307 307 DerivedBioAssay parent = findDerivedBioAssay(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, parentSubtype); 308 bioAssay = DerivedBioAssay.getNew(dc, parent );308 bioAssay = DerivedBioAssay.getNew(dc, parent, job.getJob()); 309 309 } 310 310 else 311 311 { 312 312 PhysicalBioAssay pba = findPhysicalBioAssay(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, parentSubtype); 313 bioAssay = DerivedBioAssay.getNew(dc, pba );313 bioAssay = DerivedBioAssay.getNew(dc, pba, job.getJob()); 314 314 } 315 315 -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java
r5719 r5729 213 213 hyb = findHybridization(dc, FallbackIdMethod.NAME_OR_ID, hybridizationMapper.getValue(data)); 214 214 } 215 DerivedBioAssay scan = DerivedBioAssay.getNew(dc, hyb );215 DerivedBioAssay scan = DerivedBioAssay.getNew(dc, hyb, job.getJob()); 216 216 scan.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(DerivedBioAssay.SCAN))); 217 217 updateItem(dc, scan, data); -
trunk/src/test/TestDerivedBioAssay.java
r5720 r5729 92 92 { 93 93 dc = TestUtil.getDbControl(); 94 DerivedBioAssay dbas = DerivedBioAssay.getNew(dc, PhysicalBioAssay.getById(dc, bioAssayId) );94 DerivedBioAssay dbas = DerivedBioAssay.getNew(dc, PhysicalBioAssay.getById(dc, bioAssayId), null); 95 95 dbas.setName(name); 96 96 dbas.setDescription("Added at "+new Date()); … … 140 140 { 141 141 dc = TestUtil.getDbControl(); 142 DerivedBioAssay dbas = DerivedBioAssay.getNew(dc, DerivedBioAssay.getById(dc, parentId) );142 DerivedBioAssay dbas = DerivedBioAssay.getNew(dc, DerivedBioAssay.getById(dc, parentId), null); 143 143 dbas.setName(name); 144 144 dbas.setDescription("Added at "+new Date()); -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5700 r5729 547 547 { 548 548 TestUtil.write("--Creating scan: " + name + "\n"); 549 DerivedBioAssay scan = DerivedBioAssay.getNew(dc, hyb );549 DerivedBioAssay scan = DerivedBioAssay.getNew(dc, hyb, null); 550 550 scan.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(DerivedBioAssay.SCAN))); 551 551 scan.setName(name); … … 570 570 { 571 571 TestUtil.write("--Creating root bioassay: " + name + "\n"); 572 DerivedBioAssay bioAssay = DerivedBioAssay.getNew(dc, parent );572 DerivedBioAssay bioAssay = DerivedBioAssay.getNew(dc, parent, null); 573 573 bioAssay.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(subtype))); 574 574 bioAssay.setName(name); … … 587 587 { 588 588 TestUtil.write("--Creating derived bioassay: " + name + "\n"); 589 DerivedBioAssay bioAssay = DerivedBioAssay.getNew(dc, parent );589 DerivedBioAssay bioAssay = DerivedBioAssay.getNew(dc, parent, null); 590 590 bioAssay.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(subtype))); 591 591 bioAssay.setName(name); -
trunk/www/views/derivedbioassays/index.jsp
r5721 r5729 182 182 { 183 183 PhysicalBioAssay bioAssay = PhysicalBioAssay.getById(dc, physicalBioAssayId); 184 bas = DerivedBioAssay.getNew(dc, bioAssay );184 bas = DerivedBioAssay.getNew(dc, bioAssay, null); 185 185 cc.setRecent(bioAssay, maxRecent); 186 186 } … … 188 188 { 189 189 DerivedBioAssay parent = DerivedBioAssay.getById(dc, parentId); 190 bas = DerivedBioAssay.getNew(dc, parent );190 bas = DerivedBioAssay.getNew(dc, parent, null); 191 191 cc.setRecent(parent, maxRecent); 192 192 } -
trunk/www/views/derivedbioassays/view_bioassay.jsp
r5727 r5729 610 610 <jsp:param name="item_type" value="<%=itemType.name()%>" /> 611 611 <jsp:param name="item_id" value="<%=itemId%>" /> 612 <jsp:param name="title" value="Other items related to this bioassay set" />612 <jsp:param name="title" value="Other items related to this bioassay" /> 613 613 </jsp:include> 614 614 </div>
Note: See TracChangeset
for help on using the changeset viewer.