public class ListUtil
extends java.lang.Object
Constructor and Description |
---|
ListUtil() |
Modifier and Type | Method and Description |
---|---|
static <S extends BioMaterial> |
addToList(BioMaterialList list,
java.util.Collection<? extends S> sources,
CollectionTransformer<S,? extends BioMaterial> transformer)
Adds items to a biomaterial list.
|
static CollectionTransformer |
createTransformer(DbControl dc,
Item sourceItem,
Item destinationItem,
boolean sameType)
Create a transformer that can transform a collection with
sourceItem :s into a collection with destinationItem :s
by following parent/child paths. |
static ItemQuery<? extends BioMaterial> |
getQuery(Item biomaterialType)
Get a query that returns all biomaterials that can possibly be
members of this list.
|
public static ItemQuery<? extends BioMaterial> getQuery(Item biomaterialType) throws BaseException
BioSource.getQuery()
, etc. depending on the
member type of the list.ItemQuery
objectBaseException
- If the query could not be created and configured.public static <S extends BioMaterial> int addToList(BioMaterialList list, java.util.Collection<? extends S> sources, CollectionTransformer<S,? extends BioMaterial> transformer) throws InvalidDataException, PermissionDeniedException
BioMaterialList.getMemberType()
for the list.list
- The list to add items tosources
- The source collection of biomaterialstransformer
- An optional transformerInvalidDataException
- If an item is not of the correct
member typePermissionDeniedException
- If the logged in user doesn't have
write permission for the listpublic static CollectionTransformer createTransformer(DbControl dc, Item sourceItem, Item destinationItem, boolean sameType)
sourceItem
:s into a collection with destinationItem
:s
by following parent/child paths. Both the source and destination must be
one of Item.BIOSOURCE
, Item.SAMPLE
or Item.EXTRACT
.dc
- The DbControl the transformers should use for loading
items from the databasesourceItem
- The type of source itemsdestinationItem
- The type of destination itemssameType
- If children/parents of the same type should be considered or not