Changeset 3956


Ignore:
Timestamp:
Nov 13, 2007, 2:04:45 PM (14 years ago)
Author:
Martin Svensson
Message:

References #823 The *Info classes are now refactored.
The property of info-classes are now being set in the item-classes using
'item.toInfo(itemInfo)'

Location:
trunk/src
Files:
6 added
1 deleted
21 edited

Legend:

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

    r3679 r3956  
    2727import net.sf.basedb.core.data.AnnotatedData;
    2828import net.sf.basedb.core.data.AnnotationSetData;
     29import net.sf.basedb.info.AnnotatedItemInfo;
    2930
    3031/**
     
    9192  // -------------------------------------------
    9293
     94  /**
     95    @since 2.5
     96   */
     97  AnnotatedItemInfo toInfo(AnnotatedItemInfo info)
     98  {
     99    super.toInfo(info);
     100    info.setAnnotated(this.isAnnotated());
     101    return info;
     102  }
    93103}
    94104
  • trunk/src/core/net/sf/basedb/core/ArrayDesign.java

    r3820 r3956  
    3131import net.sf.basedb.core.query.Hql;
    3232import net.sf.basedb.core.query.Restrictions;
     33import net.sf.basedb.info.ArrayDesignInfo;
    3334
    3435import java.util.Collection;
     
    753754  }
    754755 
     756  /**
     757    @since 2.5
     758   */
     759  public ArrayDesignInfo toInfo(ArrayDesignInfo info)
     760  {
     761    super.toInfo(info);
     762    info.setNumDbFeatures(this.getNumDbFeatures());
     763    info.setNumFileFeatures(this.getNumFileFeatures());
     764   
     765    return info;
     766  }
    755767}
  • trunk/src/core/net/sf/basedb/core/BasicItem.java

    r3857 r3956  
    2626
    2727import net.sf.basedb.core.data.BasicData;
     28import net.sf.basedb.info.BasicItemInfo;
     29
    2830import java.lang.ref.WeakReference;
    2931import java.util.Set;
     
    170172  }
    171173  // -------------------------------------------
     174 
     175  /**
     176    @since 2.5
     177   */
     178  BasicItemInfo toInfo(BasicItemInfo info)
     179  {
     180    info.setId(this.getId());
     181    return info;
     182  }
    172183
    173184  /**
  • trunk/src/core/net/sf/basedb/core/BioAssaySet.java

    r3857 r3956  
    4242import net.sf.basedb.core.query.Selects;
    4343import net.sf.basedb.core.query.JoinType;
     44import net.sf.basedb.info.BioAssaySetInfo;
    4445
    4546import java.util.Collections;
     
    341342  {
    342343    return Permission.USE;
     344  }
     345 
     346  /**
     347    @since 2.5
     348   */
     349  public BioAssaySetInfo toInfo(BioAssaySetInfo info, DbControl dc)
     350  {
     351    super.toInfo(info);   
     352    info.setName(this.getName());
     353    info.setDescription(this.getDescription());
     354    info.setNumReporters(this.getNumReporters());
     355    info.setNumSpots(this.getNumSpots());
     356   
     357    ItemQuery<BioAssay> query = this.getBioAssays();   
     358    List<BioAssay> bioas = null;
     359    int[] basIds;;
     360    try
     361    {
     362      bioas = query.list(dc);
     363      basIds = new int[bioas.size()];
     364    }
     365    catch (PermissionDeniedException pex)
     366    {
     367      basIds = new int[0];
     368    }     
     369    for (int i=0; i<basIds.length; i++)
     370    {
     371      basIds[i] = bioas.get(i).getId();
     372    }   
     373    info.setBioAssayIds(basIds);
     374   
     375    return info;
    343376  }
    344377  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/CommonItem.java

    r3679 r3956  
    2727
    2828import net.sf.basedb.core.data.CommonData;
     29import net.sf.basedb.info.CommonItemInfo;
    2930
    3031/**
     
    8182    getData().setRemoved(removed);
    8283  }
     84 
     85  /**
     86    @since 2.5
     87   */
     88  CommonItemInfo toInfo(CommonItemInfo info)
     89  {
     90    super.toInfo(info);
     91    info.setDescription(this.getDescription());
     92    info.setName(this.getName());
     93    return info;
     94  }
    8395}
    8496
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r3835 r3956  
    3232import net.sf.basedb.core.query.Hql;
    3333import net.sf.basedb.core.query.Restrictions;
     34import net.sf.basedb.info.DataFileTypeInfo;
    3435import net.sf.basedb.util.ClassUtil;
    3536
     
    359360    return using;
    360361  }
     362 
     363  /**
     364    @since 2.5
     365   */
     366  public DataFileTypeInfo toInfo(DataFileTypeInfo info)
     367  {
     368    super.toInfo(info);
     369    info.setName(getName());
     370    info.setDescription(getDescription());
     371    info.setExtension(this.getExtension());
     372    info.setExternalId(this.getExternalId());
     373    return info;
     374  }
    361375  // -------------------------------------------
    362376 
  • trunk/src/core/net/sf/basedb/core/Experiment.java

    r3820 r3956  
    2929import net.sf.basedb.core.query.Restrictions;
    3030import net.sf.basedb.core.query.Hql;
     31import net.sf.basedb.info.ExperimentInfo;
    3132
    3233import java.util.Date;
     
    262263    }
    263264  }
     265 
     266  /**
     267    @since 2.5
     268   */
     269  public ExperimentInfo toInfo(ExperimentInfo info)
     270  {
     271    super.toInfo(info);
     272    info.setAbstractText(this.getAbstract());
     273    info.setAffiliations(this.getAffiliations());
     274    info.setAuthors(this.getAuthors());
     275    info.setExperimentDesign(this.getExperimentDesign());
     276    info.setExperimentType(this.getExperimentType());
     277    info.setPublication(this.getPublication());
     278    info.setTitle(this.getTitle());
     279    info.setPublicationDate(this.getPublicationDate());
     280    info.setPubMedId(this.getPubMedId());
     281    return info;
     282  }
     283 
    264284  // -------------------------------------------
    265285 
  • trunk/src/core/net/sf/basedb/core/OwnedItem.java

    r3679 r3956  
    2727import net.sf.basedb.core.data.OwnedData;
    2828import net.sf.basedb.core.data.UserData;
     29import net.sf.basedb.info.OwnedItemInfo;
    2930
    3031/**
     
    117118    super.initPermissions(granted, denied);
    118119  }
     120 
     121  /**
     122    @since 2.5
     123   */
     124  OwnedItemInfo toInfo(OwnedItemInfo info)
     125  {
     126    super.toInfo(info);
     127    try
     128    {
     129      info.setOwnerId(this.getOwner().getId());
     130    }
     131    catch (PermissionDeniedException ex)
     132    {
     133      info.setOwnerId(0);
     134    }
     135    return info;
     136  }
    119137}
  • trunk/src/core/net/sf/basedb/core/Project.java

    r3857 r3956  
    3333import net.sf.basedb.core.query.EntityQuery;
    3434import net.sf.basedb.core.query.ResultList;
     35import net.sf.basedb.info.ProjectInfo;
    3536
    3637import java.util.ArrayList;
     
    581582  }
    582583 
     584  public ProjectInfo toInfo(ProjectInfo info)
     585  {
     586    super.toInfo(info);
     587    return info;
     588  }
     589 
    583590  /**
    584591    A runtime filter implementation that limits a query to only
  • trunk/src/core/net/sf/basedb/core/RawBioAssay.java

    r3857 r3956  
    3838import net.sf.basedb.core.query.Dynamic;
    3939import net.sf.basedb.core.query.Expressions;
     40import net.sf.basedb.info.RawBioAssayInfo;
    4041
    4142import java.util.Collection;
     
    420421      }
    421422    }
     423  }
     424 
     425  /**
     426    @since 2.5
     427   */
     428  public RawBioAssayInfo toInfo(RawBioAssayInfo info)
     429  {
     430    super.toInfo(info);
     431    info.setArrayDesignId(this.getArrayDesign().getId());
     432    info.setPlatformId(this.getPlatform().getId());
     433    info.setRawDataTypeId(this.getRawDataType().getId());
     434    return info;
    422435  }
    423436  // -------------------------------------------
  • trunk/src/core/net/sf/basedb/core/SharedItem.java

    r3679 r3956  
    2727import net.sf.basedb.core.data.SharedData;
    2828import net.sf.basedb.core.data.ProjectKeyData;
     29import net.sf.basedb.info.SharedItemInfo;
    2930
    3031/**
     
    117118    super.initPermissions(granted, denied);
    118119  }
     120 
     121  /**
     122    @since 2.5
     123   */
     124  SharedItemInfo toInfo(SharedItemInfo info)
     125  {
     126    super.toInfo(info);
     127    info.setShared(this.isShared());
     128    return info;
     129  }
    119130}
  • trunk/src/info/net/sf/basedb/info/ArrayDesignInfo.java

    r3951 r3956  
    3434 */
    3535public class ArrayDesignInfo
    36   extends ItemInfo
     36  extends AnnotatedItemInfo
    3737{
    3838  private int numDbFeatures = 0;
     
    4747  }
    4848 
    49   /**
    50     Creates a new info object, with it's properties set,
    51     for an ArrayDesign.   
    52       @param arrayDesign The ArrayDesign the object should relate to.
    53    */
    54   /*
    55   public ArrayDesignInfo(ArrayDesign arrayDesign)
    56   {
    57     super(arrayDesign);
    58     this.numDbFeatures = arrayDesign.getNumDbFeatures();
    59     this.numFileFeatures = arrayDesign.getNumFileFeatures();
    60   }
    61   */
    62 
    6349  /**
    6450      @param numDbFeatures The numDbFeatures to set.
  • trunk/src/info/net/sf/basedb/info/BioAssaySetInfo.java

    r3951 r3956  
    3434 */
    3535public class BioAssaySetInfo
    36   extends ItemInfo
     36  extends BasicItemInfo
     37    implements NameableInfo
    3738{
     39  private String name;
     40  private String description;
    3841  private int numReporters = 0;
    3942  private int numSpots = 0;
     
    4750    super();
    4851  }
    49  
    50   /**
    51     Creates a new info object for a bioassay set   
    52       @param bioas The bioassay set to relate to.
    53    */
    54   /*
    55   public BioAssaySetInfo(BioAssaySet bioas)
    56   {
    57     super(bioas);
    58     this.numReporters = bioas.getNumReporters();
    59     this.numSpots = bioas.getNumSpots();   
    60   }
    61   */
    6252
    6353  /**
     
    10898    return bioAssayIds;
    10999  }
     100
     101  public String getDescription()
     102  {   
     103    return this.description;
     104  }
     105
     106  public String getName()
     107  {   
     108    return this.name;
     109  }
     110
     111  public void setDescription(String description)
     112  {
     113    this.description = description;
     114  }
     115
     116  public void setName(String name)
     117  {
     118    this.name = name;
     119  }
    110120}
  • trunk/src/info/net/sf/basedb/info/DataFileTypeInfo.java

    r3951 r3956  
    3434 
    3535 */
    36 public class DataFileTypeInfo extends ItemInfo
     36public class DataFileTypeInfo
     37  extends BasicItemInfo
     38    implements NameableInfo
    3739{
    3840  private String externalId = null;
    3941  private String extension = null;
     42  private String name = null;
     43  private String description = null;
    4044 
    4145  /**
     
    4751  }
    4852 
    49   /**
    50     Creates a new object that relates to a DataFileType.   
    51       @param dataFileType
    52    */
    53   /*
    54   public DataFileTypeInfo(DataFileType dataFileType)
    55   {
    56     super(dataFileType);
    57     this.externalId = dataFileType.getExternalId();
    58     this.extension = dataFileType.getExtension();
    59   }
    60   */
    61 
    6253  /**
    6354      @param externalId The externalId to set.
     
    9182    return extension;
    9283  }
     84
     85  /**
     86      @param description The description to set.
     87  */
     88  public void setDescription(String description)
     89  {
     90    this.description = description;
     91  }
     92
     93  /**
     94    @return Returns the description.
     95  */
     96  public String getDescription()
     97  {
     98    return description;
     99  }
     100
     101  /**
     102      @param name The name to set.
     103  */
     104  public void setName(String name)
     105  {
     106    this.name = name;
     107  }
     108
     109  /**
     110    @return Returns the name.
     111  */
     112  public String getName()
     113  {
     114    return name;
     115  }
    93116}
  • trunk/src/info/net/sf/basedb/info/ExperimentInfo.java

    r3951 r3956  
    3434  like id, name, texts etc. can be put in this info-object.
    3535   
    36     @author martin
     36    @author Martin
    3737    @version 2.5
    3838 */
    3939public class ExperimentInfo
    40   extends ItemInfo
     40  extends CommonItemInfo
    4141{
    4242  private String abstractText = null;
     
    5757    super();
    5858  }
    59  
    60   /**
    61     Creates an info-object with field set to corresponding
    62     properties in an Experiment object.
    63       @param experiment The Experiment{@link net.sf.basedb.core.Experiment}
    64         this info object correspond to.
    65    */
    66   /*
    67   public ExperimentInfo(Experiment experiment)
    68   {
    69     super(experiment);
    70     this.abstractText = experiment.getAbstract();
    71     this.affiliations = experiment.getAffiliations();
    72     this.authors = experiment.getAuthors();
    73     this.experimentDesign = experiment.getExperimentDesign();
    74     this.experimentType = experiment.getExperimentType();
    75     this.publication = experiment.getPublication();
    76     this.title = experiment.getTitle();
    77     this.publicationDate = experiment.getPublicationDate();
    78     this.pubMedId = experiment.getPubMedId();
    79   }
    80   */
    8159
    8260  /**
  • trunk/src/info/net/sf/basedb/info/ProjectInfo.java

    r3951 r3956  
    3434 */
    3535public class ProjectInfo
    36   extends ItemInfo
     36  extends OwnedItemInfo
    3737{
    3838  /**
     
    4343    super();
    4444  }
    45  
    46   /**
    47     Creates a new info object for a project   
    48       @param project The project this info object relates to.
    49    */
    50   /*
    51   public ProjectInfo(Project project)
    52   {
    53     super(project);
    54   }
    55   */
    5645}
  • trunk/src/info/net/sf/basedb/info/RawBioAssayInfo.java

    r3951 r3956  
    3434*/
    3535public class RawBioAssayInfo
    36   extends ItemInfo
     36  extends AnnotatedItemInfo
    3737{
    3838
     
    4949    super();
    5050  }
    51  
    52   /**
    53       Creates a new object with it's properties set.
    54       @param rba The RawBioAssay the object correspond to.
    55   */
    56   /*
    57   public RawBioAssayInfo(RawBioAssay rba)
    58   {
    59     super(rba);
    60     this.arrayDesignId = rba.getArrayDesign().getId();
    61     this.platformId = rba.getPlatform().getId();
    62     this.rawDataTypeId = rba.getRawDataType().getId();
    63   }
    64   */
    6551
    6652  /**
  • trunk/src/webservices/server/net/sf/basedb/ws/server/ArrayDesignService.java

    r3952 r3956  
    138138        for (FileSetMember fsm : query.list(dc))
    139139        {
    140           types.add(new DataFileTypeInfo()); //fsm.getDataFileType()));
     140          DataFileTypeInfo dftInfo = new DataFileTypeInfo();
     141          dftInfo = fsm.getDataFileType().toInfo(dftInfo);
     142          types.add(dftInfo);
    141143        }
    142144      }
  • trunk/src/webservices/server/net/sf/basedb/ws/server/ExperimentService.java

    r3952 r3956  
    7272      for (Experiment experiment : query.list(dc))
    7373      {
    74         experiments.add(new ExperimentInfo()); //experiment));
     74        ExperimentInfo expInfo = new ExperimentInfo();
     75        experiment.toInfo(expInfo);
     76        experiments.add(expInfo);
    7577      }
    7678    }
     
    105107      for (BioAssaySet bas : query.list(dc))
    106108      {
    107         BioAssaySetInfo info = new BioAssaySetInfo(); //bas);
    108         bioAssaySetsInfo.add(info);
     109        BioAssaySetInfo basInfo = new BioAssaySetInfo();
     110        bas.toInfo(basInfo, dc);       
     111        bioAssaySetsInfo.add(basInfo);
    109112      }
    110113    }
     
    139142      for (RawBioAssay rba : query.list(dc))
    140143      {       
    141         rawBioAssays.add(new RawBioAssayInfo()); //rba));
     144        RawBioAssayInfo rbaInfo = new RawBioAssayInfo();
     145        rbaInfo = rba.toInfo(rbaInfo);
     146        rawBioAssays.add(rbaInfo);
    142147      }
    143148     
  • trunk/src/webservices/server/net/sf/basedb/ws/server/ProjectService.java

    r3952 r3956  
    9292      for (Project project : query.list(dc))
    9393      {
    94         projects.add(new ProjectInfo());//project));
     94        ProjectInfo pInfo = new ProjectInfo();
     95        project.toInfo(pInfo);       
     96        projects.add(pInfo);
    9597      }
    9698    }
  • trunk/src/webservices/server/net/sf/basedb/ws/server/RawBioAssayService.java

    r3952 r3956  
    7777      if (dc != null) dc.close();
    7878    }
    79     return new ArrayDesignInfo(); //arrayDesign);
     79   
     80    ArrayDesignInfo adInfo = new ArrayDesignInfo();
     81    arrayDesign.toInfo(adInfo);
     82    return adInfo;
    8083  }
    8184 
     
    142145    of a RawBioAssay.
    143146      @param ID Id of the active session.
    144       @param rawBioAssayId Id of the rawbio assay it concerns
     147      @param rawBioAssayId Id of the rawbioassay it concerns
    145148    @param qOpt Restrictions and includes to put on the query
    146149      @return An array with DataFileTypeInfo:s.
     
    160163        for (FileSetMember fsm : query.list(dc))
    161164        {
    162           types.add(new DataFileTypeInfo());//fsm.getDataFileType()));
     165          DataFileTypeInfo dftInfo = new DataFileTypeInfo();
     166          fsm.getDataFileType().toInfo(dftInfo);
     167          types.add(dftInfo);
    163168        }
    164169      }
Note: See TracChangeset for help on using the changeset viewer.