Package org.intermine.client.services
Class ListService
- java.lang.Object
-
- org.intermine.client.core.Service
-
- org.intermine.client.services.ListService
-
public class ListService extends Service
An interface to all the resources that represent list information and list operations available at an InterMine implementation. Normally the user should obtain an instance of this class through the ServiceFactory class. Any authentication provided to that parent class will be used in all requests that need authentication by the ListService. The services provided include:- Getting information about the available lists
- Getting information about which lists an item is in
- Creating new lists
- Modifying lists by adding items to them
- Creating new lists from set operations between existing lists
- Renaming lists
- Deleting lists
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ListService.ListCreationInfo
An abstraction of the combination of options that can be specified to generate a new list in a list creation operation.class
ListService.ListOperationInfo
An abstraction of the combination of options that can be specified to generate a new list in a list operation.
-
Field Summary
-
Fields inherited from class org.intermine.client.core.Service
resourceUrl, VERSION
-
-
Constructor Summary
Constructors Constructor Description ListService(java.lang.String rootUrl, java.lang.String applicationName)
UseServiceFactory
instead of constructor for creating this service .
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>
addTags(ItemList itemList, java.lang.String... newTags)
Get the tags for a list after adding some to the tag set.ItemList
append(ItemList list, java.lang.String... ids)
Append some objects corresponding to identifiers to the given list, returning a list representing the new state.ItemList
append(ItemList list, java.util.Collection<? extends java.lang.String> ids)
Append some objects corresponding to identifiers to the given list, returning a list representing the new state.ItemList
append(ItemList list, org.intermine.pathquery.PathQuery query)
Append the objects contained in the result set of a given query to the given list, returning a list representing the new state.boolean
contains(ItemList list, Item... items)
Report whether the given list contains all the items in the supplied array.ItemList
createList(ListService.ListCreationInfo info)
Create a new list on the server by specifying its content.void
deleteList(ItemList delendum)
Deletes a list on the server.ItemList
diff(java.util.Collection<ItemList> lists)
Find the symmetric difference of one or more lists to produce a new list.ItemList
diff(ItemList... lists)
Find the symmetric difference of one or more lists to produce a new list.ItemList
diff(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Find the symmetric difference of one or more lists to produce a new list.ItemList
diff(ListService.ListOperationInfo info, ItemList... lists)
Find the symmetric difference of one or more lists to produce a new list.java.util.List<ItemList>
getAccessibleLists()
Returns all the lists that this service has access to.ItemList
getList(java.lang.String name)
Returns an object representing a list on the server.java.util.Map<java.lang.String,ItemList>
getListMap()
Returns a map from list-name to list.java.util.List<ItemList>
getListsWithObject(int id)
Returns all accessible InterMine public lists containing the object with the specified DB identifier.java.util.List<ItemList>
getListsWithObject(java.lang.String publicId, java.lang.String type)
Returns all accessible InterMine lists containing the object corresponding to the specified publicId.java.util.List<java.lang.String>
getTags(ItemList itemList)
Get the most current tag set for a list.ItemList
intersect(java.util.Collection<ItemList> lists)
Intersect one or more lists to produce a new list.ItemList
intersect(ItemList... lists)
Intersect one or more lists to produce a new list.ItemList
intersect(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Intersect one or more lists to produce a new list.ItemList
intersect(ListService.ListOperationInfo info, ItemList... lists)
Intersect one or more lists to produce a new list.ItemList
merge(java.util.Collection<ItemList> lists)
Merge one or more lists into a new list.ItemList
merge(ItemList... lists)
Merge one or more lists into a new list.ItemList
merge(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Merge one or more lists into a new list.ItemList
merge(ListService.ListOperationInfo info, ItemList... lists)
Merge one or more lists into a new list.java.util.List<java.lang.String>
removeTags(ItemList itemList, java.lang.String... removeThese)
Get the tags for a list after removing some from its tag set.ItemList
rename(ItemList list, java.lang.String newName)
Rename a list on the server, returning a list representing the new state.ItemList
subtract(java.util.Collection<ItemList> from, java.util.Collection<ItemList> lists)
Subtract some lists from some other lists to produce a new list.ItemList
subtract(ItemList[] from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList
subtract(ItemList from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList
subtract(ListService.ListOperationInfo info, java.util.Collection<ItemList> x, java.util.Collection<ItemList> y)
Subtract some lists from some other lists to produce a new list.ItemList
subtract(ListService.ListOperationInfo info, ItemList[] from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList
subtract(ListService.ListOperationInfo info, ItemList from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.-
Methods inherited from class org.intermine.client.core.Service
assureOutputFormatSpecified, clearCache, createGetRequest, createPostRequest, executeRequest, getAPIVersion, getApplicationName, getFactory, getIntResponse, getRootUrl, getStringResponse, getUrl, getVersion, setAuthentication, setAuthentication, setConnectionTimeout, setFactory
-
-
-
-
Method Detail
-
getListsWithObject
public java.util.List<ItemList> getListsWithObject(java.lang.String publicId, java.lang.String type)
Returns all accessible InterMine lists containing the object corresponding to the specified publicId.- Parameters:
publicId
- An identifier of the object of interest. An object can have different identifiers in different public databases. If there is an object with one of these as a property, the webservice will resolve the given id to that object.type
- the type of Object. Must be a valid name of a class in the service's data-model (eg: "Gene")- Returns:
- A list of ItemList objects that represent lists containing the given object.
-
getListsWithObject
public java.util.List<ItemList> getListsWithObject(int id)
Returns all accessible InterMine public lists containing the object with the specified DB identifier.- Parameters:
id
- The internal DB identifier. This value changes between releases, so this method is only reliable for fetching data when the id has been fetched immediately before the request.- Returns:
- A list of ItemList objects that represent lists containing the given object.
-
getListMap
public java.util.Map<java.lang.String,ItemList> getListMap()
Returns a map from list-name to list. This method retrieves all accessible lists and returns them as a map, with each list accessible via its name.getAccessibleLists()
getList(String)
- Returns:
- A map of all accessible lists, with the lists accessible by name.
-
getList
public ItemList getList(java.lang.String name)
Returns an object representing a list on the server.getListMap()
getAccessibleLists()
- Parameters:
name
- the name of the list to retrieve.- Returns:
- The list, or null if it does not exist.
-
getAccessibleLists
public java.util.List<ItemList> getAccessibleLists()
Returns all the lists that this service has access to. Note that the return value of this method will differ depending on the authentication credentials supplied, as each user only has access to their own list, and those that are publicly available.getListMap()
getList(String)
- Returns:
- A list of all accessible lists.
-
createList
public ItemList createList(ListService.ListCreationInfo info)
Create a new list on the server by specifying its content. This method abstracts a couple of different REST calls that create lists based on a specification of content. Content may be given as a set of identifiers to resolve into objects, or as a query to collect as a result set. These parameters, and others are bundled into the ListCreationInfo parameter.- Parameters:
info
- The bundle of options that defines what content the new list will have.- Returns:
- A new list.
-
append
public ItemList append(ItemList list, java.lang.String... ids)
Append some objects corresponding to identifiers to the given list, returning a list representing the new state. UseItemList.append(String...)
- Parameters:
list
- The list to append the new items to.ids
- The ids to append to the list.- Returns:
- A list object representing the new state.
-
append
public ItemList append(ItemList list, java.util.Collection<? extends java.lang.String> ids)
Append some objects corresponding to identifiers to the given list, returning a list representing the new state. UseItemList.append(Collection)
- Parameters:
list
- The list to append the new items to.ids
- The identifiers of the objects to append to the list.- Returns:
- A list object representing the new state.
-
append
public ItemList append(ItemList list, org.intermine.pathquery.PathQuery query)
Append the objects contained in the result set of a given query to the given list, returning a list representing the new state. The query must have a single output column (that of the id of the objects to add) and that column must be on an object of a compatible type to the list it is being appended to. Note that this is the most efficient method of appending to a list from a query's result set. UseItemList.append(PathQuery)
- Parameters:
list
- The list to append the new items to.query
- The query to run to find objects for the list.- Returns:
- A list object representing the new state.
-
deleteList
public void deleteList(ItemList delendum)
Deletes a list on the server. After being deleted, any query or operation that uses this list will throw an exception.- Parameters:
delendum
- The list to delete.
-
merge
public ItemList merge(ItemList... lists)
Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.- Parameters:
lists
- The lists to merge.- Returns:
- A new list
-
merge
public ItemList merge(ListService.ListOperationInfo info, ItemList... lists)
Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to merge.- Returns:
- A new list
-
merge
public ItemList merge(java.util.Collection<ItemList> lists)
Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.- Parameters:
lists
- The lists to merge.- Returns:
- A new list
-
merge
public ItemList merge(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to merge.- Returns:
- A new list
-
intersect
public ItemList intersect(ItemList... lists)
Intersect one or more lists to produce a new list.- Parameters:
lists
- The lists to intersect.- Returns:
- A new list
-
intersect
public ItemList intersect(ListService.ListOperationInfo info, ItemList... lists)
Intersect one or more lists to produce a new list.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to intersect.- Returns:
- A new list
-
intersect
public ItemList intersect(java.util.Collection<ItemList> lists)
Intersect one or more lists to produce a new list.- Parameters:
lists
- The lists to intersect.- Returns:
- A new list
-
intersect
public ItemList intersect(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Intersect one or more lists to produce a new list.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to intersect.- Returns:
- A new list
-
diff
public ItemList diff(ItemList... lists)
Find the symmetric difference of one or more lists to produce a new list.- Parameters:
lists
- The lists to find the symmetric difference of.- Returns:
- A new list
-
diff
public ItemList diff(ListService.ListOperationInfo info, ItemList... lists)
Find the symmetric difference of one or more lists to produce a new list.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to find the symmetric difference of.- Returns:
- A new list
-
diff
public ItemList diff(java.util.Collection<ItemList> lists)
Find the symmetric difference of one or more lists to produce a new list.- Parameters:
lists
- The lists to find the symmetric difference of.- Returns:
- A new list
-
diff
public ItemList diff(ListService.ListOperationInfo info, java.util.Collection<ItemList> lists)
Find the symmetric difference of one or more lists to produce a new list.- Parameters:
info
- The parameter bundle specifying the details of the new list.lists
- The lists to find the symmetric difference of.- Returns:
- A new list
-
subtract
public ItemList subtract(ListService.ListOperationInfo info, ItemList from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(ListOperationInfo, ItemList...)
- Parameters:
info
- The parameter bundle specifying the details of the new list.from
- The lists to subtract items from.lists
- The lists to subtract.- Returns:
- A new list
-
subtract
public ItemList subtract(ListService.ListOperationInfo info, ItemList[] from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(ListOperationInfo, ItemList...)
- Parameters:
info
- The parameter bundle specifying the details of the new list.from
- The lists to subtract items from.lists
- The lists to subtract.- Returns:
- A new list
-
subtract
public ItemList subtract(ItemList from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(ItemList...)
- Parameters:
from
- The list to subtract items from.lists
- The lists to subtract.- Returns:
- A new list
-
subtract
public ItemList subtract(ItemList[] from, ItemList... lists)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(ItemList...)
- Parameters:
from
- The lists to subtract items from.lists
- The lists to subtract.- Returns:
- A new list
-
subtract
public ItemList subtract(java.util.Collection<ItemList> from, java.util.Collection<ItemList> lists)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(Collection)
- Parameters:
from
- The lists to subtract items from.lists
- The lists to subtract.- Returns:
- A new list
-
subtract
public ItemList subtract(ListService.ListOperationInfo info, java.util.Collection<ItemList> x, java.util.Collection<ItemList> y)
Subtract some lists from some other lists to produce a new list.ItemList.subtract(ListOperationInfo, Collection)
- Parameters:
info
- The parameter bundle specifying the details of the new list.x
- The lists to subtract items from.y
- The lists to subtract.- Returns:
- A new list
-
rename
public ItemList rename(ItemList list, java.lang.String newName)
Rename a list on the server, returning a list representing the new state. UseItemList.rename(String)
- Parameters:
list
- The list to rename.newName
- The new name to give it.- Returns:
- A list object representing the new state.
-
contains
public boolean contains(ItemList list, Item... items)
Report whether the given list contains all the items in the supplied array.- Parameters:
list
- The list supposed to contain the items.items
- The items supposed to belong to the list- Returns:
- Whether or not all the items are members of this list.
-
getTags
public java.util.List<java.lang.String> getTags(ItemList itemList)
Get the most current tag set for a list.- Parameters:
itemList
- The list to get tags for.- Returns:
- A list of tags.
-
addTags
public java.util.List<java.lang.String> addTags(ItemList itemList, java.lang.String... newTags)
Get the tags for a list after adding some to the tag set.- Parameters:
itemList
- The list to add to.newTags
- The new tags to add.- Returns:
- The current list of tags.
-
removeTags
public java.util.List<java.lang.String> removeTags(ItemList itemList, java.lang.String... removeThese)
Get the tags for a list after removing some from its tag set.- Parameters:
itemList
- The list to remove from.removeThese
- The tags to remove.- Returns:
- The current list of tags.
-
-