Changeset 3764
- Timestamp:
- Sep 21, 2007, 2:51:18 PM (15 years ago)
- Location:
- branches/filedb/src
- Files:
-
- 10 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/filedb/src/core/common-queries.xml
r3741 r3764 2765 2765 </query> 2766 2766 2767 <query id="GET_RAWBIOASSAYS_FOR_PLATFORM" type="HQL"> 2768 <sql> 2769 SELECT {1} 2770 FROM RawBioAssayData rba 2771 WHERE rba.platform = :platform 2772 </sql> 2773 <description> 2774 A Hibernate query that gets raw bioassays 2775 with a given platform. 2776 </description> 2777 </query> 2778 2779 <query id="GET_ARRAYDESIGNS_FOR_PLATFORM" type="HQL"> 2780 <sql> 2781 SELECT {1} 2782 FROM ArrayDesignData ad 2783 WHERE ad.platform = :platform 2784 </sql> 2785 <description> 2786 A Hibernate query that gets array designs 2787 with a given platform. 2788 </description> 2789 </query> 2790 2791 <query id="GET_RAWBIOASSAYS_FOR_VARIANT" type="HQL"> 2792 <sql> 2793 SELECT {1} 2794 FROM RawBioAssayData rba 2795 WHERE rba.variant = :variant 2796 </sql> 2797 <description> 2798 A Hibernate query that gets raw bioassays 2799 with a given platform variant. 2800 </description> 2801 </query> 2802 2803 <query id="GET_ARRAYDESIGNS_FOR_VARIANT" type="HQL"> 2804 <sql> 2805 SELECT {1} 2806 FROM ArrayDesignData ad 2807 WHERE ad.variant = :variant 2808 </sql> 2809 <description> 2810 A Hibernate query that gets array designs 2811 with a given platform variant. 2812 </description> 2813 </query> 2814 2815 <query id="GET_PLATFORM_FOR_SYSTEM_ID" type="HQL"> 2816 <sql> 2817 SELECT plf 2818 FROM PlatformData plf 2819 WHERE plf.systemId = :systemId 2820 </sql> 2821 <description> 2822 A Hibernate query that loads a platform by system ID. 2823 </description> 2824 </query> 2825 2826 <query id="GET_FILESETMEMBERTYPE_FOR_SYSTEM_ID" type="HQL"> 2827 <sql> 2828 SELECT fsmt 2829 FROM FileSetMemberTypeData fsmt 2830 WHERE fsmt.systemId = :systemId 2831 </sql> 2832 <description> 2833 A Hibernate query that loads a file set member type by system ID. 2834 </description> 2835 </query> 2836 2767 2837 </predefined-queries> -
branches/filedb/src/core/net/sf/basedb/core/Install.java
r3741 r3764 28 28 import net.sf.basedb.core.data.ColoringData; 29 29 import net.sf.basedb.core.data.DirectoryData; 30 import net.sf.basedb.core.data.FileSetMemberTypeData; 30 31 import net.sf.basedb.core.data.FileTypeData; 31 32 import net.sf.basedb.core.data.FormulaData; … … 33 34 import net.sf.basedb.core.data.HardwareTypeData; 34 35 import net.sf.basedb.core.data.MimeTypeData; 36 import net.sf.basedb.core.data.PlatformData; 37 import net.sf.basedb.core.data.PlatformFileTypeData; 35 38 import net.sf.basedb.core.data.PluginConfigurationData; 36 39 import net.sf.basedb.core.data.ProtocolTypeData; … … 162 165 throws BaseException 163 166 { 164 final int total_progress_steps = 2 4;167 final int total_progress_steps = 26; 165 168 final float progress_factor = 100 / total_progress_steps; 166 169 if (progress != null) progress.display(0, "Initialising database..."); … … 323 326 createRoleKey(Item.SOFTWARETYPE, "Software types", "Gives access to software types", all_use_administrators_write); 324 327 createRoleKey(Item.SOFTWARE, "Software", "Gives access to software", power_users_create); 325 328 329 // Platforms, platform variants, platform file types 330 createRoleKey(Item.PLATFORM, "Platforms", "Gives access to platforms", guests_use_administrators_all); 331 createRoleKey(Item.PLATFORMVARIANT, "Platform variants", "Gives access to platform variants", guests_use_administrators_all); 332 createRoleKey(Item.FILESETMEMBERTYPE, "Data file types", "Gives access to data file types", guests_use_administrators_all); 333 326 334 // Annotations 327 335 createRoleKey(Item.ANNOTATIONTYPE, "Annotation types", "Gives access to annotation types", power_users_create); … … 667 675 if (progress != null) progress.display((int)(24*progress_factor), "--Creating job agents..."); 668 676 // TODO 677 678 // File set member types 679 if (progress != null) progress.display((int)(25*progress_factor), "--Creating data file types..."); 680 FileSetMemberTypeData celFile = createFileSetMemberType( 681 "affymetric.cel", "CEL file", "Affymetrix CEL file", 682 Item.RAWBIOASSAY, "cel", rawDataType, true, 683 "todo", "todo"); 684 FileSetMemberTypeData cdfFile = createFileSetMemberType( 685 "affymetric.cdf", "CDF file", "Affymetrix CDF file", 686 Item.ARRAYDESIGN, "cdf", reporterMapType, true, 687 "todo", "todo"); 688 689 // Platforms and variants 690 if (progress != null) progress.display((int)(26*progress_factor), "--Creating platforms..."); 691 createPlatform("generic", "Generic", "Generic platform which expects data to be imported into the database", 692 false, null, 0); 693 createPlatform("affymetrix", "Affymetrix", "Affymetrix platform", 694 true, null, 1, celFile, cdfFile); 669 695 670 696 if (progress != null) progress.display(100, "Database initialised successfully."); … … 2156 2182 } 2157 2183 return formula; 2184 } 2185 2186 /** 2187 Create a {@link Platform}. 2188 */ 2189 private static PlatformData createPlatform(String systemId, String name, String description, 2190 boolean fileOnly, String rawDataType, int channels, FileSetMemberTypeData... fileTypes) 2191 throws BaseException 2192 { 2193 org.hibernate.Transaction tx = null; 2194 PlatformData platform = null; 2195 try 2196 { 2197 tx = HibernateUtil.newTransaction(session); 2198 2199 if (platform == null) 2200 { 2201 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_PLATFORM_FOR_SYSTEM_ID"); 2202 query.setString("systemId", systemId); 2203 platform = HibernateUtil.loadData(PlatformData.class, query); 2204 } 2205 2206 if (platform != null) 2207 { 2208 log.info("createPlatform: EXISTS [systemId="+systemId+"]"); 2209 HibernateUtil.commit(tx); 2210 } 2211 else 2212 { 2213 platform = new PlatformData(); 2214 platform.setSystemId(systemId); 2215 platform.setName(name); 2216 platform.setDescription(description); 2217 platform.setFileOnly(fileOnly); 2218 if (fileOnly) 2219 { 2220 platform.setChannels(channels); 2221 } 2222 else 2223 { 2224 platform.setRawDataType(rawDataType); 2225 } 2226 HibernateUtil.saveData(session, platform); 2227 2228 if (fileTypes != null) 2229 { 2230 for (FileSetMemberTypeData fileType : fileTypes) 2231 { 2232 PlatformFileTypeData platformFile = new PlatformFileTypeData(); 2233 platformFile.setFileType(fileType); 2234 platformFile.setPlatform(platform); 2235 HibernateUtil.saveData(session, platformFile); 2236 } 2237 } 2238 2239 HibernateUtil.commit(tx); 2240 log.info("createPlatform: OK [systemId="+systemId+"]"); 2241 } 2242 } 2243 catch (BaseException ex) 2244 { 2245 if(tx != null) HibernateUtil.rollback(tx); 2246 log.error("createPlatform: FAILED [systemId="+systemId+"]", ex); 2247 throw ex; 2248 } 2249 return platform; 2250 } 2251 2252 /** 2253 Create a {@link FileSetMemberType}. 2254 */ 2255 private static FileSetMemberTypeData createFileSetMemberType( 2256 String systemId, String name, String description, 2257 Item itemType, String extension, FileTypeData genericType, boolean required, 2258 String validatorClass, String metadataReaderClass) 2259 throws BaseException 2260 { 2261 org.hibernate.Transaction tx = null; 2262 FileSetMemberTypeData fileType = null; 2263 try 2264 { 2265 tx = HibernateUtil.newTransaction(session); 2266 2267 if (fileType == null) 2268 { 2269 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, 2270 "GET_FILESETMEMBERTYPE_FOR_SYSTEM_ID"); 2271 query.setString("systemId", systemId); 2272 fileType = HibernateUtil.loadData(FileSetMemberTypeData.class, query); 2273 } 2274 2275 if (fileType != null) 2276 { 2277 log.info("createFileSetMemberType: EXISTS [systemId="+systemId+"]"); 2278 HibernateUtil.commit(tx); 2279 } 2280 else 2281 { 2282 fileType = new FileSetMemberTypeData(); 2283 fileType.setSystemId(systemId); 2284 fileType.setName(name); 2285 fileType.setDescription(description); 2286 fileType.setItemType(itemType.getValue()); 2287 fileType.setExtension(extension); 2288 fileType.setGenericType(genericType); 2289 fileType.setRequired(required); 2290 fileType.setValidatorClass(validatorClass); 2291 fileType.setMetadataReaderClass(metadataReaderClass); 2292 2293 HibernateUtil.saveData(session, fileType); 2294 HibernateUtil.commit(tx); 2295 log.info("createFileSetMemberType: OK [systemId="+systemId+"]"); 2296 } 2297 } 2298 catch (BaseException ex) 2299 { 2300 if(tx != null) HibernateUtil.rollback(tx); 2301 log.error("createFileSetMemberType: FAILED [systemId="+systemId+"]", ex); 2302 throw ex; 2303 } 2304 return fileType; 2158 2305 } 2306 2159 2307 } -
branches/filedb/src/core/net/sf/basedb/core/Item.java
r3679 r3764 496 496 */ 497 497 DATACUBEEXTRAVALUE(326, "Data cube extra value", "dev", DataCubeExtraValue.class, DataCubeExtraValueData.class, null, 498 250); 498 250), 499 500 /** 501 The item is a {@link Platform} 502 */ 503 PLATFORM(350, "Platform", "plf", Platform.class, PlatformData.class, null, 504 970), 505 506 /** 507 The item is a {@link PlatformVariant} 508 */ 509 PLATFORMVARIANT(351, "Platform variant", "plv", PlatformVariant.class, PlatformVariantData.class, null, 510 965), 511 512 /** 513 The item is a {@link PlatformFileType} 514 */ 515 PLATFORMFILETYPE(352, "Platform file type", "pft", null, PlatformFileTypeData.class, null, 516 960), 517 518 /** 519 The item is a {@link FileSet} 520 */ 521 FILESET(353, "File set", "fs", null, FileSetData.class, null, 522 950), 523 524 /** 525 The item is a {@link FileSetMember} 526 */ 527 FILESETMEMBER(354, "File set member", "fsm", null, FileSetMemberData.class, null, 528 955), 529 530 /** 531 The item is a {@link FileSetMemberType} 532 */ 533 FILESETMEMBERTYPE(355, "File set member type", "fsmt", null, FileSetMemberTypeData.class, null, 534 980), 535 536 ; 499 537 500 538 static int MAX_VALUE = 0; -
branches/filedb/src/core/net/sf/basedb/core/SystemItem.java
r3679 r3764 24 24 */ 25 25 package net.sf.basedb.core; 26 27 import net.sf.basedb.core.data.PlatformData; 26 28 27 29 /** … … 56 58 { 57 59 /** 60 The maximum length of the system ID that can be stored in the database. 61 @see #getSystemId() 62 */ 63 public static final int MAX_SYSTEM_ID_LENGTH = 64 PlatformData.MAX_SYSTEM_ID_LENGTH; 65 66 67 /** 58 68 Get the system id for the item. 59 69 @return The id of the item or null if it is not a system item -
branches/filedb/src/core/net/sf/basedb/core/data/ArrayDesignData.java
r3741 r3764 40 40 public class ArrayDesignData 41 41 extends AnnotatedData 42 implements FileStoreEnabledData 42 43 { 43 44 public ArrayDesignData() 44 45 {} 45 46 47 /* 48 From the FileStoreEnabledData interface 49 ------------------------------------------- 50 */ 51 private FileSetData fileSet; 52 public FileSetData getFileSet() 53 { 54 return fileSet; 55 } 56 public void setFileSet(FileSetData fileSet) 57 { 58 this.fileSet = fileSet; 59 } 60 // ------------------------------------------- 61 62 private PlatformData platform; 63 /** 64 Get the platform this raw bioassay uses 65 @since 2.5 66 @hibernate.many-to-one outer-join="false" update="false" 67 @hibernate.column name="`platform_id`" not-null="true" 68 */ 69 public PlatformData getPlatform() 70 { 71 return platform; 72 } 73 public void setPlatform(PlatformData platform) 74 { 75 this.platform = platform; 76 } 77 78 private PlatformVariantData variant; 79 /** 80 Get the platform variant this raw bioassay uses, or null. 81 @since 2.5 82 @hibernate.many-to-one outer-join="false" update="false" 83 @hibernate.column name="`variant_id`" 84 */ 85 public PlatformVariantData getVariant() 86 { 87 return variant; 88 } 89 public void setVariant(PlatformVariantData variant) 90 { 91 this.variant = variant; 92 } 93 46 94 private boolean affyChip; 47 95 /** 48 96 Check if this design is an Affymetrix chip. 49 97 @hibernate.property column="`affy_chip`" type="boolean" not-null="true" update="false" 98 @deprecated Has been replaced by platform 50 99 */ 51 100 public boolean isAffyChip() … … 53 102 return affyChip; 54 103 } 104 /** 105 @deprecated Has been replaced by platform 106 */ 55 107 public void setAffyChip(boolean affyChip) 56 108 { -
branches/filedb/src/core/net/sf/basedb/core/data/RawBioAssayData.java
r3679 r3764 43 43 public class RawBioAssayData 44 44 extends AnnotatedData 45 implements DiskConsumableData 45 implements DiskConsumableData, FileStoreEnabledData 46 46 { 47 47 … … 64 64 } 65 65 // ------------------------------------------- 66 66 /* 67 From the FileStoreEnabledData interface 68 ------------------------------------------- 69 */ 70 private FileSetData fileSet; 71 public FileSetData getFileSet() 72 { 73 return fileSet; 74 } 75 public void setFileSet(FileSetData fileSet) 76 { 77 this.fileSet = fileSet; 78 } 79 // ------------------------------------------- 80 81 private PlatformData platform; 82 /** 83 Get the platform this raw bioassay uses 84 @since 2.5 85 @hibernate.many-to-one outer-join="false" update="false" 86 @hibernate.column name="`platform_id`" not-null="true" 87 */ 88 public PlatformData getPlatform() 89 { 90 return platform; 91 } 92 public void setPlatform(PlatformData platform) 93 { 94 this.platform = platform; 95 } 96 97 private PlatformVariantData variant; 98 /** 99 Get the platform variant this raw bioassay uses, or null. 100 @since 2.5 101 @hibernate.many-to-one outer-join="false" update="false" 102 @hibernate.column name="`variant_id`" 103 */ 104 public PlatformVariantData getVariant() 105 { 106 return variant; 107 } 108 public void setVariant(PlatformVariantData variant) 109 { 110 this.variant = variant; 111 } 112 67 113 private ScanData scan; 68 114 /** -
branches/filedb/src/core/net/sf/basedb/core/data/SystemData.java
r3679 r3764 65 65 extends IdentifiableData 66 66 { 67 68 /** 69 The maximum length of the system ID of the item that can be 70 stored in the database. 71 @see #getSystemId() 72 @since 2.5 73 */ 74 public static int MAX_SYSTEM_ID_LENGTH = 255; 75 67 76 /** 68 77 Get the system id for the item.
Note: See TracChangeset
for help on using the changeset viewer.