Package org.intermine.client.lists
Class ItemList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<Item>
-
- org.intermine.client.lists.ItemList
-
- All Implemented Interfaces:
java.lang.Iterable<Item>
,java.util.Collection<Item>
,java.util.Set<Item>
public class ItemList extends java.util.AbstractSet<Item>
A representation of a list of objects stored on the server. The object is not meant to be directly instantiated nor modified. Rather it should be retrieved from the originating web-service, and only modified through the available methods (appending new items, and renaming the list). SeeInterMineBag
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(Item i)
boolean
addAll(java.util.Collection newItems)
void
addTags(java.lang.String... newTags)
Add some new tags to this list.protected void
addUnmatchedId(java.lang.String id)
Add a new unmatched id to the set of unmatched identifiers.void
addUnmatchedIds(java.util.Collection<java.lang.String> ids)
Add some new unmatched ids to the set of unmatched identifiers.void
append(java.lang.String... ids)
Add new items to the list by resolving the identifiers of objects.void
append(java.util.Collection<? extends java.lang.String> ids)
Add new items to the list by resolving the identifiers of objects.void
append(Item... newItems)
Add new items to the list.void
append(org.intermine.pathquery.PathQuery pq)
Add new items to the list by resolving the identifiers of objects.boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection c)
void
delete()
Call for this list to be deleted on the server.java.util.List<Item>
find(java.util.Map<java.lang.String,java.lang.Object> conditions)
Convenience method for finding members of a collection matching certain properties.Item
get(int index)
Get an item by its index.java.util.Date
getCreatedAt()
Get the date when this list was created.java.lang.String
getDescription()
java.lang.String
getName()
Get the name of this list.int
getSize()
java.lang.String
getStatus()
Any status other thanCURRENT
indicated this list needs manual attention in the webapp.java.util.Set<java.lang.String>
getTags()
Modifying the returned set will not change the underlying tags collection.java.lang.String
getType()
java.util.Set<java.lang.String>
getUnmatchedIdentifiers()
Get the identifiers used in creating or appending to this list that could not be resolved to any objects.boolean
isAuthorized()
java.util.Iterator<Item>
iterator()
boolean
remove(java.lang.Object i)
boolean
removeAll(java.util.Collection c)
void
removeTags(java.lang.String... removeThese)
Remove some tags from this list.void
rename(java.lang.String newName)
Rename this list on the server.int
size()
Synonym for getSize()ItemList
subtract(java.util.Collection<ItemList> lists)
Remove the items in the given lists from this list.ItemList
subtract(ItemList... lists)
Remove the items in the given lists from this list.ItemList
subtract(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Remove the items in the given lists from this list.ItemList
subtract(ListService.ListOperationInfo info, ItemList... lists)
Remove the items in the given lists from this list.java.lang.String
toString()
void
updateTags()
Make sure that the tags on this object are up-to-date with those stored on the server.-
Methods inherited from class java.util.AbstractCollection
clear, isEmpty, retainAll, toArray, toArray
-
-
-
-
Method Detail
-
getUnmatchedIdentifiers
public java.util.Set<java.lang.String> getUnmatchedIdentifiers()
Get the identifiers used in creating or appending to this list that could not be resolved to any objects. This set will be updated whenever new requests are made to append to this list.- Returns:
- A set of unmatched identifiers.
-
getCreatedAt
public java.util.Date getCreatedAt()
Get the date when this list was created.- Returns:
- The list's creation date.
-
addUnmatchedId
protected void addUnmatchedId(java.lang.String id)
Add a new unmatched id to the set of unmatched identifiers. This is meant for use by the service modules.- Parameters:
id
- The id to add.
-
addUnmatchedIds
public void addUnmatchedIds(java.util.Collection<java.lang.String> ids)
Add some new unmatched ids to the set of unmatched identifiers. This is meant for use by the service modules.- Parameters:
ids
- the ids to add.
-
isAuthorized
public boolean isAuthorized()
- Returns:
- Whether the current user has the authority to modify this list.
-
getTags
public java.util.Set<java.lang.String> getTags()
Modifying the returned set will not change the underlying tags collection.- Returns:
- the tags this list has.
-
updateTags
public void updateTags()
Make sure that the tags on this object are up-to-date with those stored on the server.
-
addTags
public void addTags(java.lang.String... newTags)
Add some new tags to this list. After adding, list will have an updated set of tags, and the tags will be stored on the server.- Parameters:
newTags
- The tags to add.
-
removeTags
public void removeTags(java.lang.String... removeThese)
Remove some tags from this list. After removing, the list will have an updated set of tags, and the tags will be synchronised with those on the server.- Parameters:
removeThese
- The tags to remove.
-
getName
public java.lang.String getName()
Get the name of this list.- Returns:
- The list's name.
-
getSize
public int getSize()
- Returns:
- the number of items in this list.
-
size
public int size()
Synonym for getSize()
-
getType
public java.lang.String getType()
- Returns:
- return the type of the list.
-
getDescription
public java.lang.String getDescription()
- Returns:
- The description of the list, or null.
-
getStatus
public java.lang.String getStatus()
Any status other thanCURRENT
indicated this list needs manual attention in the webapp.- Returns:
- the current status if the list.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<Item>
-
get
public Item get(int index)
Get an item by its index. Note that while the order of elements is determinate, it is difficult to predict what that order may be.- Parameters:
index
- The index of the element to get.- Returns:
- an Item representing one of the elements in the list.
-
append
public void append(java.lang.String... ids)
Add new items to the list by resolving the identifiers of objects. This method will update the size of the list, and clear the items cache.- Parameters:
ids
- The identifiers to use to find objects to add.
-
append
public void append(java.util.Collection<? extends java.lang.String> ids)
Add new items to the list by resolving the identifiers of objects. This method will update the size of the list, and clear the items cache.- Parameters:
ids
- The identifiers to use to find objects to add.
-
append
public void append(Item... newItems)
Add new items to the list. This method will update the size of the list, and clear the items cache.- Parameters:
newItems
- The items to add.
-
append
public void append(org.intermine.pathquery.PathQuery pq)
Add new items to the list by resolving the identifiers of objects. This method will update the size of the list, and clear the items cache.- Parameters:
pq
- The query to run to find objects with.
-
add
public boolean add(Item i)
-
addAll
public boolean addAll(java.util.Collection newItems)
-
remove
public boolean remove(java.lang.Object i)
-
removeAll
public boolean removeAll(java.util.Collection c)
-
delete
public void delete()
Call for this list to be deleted on the server. As soon as the call returns, this list should no longer be used for any operation.
-
subtract
public ItemList subtract(ItemList... lists)
Remove the items in the given lists from this list. This call performs the operation of asymmetric difference on the current list and returns the result. For operations that alter the current list seeremoveAll(Collection)
- Parameters:
lists
- The lists to subtract from this list.- Returns:
- A new list
-
subtract
public ItemList subtract(ListService.ListOperationInfo info, ItemList... lists)
Remove the items in the given lists from this list. This call performs the operation of asymmetric difference on the current list and returns the result. For operations that alter the current list seeremoveAll(Collection)
- Parameters:
lists
- The lists to subtract from this list.info
- The options describing the new list.- Returns:
- A new list
-
subtract
public ItemList subtract(java.util.Collection<ItemList> lists)
Remove the items in the given lists from this list. This call performs the operation of asymmetric difference on the current list and returns the result. For operations that alter the current list seeremoveAll(Collection)
- Parameters:
lists
- The lists to subtract from this list.- Returns:
- A new list
-
subtract
public ItemList subtract(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Remove the items in the given lists from this list. This call performs the operation of asymmetric difference on the current list and returns the result. For operations that alter the current list seeremoveAll(Collection)
- Parameters:
lists
- The lists to subtract from this list.info
- The options describing the new list.- Returns:
- A new list
-
rename
public void rename(java.lang.String newName)
Rename this list on the server. This method will update the name of the list stored on the server, and also change of the name returned by this object.- Parameters:
newName
- The new name to give this list.
-
contains
public boolean contains(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection c)
-
find
public java.util.List<Item> find(java.util.Map<java.lang.String,java.lang.Object> conditions)
Convenience method for finding members of a collection matching certain properties. This search is implemented with a query that performs case-insensitive matching on values. Null constraints will be honoured, but other lookups will be converted to strings. Wild-cards are permitted wherever they are permitted in path-queries.
Using a query to back the search means that finding matching members is efficient even over large lists - you will not need to pull in and iterate over thousands of rows of data to find items if you have specific conditions.
These conditions must all match for the result to be included. For more specific and flexible searching strategies, please see thePathQuery
API.- Parameters:
conditions
- The properties these elements should have.- Returns:
- A list of matching items.
-
-