|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.core.BasicItem<D>
net.sf.basedb.core.OwnedItem<D>
net.sf.basedb.core.SharedItem<D>
net.sf.basedb.core.CommonItem<BioMaterialListData>
net.sf.basedb.core.BioMaterialList
public class BioMaterialList
This class represents a list of biomaterials.
| Field Summary | |
|---|---|
static int |
MAX_EXTERNAL_ID_LENGTH
The maximum length of the external id variable that can be stored in the database. |
static Item |
TYPE
The type of item represented by this class. |
| Fields inherited from interface net.sf.basedb.core.Nameable |
|---|
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH |
| Constructor Summary | |
|---|---|
BioMaterialList(BioMaterialListData listData)
|
|
| Method Summary | |
|---|---|
boolean |
add(BioMaterial bioMaterial)
Add a biomaterial to this list. |
int |
add(Iterator<? extends BioMaterial> it)
Add multiple biomaterials to this list in one go. |
int |
addAll(BioMaterialList list)
Add all items from another biomaterial list to this list. |
int |
addIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
Add items that are present in the specified number of lists to this list. |
int |
addIntersection(Collection<BioMaterialList> lists)
Add items that are present in ALL OF the given lists to this list. |
private int |
addMembers(Set<BioMaterialData> items)
Add members to this list. |
int |
addUnion(Collection<BioMaterialList> lists)
Add items that are present in at least ONE OF the given lists to this list. |
private void |
checkMemberType(Collection<BioMaterialList> lists)
Checks that the lists have the same member type as this list. |
private void |
checkMemberType(Item otherType)
Checks if the other type is the same type as the member type of this list. |
private static Set<BioMaterialData> |
count(Collection<BioMaterialList> lists,
int minCount,
int maxCount)
Count the number of times each item is present in the given lists and return those items that are found in >=minCount and <=maxCount lists. |
ItemQuery<? extends BioMaterial> |
getAllBioMaterials()
Get a query that returns all biomaterials that can possibly be members of this list. |
static BioMaterialList |
getById(DbControl dc,
int id)
Get a BioMaterialList item when you know the id. |
String |
getExternalId()
Get the external id for this list. |
ItemQuery<? extends BioMaterial> |
getMemberBioMaterials()
Get a query that returns all biomaterials that are members of this list. |
Item |
getMemberType()
Get the item type of members on this list. |
static BioMaterialList |
getNew(DbControl dc,
Item memberType)
Create a new BioMaterialList item. |
static ItemQuery<BioMaterialList> |
getQuery()
Get a query that returns biomaterial lists. |
int |
getSize()
Get the number of members in this list. |
Item |
getType()
Get the type of item represented by the object. |
private static Set<BioMaterialData> |
intersection(Collection<BioMaterialList> lists)
Create a set with the intersection of the items in the given lists. |
void |
remove(BioMaterial bioMaterial)
Remove a biomaterial from the list. |
int |
removeAll(BioMaterialList list)
Remove all items from this list that are present in the other list. |
int |
removeIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
Remove items that are present in the specified number of lists from this list. |
int |
removeIntersection(Collection<BioMaterialList> lists)
Remove items that are present in ALL OF the given lists from this list. |
private int |
removeMembers(Set<BioMaterialData> items)
Remove members from this list |
int |
removeUnion(Collection<BioMaterialList> lists)
Remove items that are present in at least ONE OF the given lists from this list. |
int |
retainAll(BioMaterialList list)
Remove all items from this list that are NOT present in the other list. |
int |
retainIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
Retain items that are present in the specified number of lists in this list. |
int |
retainIntersection(Collection<BioMaterialList> lists)
Retain items that are present in ALL OF the given lists in this list. |
private int |
retainMembers(Set<BioMaterialData> items)
Keep only specified members in this list |
int |
retainUnion(Collection<BioMaterialList> lists)
Retain items that are present in at least ONE OF the given lists in this list. |
void |
setExternalId(String externalId)
Set the external id for this list. |
private void |
setMemberType(Item memberType)
|
private static Set<BioMaterialData> |
union(Collection<BioMaterialList> lists)
Create a set with the union of the items in the given lists. |
| Methods inherited from class net.sf.basedb.core.CommonItem |
|---|
getDescription, getName, isRemoved, setDescription, setName, setRemoved, toTransferable |
| Methods inherited from class net.sf.basedb.core.SharedItem |
|---|
getItemKey, getProjectKey, initPermissions, isShared, onBeforeCommit, setItemKey, setProjectKey, toTransferable |
| Methods inherited from class net.sf.basedb.core.OwnedItem |
|---|
getOwner, isOwner, setOwner, takeOwnership, toTransferable |
| Methods inherited from class net.sf.basedb.core.BasicItem |
|---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.basedb.core.Identifiable |
|---|
getId, getVersion |
| Methods inherited from interface net.sf.basedb.core.AccessControlled |
|---|
checkPermission, getPermissions, hasPermission |
| Methods inherited from interface net.sf.basedb.core.Ownable |
|---|
getOwner, isOwner, setOwner, takeOwnership |
| Field Detail |
|---|
public static final Item TYPE
Item.BIOMATERIALLIST,
getType()public static final int MAX_EXTERNAL_ID_LENGTH
setExternalId(String) method to avoid
exceptions.
| Constructor Detail |
|---|
BioMaterialList(BioMaterialListData listData)
| Method Detail |
|---|
public static BioMaterialList getNew(DbControl dc,
Item memberType)
throws BaseException
BioMaterialList item.
dc - The DbControl which will be used for
permission checking and database accessmemberType - The item type of members in this list
BioMaterialList item
BaseException - If there is an error
public static BioMaterialList getById(DbControl dc,
int id)
throws ItemNotFoundException,
PermissionDeniedException,
BaseException
BioMaterialList item when you know the id.
dc - The DbControl which will be used for
permission checking and database access.id - The id of the item to load
BioMaterialList item
ItemNotFoundException - If an item with the specified
id is not found
PermissionDeniedException - If the logged in user doesn't
have Permission.READ permission to the item
BaseException - If there is another errorpublic static ItemQuery<BioMaterialList> getQuery()
ItemQuery objectprivate static Set<BioMaterialData> intersection(Collection<BioMaterialList> lists)
private static Set<BioMaterialData> union(Collection<BioMaterialList> lists)
private static Set<BioMaterialData> count(Collection<BioMaterialList> lists,
int minCount,
int maxCount)
NOTE!
union(Collection)
intersection(Collection).
lists - The lists to look inminCount - The minimum number of list an item
is required to be present inmaxCount - The maximum number of lists an item
is allowed to the present in
public Item getType()
IdentifiableItem enumeration.
public String getExternalId()
public void setExternalId(String externalId)
throws PermissionDeniedException,
InvalidDataException
MAX_EXTERNAL_ID_LENGTH constant. The value doesn't have to be unique.
externalId - The new external id for this item
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the new value is longer than
MAX_EXTERNAL_ID_LENGTHpublic int getSize()
public Item getMemberType()
private void setMemberType(Item memberType)
private void checkMemberType(Item otherType)
private void checkMemberType(Collection<BioMaterialList> lists)
public boolean add(BioMaterial bioMaterial)
throws PermissionDeniedException,
InvalidDataException
bioMaterial - The biomaterial to add to the list
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the biomaterial is null or not of the
correct member type
public int add(Iterator<? extends BioMaterial> it)
throws PermissionDeniedException,
InvalidDataException
it - An iterator that returns all biomaterials to be added,
null items are ignored
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the iterator returns a biomaterial
of a different type than getMemberType()
public void remove(BioMaterial bioMaterial)
throws PermissionDeniedException,
InvalidDataException
bioMaterial - The biomaterial to remove.
PermissionDeniedException - If the logged in user doesn't have
write permission
InvalidDataException - If the biomaterial is null
public ItemQuery<? extends BioMaterial> getMemberBioMaterials()
throws BaseException
ItemQuery object
BaseException - If the query could not be created and configured.
public ItemQuery<? extends BioMaterial> getAllBioMaterials()
throws BaseException
BioSource.getQuery(), etc. depending on the
member type of the list.
ItemQuery object
BaseException - If the query could not be created and configuredListUtil.getQuery(Item)private int addMembers(Set<BioMaterialData> items)
items - The items to add
private int removeMembers(Set<BioMaterialData> items)
items - The items to remove
private int retainMembers(Set<BioMaterialData> items)
items - The items to keep
public int addAll(BioMaterialList list)
list - The list to add items from
public int addUnion(Collection<BioMaterialList> lists)
lists - The lists to add items from
public int addIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
addUnion(Collection) if
minCount <= 1 && maxCount >= size(lists)
addIntersection(Collection)
if minCount = size(lists) && maxCount >= size(lists).
minCount > size(lists) || minCount > maxCount no
items will be added.
lists - The lists to add items fromminCount - The minimum number of lists an item is required to
be present inmaxCount - The maximum number of lists an item is allowed to
be present in
public int addIntersection(Collection<BioMaterialList> lists)
lists - The lists to add items from
public int removeAll(BioMaterialList list)
list - The list that contains the items
to remove
public int removeUnion(Collection<BioMaterialList> lists)
lists - The lists that contains the items to remove
public int removeIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
removeUnion(Collection) if
minCount <= 1 && maxCount >= size(lists)
removeIntersection(Collection)
if minCount = size(lists) && maxCount >= size(lists).
minCount > size(lists) || minCount > maxCount no
items will be removed.
lists - The lists with the itemsminCount - The minimum number of lists an item is required to
be present inmaxCount - The maximum number of lists an item is allowed to
be present in
public int removeIntersection(Collection<BioMaterialList> lists)
lists - The lists that contains the items to remove
public int retainAll(BioMaterialList list)
list - The list that contains the items
to be retained
public int retainUnion(Collection<BioMaterialList> lists)
lists - The lists that contains the items to retain
public int retainIntersection(Collection<BioMaterialList> lists)
lists - The lists that contains the items to retain
public int retainIfPresentIn(int minCount,
int maxCount,
Collection<BioMaterialList> lists)
retainUnion(Collection) if
minCount <= 1 && maxCount >= size(lists)
retainIntersection(Collection)
if minCount = size(lists) && maxCount >= size(lists).
minCount > size(lists) || minCount > maxCount no
items will be removed.
lists - The lists with the itemsminCount - The minimum number of lists an item is required to
be present inmaxCount - The maximum number of lists an item is allowed to
be present in
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||