Changeset 7002
- Timestamp:
- Nov 5, 2015, 2:16:22 PM (7 years ago)
- Location:
- trunk/src/core/net/sf/basedb
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/ArrayBatch.java
r6881 r7002 136 136 { 137 137 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 138 try 139 { 140 annotatable.add(getArrayDesign()); 141 } 142 catch (PermissionDeniedException ex) 143 {} 138 ArrayBatchData data = getData(); 139 140 addAnnotatableParents(getDbControl(), annotatable, 141 data.getArrayDesign() 142 ); 144 143 return annotatable; 145 144 } -
trunk/src/core/net/sf/basedb/core/ArraySlide.java
r6874 r7002 167 167 { 168 168 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 169 try 170 { 171 annotatable.add(getArrayBatch()); 172 } 173 catch (PermissionDeniedException ex) 174 {} 169 ArraySlideData data = getData(); 170 171 addAnnotatableParents(getDbControl(), annotatable, 172 data.getArrayBatch() 173 ); 175 174 return annotatable; 176 175 } -
trunk/src/core/net/sf/basedb/core/BasicItem.java
r6898 r7002 23 23 package net.sf.basedb.core; 24 24 25 import net.sf.basedb.core.data.AnnotatableData; 25 26 import net.sf.basedb.core.data.BasicData; 26 27 … … 296 297 } 297 298 299 /** 300 Try to load the the item-class representation of all the 301 data-class items ignoring permission problems. The loaded 302 items are added to the 'parents' set. Typically used 303 by {@link Annotatable#getAnnotatableParents()} implementations to 304 load all annotatable parent items. 305 @since 3.7 306 */ 307 protected void addAnnotatableParents(DbControl dc, Set<Annotatable> parents, AnnotatableData... items) 308 { 309 if (items == null || items.length == 0) return; 310 for (AnnotatableData data : items) 311 { 312 if (data != null) 313 { 314 BasicData d = (BasicData)data; 315 Item itemType = Item.fromDataObject(d); 316 Class<? extends BasicItem> itemClass = itemType.getItemClass(); 317 try 318 { 319 Annotatable parent = (Annotatable)dc.getItem(itemType.getItemClass(), d); 320 parents.add(parent); 321 } 322 catch (PermissionDeniedException ex) 323 {} 324 } 325 } 326 } 327 298 328 299 329 /** -
trunk/src/core/net/sf/basedb/core/BioAssay.java
r6909 r7002 246 246 DbControl dc = getDbControl(); 247 247 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 248 annotatable.add(getBioAssaySet()); 248 BioAssayData data = getData(); 249 addAnnotatableParents(dc, annotatable, 250 data.getBioAssaySet() 251 ); 252 249 253 ItemQuery<BioAssay> parentQuery = getParents(); 250 254 if (parentQuery != null) -
trunk/src/core/net/sf/basedb/core/BioAssaySet.java
r6875 r7002 29 29 import net.sf.basedb.core.data.BioAssayData; 30 30 import net.sf.basedb.core.data.SharedData; 31 import net.sf.basedb.core.data.TransformationData; 31 32 import net.sf.basedb.core.data.DataCubeData; 32 33 import net.sf.basedb.core.data.DataCubeLayerData; … … 313 314 { 314 315 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 315 annotatable.add(getExperiment()); 316 Transformation t = getTransformation(); 317 if (t != null) 318 { 319 BioAssaySet parent = t.getSource(); 320 if (parent != null) annotatable.add(parent); 321 } 316 DbControl dc = getDbControl(); 317 318 BioAssaySetData data = getData(); 319 addAnnotatableParents(dc, annotatable, 320 data.getExperiment() 321 ); 322 TransformationData tData = data.getTransformation(); 323 if (tData != null) 324 { 325 addAnnotatableParents(dc, annotatable, 326 tData.getSource() 327 ); 328 } 329 322 330 return annotatable; 323 331 } -
trunk/src/core/net/sf/basedb/core/DerivedBioAssay.java
r6996 r7002 358 358 { 359 359 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 360 try 361 { 362 if (isRoot()) 363 { 364 ItemQuery<PhysicalBioAssay> query = getPhysicalBioAssays(); 365 query.include(Include.ALL); 366 annotatable.addAll(query.list(getDbControl())); 367 } 368 else 369 { 370 ItemQuery<DerivedBioAssay> query = getParents(); 371 query.include(Include.ALL); 372 annotatable.addAll(query.list(getDbControl())); 373 } 374 if (getData().getExtract() != null) annotatable.add(getExtract()); 375 if (getData().getHardware() != null) annotatable.add(getHardware()); 376 if (getData().getSoftware() != null) annotatable.add(getSoftware()); 377 } 378 catch (PermissionDeniedException ex) 379 {} 360 DerivedBioAssayData data = getData(); 361 DbControl dc = getDbControl(); 362 363 if (isRoot()) 364 { 365 ItemQuery<PhysicalBioAssay> query = getPhysicalBioAssays(); 366 query.include(Include.ALL); 367 annotatable.addAll(query.list(dc)); 368 } 369 else 370 { 371 ItemQuery<DerivedBioAssay> query = getParents(); 372 query.include(Include.ALL); 373 annotatable.addAll(query.list(dc)); 374 } 375 376 addAnnotatableParents(dc, annotatable, 377 data.getExtract(), 378 data.getHardware(), 379 data.getSoftware() 380 ); 381 380 382 return annotatable; 381 383 } -
trunk/src/core/net/sf/basedb/core/MeasuredBioMaterial.java
r6881 r7002 214 214 { 215 215 Set<Annotatable> annotatable = super.getAnnotatableParents(); 216 try 217 { 218 if (getData().getParent() != null) 219 { 220 annotatable.add(getParent()); 221 } 222 else if (getParentType() != null) 223 { 224 ItemQuery<? extends BioMaterial> query = getCreationEvent().getSources(); 225 query.include(Include.ALL); 226 if (parents != null && parents.size() > 0) 227 { 228 query.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("parents"))); 229 Set<Integer> parentIds = new HashSet<Integer>(); 230 new BasicItemToIdTransformer().transform(parents, parentIds); 231 query.setParameter("parents", parentIds, Type.INT); 232 } 233 annotatable.addAll(query.list(getDbControl())); 234 } 235 if (getData().getBioWell() != null) 236 { 237 annotatable.add(getBioWell().getPlate()); 238 } 239 } 240 catch (PermissionDeniedException ex) 241 {} 216 217 MeasuredBioMaterialData data = getData(); 218 DbControl dc = getDbControl(); 219 220 if (data.getBioWell() != null) 221 { 222 addAnnotatableParents(dc, annotatable, data.getBioWell().getBioPlate()); 223 } 224 225 if (data.getParent() != null) 226 { 227 // Single parent item 228 addAnnotatableParents(dc, annotatable, data.getParent()); 229 } 230 else if (getParentType() != null) 231 { 232 // Multiple parent items 233 ItemQuery<? extends BioMaterial> query = getCreationEvent().getSources(); 234 query.include(Include.ALL); 235 if (parents != null && parents.size() > 0) 236 { 237 query.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("parents"))); 238 Set<Integer> parentIds = new HashSet<Integer>(); 239 new BasicItemToIdTransformer().transform(parents, parentIds); 240 query.setParameter("parents", parentIds, Type.INT); 241 } 242 annotatable.addAll(query.list(dc)); 243 } 244 242 245 return annotatable; 243 246 } -
trunk/src/core/net/sf/basedb/core/PhysicalBioAssay.java
r6994 r7002 23 23 24 24 import net.sf.basedb.core.data.ArraySlideData; 25 import net.sf.basedb.core.data.BioMaterialEventData; 25 26 import net.sf.basedb.core.data.PhysicalBioAssayData; 26 27 import net.sf.basedb.core.query.Expressions; … … 309 310 { 310 311 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 311 try 312 { 313 BioMaterialEvent event = getCreationEvent(); 314 ItemQuery<Extract> query = (ItemQuery<Extract>)event.getSources(); 315 query.include(Include.ALL); 316 if (position > 0) 317 { 318 query.restrict( 319 Restrictions.eq( 320 Hql.property("srcevt", "position"), 321 Expressions.integer(position) 322 ) 323 ); 324 } 325 if (extracts != null && extracts.size() > 0) 326 { 327 query.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("extracts"))); 328 Set<Integer> extractIds = new HashSet<Integer>(); 329 new BasicItemToIdTransformer().transform(extracts, extractIds); 330 query.setParameter("extracts", extractIds, Type.INT); 331 } 332 annotatable.addAll(query.list(getDbControl())); 333 if (getData().getArraySlide() != null) annotatable.add(getArraySlide()); 334 if (getCreationEvent().getHardware() != null) annotatable.add(getCreationEvent().getHardware()); 335 } 336 catch (PermissionDeniedException ex) 337 {} 312 PhysicalBioAssayData data = getData(); 313 DbControl dc = getDbControl(); 314 315 BioMaterialEvent event = getCreationEvent(); 316 BioMaterialEventData eventData = event.getData(); 317 318 ItemQuery<Extract> query = (ItemQuery<Extract>)event.getSources(); 319 query.include(Include.ALL); 320 if (position > 0) 321 { 322 query.restrict( 323 Restrictions.eq( 324 Hql.property("srcevt", "position"), 325 Expressions.integer(position) 326 ) 327 ); 328 } 329 if (extracts != null && extracts.size() > 0) 330 { 331 query.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("extracts"))); 332 Set<Integer> extractIds = new HashSet<Integer>(); 333 new BasicItemToIdTransformer().transform(extracts, extractIds); 334 query.setParameter("extracts", extractIds, Type.INT); 335 } 336 annotatable.addAll(query.list(dc)); 337 338 addAnnotatableParents(dc, annotatable, 339 data.getArraySlide(), 340 eventData.getHardware() 341 ); 342 338 343 return annotatable; 339 344 } -
trunk/src/core/net/sf/basedb/core/RawBioAssay.java
r6924 r7002 241 241 { 242 242 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 243 try 244 { 245 if (getData().getArrayDesign() != null) annotatable.add(getArrayDesign()); 246 if (getData().getParentBioAssay() != null) annotatable.add(getParentBioAssay()); 247 if (getData().getParentExtract() != null) annotatable.add(getParentExtract()); 248 if (getData().getSoftware() != null) annotatable.add(getSoftware()); 249 } 250 catch (PermissionDeniedException ex) 251 {} 243 RawBioAssayData data = getData(); 244 245 addAnnotatableParents(getDbControl(), annotatable, 246 data.getArrayDesign(), 247 data.getParentBioAssay(), 248 data.getParentExtract(), 249 data.getSoftware() 250 ); 252 251 return annotatable; 253 252 } -
trunk/src/core/net/sf/basedb/core/RootRawBioAssay.java
r6915 r7002 159 159 DbControl dc = getDbControl(); 160 160 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 161 annotatable.add(getRawBioAssay()); 161 RootRawBioAssayData data = getData(); 162 163 addAnnotatableParents(dc, annotatable, 164 data.getRawBioAssay() 165 ); 162 166 return annotatable; 163 167 } -
trunk/src/core/net/sf/basedb/core/Well.java
r6881 r7002 164 164 { 165 165 Set<Annotatable> annotatable = new HashSet<Annotatable>(); 166 try 167 { 168 if (getData().getParent() != null) annotatable.add(getParent()); 169 } 170 catch (PermissionDeniedException ex) 171 {} 166 DbControl dc = getDbControl(); 167 WellData data = getData(); 168 169 addAnnotatableParents(dc, annotatable, 170 data.getParent(), 171 data.getPlate() 172 ); 172 173 return annotatable; 173 174 } -
trunk/src/core/net/sf/basedb/util/AnnotationUtil.java
r6799 r7002 37 37 import net.sf.basedb.core.DerivedBioAssay; 38 38 import net.sf.basedb.core.Extract; 39 import net.sf.basedb.core.PermissionDeniedException; 39 40 import net.sf.basedb.core.PhysicalBioAssay; 40 41 import net.sf.basedb.core.RawBioAssay; … … 160 161 { 161 162 Extract result = null; 162 if (item instanceof RawBioAssay) 163 { 164 result = ((RawBioAssay)item).getParentExtract(); 165 } 166 else if (item instanceof DerivedBioAssay) 167 { 168 result = ((DerivedBioAssay)item).getExtract(); 169 } 163 try 164 { 165 if (item instanceof RawBioAssay) 166 { 167 result = ((RawBioAssay)item).getParentExtract(); 168 } 169 else if (item instanceof DerivedBioAssay) 170 { 171 result = ((DerivedBioAssay)item).getExtract(); 172 } 173 } 174 catch (PermissionDeniedException ex) 175 {} 170 176 return result; 171 177 }
Note: See TracChangeset
for help on using the changeset viewer.