Changeset 3976


Ignore:
Timestamp:
Nov 16, 2007, 11:42:08 AM (14 years ago)
Author:
Martin Svensson
Message:

References #827 Added ExperimentService?.getReporterLists().

Location:
trunk/src
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/ReporterList.java

    r3679 r3976  
    2828import net.sf.basedb.core.data.ReporterData;
    2929import net.sf.basedb.core.data.ReporterListScoreData;
     30import net.sf.basedb.info.ReporterListInfo;
     31import net.sf.basedb.info.ToTransferable;
    3032
    3133
     
    3840public class ReporterList
    3941  extends CommonItem<ReporterListData>
     42    implements ToTransferable<ReporterListInfo>
    4043{
    4144  /**
     
    240243    return query;
    241244  }
     245
     246  public ReporterListInfo toTransferable(ReporterListInfo info)
     247  {
     248    super.toTransferable(info);
     249    info.setExternalId(this.getExternalId());
     250    return info;
     251  }
    242252 
    243253}
  • trunk/src/test/TestReporterList.java

    r3679 r3976  
    276276  }
    277277
    278 
     278  static void test_setExperiment(int id, int experimentId)
     279  {
     280    if (id == 0 || experimentId == 0)return;
     281    DbControl dc = null;
     282    try
     283    {
     284      dc = TestUtil.getDbControl();
     285      ReporterList rl = ReporterList.getById(dc, id);
     286      Experiment exp = Experiment.getById(dc, experimentId);
     287     
     288      rl.setExperiment(exp);
     289      dc.commit();
     290    }
     291    catch (Throwable ex)
     292    {
     293      write ("--Set experiment to list FAILED");
     294      ex.printStackTrace();
     295      ok = false;
     296    }
     297    finally
     298    {
     299      if (dc != null) dc.close();
     300    }
     301  }
    279302
    280303}
  • trunk/src/test/TestWebservices.java

    r3973 r3976  
    4343import net.sf.basedb.info.QueryOptions;
    4444import net.sf.basedb.info.RawBioAssayInfo;
     45import net.sf.basedb.info.ReporterListInfo;
    4546import net.sf.basedb.util.FileUtil;
    4647import net.sf.basedb.ws.client.ArrayDesignClient;
     
    9394    TestReporter.test_import_from_file("data/test.rawdata.import.txt",
    9495        "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", "\\t", 4, 3);
     96    int reporterListId1 = TestReporterList.test_create("net.sf.basedb.clients.test.reporterlist1", true);
     97    TestReporterList.test_add_reporters(reporterListId1, 50);
     98    TestReporterList.test_setExperiment(reporterListId1, experimentId1);
     99       
    95100    int arrayDesignId1 = TestArrayDesign.test_create(Platform.GENERIC, false);
    96101    TestArrayDesign.test_import_from_file(arrayDesignId1, "data/test.rawdata.import.txt",
     
    136141    test_BioAssaySetClient(client, experimentId1, rootBioAssaySetId1);
    137142    test_getExperimentalFactorValues(client, experimentId1);
     143    test_ReportersInExperiment(client, experimentId1, reporterListId1);
    138144    test_Logout(client);
    139145   
     
    141147   
    142148    //Standard test:Delete/cleanup
     149    TestReporterList.test_delete(reporterListId1);
     150   
    143151    TestExperiment.test_delete_bioassayset(rootBioAssaySetId1);
    144152    TestExperiment.test_delete(experimentId1);
     
    556564    }
    557565  }
     566 
     567  static void test_ReportersInExperiment(SessionClient client, int experimentId, int reporterListId)
     568  {
     569    if (client == null || experimentId == 0 || reporterListId == 0)return;
     570    ExperimentClient experimentClient = new ExperimentClient(client);
     571    try
     572    {
     573      ReporterListInfo[] listInfo = experimentClient.getReporterLists(experimentId, null);
     574      if (listInfo.length > 0)
     575      {
     576       
     577      }
     578      else
     579      {
     580        write ("--No reporterlists were received");
     581      }
     582     
     583      write("--Test of getReporterLists OK");
     584    }
     585    catch (Throwable t)
     586    {
     587      write ("--Test of getReporterLists FAILED");
     588      t.printStackTrace();
     589      ok = false;
     590    }
     591  }
    558592}
  • trunk/src/webservices/client/java/net/sf/basedb/ws/client/ExperimentClient.java

    r3973 r3976  
    2929import net.sf.basedb.info.QueryOptions;
    3030import net.sf.basedb.info.RawBioAssayInfo;
     31import net.sf.basedb.info.ReporterListInfo;
    3132
    3233import org.apache.axis2.AxisFault;
     
    9091    throws AxisFault
    9192  {
    92     BioAssaySetInfo[] result = invokeBlocking("getBioAssaySets", BioAssaySetInfo[].class, session.getId(), experimentId, new QueryOptions());
     93    BioAssaySetInfo[] result = invokeBlocking("getBioAssaySets", BioAssaySetInfo[].class, session.getId(), experimentId, qOpt);
    9394    return result;
    9495  }
     
    109110  }
    110111
     112 
     113  /**
     114    Gets info about reporter lists in an experiment.
     115      @param experimentId Id of the experiment the lists are used in
     116      @param qOpt Options to put on the query that gets the reporter lists.
     117      @return An array with info about each reporter list.
     118      @throws AxisFault If communication with web services fails.
     119   */
     120  public ReporterListInfo[] getReporterLists(int experimentId, QueryOptions qOpt)
     121    throws AxisFault
     122  {
     123    ReporterListInfo[] result = invokeBlocking("getReporterLists", ReporterListInfo[].class, session.getId(), experimentId, qOpt);
     124    return result;
     125  }
    111126}
  • trunk/src/webservices/server/net/sf/basedb/ws/server/ExperimentService.java

    r3973 r3976  
    3030import net.sf.basedb.core.ItemQuery;
    3131import net.sf.basedb.core.RawBioAssay;
     32import net.sf.basedb.core.ReporterList;
    3233import net.sf.basedb.core.SessionControl;
     34import net.sf.basedb.core.query.Hql;
     35import net.sf.basedb.core.query.Restrictions;
    3336import net.sf.basedb.info.AnnotationTypeInfo;
    3437import net.sf.basedb.info.BioAssaySetInfo;
     
    3639import net.sf.basedb.info.QueryOptions;
    3740import net.sf.basedb.info.RawBioAssayInfo;
     41import net.sf.basedb.info.ReporterListInfo;
    3842
    3943import java.util.LinkedList;
     
    128132    }
    129133  }
     134 
     135  /**
     136    Gets an array with information objects for each reporter list used
     137    in an Experiment.
     138      @param ID The id to identify an active session.
     139      @param experimentId The id of the experiment to get the reporter lists from.
     140      @param qOpt QueryOptions to put on the query when getting the reporter lists.
     141      @return ReporterListInfo array.
     142   */
     143  public ReporterListInfo[] getReporterLists(String ID, int experimentId, QueryOptions qOpt)
     144  {
     145    SessionControl sc = getSessionControl(ID);
     146    DbControl dc = sc.newDbControl();
     147    try
     148    {
     149      Experiment experiment = Experiment.getById(dc, experimentId);
     150      ItemQuery<ReporterList> query = ReporterList.getQuery(); 
     151      query.restrictPermanent(Restrictions.eq(Hql.property("experiment"), Hql.entity(experiment)));
     152      return util.listToInfo(query.list(dc), ReporterListInfo.class);
     153    }
     154    finally
     155    {
     156      if (dc != null) dc.close();
     157    }   
     158  }
    130159
    131160  /**
Note: See TracChangeset for help on using the changeset viewer.