Changeset 3974
- Timestamp:
- Nov 16, 2007, 9:28:40 AM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/AnnotatedItem.java
r3956 r3974 95 95 @since 2.5 96 96 */ 97 AnnotatedItemInfo to Info(AnnotatedItemInfo info)97 AnnotatedItemInfo toTransferable(AnnotatedItemInfo info) 98 98 { 99 super.to Info(info);99 super.toTransferable(info); 100 100 info.setAnnotated(this.isAnnotated()); 101 101 return info; -
trunk/src/core/net/sf/basedb/core/AnnotationType.java
r3973 r3974 33 33 import net.sf.basedb.core.query.Hql; 34 34 import net.sf.basedb.info.AnnotationTypeInfo; 35 import net.sf.basedb.info.ToTransferable; 35 36 36 37 import java.util.Set; … … 57 58 public class AnnotationType 58 59 extends CommonItem<AnnotationTypeData> 60 implements ToTransferable<AnnotationTypeInfo> 59 61 { 60 62 /** … … 266 268 } 267 269 268 public AnnotationTypeInfo to Info(AnnotationTypeInfo info)269 { 270 super.to Info(info);270 public AnnotationTypeInfo toTransferable(AnnotationTypeInfo info) 271 { 272 super.toTransferable(info); 271 273 info.setDefaultValue(getDefaultValue()); 272 274 info.setExternalId(getExternalId()); -
trunk/src/core/net/sf/basedb/core/ArrayDesign.java
r3956 r3974 32 32 import net.sf.basedb.core.query.Restrictions; 33 33 import net.sf.basedb.info.ArrayDesignInfo; 34 import net.sf.basedb.info.ToTransferable; 34 35 35 36 import java.util.Collection; … … 61 62 public class ArrayDesign 62 63 extends AnnotatedItem<ArrayDesignData> 63 implements FileStoreEnabled 64 implements FileStoreEnabled, ToTransferable<ArrayDesignInfo> 64 65 { 65 66 … … 757 758 @since 2.5 758 759 */ 759 public ArrayDesignInfo to Info(ArrayDesignInfo info)760 { 761 super.to Info(info);760 public ArrayDesignInfo toTransferable(ArrayDesignInfo info) 761 { 762 super.toTransferable(info); 762 763 info.setNumDbFeatures(this.getNumDbFeatures()); 763 764 info.setNumFileFeatures(this.getNumFileFeatures()); 764 765 765 return info; 766 766 } -
trunk/src/core/net/sf/basedb/core/BasicItem.java
r3956 r3974 176 176 @since 2.5 177 177 */ 178 BasicItemInfo to Info(BasicItemInfo info)178 BasicItemInfo toTransferable(BasicItemInfo info) 179 179 { 180 180 info.setId(this.getId()); 181 info.setVersion(getVersion()); 181 182 return info; 182 183 } -
trunk/src/core/net/sf/basedb/core/BioAssaySet.java
r3972 r3974 43 43 import net.sf.basedb.core.query.JoinType; 44 44 import net.sf.basedb.info.BioAssaySetInfo; 45 import net.sf.basedb.info.ToTransferable; 45 46 46 47 import java.util.Collections; … … 70 71 public class BioAssaySet 71 72 extends ChildItem<BioAssaySetData> 72 implements Nameable, Removable, Annotatable 73 implements Nameable, Removable, Annotatable, ToTransferable<BioAssaySetInfo> 73 74 { 74 75 /** … … 347 348 @since 2.5 348 349 */ 349 public BioAssaySetInfo to Info(BioAssaySetInfo info)350 { 351 super.to Info(info);350 public BioAssaySetInfo toTransferable(BioAssaySetInfo info) 351 { 352 super.toTransferable(info); 352 353 info.setName(this.getName()); 353 354 info.setDescription(this.getDescription()); -
trunk/src/core/net/sf/basedb/core/CommonItem.java
r3956 r3974 86 86 @since 2.5 87 87 */ 88 CommonItemInfo to Info(CommonItemInfo info)88 CommonItemInfo toTransferable(CommonItemInfo info) 89 89 { 90 super.to Info(info);90 super.toTransferable(info); 91 91 info.setDescription(this.getDescription()); 92 92 info.setName(this.getName()); -
trunk/src/core/net/sf/basedb/core/DataFileType.java
r3956 r3974 33 33 import net.sf.basedb.core.query.Restrictions; 34 34 import net.sf.basedb.info.DataFileTypeInfo; 35 import net.sf.basedb.info.ToTransferable; 35 36 import net.sf.basedb.util.ClassUtil; 36 37 … … 49 50 public class DataFileType 50 51 extends BasicItem<DataFileTypeData> 51 implements Nameable, Removable 52 implements Nameable, Removable, ToTransferable<DataFileTypeInfo> 52 53 { 53 54 … … 364 365 @since 2.5 365 366 */ 366 public DataFileTypeInfo to Info(DataFileTypeInfo info)367 { 368 super.to Info(info);367 public DataFileTypeInfo toTransferable(DataFileTypeInfo info) 368 { 369 super.toTransferable(info); 369 370 info.setName(getName()); 370 371 info.setDescription(getDescription()); -
trunk/src/core/net/sf/basedb/core/Experiment.java
r3956 r3974 30 30 import net.sf.basedb.core.query.Hql; 31 31 import net.sf.basedb.info.ExperimentInfo; 32 import net.sf.basedb.info.ToTransferable; 32 33 33 34 import java.util.Date; … … 51 52 public class Experiment 52 53 extends CommonItem<ExperimentData> 53 implements DiskConsumable, Transactional 54 implements DiskConsumable, Transactional, ToTransferable<ExperimentInfo> 54 55 { 55 56 /** … … 267 268 @since 2.5 268 269 */ 269 public ExperimentInfo to Info(ExperimentInfo info)270 { 271 super.to Info(info);270 public ExperimentInfo toTransferable(ExperimentInfo info) 271 { 272 super.toTransferable(info); 272 273 info.setAbstractText(this.getAbstract()); 273 274 info.setAffiliations(this.getAffiliations()); -
trunk/src/core/net/sf/basedb/core/OwnedItem.java
r3956 r3974 122 122 @since 2.5 123 123 */ 124 OwnedItemInfo to Info(OwnedItemInfo info)124 OwnedItemInfo toTransferable(OwnedItemInfo info) 125 125 { 126 super.to Info(info);126 super.toTransferable(info); 127 127 try 128 128 { -
trunk/src/core/net/sf/basedb/core/Project.java
r3957 r3974 34 34 import net.sf.basedb.core.query.ResultList; 35 35 import net.sf.basedb.info.ProjectInfo; 36 import net.sf.basedb.info.ToTransferable; 36 37 37 38 import java.util.ArrayList; … … 80 81 public class Project 81 82 extends OwnedItem<ProjectData> 82 implements Nameable, Removable 83 implements Nameable, Removable, ToTransferable<ProjectInfo> 83 84 { 84 85 /** … … 582 583 } 583 584 584 public ProjectInfo to Info(ProjectInfo info)585 { 586 super.to Info(info);585 public ProjectInfo toTransferable(ProjectInfo info) 586 { 587 super.toTransferable(info); 587 588 info.setDescription(this.getDescription()); 588 589 info.setName(this.getName()); -
trunk/src/core/net/sf/basedb/core/RawBioAssay.java
r3956 r3974 39 39 import net.sf.basedb.core.query.Expressions; 40 40 import net.sf.basedb.info.RawBioAssayInfo; 41 import net.sf.basedb.info.ToTransferable; 41 42 42 43 import java.util.Collection; … … 66 67 public class RawBioAssay 67 68 extends AnnotatedItem<RawBioAssayData> 68 implements DiskConsumable, FileStoreEnabled 69 implements DiskConsumable, FileStoreEnabled, ToTransferable<RawBioAssayInfo> 69 70 { 70 71 /** … … 426 427 @since 2.5 427 428 */ 428 public RawBioAssayInfo to Info(RawBioAssayInfo info)429 { 430 super.to Info(info);429 public RawBioAssayInfo toTransferable(RawBioAssayInfo info) 430 { 431 super.toTransferable(info); 431 432 info.setArrayDesignId(this.getArrayDesign().getId()); 432 433 info.setPlatformId(this.getPlatform().getId()); -
trunk/src/core/net/sf/basedb/core/SharedItem.java
r3956 r3974 122 122 @since 2.5 123 123 */ 124 SharedItemInfo to Info(SharedItemInfo info)124 SharedItemInfo toTransferable(SharedItemInfo info) 125 125 { 126 super.to Info(info);126 super.toTransferable(info); 127 127 info.setShared(this.isShared()); 128 128 return info; -
trunk/src/info/net/sf/basedb/info/AnnotationInfo.java
r3973 r3974 34 34 */ 35 35 public class AnnotationInfo 36 implements Serializable 36 implements Serializable, Transferable 37 37 { 38 38 -
trunk/src/info/net/sf/basedb/info/ArrayDesignInfo.java
r3959 r3974 37 37 public class ArrayDesignInfo 38 38 extends AnnotatedItemInfo 39 39 implements Serializable 40 40 { 41 41 private static final long serialVersionUID = 5869031159593261755L; -
trunk/src/info/net/sf/basedb/info/BasicItemInfo.java
r3957 r3974 26 26 27 27 /** 28 Superclass for all transferable classes that transfer information 29 about item-classes, ie. classes that are subclasses of 30 {@link net.sf.basedb.core.BasicItem}. 31 28 32 @author Martin 29 33 @version 2.5 30 34 */ 31 35 public abstract class BasicItemInfo 36 implements Transferable 32 37 { 33 38 private int id; 34 39 private int version; 40 35 41 /** 36 42 @param id The id to set. … … 48 54 return id; 49 55 } 56 57 public void setVersion(int version) 58 { 59 this.version = version; 60 } 61 62 public int getVersion() 63 { 64 return version; 65 } 66 50 67 51 68 } -
trunk/src/info/net/sf/basedb/info/QueryOptions.java
r3952 r3974 42 42 */ 43 43 public class QueryOptions 44 implements Transferable 44 45 { 45 46 /** -
trunk/src/info/net/sf/basedb/info/VersionInfo.java
r3960 r3974 33 33 */ 34 34 public class VersionInfo 35 implements Serializable 35 implements Serializable, Transferable 36 36 { 37 37 private static final long serialVersionUID = 9189853948028180946L; -
trunk/src/info/net/sf/basedb/info/package.html
r3960 r3974 28 28 classes are, for example, used by the webservices implementation, but 29 29 can also be used by other clients with similar needs. The classes 30 are <code>Serializable</code>.30 are {@link java.io.Serializable} and {@link net.sf.basedb.info.Transferable}. 31 31 </p> 32 32 <p> … … 36 36 For each class in this package, there usually is a corresponding class 37 37 in the business layer, for example {@link net.sf.basedb.info.ProjectInfo} and 38 {@link net.sf.basedb.core. User}.38 {@link net.sf.basedb.core.Project}. 39 39 </p> 40 40 <p> 41 Client applications can create instances themselves or use the42 {@link net.sf.basedb. core.BasicItem#toInfo(net.sf.basedb.info.BasicInfo)}43 method to let the core create an initialisedinstance. Note! The latter41 Client applications can create and initialise instances themselves or use the 42 {@link net.sf.basedb.info.ToTransferable#toTransferable(net.sf.basedb.info.Transferable)} 43 method to let the core initialise an instance. Note! The latter 44 44 alternative will of course only work for code executing on the server. 45 45 It will, for example, not work in the webservices client since it doesn't -
trunk/src/webservices/server/net/sf/basedb/ws/server/RawBioAssayService.java
r3973 r3974 71 71 RawBioAssay rawBioAssay = RawBioAssay.getById(dc, rawBioAssayId); 72 72 ArrayDesign arrayDesign = rawBioAssay.getArrayDesign(); 73 if (arrayDesign != null) info = arrayDesign.to Info(new ArrayDesignInfo());73 if (arrayDesign != null) info = arrayDesign.toTransferable(new ArrayDesignInfo()); 74 74 } 75 75 finally -
trunk/src/webservices/server/net/sf/basedb/ws/server/ServicesUtil.java
r3973 r3974 35 35 import net.sf.basedb.info.AnnotationInfo; 36 36 import net.sf.basedb.info.QueryOptions; 37 import net.sf.basedb.info.ToTransferable; 38 import net.sf.basedb.info.Transferable; 37 39 38 import java.lang.reflect.InvocationTargetException;39 import java.lang.reflect.Method;40 40 import java.util.EnumSet; 41 41 import java.util.LinkedList; … … 105 105 */ 106 106 @SuppressWarnings("unchecked") 107 public <T > T[] listToInfo(List<?> list, Class<T> clazz)107 public <T extends Transferable> T[] listToInfo(List<? extends ToTransferable<T>> list, Class<T> clazz) 108 108 { 109 109 T[] result = (T[])java.lang.reflect.Array.newInstance(clazz, list.size()); 110 int i = 0;111 Method toInfo = null;112 110 try 113 111 { 114 for (Object o : list) 112 int i = 0; 113 for (ToTransferable<T> o : list) 115 114 { 116 if (toInfo == null) toInfo = o.getClass().getDeclaredMethod("toInfo", clazz); 117 result[i] = clazz.newInstance(); 118 toInfo.invoke(o, result[i]); 115 result[i] = o.toTransferable(clazz.newInstance()); 119 116 ++i; 120 117 } 121 }122 catch (NoSuchMethodException ex)123 {124 throw new RuntimeException(ex);125 118 } 126 119 catch (InstantiationException ex) … … 129 122 } 130 123 catch (IllegalAccessException ex) 131 {132 throw new RuntimeException(ex);133 }134 catch (InvocationTargetException ex)135 124 { 136 125 throw new RuntimeException(ex);
Note: See TracChangeset
for help on using the changeset viewer.