2.17.2: 2011-06-17

net.sf.basedb.ws.server
Class ServicesUtil

java.lang.Object
  extended by net.sf.basedb.ws.server.ServicesUtil

public class ServicesUtil
extends Object

A utility class for common methods in the web services.

Version:
2.5
Author:
Martin, Nicklas

Constructor Summary
ServicesUtil()
           
 
Method Summary
 AnnotationInfo[] getAnnotations(DbControl dc, Annotatable annotatable, Integer[] annotationTypes, boolean findInherited)
          Load annotation values from an annotatable item.
<T extends BasicItem>
ItemQuery<T>
getConfiguredItemQuery(ItemQuery<T> query, QueryOptions qOpt)
          Put options and restriction on a item query and returns it
<T extends Transferable>
T[]
listToInfo(List<? extends ToTransferable<T>> list, Class<T> clazz)
          Convert a list of objects to an array of Transferable objects objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServicesUtil

public ServicesUtil()
Method Detail

getConfiguredItemQuery

public <T extends BasicItem> ItemQuery<T> getConfiguredItemQuery(ItemQuery<T> query,
                                                                 QueryOptions qOpt)
Put options and restriction on a item query and returns it

Type Parameters:
T - The kind of BasicItem the item query work with.
Parameters:
query - ItemQuery that should get includes and restriction.
qOpt - QueryOptions object with restrictions and includes to put on the ItemQuery
Returns:
A ItemQuery with restriction and includes set.

listToInfo

public <T extends Transferable> T[] listToInfo(List<? extends ToTransferable<T>> list,
                                               Class<T> clazz)
Convert a list of objects to an array of Transferable objects objects. The objects in must be of the same type and implement the ToTransferable interface. The specified transferable class must hava a public no-argument constructor. See for example: Experiment.toTransferable(net.sf.basedb.info.ExperimentInfo)

Type Parameters:
T - The kind of info object the items can be transfered into.
Parameters:
list - A list of ToTransferable objects
clazz - The Transferable class that the objects in the list are beeing converted to
Returns:
An array info objects of the specified transferable class

getAnnotations

public AnnotationInfo[] getAnnotations(DbControl dc,
                                       Annotatable annotatable,
                                       Integer[] annotationTypes,
                                       boolean findInherited)
Load annotation values from an annotatable item.

Parameters:
dc - The DbControl to use for database access
annotatable - The annotatable item to load annotations from
annotationTypes - Array of annotation type ID
findInherited - TRUE to find inherited annotations, FALSE to only look for primary annotations
Returns:
An array of AnnotationInfo objects, each position corresponds to the position with the same index in the annotationTypes array. The returned array is always the same length as the annotationTypes array. If the annotatable item doesn't have any annotations of a particular type, that element is null

2.17.2: 2011-06-17