Changeset 3977


Ignore:
Timestamp:
Nov 16, 2007, 11:59:48 AM (14 years ago)
Author:
Nicklas Nordborg
Message:

References #827: Add more web services methods

Added AnnotationTypeService? that can be used to find available annotation types.

Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r3967 r3977  
    10641064    <webservices.wsdl serviceClassName="RawBioAssayService"/>
    10651065    <webservices.wsdl serviceClassName="SessionService"/>
     1066    <webservices.wsdl serviceClassName="AnnotationTypeService"/>
    10661067  </target>
    10671068 
  • trunk/doc/src/docbook/developerdoc/webservices.xml

    r3969 r3977  
    142142              Services related to array design. Find out which data files that
    143143              are present and download them.
     144            </para>
     145          </listitem>
     146        </varlistentry>
     147       
     148        <varlistentry>
     149          <term><classname docapi="net.sf.basedb.ws.server">AnnotationTypeService</classname></term>
     150          <term><classname docapi="net.sf.basedb.ws.client">AnnotationTypeClient</classname></term>
     151          <listitem>
     152            <para>
     153              Services related to annotation types. Find out which annotation types that
     154              can be used for different types of items.
    144155            </para>
    145156          </listitem>
  • trunk/src/core/net/sf/basedb/core/AnnotationType.java

    r3974 r3977  
    3434import net.sf.basedb.info.AnnotationTypeInfo;
    3535import net.sf.basedb.info.ToTransferable;
     36import net.sf.basedb.util.formatter.Formatter;
    3637
    3738import java.util.Set;
     
    282283    info.setRequiredForMiame(isRequiredForMiame());
    283284    info.setValueType(getValueType().name());
     285    info.setItemTypes(net.sf.basedb.util.Values.toStrings(getEnabledItems(),
     286      new Formatter<Item>()
     287      {
     288        public String format(Item item)
     289        {
     290          return item.name();
     291        }
     292        public Item parseString(String value)
     293        {
     294          return Item.valueOf(value);
     295        }
     296      }
     297    ));
    284298    return info;
    285299  }
  • trunk/src/info/net/sf/basedb/info/AnnotationTypeInfo.java

    r3973 r3977  
    4949  private boolean requiredForMiame;
    5050  private String[] enumValues;
     51  private String[] itemTypes;
    5152 
    5253  /**
     
    193194    this.valueType = valueType;
    194195  }
     196 
     197  /**
     198    @return The types of items that can be annotated with this annotation type. The value
     199      is the string representation of one of the options in {@link net.sf.basedb.core.Item},
     200      ie. SAMPLE, EXTRACT, BIOASSAYSET, RAWBIOASSAY, etc.
     201  */
     202  public String[] getItemTypes()
     203  {
     204    return itemTypes;
     205  }
     206 
     207  /**
     208    @param itemTypes The type of items that can be annotated with this annotation type.
     209    @see #getItemTypes()
     210  */
     211  public void setItemTypes(String[] itemTypes)
     212  {
     213    this.itemTypes = itemTypes;
     214  }
    195215
    196216
  • trunk/src/test/TestWebservices.java

    r3976 r3977  
    4545import net.sf.basedb.info.ReporterListInfo;
    4646import net.sf.basedb.util.FileUtil;
     47import net.sf.basedb.ws.client.AnnotationTypeClient;
    4748import net.sf.basedb.ws.client.ArrayDesignClient;
    4849import net.sf.basedb.ws.client.BioAssaySetClient;
     
    135136    //Tests
    136137    test_ProjectClient(client, projectId);
     138    test_AnnotationTypes(client);
    137139    test_getRawDataInExperiment(client, experimentId1, rawBioAssayId1);
    138140    test_getRawDataInExperiment(client, experimentId2, rawBioAssayId3);   
     
    512514  }
    513515 
     516  static void test_AnnotationTypes(SessionClient client)
     517  {
     518    if (client == null) return;
     519   
     520    AnnotationTypeClient atClient = new AnnotationTypeClient(client);
     521    try
     522    {
     523      //Tests ProjectClient.getProjects(QueryOptions qOpt)
     524      QueryOptions qOpt = new QueryOptions();
     525      AnnotationTypeInfo[] infos = atClient.getAnnotationTypes(null, qOpt);
     526     
     527      for (AnnotationTypeInfo info : infos)
     528      {
     529        write(info.getId() +"\t" + info.getName() + "\t" + info.getValueType() + "\t" +
     530          Arrays.asList(info.getItemTypes()));
     531      }
     532     
     533      write("--Test of AnnotationTypeClient OK");
     534    }
     535    catch (Throwable t)
     536    {
     537      write ("--Test of AnnotationTypeClient FAILED");
     538      t.printStackTrace();
     539      ok = false;
     540    }   
     541  }
     542 
    514543  static SessionClient test_SessionClient()
    515544  {
  • trunk/src/webservices/server/META-INF/services.xml

    r3861 r3977  
    7272    <parameter name="ServiceClass" locked="false">net.sf.basedb.ws.server.ArrayDesignService</parameter>
    7373  </service>
     74  <service name="AnnotationType" scope="application">
     75    <description>
     76      This service handles annotation types
     77    </description>
     78    <messageReceivers>
     79      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
     80        class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
     81      <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
     82        class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
     83    </messageReceivers>
     84    <parameter name="ServiceClass" locked="false">net.sf.basedb.ws.server.AnnotationTypeService</parameter>
     85  </service>
    7486</serviceGroup>
Note: See TracChangeset for help on using the changeset viewer.