Changeset 5630
- Timestamp:
- May 13, 2011, 2:54:50 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 16 deleted
- 131 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/ehcache.xml
r5523 r5630 103 103 /> 104 104 <cache 105 name="net.sf.basedb.core.data.FileTypeData"106 maxElementsInMemory="100"107 eternal="false"108 timeToIdleSeconds="3600"109 timeToLiveSeconds="3600"110 overflowToDisk="false"111 />112 <cache113 105 name="net.sf.basedb.core.data.FormulaData" 114 106 maxElementsInMemory="100" … … 135 127 /> 136 128 <cache 137 name="net.sf.basedb.core.data.HardwareTypeData"138 maxElementsInMemory="100"139 eternal="false"140 timeToIdleSeconds="3600"141 timeToLiveSeconds="3600"142 overflowToDisk="false"143 />144 <cache145 129 name="net.sf.basedb.core.data.HelpData" 146 130 maxElementsInMemory="100" … … 159 143 /> 160 144 <cache 145 name="net.sf.basedb.core.data.ItemSubtypeData" 146 maxElementsInMemory="100" 147 eternal="false" 148 timeToIdleSeconds="3600" 149 timeToLiveSeconds="3600" 150 overflowToDisk="false" 151 /> 152 <cache 161 153 name="net.sf.basedb.core.data.LabelData" 162 154 maxElementsInMemory="100" … … 263 255 /> 264 256 <cache 265 name="net.sf.basedb.core.data.ProtocolTypeData"266 maxElementsInMemory="100"267 eternal="false"268 timeToIdleSeconds="3600"269 timeToLiveSeconds="3600"270 overflowToDisk="false"271 />272 <cache273 257 name="net.sf.basedb.core.data.QuantityData" 274 258 maxElementsInMemory="100" … … 319 303 /> 320 304 <cache 321 name="net.sf.basedb.core.data.SoftwareTypeData"322 maxElementsInMemory="100"323 eternal="false"324 timeToIdleSeconds="3600"325 timeToLiveSeconds="3600"326 overflowToDisk="false"327 />328 <cache329 305 name="net.sf.basedb.core.data.UnitData" 330 306 maxElementsInMemory="100" -
trunk/config/dist/hibernate.cfg.xml
r5523 r5630 83 83 /> 84 84 <class-cache 85 class="net.sf.basedb.core.data.FileTypeData"86 usage="nonstrict-read-write"87 />88 <class-cache89 85 class="net.sf.basedb.core.data.FormulaData" 90 86 usage="nonstrict-read-write" … … 99 95 /> 100 96 <class-cache 101 class="net.sf.basedb.core.data.HardwareTypeData"102 usage="nonstrict-read-write"103 />104 <class-cache105 97 class="net.sf.basedb.core.data.HelpData" 106 98 usage="nonstrict-read-write" … … 111 103 /> 112 104 <class-cache 105 class="net.sf.basedb.core.data.ItemSubtypeData" 106 usage="nonstrict-read-write" 107 /> 108 <class-cache 113 109 class="net.sf.basedb.core.data.LabelData" 114 110 usage="nonstrict-read-write" … … 163 159 /> 164 160 <class-cache 165 class="net.sf.basedb.core.data.ProtocolTypeData"166 usage="nonstrict-read-write"167 />168 <class-cache169 161 class="net.sf.basedb.core.data.QuantityData" 170 162 usage="nonstrict-read-write" … … 191 183 /> 192 184 <class-cache 193 class="net.sf.basedb.core.data.SoftwareTypeData"194 usage="nonstrict-read-write"195 />196 <class-cache197 185 class="net.sf.basedb.core.data.UnitData" 198 186 usage="nonstrict-read-write" -
trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java
r5523 r5630 186 186 Arrays.asList(new Item[] 187 187 { 188 Item.PROTOCOL, Item. PROTOCOLTYPE, Item.HARDWARE, Item.HARDWARETYPE, Item.SOFTWARE, Item.SOFTWARETYPE,189 Item.ANNOTATIONTYPE, Item.ANNOTATIONTYPECATEGORY, Item. FILETYPE, Item.MIMETYPE, Item.REPORTER,190 Item.REPORTERLIST, Item.REPORTERTYPE, Item.EXTRAVALUETYPE, 188 Item.PROTOCOL, Item.HARDWARE, Item.SOFTWARE, 189 Item.ANNOTATIONTYPE, Item.ANNOTATIONTYPECATEGORY, Item.MIMETYPE, Item.REPORTER, 190 Item.REPORTERLIST, Item.REPORTERTYPE, Item.EXTRAVALUETYPE, Item.ITEMSUBTYPE, 191 191 Item.PLATFORM, Item.DATAFILETYPE, Item.QUANTITY, Item.UNIT 192 192 }) -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/edit/EditUtil.java
r5525 r5630 70 70 Item.PLUGINTYPE, Item.PLUGINDEFINITION, Item.PLUGINCONFIGURATION, Item.JOBAGENT, 71 71 Item.PLATFORM, Item.PLATFORMVARIANT, Item.DATAFILETYPE, 72 Item.QUOTATYPE, Item. PROTOCOLTYPE, Item.FILETYPE, Item.MIMETYPE,73 Item. SOFTWARETYPE, Item.HARDWARETYPE, Item.ANNOTATIONTYPECATEGORY, Item.ANNOTATIONTYPE,72 Item.QUOTATYPE, Item.MIMETYPE, 73 Item.ANNOTATIONTYPECATEGORY, Item.ANNOTATIONTYPE, 74 74 Item.QUANTITY, Item.UNIT, Item.EXTRAVALUETYPE, Item.REPORTERTYPE 75 75 }; -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java
r5525 r5630 71 71 Item.FEATURE, 72 72 Item.USER, Item.GROUP, Item.ROLE, Item.QUOTA, Item.QUOTATYPE, Item.NEWS, 73 Item.SOFTWARE, Item. SOFTWARETYPE, Item.HARDWARE, Item.HARDWARETYPE,74 Item.PROTOCOL, Item. PROTOCOLTYPE, Item.CLIENT, Item.HELP,75 Item.PLATFORM, Item.PLATFORMVARIANT, Item.DATAFILETYPE, Item.FILETYPE,73 Item.SOFTWARE, Item.HARDWARE, 74 Item.PROTOCOL, Item.CLIENT, Item.HELP, 75 Item.PLATFORM, Item.PLATFORMVARIANT, Item.DATAFILETYPE, 76 76 Item.PLUGINDEFINITION, Item.PLUGINTYPE, Item.PLUGINCONFIGURATION, Item.JOBAGENT, 77 77 Item.MIMETYPE, Item.REPORTERTYPE, Item.EXTRAVALUETYPE, -
trunk/src/clients/web/net/sf/basedb/clients/web/resources/common.properties
r5525 r5630 178 178 item.quotatype Quota type 179 179 item.quotatype+ Quota types 180 item.protocoltype Protocol type 181 item.protocoltype+ Protocol types 182 item.filetype File type 183 item.filetype+ File types 180 item.itemsubtype Item subtype 181 item.itemsubtype+ Item subtypes 184 182 item.mimetype MIME type 185 183 item.mimetype+ MIME types 186 item.softwaretype Software type187 item.softwaretype+ Software types188 item.hardwaretype Hardware type189 item.hardwaretype+ Hardware types190 184 item.annotationtype Annotation type 191 185 item.annotationtype+ Annotation types -
trunk/src/clients/web/net/sf/basedb/clients/web/resources/menu.properties
r5616 r5630 215 215 quotatypes.tooltip.1 Administrate quota types 216 216 quotatypes.tooltip.0 You do not have permission to administrate quota types 217 protocoltypes.tooltip.1 Administrate protocol types218 protocoltypes.tooltip.0 You do not have permission to administrate protocol types219 filetypes.tooltip.1 Administrate file types220 filetypes.tooltip.0 You do not have permission to administrate file types221 217 mimetypes.tooltip.1 Administrate MIME types 222 218 mimetypes.tooltip.0 You do not have permission to administrate mime types 223 softwaretypes.tooltip.1 Administrate software types224 softwaretypes.tooltip.0 You do not have permission to administrate software types225 hardwaretypes.tooltip.1 Administrate hardware types226 hardwaretypes.tooltip.0 You do not have permission to administrate hardware types227 219 annotationtypes.tooltip.1 Administrate annotation types 228 220 annotationtypes.tooltip.0 You do not have permission to administrate annotation types … … 236 228 extravaluetypes.tooltip.1 Administrate extra value types 237 229 extravaluetypes.tooltip.0 You do not have permission to administrate extra value types 230 itemsubtypes.tooltip.1 Administrate item subtypes 231 itemsubtypes.tooltip.0 You do not have permission to administrate item subtypes 238 232 239 233 ## Extensions menu ## -
trunk/src/clients/web/net/sf/basedb/clients/web/servlet/Upload.java
r5595 r5630 37 37 import net.sf.basedb.core.Directory; 38 38 import net.sf.basedb.core.File; 39 import net.sf.basedb.core.FileType;40 39 import net.sf.basedb.core.Item; 41 40 import net.sf.basedb.core.ItemContext; 41 import net.sf.basedb.core.ItemSubtype; 42 42 import net.sf.basedb.core.Path; 43 43 import net.sf.basedb.core.Permission; … … 189 189 if (fileTypeId >= 0) // < 0 = denied or unchanged 190 190 { 191 FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);192 f.set FileType(ft);191 ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId); 192 f.setItemSubtype(ft); 193 193 if (ft != null) cc.setRecent(ft, maxRecent); 194 194 } -
trunk/src/core/common-queries.xml
r5629 r5630 588 588 </description> 589 589 </query> 590 591 <query id="GET_FILES_FOR_FILETYPE" type="HQL">592 <sql>593 SELECT {1}594 FROM FileData f595 WHERE f.fileType = :filetype596 </sql>597 <description>598 A Hibernate query that gets the files599 with a given filetype.600 </description>601 </query>602 590 603 591 <query id="GET_FILES_FOR_FILESERVER" type="HQL"> … … 673 661 </description> 674 662 </query> 675 676 <query id="GET_FILE_TYPE_WITH_NAME" type="HQL">677 <sql>678 SELECT ft679 FROM FileTypeData ft680 WHERE ft.name = :name681 </sql>682 <description>683 A Hibernate query that returns the file type with the specified684 name.685 </description>686 </query>687 663 688 664 <query id="GET_QUOTA_TYPE_WITH_NAME" type="HQL"> … … 734 710 </query> 735 711 736 <query id="GET_PROTOCOL_TYPE_WITH_NAME" type="HQL">737 <sql>738 SELECT pt739 FROM ProtocolTypeData pt740 WHERE pt.name = :name741 </sql>742 <description>743 A Hibernate query that returns the protocol type with the specified744 name.745 </description>746 </query>747 748 <query id="GET_SOFTWARE_TYPE_WITH_NAME" type="HQL">749 <sql>750 SELECT st751 FROM SoftwareTypeData st752 WHERE st.name = :name753 </sql>754 <description>755 A Hibernate query that returns the software type with the specified756 name.757 </description>758 </query>759 760 712 <query id="GET_SOFTWARE_WITH_NAME" type="HQL"> 761 713 <sql> … … 766 718 <description> 767 719 A Hibernate query that returns the software with the specified 768 name.769 </description>770 </query>771 772 <query id="GET_HARDWARE_TYPE_WITH_NAME" type="HQL">773 <sql>774 SELECT ht775 FROM HardwareTypeData ht776 WHERE ht.name = :name777 </sql>778 <description>779 A Hibernate query that returns the hardware type with the specified780 720 name. 781 721 </description> … … 868 808 </query> 869 809 870 <query id="GET_PROTOCOLS_FOR_PROTOCOLTYPE" type="HQL">871 <sql>872 SELECT {1}873 FROM ProtocolData p874 WHERE p.protocolType = :protocolType875 </sql>876 <description>877 Get the protocols the uses a protocol type.878 </description>879 </query>880 881 810 <query id="GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE" type="HQL"> 882 811 <sql> 883 812 SELECT {1} 884 813 FROM PlateEventTypeData pet 885 WHERE pet.protocolType = : protocolType814 WHERE pet.protocolType = :subtype 886 815 </sql> 887 816 <description> … … 988 917 </query> 989 918 990 <query id="GET_HARDWARE_FOR_TYPE" type="HQL">991 <sql>992 SELECT {1}993 FROM HardwareData hw994 WHERE hw.hardwareType = :hardwaretype995 </sql>996 <description>997 A Hibernate query that gets hardware items998 of the given hardware type.999 </description>1000 </query>1001 1002 919 <query id="GET_SCANS_FOR_SCANNER" type="HQL"> 1003 920 <sql> … … 1068 985 <description> 1069 986 A Hibernate query that finds the reporter with a given external id. 1070 </description>1071 </query>1072 1073 <query id="GET_SOFTWARE_FOR_SOFTWARETYPE" type="HQL">1074 <sql>1075 SELECT {1}1076 FROM SoftwareData sw1077 WHERE sw.softwareType = :softwaretype1078 </sql>1079 <description>1080 A Hibernate query that gets software items1081 of the given software type.1082 987 </description> 1083 988 </query> … … 2937 2842 </description> 2938 2843 </query> 2844 2845 <query id="GET_SUBTYPABLE_ITEMS_FOR_SUBTYPE_OF_CLASS" type="HQL"> 2846 <sql> 2847 SELECT {1} 2848 FROM {2} sub 2849 WHERE sub.itemSubtype = :subtype 2850 </sql> 2851 <description> 2852 Get all items that are subtyped with a subtype for a given class. 2853 </description> 2854 </query> 2855 2856 <query id="GET_MIMETYPES_FOR_FILETYPE" type="HQL"> 2857 <sql> 2858 SELECT {1} 2859 FROM MimeTypeData mt 2860 WHERE mt.fileType = :subtype 2861 </sql> 2862 <description> 2863 A Hibernate query that gets MIME types for a given item subtype. 2864 </description> 2865 </query> 2866 2867 <query id="GET_DATAFILETYPES_FOR_FILETYPE" type="HQL"> 2868 <sql> 2869 SELECT {1} 2870 FROM DataFileTypeData dft 2871 WHERE dft.genericType = :subtype 2872 </sql> 2873 <description> 2874 A Hibernate query that gets Data file types for a given item subtype. 2875 </description> 2876 </query> 2939 2877 2940 2878 </predefined-queries> -
trunk/src/core/net/sf/basedb/core/Application.java
r5622 r5630 954 954 /** 955 955 Check if auto-compression has been enabled or not. Files that 956 are checked with the {@link File#setMimeTypeAuto(String, FileType)}956 are checked with the {@link File#setMimeTypeAuto(String, ItemSubtype)} 957 957 and will automaically be compressed if auto-compression is enabled and 958 958 the {@link MimeType#getAutoCompress()} returns TRUE. -
trunk/src/core/net/sf/basedb/core/ArrayBatch.java
r4889 r5630 265 265 Set the {@link Protocol} used for printing the arrays. 266 266 @param protocol A <code>Protocol</code> item of the {@link 267 Protocol Type#PRINTING} protocol type267 Protocol#PRINTING} protocol type 268 268 @throws PermissionDeniedException If the 269 269 logged in user doesn't have write … … 283 283 Get the {@link Hardware print robot} used for printing the arrays. 284 284 @return A <code>Hardware</code> item of type 285 {@link Hardware Type#PRINT_ROBOT}285 {@link Hardware#PRINT_ROBOT} 286 286 @throws PermissionDeniedException If 287 287 the logged in user doesn't have read … … 298 298 Set the {@link Hardware print robot} used for this array batch. 299 299 @param printRobot A <code>Hardware</code> item of type 300 {@link Hardware Type#PRINT_ROBOT }300 {@link Hardware#PRINT_ROBOT } 301 301 @throws PermissionDeniedException If the 302 302 logged in user doesn't have write -
trunk/src/core/net/sf/basedb/core/DataFileType.java
r5623 r5630 260 260 */ 261 261 public static ItemQuery<DataFileType> getQuery(Platform platform, PlatformVariant variant, 262 Item itemType, FileType genericType)262 Item itemType, ItemSubtype genericType) 263 263 { 264 264 ItemQuery<DataFileType> query = getQuery(); … … 492 492 /** 493 493 Get the generic file type for this data file type. 494 @return A <code>FileType</code> item 495 */ 496 public FileType getGenericType() 497 { 498 return getDbControl().getItem(FileType.class, getData().getGenericType()); 494 @return A file subtype item 495 @since 3.0 496 */ 497 public ItemSubtype getGenericType() 498 { 499 return getDbControl().getItem(ItemSubtype.class, getData().getGenericType()); 499 500 } 500 501 501 502 /** 502 503 Set the generic file type of this item. Null is not allowed. 503 @param genericType The generic type504 @param genericType The generic file type 504 505 @throws PermissionDeniedException If the logged in user doesn't 505 506 have write permission 506 */ 507 public void setGenericType(FileType genericType) 507 @since 3.0 508 */ 509 public void setGenericType(ItemSubtype genericType) 508 510 { 509 511 checkPermission(Permission.WRITE); 512 if (genericType != null) genericType.checkItemType(Item.FILE); 510 513 getData().setGenericType(genericType == null ? null : genericType.getData()); 511 514 } -
trunk/src/core/net/sf/basedb/core/File.java
r5599 r5630 28 28 import net.sf.basedb.core.data.FileData; 29 29 import net.sf.basedb.core.data.FileSetData; 30 import net.sf.basedb.core.data. FileTypeData;30 import net.sf.basedb.core.data.ItemSubtypeData; 31 31 import net.sf.basedb.core.data.MimeTypeData; 32 32 import net.sf.basedb.util.EqualsHelper; … … 79 79 public class File 80 80 extends CommonItem<FileData> 81 implements Transactional, DiskConsumable 81 implements Transactional, DiskConsumable, Subtypable 82 82 { 83 83 /** … … 88 88 public static final Item TYPE = Item.FILE; 89 89 90 /** 91 The id for the <code>FileType</code> item representing a 92 protocol. 93 @since 3.0 94 */ 95 public static final String PROTOCOL = "net.sf.basedb.core.FileType.PROTOCOL"; 96 97 /** 98 The id for the <code>FileType</code> item representing a 99 raw data file. 100 @since 3.0 101 */ 102 public static final String RAW_DATA = "net.sf.basedb.core.FileType.RAW_DATA"; 103 104 /** 105 The id for the <code>FileType</code> item representing a 106 plate mapping file. 107 @since 3.0 108 */ 109 public static final String PLATE_MAPPING = "net.sf.basedb.core.FileType.PLATE_MAPPING"; 110 111 /** 112 The id for the <code>FileType</code> item representing a 113 reporter map file. 114 @since 3.0 115 */ 116 public static final String REPORTER_MAP = "net.sf.basedb.core.FileType.REPORTER_MAP"; 117 118 /** 119 The id for the <code>FileType</code> item representing a 120 print map file. 121 @since 3.0 122 */ 123 public static final String PRINT_MAP = "net.sf.basedb.core.FileType.PRINT_MAP"; 124 125 /** 126 The id for the <code>FileType</code> item representing an 127 image file. 128 @since 3.0 129 */ 130 public static final String IMAGE = "net.sf.basedb.core.FileType.IMAGE"; 131 132 /** 133 The id for the <code>FileType</code> item representing a 134 spot images file. 135 @since 3.0 136 */ 137 public static final String SPOT_IMAGES = "net.sf.basedb.core.FileType.SPOT_IMAGES"; 138 139 /** 140 The id for the <code>FileType</code> item representing a 141 reporter file. 142 @since 3.0 143 */ 144 public static final String REPORTER = "net.sf.basedb.core.FileType.REPORTER"; 145 146 /** 147 The id for the <code>FileType</code> item representing a 148 plate file. 149 @since 3.0 150 */ 151 public static final String PLATE = "net.sf.basedb.core.FileType.PLATE"; 152 153 /** 154 The id for the <code>FileType</code> item representing a 155 file containing analysed spot data. 156 @since 3.0 157 */ 158 public static final String SPOT_DATA = "net.sf.basedb.core.FileType.SPOT_DATA"; 159 160 /** 161 The id for the <code>FileType</code> item representing a 162 file containing analysed extra value data. 163 @since 3.0 164 */ 165 public static final String EXTRAVALUE_DATA = "net.sf.basedb.core.FileType.EXTRAVALUE_DATA"; 166 167 90 168 /** 91 169 Create a new <code>File</code> item. … … 386 464 // ------------------------------------------- 387 465 /* 466 From the Subtypable interface 467 ----------------------------- 468 */ 469 @Override 470 public ItemSubtype getItemSubtype() 471 { 472 return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype()); 473 } 474 @Override 475 public void setItemSubtype(ItemSubtype subtype) 476 { 477 checkPermission(Permission.WRITE); 478 if (subtype != null) 479 { 480 subtype.setOnItem(this); 481 } 482 else 483 { 484 getData().setItemSubtype(null); 485 } 486 } 487 // ------------------------------------------- 488 /* 388 489 From BasicItem 389 490 ------------------------------------------- … … 596 697 597 698 /** 598 Get the associated {@link FileType} item.599 @return The <code>FileType</code> item, or null if no type has been specified600 @throws PermissionDeniedException This exception is thrown if601 the logged in user doesn't have {@link Permission#READ READ}602 permission to the items603 @throws BaseException If there is another error604 */605 public FileType getFileType()606 throws PermissionDeniedException, BaseException607 {608 return getDbControl().getItem(FileType.class, getData().getFileType());609 }610 611 /**612 Set the filetype of this <code>File</code> item.613 @param filetype The new <code>FileType</code>, or null614 @throws PermissionDeniedException If the logged in user doesn't have615 write permission616 */617 public void setFileType(FileType filetype)618 throws PermissionDeniedException619 {620 checkPermission(Permission.WRITE);621 getData().setFileType(filetype == null ? null : filetype.getData());622 }623 624 /**625 699 Get the internal name of this file. 626 700 … … 1038 1112 {@link Permission#WRITE} permission 1039 1113 @see #uploadCompressed() 1040 */ 1041 public void setMimeTypeAuto(String defaultMimeType, FileType defaultFileType) 1114 @since 3.0 1115 */ 1116 public void setMimeTypeAuto(String defaultMimeType, ItemSubtype defaultFileType) 1042 1117 throws PermissionDeniedException 1043 1118 { … … 1059 1134 query.setString("extension", extension); 1060 1135 MimeTypeData mimeType = HibernateUtil.loadData(MimeTypeData.class, query); 1061 FileTypeData fileType = null;1136 ItemSubtypeData fileType = null; 1062 1137 if (mimeType != null) 1063 1138 { … … 1072 1147 if (fileType != null) 1073 1148 { 1074 getData().set FileType(fileType);1149 getData().setItemSubtype(fileType); 1075 1150 } 1076 1151 else if (defaultFileType != null) 1077 1152 { 1078 set FileType(defaultFileType);1153 setItemSubtype(defaultFileType); 1079 1154 } 1080 1155 } … … 1086 1161 /** 1087 1162 Return the result of auto-compress check from the 1088 last call to {@link #setMimeTypeAuto(String, FileType)}.1163 last call to {@link #setMimeTypeAuto(String, ItemSubtype)}. 1089 1164 If this method returns true, the next call to {@link #upload(InputStream, boolean)} 1090 1165 or {@link #getUploadStream(boolean)} will store the uploaded file in a … … 1190 1265 @param compress TRUE to store the file in a compressed format, or null 1191 1266 to use whatever the {@link Directory#getAutoCompress()} is specifying 1192 or what auto-detection from the {@link #setMimeTypeAuto(String, FileType)}1267 or what auto-detection from the {@link #setMimeTypeAuto(String, ItemSubtype)} 1193 1268 found 1194 1269 @throws PermissionDeniedException If the logged in user doesn't have … … 1249 1324 @param compress TRUE to store the file in a compressed format, or null 1250 1325 to use whatever the {@link Directory#getAutoCompress()} is specifying 1251 or what auto-detection from the {@link #setMimeTypeAuto(String, FileType)}1326 or what auto-detection from the {@link #setMimeTypeAuto(String, ItemSubtype)} 1252 1327 found 1253 1328 @return An <code>OutputStream</code> object -
trunk/src/core/net/sf/basedb/core/FileSet.java
r5623 r5630 261 261 /** 262 262 Get a query that returns all members in a file set with a specific 263 generic {@link FileType}. Note! The query checks the generic type from the264 {@link DataFileType#getGenericType()}, not the {@link File#get FileType()}.263 generic {@link ItemSubtype}. Note! The query checks the generic type from the 264 {@link DataFileType#getGenericType()}, not the {@link File#getItemSubtype()}. 265 265 266 266 @param genericType The system ID of a generic type as defined 267 by {@link FileType#getSystemId()}267 by {@link ItemSubtype#getSystemId()} 268 268 @return A query returning <code>FileSetMember</code> items 269 269 */ -
trunk/src/core/net/sf/basedb/core/FileStoreUtil.java
r5623 r5630 120 120 121 121 /** 122 Get all files with a specific generic {@link FileType} in a given item's file122 Get all files with a specific generic {@link ItemSubtype} in a given item's file 123 123 set. Note! This method will only return files that the logged in user 124 124 has permission to read. Other files in the file set will be ignored. 125 125 Note! This method checks the file type from {@link DataFileType#getGenericType()}, 126 not the file type from {@link File#get FileType()}.126 not the file type from {@link File#getItemSubtype()}. 127 127 128 128 @param dc A DbControl to use for database access 129 129 @param item The {@link FileStoreEnabled} item to check 130 @param genericType The system ID of the {@link FileType} to check for130 @param genericType The system ID of the {@link ItemSubtype} to check for 131 131 @return A list of file items that matches 132 132 */ … … 185 185 /** 186 186 Set or remove a file to {@link FileStoreEnabled} item based 187 on the file's generic {@link FileType}. Note! This method checks the file187 on the file's generic {@link ItemSubtype}. Note! This method checks the file 188 188 type from {@link DataFileType#getGenericType()}, 189 not the file type from {@link File#get FileType()}.189 not the file type from {@link File#getItemSubtype()}. 190 190 191 191 @param dc A DbControl to use for database access 192 192 @param item The item to add/remove the file to/from 193 @param genericType The system ID of the generic {@link FileType}193 @param genericType The system ID of the generic {@link ItemSubtype} 194 194 @param fallbackDataFileType The external ID of a {@link DataFileType} that is used 195 195 if the specified generic file type isn't found among the file types -
trunk/src/core/net/sf/basedb/core/Hardware.java
r5452 r5630 35 35 @author enell 36 36 @version 2.0 37 @see HardwareType HardwareType38 37 @base.modified $Date$ 39 38 */ 40 39 public class Hardware 41 40 extends CommonItem<HardwareData> 42 implements Registered 41 implements Registered, Subtypable 43 42 { 44 43 /** … … 48 47 */ 49 48 public static final Item TYPE = Item.HARDWARE; 49 50 /** 51 The id for the <code>HardwareType</code> object representing a 52 scanner. 53 @since 3.0 54 */ 55 public static final String SCANNER = "net.sf.basedb.core.HardwareType.SCANNER"; 56 57 /** 58 The id for the <code>HardwareType</code> object representing a 59 print robot. 60 @since 3.0 61 */ 62 public static final String PRINT_ROBOT = "net.sf.basedb.core.HardwareType.PRINT_ROBOT"; 63 64 /** 65 The id for the <code>HardwareType</code> object representing a 66 hybridization station. 67 @since 3.0 68 */ 69 public static final String HYBRIDIZATION_STATION = "net.sf.basedb.core.HardwareType.HYBRIDIZATION_STATION"; 70 71 /** 72 The id for the <code>HardwareType</code> object representing a 73 freezer. 74 @since 3.0 75 */ 76 public static final String FREEZER = "net.sf.basedb.core.HardwareType.FREEZER"; 77 78 /** 79 The id for the <code>HardwareType</code> object representing something 80 else. 81 @since 3.0 82 */ 83 public static final String OTHER = "net.sf.basedb.core.HardwareType.OTHER"; 50 84 51 85 /** … … 62 96 @param dc The {@link DbControl} which will be used for 63 97 permission checking and database access. 64 @param hardwareType The {@link HardwareType} connected to this hardware. It65 cannot be null.66 98 @return The new <code>Hardware</code> item 67 99 @throws BaseException If there is an error 68 100 */ 69 public static Hardware getNew(DbControl dc , HardwareType hardwareType)101 public static Hardware getNew(DbControl dc) 70 102 throws BaseException 71 103 { 72 104 Hardware hardware = dc.newItem(Hardware.class); 73 105 hardware.setName("New hardware"); 74 hardware.setHardwareType(hardwareType);75 106 hardware.getData().setEntryDate(new Date()); 76 107 return hardware; … … 136 167 { 137 168 return DateUtil.copy(getData().getEntryDate()); 169 } 170 // ------------------------------------------- 171 /* 172 From the Subtypable interface 173 ----------------------------- 174 */ 175 @Override 176 public ItemSubtype getItemSubtype() 177 { 178 return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype()); 179 } 180 @Override 181 public void setItemSubtype(ItemSubtype subtype) 182 { 183 checkPermission(Permission.WRITE); 184 if (subtype != null) 185 { 186 subtype.setOnItem(this); 187 } 188 else 189 { 190 getData().setItemSubtype(null); 191 } 138 192 } 139 193 // ------------------------------------------- … … 284 338 } 285 339 // ------------------------------------------- 286 287 /**288 Get the associated {@link HardwareType} item.289 All <code>Hardware</code> items must have a type.290 @return The <code>HardwareType</code> item291 @throws PermissionDeniedException If the logged in user doesn't have292 {@link Permission#READ } permission to the item293 @throws BaseException If there is any error294 */295 public HardwareType getHardwareType()296 throws PermissionDeniedException, BaseException297 {298 return getDbControl().getItem(HardwareType.class, getData().getHardwareType());299 }300 301 /**302 Set the {@link HardwareType} of this <code>Hardware</code> item.303 This parameter mustn't be <code>null</code>.304 @param hardwareType The new <code>HardwareType</code>305 @throws PermissionDeniedException If the logged in user doesn't have306 {@link Permission#WRITE} permission for the hardware or307 {@link Permission#USE} permission for the hardware type308 @throws InvalidUseOfNullException If the hardware type is null309 */310 public void setHardwareType(HardwareType hardwareType)311 throws PermissionDeniedException, InvalidUseOfNullException312 {313 checkPermission(Permission.WRITE);314 if (hardwareType == null) throw new InvalidUseOfNullException("hardwareType");315 hardwareType.checkPermission(Permission.USE);316 getData().setHardwareType(hardwareType.getData());317 }318 340 319 341 /** -
trunk/src/core/net/sf/basedb/core/Install.java
r5629 r5630 30 30 import net.sf.basedb.core.data.DirectoryData; 31 31 import net.sf.basedb.core.data.DataFileTypeData; 32 import net.sf.basedb.core.data.FileTypeData;33 32 import net.sf.basedb.core.data.FormulaData; 34 33 import net.sf.basedb.core.data.HardwareData; 35 import net.sf.basedb.core.data. HardwareTypeData;34 import net.sf.basedb.core.data.ItemSubtypeData; 36 35 import net.sf.basedb.core.data.MimeTypeData; 37 36 import net.sf.basedb.core.data.PlatformData; … … 39 38 import net.sf.basedb.core.data.PluginConfigurationData; 40 39 import net.sf.basedb.core.data.ProjectKeyData; 41 import net.sf.basedb.core.data.ProtocolTypeData;42 40 import net.sf.basedb.core.data.QuantityData; 43 41 import net.sf.basedb.core.data.QuotaData; … … 47 45 import net.sf.basedb.core.data.SchemaVersionData; 48 46 import net.sf.basedb.core.data.ShareableData; 49 import net.sf.basedb.core.data.SoftwareTypeData;50 47 import net.sf.basedb.core.data.SoftwareData; 51 48 import net.sf.basedb.core.data.UnitData; … … 164 161 throws BaseException 165 162 { 166 final int totalProgressSteps = 2 6;163 final int totalProgressSteps = 27; 167 164 final float progress_factor = 100 / totalProgressSteps; 168 165 int progressStep = 0; … … 321 318 // Files, directories and quota 322 319 createRoleKey(Item.DIRECTORY, "Directories", "Gives access to directories", guests_create); 323 createRoleKey(Item.FILETYPE, "File types", "Gives access to file types", all_use_administrators_write);324 320 createRoleKey(Item.FILESERVER, "File servers", "Gives access to file servers", guests_create); 325 321 createRoleKey(Item.FILE, "Files", "Gives access to files", guests_create); … … 329 325 330 326 // Protocols, hardware, software 331 createRoleKey(Item.PROTOCOLTYPE, "Protocol types", "Gives access to protocol types", guests_use_power_users_all);332 327 createRoleKey(Item.PROTOCOL, "Protocols", "Gives access to protocols", power_users_create); 333 createRoleKey(Item.HARDWARETYPE, "Hardware types", "Gives access to hardware types", guests_use_power_users_all);334 328 createRoleKey(Item.HARDWARE, "Hardware", "Gives access to hardware", power_users_create); 335 createRoleKey(Item.SOFTWARETYPE, "Software types", "Gives access to software types", all_use_administrators_write);336 329 createRoleKey(Item.SOFTWARE, "Software", "Gives access to software", power_users_create); 337 330 … … 397 390 createRoleKey(Item.MESSAGE, "Messages", "Gives access to messages", users_create); 398 391 createRoleKey(Item.CHANGEHISTORY, "Change history", "Gives access to change history of items", administrators_read); 392 createRoleKey(Item.ITEMSUBTYPE, "Item subtypes", "Gives access to item subtypes", guests_use_power_users_all); 399 393 400 394 // Permissions for job agents are only added for new installations … … 427 421 installUnits("/units.xml", update); 428 422 429 // Protocol Types423 // Protocol subtypes 430 424 progressStep++; 431 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating protocol types...");432 create ProtocolType(ProtocolType.SAMPLING, "Sampling", "Protocols used for creating samples.");433 create ProtocolType(ProtocolType.EXTRACTION, "Extraction", "Protocols used for creating extracts.");434 create ProtocolType(ProtocolType.LABELING, "Labeling", "Protocols used for creating labeled extracts.");435 create ProtocolType(ProtocolType.POOLING, "Pooling", "Protocols used for creating pooled biomaterails.");436 create ProtocolType(ProtocolType.HYBRIDIZATION, "Hybridization", "Protocols used for creating hybridizations.");437 create ProtocolType(ProtocolType.PRINTING, "Printing", "Protocols used for printing a bathc of array slides.");438 create ProtocolType(ProtocolType.SCANNING, "Scanning", "Protocols used for scanning microarray images.");439 create ProtocolType(ProtocolType.FEATURE_EXTRACTION, "Feature extraction", "Protocols used for extracting features from microarray images.");440 441 // Hardware Types425 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating protocol subtypes..."); 426 createItemSubtype(Item.PROTOCOL, Protocol.SAMPLING, "Sampling", "Protocols used for creating samples."); 427 createItemSubtype(Item.PROTOCOL, Protocol.EXTRACTION, "Extraction", "Protocols used for creating extracts."); 428 createItemSubtype(Item.PROTOCOL, Protocol.LABELING, "Labeling", "Protocols used for creating labeled extracts."); 429 createItemSubtype(Item.PROTOCOL, Protocol.POOLING, "Pooling", "Protocols used for creating pooled biomaterails."); 430 createItemSubtype(Item.PROTOCOL, Protocol.HYBRIDIZATION, "Hybridization", "Protocols used for creating hybridizations."); 431 createItemSubtype(Item.PROTOCOL, Protocol.PRINTING, "Printing", "Protocols used for printing a bathc of array slides."); 432 createItemSubtype(Item.PROTOCOL, Protocol.SCANNING, "Scanning", "Protocols used for scanning microarray images."); 433 createItemSubtype(Item.PROTOCOL, Protocol.FEATURE_EXTRACTION, "Feature extraction", "Protocols used for extracting features from microarray images."); 434 435 // Hardware subtypes 442 436 progressStep++; 443 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating hardware types...");444 HardwareTypeData scanner = createHardwareType(HardwareType.SCANNER, "Scanner", "Scans the microarray images.");445 HardwareTypeData robot = createHardwareType(HardwareType.PRINT_ROBOT, "Print robot", "Spot the probe on the array.");446 HardwareTypeData hybStation = createHardwareType(HardwareType.HYBRIDIZATION_STATION, "Hybridization station", "Automate the hybridization of microarrays on slides.");447 HardwareTypeData freezer = createHardwareType(HardwareType.FREEZER, "Freezer", "Storage area for bioplates");448 HardwareTypeData otherHardware = createHardwareType(HardwareType.OTHER, "Other", "Other kinds of hardware that is used for some process.");437 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating hardware subtypes..."); 438 ItemSubtypeData scanner = createItemSubtype(Item.HARDWARE, Hardware.SCANNER, "Scanner", "Scans the microarray images."); 439 ItemSubtypeData robot = createItemSubtype(Item.HARDWARE, Hardware.PRINT_ROBOT, "Print robot", "Spot the probe on the array."); 440 ItemSubtypeData hybStation = createItemSubtype(Item.HARDWARE, Hardware.HYBRIDIZATION_STATION, "Hybridization station", "Automate the hybridization of microarrays on slides."); 441 ItemSubtypeData freezer = createItemSubtype(Item.HARDWARE, Hardware.FREEZER, "Freezer", "Storage area for bioplates"); 442 ItemSubtypeData otherHardware = createItemSubtype(Item.HARDWARE, Hardware.OTHER, "Other", "Other kinds of hardware that is used for some process."); 449 443 450 444 // Hardware … … 464 458 // SoftwareTypes 465 459 progressStep++; 466 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating software types...");467 SoftwareTypeData feature = createSoftwareType(SoftwareType.FEATURE_EXTRACTION, "Feature extraction", "Extracts features from microarray images.");460 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating software subtypes..."); 461 ItemSubtypeData feature = createItemSubtype(Item.SOFTWARE, Software.FEATURE_EXTRACTION, "Feature extraction", "Extracts features from microarray images."); 468 462 469 463 // Software … … 482 476 createSoftware("Illumina BeadStudio", null, null, feature, rootUser, keyEveryoneUse); 483 477 478 // Item subtypes 479 progressStep++; 480 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating item subtypes..."); 481 //createItemSubtype(systemId, itemType, name, description, protocolType, hardwareType, softwareType); 482 484 483 // Directory 485 484 progressStep++; … … 495 494 progressStep++; 496 495 if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating file types..."); 497 create FileType(FileType.PROTOCOL, "Protocol", "Protocol files");498 FileTypeData rawDataType = createFileType(FileType.RAW_DATA, "Raw data", "Raw data files");499 create FileType(FileType.PLATE, "Plate", "Plate files");500 create FileType(FileType.PLATE_MAPPING, "Plate mapping", "Plate mapping files");501 FileTypeData printMapType = createFileType(FileType.PRINT_MAP, "Print map", "Print map files");502 FileTypeData reporterMapType = createFileType(FileType.REPORTER_MAP, "Reporter map", "Reporter map files");503 create FileType(FileType.REPORTER, "Reporter", "Reporter files");504 FileTypeData imageType = createFileType(FileType.IMAGE, "Image", "Image files");505 create FileType(FileType.SPOT_IMAGES, "Spot images", "A zip file containing generated spot images in png format.");506 FileTypeData spotDataType = createFileType(FileType.SPOT_DATA, "Spot data", "Analysed bioassay set data");507 FileTypeData extraValueType = createFileType(FileType.EXTRAVALUE_DATA, "Extra value data", "Analysed extra values");496 createItemSubtype(Item.FILE, File.PROTOCOL, "Protocol", "Protocol files"); 497 ItemSubtypeData rawDataType = createItemSubtype(Item.FILE, File.RAW_DATA, "Raw data", "Raw data files"); 498 createItemSubtype(Item.FILE, File.PLATE, "Plate", "Plate files"); 499 createItemSubtype(Item.FILE, File.PLATE_MAPPING, "Plate mapping", "Plate mapping files"); 500 ItemSubtypeData printMapType = createItemSubtype(Item.FILE, File.PRINT_MAP, "Print map", "Print map files"); 501 ItemSubtypeData reporterMapType = createItemSubtype(Item.FILE, File.REPORTER_MAP, "Reporter map", "Reporter map files"); 502 createItemSubtype(Item.FILE, File.REPORTER, "Reporter", "Reporter files"); 503 ItemSubtypeData imageType = createItemSubtype(Item.FILE, File.IMAGE, "Image", "Image files"); 504 createItemSubtype(Item.FILE, File.SPOT_IMAGES, "Spot images", "A zip file containing generated spot images in png format."); 505 ItemSubtypeData spotDataType = createItemSubtype(Item.FILE, File.SPOT_DATA, "Spot data", "Analysed bioassay set data"); 506 ItemSubtypeData extraValueType = createItemSubtype(Item.FILE, File.EXTRAVALUE_DATA, "Extra value data", "Analysed extra values"); 508 507 509 508 // MimeTypes … … 957 956 Create a {@link MimeType}. 958 957 */ 959 private static MimeTypeData createMimeType(String name, String description, String extension, FileTypeData fileType, boolean autoCompress)958 private static MimeTypeData createMimeType(String name, String description, String extension, ItemSubtypeData fileType, boolean autoCompress) 960 959 throws BaseException 961 960 { … … 1000 999 } 1001 1000 1002 /**1003 Create a {@link FileType}.1004 */1005 private static FileTypeData createFileType(String systemId, String name, String description)1006 throws BaseException1007 {1008 int id = SystemItems.getId(systemId);1009 org.hibernate.Transaction tx = null;1010 FileTypeData fileType = null;1011 try1012 {1013 tx = HibernateUtil.newTransaction(session);1014 if (id != 0)1015 {1016 fileType = HibernateUtil.loadData(session, FileTypeData.class, id);1017 }1018 if (fileType == null && systemId == null)1019 {1020 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_FILE_TYPE_WITH_NAME");1021 query.setString("name", name);1022 fileType = HibernateUtil.loadData(FileTypeData.class, query);1023 }1024 1025 if (fileType != null)1026 {1027 log.info("createFileType: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]");1028 HibernateUtil.commit(tx);1029 }1030 else1031 {1032 fileType = new FileTypeData();1033 fileType.setEntryDate(new Date());1034 if (systemId != null) fileType.setSystemId(systemId);1035 fileType.setName(name);1036 fileType.setDescription(description);1037 HibernateUtil.saveData(session, fileType);1038 HibernateUtil.commit(tx);1039 if (systemId != null) SystemItems.add(fileType);1040 log.info("createFileType: OK [SYSTEM ID="+systemId+"; name="+name+"]");1041 }1042 }1043 catch (BaseException ex)1044 {1045 if(tx != null) HibernateUtil.rollback(tx);1046 log.error("createFileType: FAILED [SYSTEM ID="+systemId+"; name="+name+"]", ex);1047 throw ex;1048 }1049 return fileType;1050 }1051 1052 1001 /** 1053 1002 Create a {@link QuotaType}. … … 1493 1442 } 1494 1443 1495 /**1496 Create a {@link ProtocolType}.1497 */1498 private static ProtocolTypeData createProtocolType(String systemId, String name, String description)1499 throws BaseException1500 {1501 int id = SystemItems.getId(systemId);1502 org.hibernate.Transaction tx = null;1503 ProtocolTypeData pt = null;1504 try1505 {1506 tx = HibernateUtil.newTransaction(session);1507 if (id != 0)1508 {1509 pt = HibernateUtil.loadData(session, ProtocolTypeData.class, id);1510 }1511 if (pt == null && systemId == null)1512 {1513 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_PROTOCOL_TYPE_WITH_NAME");1514 query.setString("name", name);1515 pt = HibernateUtil.loadData(ProtocolTypeData.class, query);1516 }1517 1518 if (pt != null)1519 {1520 log.info("createProtocolType: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]");1521 HibernateUtil.commit(tx);1522 }1523 else1524 {1525 pt = new ProtocolTypeData();1526 pt.setEntryDate(new Date());1527 if (systemId != null) pt.setSystemId(systemId);1528 pt.setName(name);1529 pt.setDescription(description);1530 HibernateUtil.saveData(session, pt);1531 HibernateUtil.commit(tx);1532 if (systemId != null) SystemItems.add(pt);1533 log.info("createProtocolType: OK [SYSTEM ID="+systemId+"; name="+name+"]");1534 }1535 }1536 catch (BaseException ex)1537 {1538 if (tx != null) HibernateUtil.rollback(tx);1539 log.error("createProtocolType: FAILED [SYSTEM ID="+systemId+"; name="+name+"]", ex);1540 throw ex;1541 }1542 return pt;1543 }1544 /**1545 Create a {@link SoftwareType}.1546 */1547 private static SoftwareTypeData createSoftwareType(String systemId, String name, String description)1548 throws BaseException1549 {1550 int id = SystemItems.getId(systemId);1551 org.hibernate.Transaction tx = null;1552 SoftwareTypeData st = null;1553 try1554 {1555 tx = HibernateUtil.newTransaction(session);1556 if (id != 0)1557 {1558 st = HibernateUtil.loadData(session, SoftwareTypeData.class, id);1559 }1560 if (st == null && systemId == null)1561 {1562 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_SOFTWARE_TYPE_WITH_NAME");1563 query.setString("name", name);1564 st = HibernateUtil.loadData(SoftwareTypeData.class, query);1565 }1566 1567 if (st != null)1568 {1569 log.info("createSoftwareType: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]");1570 HibernateUtil.commit(tx);1571 }1572 else1573 {1574 st = new SoftwareTypeData();1575 st.setEntryDate(new Date());1576 if (systemId != null) st.setSystemId(systemId);1577 st.setName(name);1578 st.setDescription(description);1579 HibernateUtil.saveData(session, st);1580 HibernateUtil.commit(tx);1581 if (systemId != null) SystemItems.add(st);1582 log.info("createSoftwareType: OK [SYSTEM ID="+systemId+"; name="+name+"]");1583 }1584 }1585 catch (BaseException ex)1586 {1587 if (tx != null) HibernateUtil.rollback(tx);1588 log.error("createSoftwareType: FAILED [SYSTEM ID="+systemId+"; name="+name+"]", ex);1589 throw ex;1590 }1591 return st;1592 }1593 1444 1594 1445 /** 1595 1446 Create a {@link Software}. 1596 1447 */ 1597 private static SoftwareData createSoftware(String name, String version, String description, SoftwareTypeData type, UserData owner, ItemKeyData shareTo)1448 private static SoftwareData createSoftware(String name, String version, String description, ItemSubtypeData type, UserData owner, ItemKeyData shareTo) 1598 1449 throws BaseException 1599 1450 { … … 1623 1474 sw.setDescription(description); 1624 1475 sw.setVersionString(version); 1625 sw.set SoftwareType(type);1476 sw.setItemSubtype(type); 1626 1477 sw.setOwner(owner); 1627 1478 sw.setItemKey(shareTo); … … 1641 1492 1642 1493 /** 1643 Create a {@link HardwareType}.1644 */1645 private static HardwareTypeData createHardwareType(String systemId, String name, String description)1646 throws BaseException1647 {1648 int id = SystemItems.getId(systemId);1649 org.hibernate.Transaction tx = null;1650 HardwareTypeData ht = null;1651 try1652 {1653 tx = HibernateUtil.newTransaction(session);1654 if (id != 0)1655 {1656 ht = HibernateUtil.loadData(session, HardwareTypeData.class, id);1657 }1658 if (ht == null && systemId == null)1659 {1660 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_HARDWARE_TYPE_WITH_NAME");1661 query.setString("name", name);1662 ht = HibernateUtil.loadData(HardwareTypeData.class, query);1663 }1664 1665 if (ht != null)1666 {1667 log.info("createHardwareType: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]");1668 HibernateUtil.commit(tx);1669 }1670 else1671 {1672 ht = new HardwareTypeData();1673 ht.setEntryDate(new Date());1674 if (systemId != null) ht.setSystemId(systemId);1675 ht.setName(name);1676 ht.setDescription(description);1677 HibernateUtil.saveData(session, ht);1678 HibernateUtil.commit(tx);1679 if (systemId != null) SystemItems.add(ht);1680 log.info("createHardwareType: OK [SYSTEM ID="+systemId+"; name="+name+"]");1681 }1682 }1683 catch (BaseException ex)1684 {1685 if (tx != null) HibernateUtil.rollback(tx);1686 log.error("createHardwareType: FAILED [SYSTEM ID="+systemId+"; name="+name+"]", ex);1687 throw ex;1688 }1689 return ht;1690 }1691 1692 /**1693 1494 Create a {@link HardwareData}. 1694 1495 */ 1695 private static HardwareData createHardware(String name, String version, String description, HardwareTypeData type, UserData owner, ItemKeyData shareTo)1496 private static HardwareData createHardware(String name, String version, String description, ItemSubtypeData type, UserData owner, ItemKeyData shareTo) 1696 1497 throws BaseException 1697 1498 { … … 1721 1522 hw.setDescription(description); 1722 1523 hw.setVersionString(version); 1723 hw.set HardwareType(type);1524 hw.setItemSubtype(type); 1724 1525 hw.setOwner(owner); 1725 1526 hw.setItemKey(shareTo); … … 1738 1539 } 1739 1540 1541 /** 1542 Create an {@link ItemSubtype}. 1543 */ 1544 private static ItemSubtypeData createItemSubtype(Item itemType, String systemId, String name, String description) 1545 { 1546 int id = SystemItems.getId(systemId); 1547 org.hibernate.Transaction tx = null; 1548 ItemSubtypeData subtype = null; 1549 try 1550 { 1551 tx = HibernateUtil.newTransaction(session); 1552 if (id != 0) 1553 { 1554 subtype = HibernateUtil.loadData(session, ItemSubtypeData.class, id); 1555 } 1556 if (subtype == null && systemId == null) 1557 { 1558 org.hibernate.Query query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMSUBTYPE_WITH_NAME"); 1559 query.setString("name", name); 1560 subtype = HibernateUtil.loadData(ItemSubtypeData.class, query); 1561 } 1562 1563 if (subtype != null) 1564 { 1565 log.info("createItemSubtype: EXISTS [SYSTEM ID="+systemId+"; name="+name+"]"); 1566 HibernateUtil.commit(tx); 1567 } 1568 else 1569 { 1570 subtype = new ItemSubtypeData(); 1571 subtype.setEntryDate(new Date()); 1572 if (systemId != null) subtype.setSystemId(systemId); 1573 subtype.setItemType(itemType.getValue()); 1574 subtype.setName(name); 1575 subtype.setDescription(description); 1576 HibernateUtil.saveData(session, subtype); 1577 HibernateUtil.commit(tx); 1578 if (systemId != null) SystemItems.add(subtype); 1579 log.info("createHardwareType: OK [SYSTEM ID="+systemId+"; name="+name+"]"); 1580 } 1581 } 1582 catch (BaseException ex) 1583 { 1584 if (tx != null) HibernateUtil.rollback(tx); 1585 log.error("createItemSubtype: FAILED [SYSTEM ID="+systemId+"; name="+name+"]", ex); 1586 throw ex; 1587 } 1588 return subtype; 1589 1590 } 1591 1740 1592 /** 1741 1593 Create a {@link BioPlateType}. … … 2727 2579 private static DataFileTypeData createDataFileType( 2728 2580 String externalId, String name, String description, 2729 Item itemType, String extension, FileTypeData genericType)2581 Item itemType, String extension, ItemSubtypeData genericType) 2730 2582 throws BaseException 2731 2583 { -
trunk/src/core/net/sf/basedb/core/Item.java
r5523 r5630 157 157 FILE(81, "File", "fle", File.class, FileData.class, DefinedPermissions.shareable, 158 158 1100), 159 /** 160 The item is a {@link FileType}. 161 */ 162 FILETYPE(82, "File type", "ftp", FileType.class, FileTypeData.class, DefinedPermissions.write, 163 1110), 159 164 160 /** 165 161 The item is a {@link Directory}. … … 183 179 PROTOCOL(101, "Protocol", "prl", Protocol.class, ProtocolData.class, DefinedPermissions.shareable, 184 180 740), 185 /**186 The item is a {@link ProtocolType}.187 */188 PROTOCOLTYPE(102, "Protocol type", "ptp", ProtocolType.class, ProtocolTypeData.class, DefinedPermissions.basic,189 750),190 181 191 182 /** … … 195 186 700), 196 187 /** 197 The item is a {@link HardwareType}.198 */199 HARDWARETYPE(122, "Hardware type", "htp", HardwareType.class, HardwareTypeData.class, DefinedPermissions.basic,200 710),201 /**202 188 The item is a {@link Software}. 203 189 */ 204 190 SOFTWARE(123, "Software", "sw", Software.class, SoftwareData.class, DefinedPermissions.shareable, 205 191 720), 206 /**207 The item is a {@link SoftwareType}.208 */209 SOFTWARETYPE(124, "Software type", "stp", SoftwareType.class, SoftwareTypeData.class, DefinedPermissions.write,210 730),211 192 212 193 /** … … 234 215 ChangeHistoryDetailData.class, DefinedPermissions.read, 9999), 235 216 217 /** 218 The item is a {@link ItemSubtype}. 219 */ 220 ITEMSUBTYPE(145, "Item subtype", "ist", ItemSubtype.class, ItemSubtypeData.class, DefinedPermissions.basic, 221 1510), 222 236 223 /** 237 224 The item is a {@link Reporter}. -
trunk/src/core/net/sf/basedb/core/MeasuredBioMaterial.java
r5566 r5630 55 55 public abstract class MeasuredBioMaterial<D extends MeasuredBioMaterialData> 56 56 extends BioMaterial<D> 57 implements Registered 57 implements Registered, Subtypable 58 58 { 59 59 … … 172 172 } 173 173 // ------------------------------------------- 174 174 /* 175 From the Subtypable interface 176 */ 177 @Override 178 public ItemSubtype getItemSubtype() 179 { 180 return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype()); 181 } 182 @Override 183 public void setItemSubtype(ItemSubtype subtype) 184 { 185 checkPermission(Permission.WRITE); 186 if (subtype != null) 187 { 188 subtype.setOnItem(this); 189 } 190 else 191 { 192 getData().setItemSubtype(null); 193 } 194 } 195 196 // ------------------------------------------- 197 175 198 /** 176 199 Get the event that represents the creation of this biomaterial. -
trunk/src/core/net/sf/basedb/core/Metadata.java
r5590 r5630 67 67 private static Set<Item> diskConsumableItems; 68 68 private static Set<Item> fileStoreEnabledItems; 69 private static Set<Item> subtypableItems; 69 70 70 71 private static boolean isInitialised = false; … … 79 80 diskConsumableItems = Collections.unmodifiableSet(getImplementingItems(DiskConsumable.class)); 80 81 fileStoreEnabledItems = Collections.unmodifiableSet(getImplementingItems(FileStoreEnabled.class)); 82 subtypableItems = Collections.unmodifiableSet(getImplementingItems(Subtypable.class)); 81 83 isInitialised = true; 82 84 } … … 94 96 diskConsumableItems = null; 95 97 fileStoreEnabledItems = null; 98 subtypableItems = null; 96 99 } 97 100 … … 168 171 } 169 172 173 /** 174 Get a set containing all {@link Subtypable} item types. 175 The set cannot be modified. 176 @since 3.0 177 */ 178 public static Set<Item> getSubtypableItems() 179 { 180 return subtypableItems; 181 } 182 170 183 171 184 /** -
trunk/src/core/net/sf/basedb/core/MimeType.java
r4889 r5630 258 258 259 259 /** 260 Get the associated {@link FileType}item.260 Get the associated file subtype item. 261 261 @return The <code>FileType</code> item, or null if no type has been specified 262 262 @throws PermissionDeniedException This exception is thrown if … … 264 264 permission to the item 265 265 @throws BaseException If there is another error 266 */ 267 public FileType getFileType() 266 @since 3.0 267 */ 268 public ItemSubtype getFileType() 268 269 throws PermissionDeniedException, BaseException 269 270 { 270 return getDbControl().getItem( FileType.class, getData().getFileType());271 return getDbControl().getItem(ItemSubtype.class, getData().getFileType()); 271 272 } 272 273 273 274 /** 274 275 Set the filetype of this item. 275 @param filetype The new <code>FileType</code>, or null276 @param filetype The new file subtype, or null 276 277 @throws PermissionDeniedException If the logged in user doesn't have 277 278 write permission 278 279 */ 279 public void setFileType( FileType filetype)280 public void setFileType(ItemSubtype filetype) 280 281 throws PermissionDeniedException 281 282 { 282 283 checkPermission(Permission.WRITE); 284 if (filetype != null) 285 { 286 filetype.checkItemType(Item.FILE); 287 } 283 288 getData().setFileType(filetype == null ? null : filetype.getData()); 284 289 } -
trunk/src/core/net/sf/basedb/core/PlateEvent.java
r4889 r5630 232 232 /** 233 233 Set the protocol that was followed in this event. It is recommended 234 that the {@link ProtocolType} of the protocol matches the234 that the {@link ItemSubtype} of the protocol matches the 235 235 protocol type set by the {@link PlateEventType}, but the core doesn't 236 236 check this. -
trunk/src/core/net/sf/basedb/core/PlateEventType.java
r4889 r5630 273 273 274 274 /** 275 Get the associated {@link ProtocolType}item. When creating275 Get the associated protocol type item. When creating 276 276 {@link PlateEvent} items for a {@link Plate} the protocol for the 277 277 event must be of this type. … … 281 281 have read permission to the protocol type 282 282 @throws BaseException If there is another error 283 */ 284 public ProtocolType getProtocolType() 283 @since 3.0 284 */ 285 public ItemSubtype getProtocolType() 285 286 throws PermissionDeniedException, BaseException 286 287 { 287 return getDbControl().getItem( ProtocolType.class, getData().getProtocolType());288 return getDbControl().getItem(ItemSubtype.class, getData().getProtocolType()); 288 289 } 289 290 … … 298 299 protocol type 299 300 @throws BaseException If there is another error 300 */ 301 public void setProtocolType(ProtocolType protocolType) 301 @since 3.0 302 */ 303 public void setProtocolType(ItemSubtype protocolType) 302 304 throws PermissionDeniedException, BaseException 303 305 { 304 306 checkPermission(Permission.WRITE); 305 if (protocolType != null) protocolType.checkPermission(Permission.USE); 307 if (protocolType != null) 308 { 309 protocolType.checkPermission(Permission.USE); 310 protocolType.checkItemType(Item.PROTOCOL); 311 } 306 312 getData().setProtocolType(protocolType == null ? null : protocolType.getData()); 307 313 } -
trunk/src/core/net/sf/basedb/core/Project.java
r5590 r5630 833 833 public enum Default 834 834 { 835 SOFTWARE("default_software", "Software", Item.SOFTWARE, Software Type.FEATURE_EXTRACTION, Item.RAWBIOASSAY),835 SOFTWARE("default_software", "Software", Item.SOFTWARE, Software.FEATURE_EXTRACTION, Item.RAWBIOASSAY), 836 836 ARRAYDESIGN("default_arraydesign", "Array design", Item.ARRAYDESIGN, null, null), 837 HYBRIDIZATION_HARDWARE("default_hybridization_hardware", "Hybridization station", Item.HARDWARE, Hardware Type.HYBRIDIZATION_STATION, Item.HYBRIDIZATION),838 SCANNER_HARDWARE("default_scanner_hardware", "Scanner", Item.HARDWARE, Hardware Type.SCANNER, Item.SCAN),839 PRINTROBOT_HARDWARE("default_print_robot_hardware", "Print robot", Item.HARDWARE, Hardware Type.PRINT_ROBOT, Item.ARRAYBATCH),840 SCANNING_PROTOCOL("default_scanning_protocol", "Scanning protocol", Item.PROTOCOL, Protocol Type.SCANNING, Item.SCAN),841 SAMPLING_PROTOCOL("default_sampling_protocol", "Sampling protocol", Item.PROTOCOL, Protocol Type.SAMPLING, Item.SAMPLE),842 EXTRACTING_PROTOCOL("default_extracting_protocol", "Extracting protocol", Item.PROTOCOL, Protocol Type.EXTRACTION, Item.EXTRACT),843 LABELING_PROTOCOL("default_labeling_protocol", "Labeling protocol", Item.PROTOCOL, Protocol Type.LABELING, Item.LABELEDEXTRACT),844 HYBRIDIZATION_PROTOCOL("default_hybridization_protocol", "Hybridization protocol", Item.PROTOCOL, Protocol Type.HYBRIDIZATION, Item.HYBRIDIZATION),845 FEATURE_EXTRACTION_PROTOCOL("default_feature_extraction_protocol", "Feat. extraction protocol", Item.PROTOCOL, Protocol Type.FEATURE_EXTRACTION, Item.RAWBIOASSAY),846 POOLING_PROTOCOL("default_pooling_protocol", "Pooling protocol", Item.PROTOCOL, Protocol Type.POOLING, null),847 PRINTING_PROTOCOL("default_printing_protocol", "Printing protocol", Item.PROTOCOL, Protocol Type.PRINTING, Item.ARRAYBATCH),837 HYBRIDIZATION_HARDWARE("default_hybridization_hardware", "Hybridization station", Item.HARDWARE, Hardware.HYBRIDIZATION_STATION, Item.HYBRIDIZATION), 838 SCANNER_HARDWARE("default_scanner_hardware", "Scanner", Item.HARDWARE, Hardware.SCANNER, Item.SCAN), 839 PRINTROBOT_HARDWARE("default_print_robot_hardware", "Print robot", Item.HARDWARE, Hardware.PRINT_ROBOT, Item.ARRAYBATCH), 840 SCANNING_PROTOCOL("default_scanning_protocol", "Scanning protocol", Item.PROTOCOL, Protocol.SCANNING, Item.SCAN), 841 SAMPLING_PROTOCOL("default_sampling_protocol", "Sampling protocol", Item.PROTOCOL, Protocol.SAMPLING, Item.SAMPLE), 842 EXTRACTING_PROTOCOL("default_extracting_protocol", "Extracting protocol", Item.PROTOCOL, Protocol.EXTRACTION, Item.EXTRACT), 843 LABELING_PROTOCOL("default_labeling_protocol", "Labeling protocol", Item.PROTOCOL, Protocol.LABELING, Item.LABELEDEXTRACT), 844 HYBRIDIZATION_PROTOCOL("default_hybridization_protocol", "Hybridization protocol", Item.PROTOCOL, Protocol.HYBRIDIZATION, Item.HYBRIDIZATION), 845 FEATURE_EXTRACTION_PROTOCOL("default_feature_extraction_protocol", "Feat. extraction protocol", Item.PROTOCOL, Protocol.FEATURE_EXTRACTION, Item.RAWBIOASSAY), 846 POOLING_PROTOCOL("default_pooling_protocol", "Pooling protocol", Item.PROTOCOL, Protocol.POOLING, null), 847 PRINTING_PROTOCOL("default_printing_protocol", "Printing protocol", Item.PROTOCOL, Protocol.PRINTING, Item.ARRAYBATCH), 848 848 RAW_DATA_TYPE("default_raw_data_type", "Raw data type", null, null, null), 849 849 PLATFORM("default_platform", "Platform", Item.PLATFORM, null, null), -
trunk/src/core/net/sf/basedb/core/Protocol.java
r5452 r5630 39 39 public class Protocol 40 40 extends AnnotatedItem<ProtocolData> 41 implements FileAttachable, Registered 41 implements FileAttachable, Registered, Subtypable 42 42 { 43 43 /** … … 49 49 50 50 /** 51 The ID for the sampling protocol type, for example a protocol 52 used when creating a {@link Sample} from a {@link 53 BioSource}. 54 @since 3.0 55 */ 56 public static final String SAMPLING = "net.sf.basedb.core.ProtocolType.SAMPLING"; 57 58 /** 59 The ID for the extraction protocol type, for example a protocol 60 used when creating an {@link Extract} from a {@link 61 Sample}. 62 @since 3.0 63 */ 64 public static final String EXTRACTION = "net.sf.basedb.core.ProtocolType.EXTRACTION"; 65 66 /** 67 The ID for the labeling protocol type, for example a protocol 68 used when creating a {@link LabeledExtract} from 69 an {@link Extract}. 70 @since 3.0 71 */ 72 public static final String LABELING = "net.sf.basedb.core.ProtocolType.LABELING"; 73 74 /** 75 The ID for the pooling protocol type, for example a protocol 76 used when creating a biomaterial item ({@link Sample}, 77 {@link Extract} or {@link LabeledExtract}) 78 from a set of other biomaterial items. 79 @since 3.0 80 */ 81 public static final String POOLING = "net.sf.basedb.core.ProtocolType.POOLING"; 82 83 /** 84 The ID for the hybridization protocol type, for example a protocol 85 used when creating a {@link Hybridization} from a set of 86 {@link LabeledExtract}:s. 87 @since 3.0 88 */ 89 public static final String HYBRIDIZATION = "net.sf.basedb.core.ProtocolType.HYBRIDIZATION"; 90 91 /** 92 The ID for the printing protocol type, for example a protocol 93 used when printing a batch of array slides using a print robot. 94 @since 3.0 95 */ 96 public static final String PRINTING = "net.sf.basedb.core.ProtocolType.PRINTING"; 97 98 /** 99 The ID for the scanning protocol type, for example a protocol 100 used for scanning the microarray slide after an experiment. 101 @since 3.0 102 */ 103 public static final String SCANNING = "net.sf.basedb.core.ProtocolType.SCANNING"; 104 105 /** 106 The ID for the feature extraction protocol type, for example a 107 protocol used for analysing one or more images to create a raw 108 data file. 109 @since 3.0 110 */ 111 public static final String FEATURE_EXTRACTION = "net.sf.basedb.core.ProtocolType.FEATURE_EXTRACTION"; 112 113 /** 51 114 The maximum length of the external id that can be stored in the database. 52 115 @see #setExternalId(String) … … 61 124 @param dc The <code>DbControl</code> which will be used for 62 125 permission checking and database access 63 @param protocolType The type of the protocol64 126 @return The new <code>Protocol</code> item 65 127 @throws BaseException If there is an error 66 128 */ 67 public static Protocol getNew(DbControl dc , ProtocolType protocolType)129 public static Protocol getNew(DbControl dc) 68 130 throws BaseException 69 131 { 70 132 Protocol p = dc.newItem(Protocol.class); 71 133 p.setName("New protocol"); 72 p.setProtocolType(protocolType);73 134 p.getData().setEntryDate(new Date()); 74 135 return p; … … 169 230 // --------------------------------------------- 170 231 /* 232 From the Subtypable interface 233 ----------------------------- 234 */ 235 @Override 236 public ItemSubtype getItemSubtype() 237 { 238 return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype()); 239 } 240 @Override 241 public void setItemSubtype(ItemSubtype subtype) 242 { 243 checkPermission(Permission.WRITE); 244 if (subtype != null) 245 { 246 subtype.setOnItem(this); 247 } 248 else 249 { 250 getData().setItemSubtype(null); 251 } 252 } 253 // ------------------------------------------- 254 /* 171 255 From the BasicItem class 172 256 ------------------------------------------- … … 337 421 338 422 /** 339 Get the associated {@link ProtocolType} item.340 All <code>Protocol</code> items must have a type.341 @return The <code>ProtocolType</code> item342 @throws PermissionDeniedException If the logged in user doesn't have343 {@link Permission#READ} permission for the protocol type344 @throws BaseException If there is any error345 */346 public ProtocolType getProtocolType()347 throws PermissionDeniedException, BaseException348 {349 return getDbControl().getItem(ProtocolType.class, getData().getProtocolType());350 }351 352 /**353 Set the protocol type of this <code>Protocol</code> item.354 This parameter mustn't be <code>null</code>.355 @param protocolType The new <code>ProtocolType</code>356 @throws PermissionDeniedException If the logged in user doesn't have357 {@link Permission#WRITE} permission to this protocol or358 {@link Permission#USE} permission for the protocol type359 @throws InvalidUseOfNullException If protocoltype is null360 */361 public void setProtocolType(ProtocolType protocolType)362 throws PermissionDeniedException, InvalidUseOfNullException363 {364 checkPermission(Permission.WRITE);365 if (protocolType == null) throw new InvalidUseOfNullException("protocolType");366 protocolType.checkPermission(Permission.USE);367 getData().setProtocolType(protocolType.getData());368 }369 370 /**371 423 Get the external id of the protocol. This value can be used to link 372 424 with information in external databases. It is not used by the BASE core -
trunk/src/core/net/sf/basedb/core/Software.java
r4889 r5630 39 39 public class Software 40 40 extends CommonItem<SoftwareData> 41 implements Registered 41 implements Registered, Subtypable 42 42 { 43 43 /** … … 50 50 private static final Item TYPE = Item.SOFTWARE; 51 51 52 /** 53 The id for the <code>SoftwareType</code> item representing the 54 softwaretype "feature extraction software". 55 @since 3.0 56 */ 57 public static final String FEATURE_EXTRACTION = "net.sf.basedb.core.SoftwareType.FEATURE_EXTRACTION"; 58 59 52 60 /** 53 61 The maximum length of the version variable that can be stored in the … … 62 70 @param dc The {@link DbControl} which will be used for 63 71 permission checking and database access. 64 @param softwareType The type of this software65 72 @return The new <code>Software</code> item 66 73 @throws BaseException This exception is thrown if there is another 67 74 error 68 75 */ 69 public static Software getNew(DbControl dc , SoftwareType softwareType)76 public static Software getNew(DbControl dc) 70 77 throws BaseException 71 78 { 72 79 Software software = dc.newItem(Software.class); 73 80 software.setName("New software"); 74 software.setSoftwareType(softwareType);75 81 software.getData().setEntryDate(new Date()); 76 82 return software; … … 135 141 { 136 142 return DateUtil.copy(getData().getEntryDate()); 143 } 144 // ------------------------------------------- 145 /* 146 From the Subtypable interface 147 ----------------------------- 148 */ 149 @Override 150 public ItemSubtype getItemSubtype() 151 { 152 return getDbControl().getItem(ItemSubtype.class, getData().getItemSubtype()); 153 } 154 @Override 155 public void setItemSubtype(ItemSubtype subtype) 156 { 157 checkPermission(Permission.WRITE); 158 if (subtype != null) 159 { 160 subtype.setOnItem(this); 161 } 162 else 163 { 164 getData().setItemSubtype(null); 165 } 137 166 } 138 167 // ------------------------------------------- … … 189 218 190 219 /** 191 Get the associated {@link SoftwareType} item.192 All <code>Software</code> items must have a type.193 @return The <code>SoftwareType</code> item194 @throws PermissionDeniedException If the logged in user doesn't have195 {@link Permission#READ} permission for the software type196 @throws BaseException If there is another error197 */198 public SoftwareType getSoftwareType()199 throws PermissionDeniedException, BaseException200 {201 return getDbControl().getItem(SoftwareType.class, getData().getSoftwareType());202 }203 204 /**205 Set the {@link SoftwareType} of this <code>Software</code> item.206 This parameter mustn't be <code>null</code>.207 @param softwareType The new <code>SoftwareType</code>208 @throws PermissionDeniedException If the logged in user doesn't have209 {@link Permission#WRITE} permission for the software or210 {@link Permission#USE} permission for the software type211 @throws InvalidUseOfNullException If software type is null212 */213 public void setSoftwareType(SoftwareType softwareType)214 throws PermissionDeniedException, InvalidUseOfNullException215 {216 checkPermission(Permission.WRITE);217 if (softwareType == null) throw new InvalidUseOfNullException("softwareType");218 softwareType.checkPermission(Permission.USE);219 getData().setSoftwareType(softwareType.getData());220 }221 222 /**223 220 Get the versionstring of this <code>Software</code> item. 224 221 @return A string with the version of this item, or null if not known -
trunk/src/core/net/sf/basedb/core/SpotImages.java
r5384 r5630 403 403 setBlueImageFile(blueImageFile); 404 404 getData().setSpotImagesFile(spotImagesFile.getData()); 405 spotImagesFile.set FileType(FileType.getById(getDbControl(), SystemItems.getId(FileType.SPOT_IMAGES)));405 spotImagesFile.setItemSubtype(ItemSubtype.getById(getDbControl(), SystemItems.getId(File.SPOT_IMAGES))); 406 406 spotImagesFile.setMimeType("application/zip"); 407 407 -
trunk/src/core/net/sf/basedb/core/Update.java
r5624 r5630 305 305 306 306 307 @SuppressWarnings("unchecked") 307 308 private static void copyJarPathToJarFile(org.hibernate.Session session, String tableName) 308 309 { … … 315 316 316 317 query = HibernateUtil.getPredefinedSQLQuery(session, "GET_JAR_PATH_FROM_TABLE", tableName); 317 @SuppressWarnings("unchecked")318 318 List<Object[]> result = query.list(); 319 319 query = HibernateUtil.getPredefinedSQLQuery(session, "SET_JAR_FILE_IN_TABLE", tableName); -
trunk/src/core/net/sf/basedb/core/data/DataFileTypeData.java
r5623 r5630 138 138 } 139 139 140 private FileTypeData genericType;140 private ItemSubtypeData genericType; 141 141 /** 142 142 Get the generic file type of files with this member type. 143 143 @hibernate.many-to-one outer-join="false" 144 @hibernate.column name="`file type_id`" not-null="false"144 @hibernate.column name="`filesubtype_id`" not-null="false" 145 145 */ 146 public FileTypeData getGenericType()146 public ItemSubtypeData getGenericType() 147 147 { 148 148 return genericType; 149 149 } 150 public void setGenericType( FileTypeData genericType)150 public void setGenericType(ItemSubtypeData genericType) 151 151 { 152 152 this.genericType = genericType; -
trunk/src/core/net/sf/basedb/core/data/FileData.java
r5360 r5630 38 38 public class FileData 39 39 extends CommonData 40 implements DiskConsumableData, LoggableData 40 implements DiskConsumableData, LoggableData, SubtypableData 41 41 { 42 42 /* … … 70 70 } 71 71 // ------------------------------------------- 72 /* 73 From the SubtypableData interface 74 ---------------------------------- 75 */ 76 private ItemSubtypeData subtype; 77 @Override 78 public ItemSubtypeData getItemSubtype() 79 { 80 return subtype; 81 } 82 @Override 83 public void setItemSubtype(ItemSubtypeData subtype) 84 { 85 this.subtype = subtype; 86 } 87 // ------------------------------ 72 88 73 89 private long size; … … 176 192 { 177 193 this.directory = directory; 178 }179 180 private FileTypeData fileType;181 /**182 Get the associated {@link FileTypeData} item.183 @hibernate.many-to-one column="`filetype_id`" not-null="false" outer-join="false"184 */185 public FileTypeData getFileType()186 {187 return fileType;188 }189 public void setFileType(FileTypeData fileType)190 {191 this.fileType = fileType;192 194 } 193 195 -
trunk/src/core/net/sf/basedb/core/data/HardwareData.java
r4889 r5630 37 37 public class HardwareData 38 38 extends CommonData 39 implements RegisteredData 39 implements RegisteredData, SubtypableData 40 40 { 41 41 public HardwareData() … … 56 56 // ------------------------------------------- 57 57 58 /* 59 From the SubtypableData interface 60 ---------------------------------- 61 */ 62 private ItemSubtypeData subtype; 63 @Override 64 public ItemSubtypeData getItemSubtype() 65 { 66 return subtype; 67 } 68 @Override 69 public void setItemSubtype(ItemSubtypeData subtype) 70 { 71 this.subtype = subtype; 72 } 73 // ------------------------------ 74 58 75 public static final int MAX_VERSIONSTRING_LENGTH = 255; 59 60 private HardwareTypeData hardwareType;61 /**62 @hibernate.many-to-one column="`hardwaretype_id`" not-null="true" outer-join="false"63 */64 public HardwareTypeData getHardwareType()65 {66 return this.hardwareType;67 }68 public void setHardwareType(HardwareTypeData hardwareType)69 {70 this.hardwareType = hardwareType;71 }72 76 73 77 private String versionString; -
trunk/src/core/net/sf/basedb/core/data/MeasuredBioMaterialData.java
r5119 r5630 38 38 public abstract class MeasuredBioMaterialData 39 39 extends BioMaterialData 40 implements SubtypableData 40 41 { 41 42 42 43 public MeasuredBioMaterialData() 43 44 {} 45 46 /* 47 From the SubtypableData interface 48 ---------------------------------- 49 */ 50 private ItemSubtypeData subtype; 51 @Override 52 public ItemSubtypeData getItemSubtype() 53 { 54 return subtype; 55 } 56 @Override 57 public void setItemSubtype(ItemSubtypeData subtype) 58 { 59 this.subtype = subtype; 60 } 61 // ------------------------------ 62 44 63 45 64 private BioMaterialData parent; … … 166 185 } 167 186 168 169 187 } -
trunk/src/core/net/sf/basedb/core/data/MimeTypeData.java
r4889 r5630 112 112 } 113 113 114 private FileTypeData fileType;114 private ItemSubtypeData fileType; 115 115 /** 116 Get the associated {@link FileTypeData} item.117 @hibernate.many-to-one column="`file type_id`" not-null="false"116 Get the associated {@link ItemSubtypeData} item. 117 @hibernate.many-to-one column="`filesubtype_id`" not-null="false" 118 118 */ 119 public FileTypeData getFileType()119 public ItemSubtypeData getFileType() 120 120 { 121 121 return fileType; 122 122 } 123 public void setFileType( FileTypeData fileType)123 public void setFileType(ItemSubtypeData fileType) 124 124 { 125 125 this.fileType = fileType; -
trunk/src/core/net/sf/basedb/core/data/PlateEventTypeData.java
r4889 r5630 110 110 } 111 111 112 private ProtocolTypeData protocolType;112 private ItemSubtypeData protocolType; 113 113 /** 114 114 The protocol type that events of this event type should pick their protocols from. 115 @hibernate.many-to-one column="`protocol type_id`" outer-join="false" not-null="false"115 @hibernate.many-to-one column="`protocolsubtype_id`" outer-join="false" not-null="false" 116 116 */ 117 public ProtocolTypeData getProtocolType()117 public ItemSubtypeData getProtocolType() 118 118 { 119 119 return protocolType; 120 120 } 121 public void setProtocolType( ProtocolTypeData protocolType)121 public void setProtocolType(ItemSubtypeData protocolType) 122 122 { 123 123 this.protocolType = protocolType; -
trunk/src/core/net/sf/basedb/core/data/ProtocolData.java
r5248 r5630 36 36 public class ProtocolData 37 37 extends AnnotatedData 38 implements FileAttachableData, RegisteredData 38 implements FileAttachableData, RegisteredData, SubtypableData 39 39 { 40 40 … … 72 72 // ------------------------------------------- 73 73 74 private ProtocolTypeData protocolType; 75 /** 76 Get the associated {@link ProtocolTypeData} item. 77 @hibernate.many-to-one column="`protocoltype_id`" not-null="true" outer-join="false" 74 /* 75 From the SubtypableData interface 76 ---------------------------------- 78 77 */ 79 public ProtocolTypeData getProtocolType() 78 private ItemSubtypeData subtype; 79 @Override 80 public ItemSubtypeData getItemSubtype() 80 81 { 81 return protocolType;82 return subtype; 82 83 } 83 public void setProtocolType(ProtocolTypeData protocolType) 84 @Override 85 public void setItemSubtype(ItemSubtypeData subtype) 84 86 { 85 this.protocolType = protocolType;87 this.subtype = subtype; 86 88 } 87 89 // ------------------------------ 90 88 91 /** 89 92 The maximum length of the external id that can be stored in the database. -
trunk/src/core/net/sf/basedb/core/data/SoftwareData.java
r4889 r5630 37 37 public class SoftwareData 38 38 extends CommonData 39 implements RegisteredData 39 implements RegisteredData, SubtypableData 40 40 { 41 41 public SoftwareData() … … 56 56 // ------------------------------------------- 57 57 58 private SoftwareTypeData softwareType; 58 /* 59 From the SubtypableData interface 60 ---------------------------------- 61 */ 62 private ItemSubtypeData subtype; 63 @Override 64 public ItemSubtypeData getItemSubtype() 65 { 66 return subtype; 67 } 68 @Override 69 public void setItemSubtype(ItemSubtypeData subtype) 70 { 71 this.subtype = subtype; 72 } 73 // ------------------------------ 59 74 60 75 public static final int MAX_VERSIONSTRING_LENGTH = 255; 61 62 /**63 @hibernate.many-to-one column="`softwaretype_id`" not-null="true" outer-join="false"64 */65 public SoftwareTypeData getSoftwareType()66 {67 return softwareType;68 }69 public void setSoftwareType(SoftwareTypeData softwareType)70 {71 this.softwareType = softwareType;72 }73 76 74 77 private String versionString; -
trunk/src/core/net/sf/basedb/util/overview/validator/HardwareValidator.java
r4764 r5630 25 25 import net.sf.basedb.core.DbControl; 26 26 import net.sf.basedb.core.Hardware; 27 import net.sf.basedb.core.HardwareType;28 27 import net.sf.basedb.core.Item; 28 import net.sf.basedb.core.ItemSubtype; 29 29 import net.sf.basedb.core.PermissionDeniedException; 30 30 import net.sf.basedb.core.Project; … … 96 96 try 97 97 { 98 HardwareType ht = hardware.getHardwareType();98 ItemSubtype ht = hardware.getItemSubtype(); 99 99 String requiredId = defaultType == null ? null : defaultType.getType(); 100 100 if (requiredId != null && !requiredId.equals(ht.getSystemId())) -
trunk/src/core/net/sf/basedb/util/overview/validator/ProtocolValidator.java
r4764 r5630 25 25 import net.sf.basedb.core.DbControl; 26 26 import net.sf.basedb.core.Item; 27 import net.sf.basedb.core.ItemSubtype; 27 28 import net.sf.basedb.core.PermissionDeniedException; 28 29 import net.sf.basedb.core.Project; 29 30 import net.sf.basedb.core.Protocol; 30 import net.sf.basedb.core.ProtocolType;31 31 import net.sf.basedb.util.overview.Fix; 32 32 import net.sf.basedb.util.overview.OverviewContext; … … 96 96 try 97 97 { 98 ProtocolType pt = protocol.getProtocolType();98 ItemSubtype pt = protocol.getItemSubtype(); 99 99 String requiredId = defaultType == null ? null : defaultType.getType(); 100 100 if (requiredId != null && !requiredId.equals(pt.getSystemId())) -
trunk/src/core/net/sf/basedb/util/overview/validator/SoftwareValidator.java
r4764 r5630 25 25 import net.sf.basedb.core.DbControl; 26 26 import net.sf.basedb.core.Item; 27 import net.sf.basedb.core.ItemSubtype; 27 28 import net.sf.basedb.core.PermissionDeniedException; 28 29 import net.sf.basedb.core.Project; 29 30 import net.sf.basedb.core.Software; 30 import net.sf.basedb.core.SoftwareType;31 31 import net.sf.basedb.util.overview.Fix; 32 32 import net.sf.basedb.util.overview.OverviewContext; … … 96 96 try 97 97 { 98 SoftwareType st = software.getSoftwareType();98 ItemSubtype st = software.getItemSubtype(); 99 99 String requiredId = defaultType == null ? null : defaultType.getType(); 100 100 if (requiredId != null && !requiredId.equals(st.getSystemId())) -
trunk/src/plugins/core/net/sf/basedb/plugins/CdfFileReporterImporter.java
r5623 r5630 47 47 import net.sf.basedb.core.FileParameterType; 48 48 import net.sf.basedb.core.FileStoreUtil; 49 import net.sf.basedb.core.FileType;50 49 import net.sf.basedb.core.InvalidDataException; 51 50 import net.sf.basedb.core.Item; … … 238 237 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 239 238 fileContext.removeAllTemporaryFilters(); 240 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER, PropertyFilter.TEMPORARY));241 239 fileContext.setPropertyFilter(new PropertyFilter("name", Operator.LIKE, 242 240 "%.cdf", Type.STRING, PropertyFilter.TEMPORARY)); -
trunk/src/plugins/core/net/sf/basedb/plugins/IlluminaRawDataImporter.java
r5612 r5630 55 55 import net.sf.basedb.core.PluginParameter; 56 56 import net.sf.basedb.core.Protocol; 57 import net.sf.basedb.core.ProtocolType;58 57 import net.sf.basedb.core.RawBioAssay; 59 58 import net.sf.basedb.core.RawDataBatcher; … … 64 63 import net.sf.basedb.core.Scan; 65 64 import net.sf.basedb.core.Software; 66 import net.sf.basedb.core.SoftwareType;67 65 import net.sf.basedb.core.StringParameterType; 68 66 import net.sf.basedb.core.SystemItems; … … 737 735 List<Protocol> protocols = getItems(dc, Protocol.getQuery(), 738 736 Restrictions.eq( 739 Hql.property(" protocolType.id"),740 Expressions.integer(SystemItems.getId(Protocol Type.FEATURE_EXTRACTION))737 Hql.property("itemSubtype.id"), 738 Expressions.integer(SystemItems.getId(Protocol.FEATURE_EXTRACTION)) 741 739 ) 742 740 ); 743 741 List<Software> software = getItems(dc, Software.getQuery(), 744 742 Restrictions.eq( 745 Hql.property(" softwareType.id"),746 Expressions.integer(SystemItems.getId(Software Type.FEATURE_EXTRACTION))743 Hql.property("itemSubtype.id"), 744 Expressions.integer(SystemItems.getId(Software.FEATURE_EXTRACTION)) 747 745 ) 748 746 ); -
trunk/src/plugins/core/net/sf/basedb/plugins/PlateFlatFileImporter.java
r5612 r5630 28 28 import net.sf.basedb.core.DbControl; 29 29 import net.sf.basedb.core.File; 30 import net.sf.basedb.core.FileType;31 30 import net.sf.basedb.core.Include; 32 31 import net.sf.basedb.core.IntegerParameterType; … … 43 42 import net.sf.basedb.core.PlateType; 44 43 import net.sf.basedb.core.PluginParameter; 45 import net.sf.basedb.core.PropertyFilter;46 44 import net.sf.basedb.core.ReporterBatcher; 47 45 import net.sf.basedb.core.RequestInformation; … … 268 266 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 269 267 fileContext.removeAllTemporaryFilters(); 270 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.PLATE, PropertyFilter.TEMPORARY));271 268 } 272 269 return requestInformation; -
trunk/src/plugins/core/net/sf/basedb/plugins/PrintMapFlatFileImporter.java
r5612 r5630 36 36 import net.sf.basedb.core.FileSetMember; 37 37 import net.sf.basedb.core.FileStoreUtil; 38 import net.sf.basedb.core.FileType;39 38 import net.sf.basedb.core.IntegerUtil; 40 39 import net.sf.basedb.core.InvalidDataException; … … 49 48 import net.sf.basedb.core.Plate; 50 49 import net.sf.basedb.core.PluginParameter; 51 import net.sf.basedb.core.PropertyFilter;52 50 import net.sf.basedb.core.RequestInformation; 53 51 import net.sf.basedb.core.StringParameterType; … … 224 222 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 225 223 fileContext.removeAllTemporaryFilters(); 226 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.PRINT_MAP, PropertyFilter.TEMPORARY));227 224 } 228 225 return requestInformation; … … 301 298 File reporterMapFile = (File)job.getValue("file"); 302 299 printMapMember = FileStoreUtil.setGenericDataFile(dc, arrayDesign, 303 File Type.PRINT_MAP, DataFileType.GENERIC_PRINT_MAP, reporterMapFile);300 File.PRINT_MAP, DataFileType.GENERIC_PRINT_MAP, reporterMapFile); 304 301 if (arrayDesign.getNumDbFeatures() > 0) 305 302 { … … 520 517 { 521 518 design = ArrayDesign.getById(dc, currentArrayDesignId); 522 printMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File Type.PRINT_MAP);519 printMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File.PRINT_MAP); 523 520 } 524 521 catch (Throwable t) -
trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java
r5612 r5630 36 36 import net.sf.basedb.core.FileSetMember; 37 37 import net.sf.basedb.core.FileStoreUtil; 38 import net.sf.basedb.core.FileType;39 38 import net.sf.basedb.core.Include; 40 39 import net.sf.basedb.core.Item; … … 44 43 import net.sf.basedb.core.ItemParameterType; 45 44 import net.sf.basedb.core.ItemQuery; 45 import net.sf.basedb.core.ItemSubtype; 46 46 import net.sf.basedb.core.Permission; 47 47 import net.sf.basedb.core.PermissionDeniedException; … … 50 50 import net.sf.basedb.core.PluginConfiguration; 51 51 import net.sf.basedb.core.PluginParameter; 52 import net.sf.basedb.core.PropertyFilter;53 52 import net.sf.basedb.core.RawBioAssay; 54 53 import net.sf.basedb.core.RawDataBatcher; … … 327 326 permissions.add(new Permissions(Item.PLATFORM, null, EnumSet.of(Permission.READ))); 328 327 permissions.add(new Permissions(Item.DATAFILETYPE, null, EnumSet.of(Permission.READ))); 329 permissions.add(new Permissions(Item. FILETYPE, null, EnumSet.of(Permission.READ)));328 permissions.add(new Permissions(Item.ITEMSUBTYPE, null, EnumSet.of(Permission.READ))); 330 329 permissions.add(new Permissions(Item.PLUGINCONFIGURATION, null, EnumSet.of(Permission.READ))); 331 330 } … … 432 431 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 433 432 fileContext.removeAllTemporaryFilters(); 434 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.RAW_DATA, PropertyFilter.TEMPORARY));435 433 } 436 434 return requestInformation; … … 616 614 else 617 615 { 618 List<File> rawFiles = FileStoreUtil.getGenericDataFiles(dc, rba, File Type.RAW_DATA);616 List<File> rawFiles = FileStoreUtil.getGenericDataFiles(dc, rba, File.RAW_DATA); 619 617 if (rawFiles != null && rawFiles.size() > 0) dataFile = rawFiles.get(0); 620 618 } … … 678 676 rawBioAssay = RawBioAssay.getById(dc, fileIterator.getCurrentRawBioAssay().getId()); 679 677 rawDataMember = FileStoreUtil.setGenericDataFile(dc, rawBioAssay, 680 File Type.RAW_DATA, DataFileType.GENERIC_RAW_DATA, fileIterator.getCurrentFile());678 File.RAW_DATA, DataFileType.GENERIC_RAW_DATA, fileIterator.getCurrentFile()); 681 679 682 680 PluginConfiguration cfg = getCurrentConfiguration(dc); … … 1079 1077 try 1080 1078 { 1081 rawDataFiles = FileStoreUtil.getGenericDataFiles(dc, currentRaw, File Type.RAW_DATA);1079 rawDataFiles = FileStoreUtil.getGenericDataFiles(dc, currentRaw, File.RAW_DATA); 1082 1080 } 1083 1081 catch (Throwable t) … … 1117 1115 variant = type.getVariant(dc); 1118 1116 } 1119 FileType rawData = FileType.getById(dc, SystemItems.getId(FileType.RAW_DATA));1117 ItemSubtype rawData = ItemSubtype.getById(dc, SystemItems.getId(File.RAW_DATA)); 1120 1118 ItemQuery<DataFileType> query = DataFileType.getQuery(platform, variant, 1121 1119 Item.RAWBIOASSAY, rawData); -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterFlatFileImporter.java
r5612 r5630 25 25 26 26 import net.sf.basedb.core.File; 27 import net.sf.basedb.core.FileType;28 27 import net.sf.basedb.core.HibernateUtil; 29 28 import net.sf.basedb.core.InvalidUseOfNullException; … … 32 31 import net.sf.basedb.core.Permission; 33 32 import net.sf.basedb.core.PermissionDeniedException; 34 import net.sf.basedb.core.PropertyFilter;35 33 import net.sf.basedb.core.ReporterList; 36 34 import net.sf.basedb.core.RequestInformation; … … 271 269 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 272 270 fileContext.removeAllTemporaryFilters(); 273 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER, PropertyFilter.TEMPORARY));274 271 } 275 272 return requestInformation; -
trunk/src/plugins/core/net/sf/basedb/plugins/ReporterMapFlatFileImporter.java
r5612 r5630 36 36 import net.sf.basedb.core.FileSetMember; 37 37 import net.sf.basedb.core.FileStoreUtil; 38 import net.sf.basedb.core.FileType;39 38 import net.sf.basedb.core.InvalidDataException; 40 39 import net.sf.basedb.core.InvalidUseOfNullException; … … 43 42 import net.sf.basedb.core.ItemNotFoundException; 44 43 import net.sf.basedb.core.Permission; 45 import net.sf.basedb.core.PropertyFilter;46 44 import net.sf.basedb.core.ReporterBatcher; 47 45 import net.sf.basedb.core.ItemParameterType; … … 350 348 ItemContext fileContext = sc.getCurrentContext(Item.FILE); 351 349 fileContext.removeAllTemporaryFilters(); 352 fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER_MAP, PropertyFilter.TEMPORARY));353 350 } 354 351 return requestInformation; … … 504 501 FeatureIdentificationMethod.valueOf(fiParameter); 505 502 reporterMapMember = FileStoreUtil.setGenericDataFile(dc, arrayDesign, 506 File Type.REPORTER_MAP, DataFileType.GENERIC_REPORTER_MAP, reporterMapFile);503 File.REPORTER_MAP, DataFileType.GENERIC_REPORTER_MAP, reporterMapFile); 507 504 batcher = arrayDesign.getFeatureBatcher(fiMethod, job.getJob()); 508 505 reporterBatcher = ReporterBatcher.getNew(dc); … … 673 670 { 674 671 design = ArrayDesign.getById(dc, currentArrayDesignId); 675 reporterMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File Type.REPORTER_MAP);672 reporterMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File.REPORTER_MAP); 676 673 } 677 674 catch (Throwable t) -
trunk/src/plugins/core/net/sf/basedb/plugins/SpotImageCreator.java
r5612 r5630 86 86 permissions.add(new Permissions(Item.RAWBIOASSAY, null, EnumSet.of(Permission.WRITE))); 87 87 permissions.add(new Permissions(Item.FILE, null, EnumSet.of(Permission.CREATE, Permission.WRITE))); 88 permissions.add(new Permissions(Item. FILETYPE, EnumSet.of(Permission.USE), null));88 permissions.add(new Permissions(Item.ITEMSUBTYPE, EnumSet.of(Permission.USE), null)); 89 89 permissions.add(new Permissions(Item.DIRECTORY, null, EnumSet.of(Permission.USE))); 90 90 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java
r5481 r5630 48 48 import net.sf.basedb.core.File; 49 49 import net.sf.basedb.core.Hardware; 50 import net.sf.basedb.core.HardwareType;51 50 import net.sf.basedb.core.Hybridization; 52 51 import net.sf.basedb.core.Image; … … 60 59 import net.sf.basedb.core.ItemNotFoundException; 61 60 import net.sf.basedb.core.ItemQuery; 61 import net.sf.basedb.core.ItemSubtype; 62 62 import net.sf.basedb.core.Job; 63 63 import net.sf.basedb.core.Label; … … 74 74 import net.sf.basedb.core.ProjectKey; 75 75 import net.sf.basedb.core.Protocol; 76 import net.sf.basedb.core.ProtocolType;77 76 import net.sf.basedb.core.RawDataType; 78 77 import net.sf.basedb.core.RawDataTypes; … … 83 82 import net.sf.basedb.core.ShareableUtil; 84 83 import net.sf.basedb.core.Software; 85 import net.sf.basedb.core.SoftwareType;86 84 import net.sf.basedb.core.StringParameterType; 87 85 import net.sf.basedb.core.StringTooLongException; 88 86 import net.sf.basedb.core.StringUtil; 89 import net.sf.basedb.core.SystemItems;90 87 import net.sf.basedb.core.Type; 91 88 import net.sf.basedb.core.plugin.GuiContext; … … 1014 1011 private ItemQuery<Protocol> protocolQuery; 1015 1012 /** 1016 Same as {@link #findProtocol(DbControl, IdMethod, String, ProtocolType)} with1017 a null protocoltype.1013 Same as {@link #findProtocol(DbControl, IdMethod, String, ItemSubtype)} with 1014 a null item subtype. 1018 1015 */ 1019 1016 protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier) … … 1031 1028 called with the same id method object, otherwise the result is undefined. 1032 1029 <p> 1033 NOTE! If this method is called with a non-null protocoltype parameter and1034 no protocol is found the query will be retried without any protocoltype.1030 NOTE! If this method is called with a non-null item subtype parameter and 1031 no protocol is found the query will be retried without any subtype. 1035 1032 1036 1033 @param dc The DbControl to use for database access 1037 1034 @param identifier The identifier protocol 1038 @param type The protocol type of the protocol, or null if the type doesn't matter1035 @param subtype The protocol subtype, or null if the type doesn't matter 1039 1036 @return A protocol, or null if no item could be found 1040 @since 2.91041 */ 1042 protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier, ProtocolTypetype)1037 @since 3.0 1038 */ 1039 protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype) 1043 1040 { 1044 1041 if (identifier == null) return null; 1045 1042 if (protocolQuery == null) 1046 1043 { 1047 // where ... ( protocolType = :protocolType AND checkType = 1) || checkType = 01044 // where ... (itemSubtype = :subtype AND checkType = 1) || checkType = 0 1048 1045 Expression checkType = Expressions.parameter("checkType"); 1049 1046 protocolQuery = initReferenceQuery(dc, idMethod, Protocol.getQuery()); … … 1051 1048 Restrictions.or( 1052 1049 Restrictions.and( 1053 Restrictions.eq(Hql.property(" protocolType"), Expressions.parameter("protocolType")),1050 Restrictions.eq(Hql.property("itemSubtype"), Expressions.parameter("subtype")), 1054 1051 Restrictions.eq(checkType, Expressions.integer(1)) 1055 1052 ), … … 1058 1055 ); 1059 1056 } 1060 protocolQuery.setParameter(" protocolType", type == null ? 0 :type.getId(), Type.INT);1061 protocolQuery.setParameter("checkType", type == null ? 0 : 1, Type.INT);1057 protocolQuery.setParameter("subtype", subtype == null ? 0 : subtype.getId(), Type.INT); 1058 protocolQuery.setParameter("checkType", subtype == null ? 0 : 1, Type.INT); 1062 1059 Protocol protocol = findReferencedItem(dc, idMethod, protocolQuery, identifier, true); 1063 1060 if (protocol == null) … … 1090 1087 } 1091 1088 1092 private ItemQuery<Hardware> hybStationQuery; 1093 /** 1094 Find a hybridization station with a given identifier. This is a utility method that 1095 subclasses can use when creating or updating items. 1096 1097 <p> 1098 NOTE! A scanner is a {@link Hardware} item with it type set to 1099 {@link HardwareType#HYBRIDIZATION_STATION}. 1100 1089 1090 private ItemQuery<Hardware> hardwareQuery; 1091 /** 1092 Same as {@link #findHardware(DbControl, IdMethod, String, ItemSubtype)} with 1093 a null item subtype. 1094 */ 1095 protected Hardware findHardware(DbControl dc, IdMethod idMethod, String identifier) 1096 { 1097 return findHardware(dc, idMethod, identifier, null); 1098 } 1099 1100 /** 1101 Find a hardware with a given identifier. This is a utility method that 1102 subclasses can use when creating or updating items. 1101 1103 <p> 1102 1104 NOTE! The first time this method is called a query object is initialised … … 1104 1106 Subsequent calls uses the same query. Thus, this method should always be 1105 1107 called with the same id method object, otherwise the result is undefined. 1108 <p> 1109 NOTE! If this method is called with a non-null item subtype parameter and 1110 no hardware is found the query will be retried without any subtype. 1106 1111 1107 1112 @param dc The DbControl to use for database access 1108 1113 @param identifier The identifier protocol 1109 @return A scanner, or null if no item could be found 1110 */ 1111 protected Hardware findHybridizationStation(DbControl dc, IdMethod idMethod, String identifier) 1114 @param subtype The hardware subtype, or null if the type doesn't matter 1115 @return A hardware, or null if no item could be found 1116 @since 3.0 1117 */ 1118 protected Hardware findHardware(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype) 1112 1119 { 1113 1120 if (identifier == null) return null; 1114 if (hybStationQuery == null) 1115 { 1116 hybStationQuery = initReferenceQuery(dc, idMethod, Hardware.getQuery()); 1117 hybStationQuery.restrictPermanent( 1118 Restrictions.eq(Hql.property("hardwareType"), 1119 Expressions.integer(SystemItems.getId(HardwareType.HYBRIDIZATION_STATION))) 1121 if (hardwareQuery == null) 1122 { 1123 // where ... (itemSubtype = :subtype AND checkType = 1) || checkType = 0 1124 Expression checkType = Expressions.parameter("checkType"); 1125 hardwareQuery = initReferenceQuery(dc, idMethod, Hardware.getQuery()); 1126 hardwareQuery.restrictPermanent( 1127 Restrictions.or( 1128 Restrictions.and( 1129 Restrictions.eq(Hql.property("itemSubtype"), Expressions.parameter("subtype")), 1130 Restrictions.eq(checkType, Expressions.integer(1)) 1131 ), 1132 Restrictions.eq(checkType, Expressions.integer(0)) 1133 ) 1120 1134 ); 1121 1135 } 1122 return findReferencedItem(dc, idMethod, hybStationQuery, identifier, false); 1123 } 1124 1125 private ItemQuery<Hardware> scannerQuery; 1126 /** 1127 Find a scanner with a given identifier. This is a utility method that 1128 subclasses can use when creating or updating items. 1129 1130 <p> 1131 NOTE! A scanner is a {@link Hardware} item with it type set to 1132 {@link HardwareType#SCANNER}. 1133 1136 hardwareQuery.setParameter("subtype", subtype == null ? 0 : subtype.getId(), Type.INT); 1137 hardwareQuery.setParameter("checkType", subtype == null ? 0 : 1, Type.INT); 1138 Hardware hardware = findReferencedItem(dc, idMethod, hardwareQuery, identifier, true); 1139 if (hardware == null) 1140 { 1141 hardwareQuery.setParameter("checkType", 0, Type.INT); 1142 hardware = findReferencedItem(dc, idMethod, hardwareQuery, identifier, false); 1143 } 1144 return hardware; 1145 } 1146 1147 private ItemQuery<Software> softwareQuery; 1148 /** 1149 Same as {@link #findSoftware(DbControl, IdMethod, String, ItemSubtype)} with 1150 a null item subtype. 1151 */ 1152 protected Software findSoftware(DbControl dc, IdMethod idMethod, String identifier) 1153 { 1154 return findSoftware(dc, idMethod, identifier, null); 1155 } 1156 1157 /** 1158 Find a software with a given identifier. This is a utility method that 1159 subclasses can use when creating or updating items. 1134 1160 <p> 1135 1161 NOTE! The first time this method is called a query object is initialised … … 1137 1163 Subsequent calls uses the same query. Thus, this method should always be 1138 1164 called with the same id method object, otherwise the result is undefined. 1165 <p> 1166 NOTE! If this method is called with a non-null item subtype parameter and 1167 no software is found the query will be retried without any subtype. 1139 1168 1140 1169 @param dc The DbControl to use for database access 1141 1170 @param identifier The identifier protocol 1142 @return A scanner, or null if no item could be found 1143 */ 1144 protected Hardware findScanner(DbControl dc, IdMethod idMethod, String identifier) 1171 @param subtype The software subtype, or null if the type doesn't matter 1172 @return A software, or null if no item could be found 1173 @since 3.0 1174 */ 1175 protected Software findSoftware(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype) 1145 1176 { 1146 1177 if (identifier == null) return null; 1147 if (scannerQuery == null) 1148 { 1149 scannerQuery = initReferenceQuery(dc, idMethod, Hardware.getQuery()); 1150 scannerQuery.restrictPermanent( 1151 Restrictions.eq(Hql.property("hardwareType"), 1152 Expressions.integer(SystemItems.getId(HardwareType.SCANNER))) 1178 if (softwareQuery == null) 1179 { 1180 // where ... (itemSubtype = :subtype AND checkType = 1) || checkType = 0 1181 Expression checkType = Expressions.parameter("checkType"); 1182 softwareQuery = initReferenceQuery(dc, idMethod, Software.getQuery()); 1183 softwareQuery.restrictPermanent( 1184 Restrictions.or( 1185 Restrictions.and( 1186 Restrictions.eq(Hql.property("itemSubtype"), Expressions.parameter("subtype")), 1187 Restrictions.eq(checkType, Expressions.integer(1)) 1188 ), 1189 Restrictions.eq(checkType, Expressions.integer(0)) 1190 ) 1153 1191 ); 1154 1192 } 1155 return findReferencedItem(dc, idMethod, scannerQuery, identifier, false); 1156 } 1157 1158 private ItemQuery<Hardware> robotQuery; 1159 /** 1160 Find a print robot with a given identifier. This is a utility method that 1161 subclasses can use when creating or updating items. 1162 1163 <p> 1164 NOTE! A print robot is a {@link Hardware} item with it type set to 1165 {@link HardwareType#PRINT_ROBOT}. 1166 1167 <p> 1168 NOTE! The first time this method is called a query object is initialised 1169 using the {@link IdMethod#prepareQuery(DbControl, ItemQuery)} method. 1170 Subsequent calls uses the same query. Thus, this method should always be 1171 called with the same id method object, otherwise the result is undefined. 1172 1173 @param dc The DbControl to use for database access 1174 @param identifier The identifier protocol 1175 @return A print robot, or null if no item could be found 1176 */ 1177 protected Hardware findPrintRobot(DbControl dc, IdMethod idMethod, String identifier) 1178 { 1179 if (identifier == null) return null; 1180 if (robotQuery == null) 1181 { 1182 robotQuery = initReferenceQuery(dc, idMethod, Hardware.getQuery()); 1183 robotQuery.restrictPermanent( 1184 Restrictions.eq(Hql.property("hardwareType"), 1185 Expressions.integer(SystemItems.getId(HardwareType.PRINT_ROBOT))) 1186 ); 1187 } 1188 return findReferencedItem(dc, idMethod, robotQuery, identifier, false); 1189 } 1190 1191 private ItemQuery<Hardware> freezerQuery; 1192 /** 1193 Find a freezer with a given identifier. This is a utility method that 1194 subclasses can use when creating or updating items. 1195 1196 <p> 1197 NOTE! A freezer is a {@link Hardware} item with it type set to 1198 {@link HardwareType#FREEZER}. 1199 1200 <p> 1201 NOTE! The first time this method is called a query object is initialised 1202 using the {@link IdMethod#prepareQuery(DbControl, ItemQuery)} method. 1203 Subsequent calls uses the same query. Thus, this method should always be 1204 called with the same id method object, otherwise the result is undefined. 1205 1206 @param dc The DbControl to use for database access 1207 @param identifier The identifier protocol 1208 @return A freezer, or null if no item could be found 1209 @since 2.16 1210 */ 1211 protected Hardware findFreezer(DbControl dc, IdMethod idMethod, String identifier) 1212 { 1213 if (identifier == null) return null; 1214 if (freezerQuery == null) 1215 { 1216 freezerQuery = initReferenceQuery(dc, idMethod, Hardware.getQuery()); 1217 freezerQuery.restrictPermanent( 1218 Restrictions.eq(Hql.property("hardwareType"), 1219 Expressions.integer(SystemItems.getId(HardwareType.FREEZER))) 1220 ); 1221 } 1222 return findReferencedItem(dc, idMethod, freezerQuery, identifier, false); 1223 } 1224 1225 private ItemQuery<Software> featureQuery; 1226 /** 1227 Find a feature extraction software with a given identifier. This is a utility 1228 method that subclasses can use when creating or updating items. 1229 1230 <p> 1231 NOTE! A feature extraction software is a {@link Software} item with it's 1232 type set to {@link SoftwareType#FEATURE_EXTRACTION}. 1233 1234 <p> 1235 NOTE! The first time this method is called a query object is initialised 1236 using the {@link IdMethod#prepareQuery(DbControl, ItemQuery)} method. 1237 Subsequent calls uses the same query. Thus, this method should always be 1238 called with the same id method object, otherwise the result is undefined. 1239 1240 @param dc The DbControl to use for database access 1241 @param identifier The identifier protocol 1242 @return A software item, or null if no item could be found 1243 */ 1244 protected Software findFeatureExtractionSoftware(DbControl dc, IdMethod idMethod, String identifier) 1245 { 1246 if (identifier == null) return null; 1247 if (featureQuery == null) 1248 { 1249 featureQuery = initReferenceQuery(dc, idMethod, Software.getQuery()); 1250 featureQuery.restrictPermanent( 1251 Restrictions.eq(Hql.property("softwareType"), 1252 Expressions.integer(SystemItems.getId(SoftwareType.FEATURE_EXTRACTION))) 1253 ); 1254 } 1255 return findReferencedItem(dc, idMethod, featureQuery, identifier, false); 1256 } 1257 1193 softwareQuery.setParameter("subtype", subtype == null ? 0 : subtype.getId(), Type.INT); 1194 softwareQuery.setParameter("checkType", subtype == null ? 0 : 1, Type.INT); 1195 Software software = findReferencedItem(dc, idMethod, softwareQuery, identifier, true); 1196 if (software == null) 1197 { 1198 softwareQuery.setParameter("checkType", 0, Type.INT); 1199 software = findReferencedItem(dc, idMethod, softwareQuery, identifier, false); 1200 } 1201 return software; 1202 } 1203 1258 1204 private ItemQuery<Platform> platformQuery; 1259 1205 /** -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayBatchImporter.java
r5612 r5630 32 32 import net.sf.basedb.core.Item; 33 33 import net.sf.basedb.core.ItemQuery; 34 import net.sf.basedb.core.ItemSubtype; 34 35 import net.sf.basedb.core.PluginParameter; 35 36 import net.sf.basedb.core.Protocol; 36 import net.sf.basedb.core.ProtocolType;37 37 import net.sf.basedb.core.SystemItems; 38 38 import net.sf.basedb.core.plugin.GuiContext; … … 174 174 { 175 175 String nameOrId = protocolMapper.getValue(data); 176 ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.PRINTING));176 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Protocol.PRINTING)); 177 177 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 178 178 if (nameOrId == null || protocol != null) batch.setProtocol(protocol); … … 181 181 { 182 182 String nameOrId = hardwareMapper.getValue(data); 183 Hardware robot = findPrintRobot(dc, FallbackIdMethod.NAME_OR_ID, nameOrId); 183 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Hardware.PRINT_ROBOT)); 184 Hardware robot = findHardware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 184 185 if (nameOrId == null || robot != null) batch.setPrintRobot(robot); 185 186 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/BioPlateImporter.java
r5612 r5630 33 33 import net.sf.basedb.core.Item; 34 34 import net.sf.basedb.core.ItemQuery; 35 import net.sf.basedb.core.ItemSubtype; 35 36 import net.sf.basedb.core.LabeledExtract; 36 37 import net.sf.basedb.core.PlateGeometry; 37 38 import net.sf.basedb.core.PluginParameter; 39 import net.sf.basedb.core.SystemItems; 38 40 import net.sf.basedb.core.plugin.GuiContext; 39 41 import net.sf.basedb.util.parser.FlatFileParser; … … 208 210 { 209 211 String nameOrId = hardwareMapper.getValue(data); 210 Hardware freezer = findFreezer(dc, FallbackIdMethod.NAME_OR_ID, nameOrId); 212 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Hardware.FREEZER)); 213 Hardware freezer = findHardware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 211 214 if (nameOrId == null || freezer != null) plate.setFreezer(freezer); 212 215 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java
r5612 r5630 33 33 import net.sf.basedb.core.Item; 34 34 import net.sf.basedb.core.ItemQuery; 35 import net.sf.basedb.core.ItemSubtype; 35 36 import net.sf.basedb.core.PluginParameter; 36 37 import net.sf.basedb.core.Protocol; 37 import net.sf.basedb.core.ProtocolType;38 38 import net.sf.basedb.core.Sample; 39 39 import net.sf.basedb.core.SystemItems; … … 184 184 { 185 185 String nameOrId = protocolMapper.getValue(data); 186 ProtocolType type = ProtocolType.getById(dc,187 SystemItems.getId(extract.isPooled() ? Protocol Type.POOLING : ProtocolType.EXTRACTION));186 ItemSubtype type = ItemSubtype.getById(dc, 187 SystemItems.getId(extract.isPooled() ? Protocol.POOLING : Protocol.EXTRACTION)); 188 188 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 189 189 if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol); -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/HybridizationImporter.java
r5612 r5630 35 35 import net.sf.basedb.core.Item; 36 36 import net.sf.basedb.core.ItemQuery; 37 import net.sf.basedb.core.ItemSubtype; 37 38 import net.sf.basedb.core.LabeledExtract; 38 39 import net.sf.basedb.core.Permission; … … 40 41 import net.sf.basedb.core.PluginParameter; 41 42 import net.sf.basedb.core.Protocol; 42 import net.sf.basedb.core.ProtocolType;43 43 import net.sf.basedb.core.StringParameterType; 44 44 import net.sf.basedb.core.SystemItems; … … 237 237 { 238 238 String nameOrId = protocolMapper.getValue(data); 239 ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.HYBRIDIZATION));239 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Protocol.HYBRIDIZATION)); 240 240 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 241 241 if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol); … … 244 244 { 245 245 String nameOrId = hardwareMapper.getValue(data); 246 Hardware hybStation = findHybridizationStation(dc, FallbackIdMethod.NAME_OR_ID, nameOrId); 246 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Hardware.HYBRIDIZATION_STATION)); 247 Hardware hybStation = findHardware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 247 248 if (nameOrId == null || hybStation != null) creationEvent.setHardware(hybStation); 248 249 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/LabeledExtractImporter.java
r5612 r5630 33 33 import net.sf.basedb.core.Item; 34 34 import net.sf.basedb.core.ItemQuery; 35 import net.sf.basedb.core.ItemSubtype; 35 36 import net.sf.basedb.core.Label; 36 37 import net.sf.basedb.core.LabeledExtract; 37 38 import net.sf.basedb.core.PluginParameter; 38 39 import net.sf.basedb.core.Protocol; 39 import net.sf.basedb.core.ProtocolType;40 40 import net.sf.basedb.core.SystemItems; 41 41 import net.sf.basedb.core.plugin.GuiContext; … … 214 214 { 215 215 String nameOrId = protocolMapper.getValue(data); 216 ProtocolType type = ProtocolType.getById(dc,217 SystemItems.getId(extract.isPooled() ? Protocol Type.POOLING : ProtocolType.LABELING));216 ItemSubtype type = ItemSubtype.getById(dc, 217 SystemItems.getId(extract.isPooled() ? Protocol.POOLING : Protocol.LABELING)); 218 218 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 219 219 if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol); -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java
r5623 r5630 32 32 import net.sf.basedb.core.Item; 33 33 import net.sf.basedb.core.ItemQuery; 34 import net.sf.basedb.core.ItemSubtype; 34 35 import net.sf.basedb.core.Path; 35 36 import net.sf.basedb.core.PathParameterType; … … 39 40 import net.sf.basedb.core.PluginParameter; 40 41 import net.sf.basedb.core.Protocol; 41 import net.sf.basedb.core.ProtocolType;42 42 import net.sf.basedb.core.RawBioAssay; 43 43 import net.sf.basedb.core.RawDataType; … … 406 406 { 407 407 String nameOrId = protocolMapper.getValue(data); 408 ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.FEATURE_EXTRACTION));408 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Protocol.FEATURE_EXTRACTION)); 409 409 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 410 410 if (nameOrId == null || protocol != null) rba.setProtocol(protocol); … … 413 413 { 414 414 String nameOrId = softwareMapper.getValue(data); 415 Software software = findFeatureExtractionSoftware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId); 415 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Software.FEATURE_EXTRACTION)); 416 Software software = findSoftware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 416 417 if (nameOrId == null || software != null) rba.setSoftware(software); 417 418 } -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java
r5612 r5630 33 33 import net.sf.basedb.core.Item; 34 34 import net.sf.basedb.core.ItemQuery; 35 import net.sf.basedb.core.ItemSubtype; 35 36 import net.sf.basedb.core.PluginParameter; 36 37 import net.sf.basedb.core.Protocol; 37 import net.sf.basedb.core.ProtocolType;38 38 import net.sf.basedb.core.Sample; 39 39 import net.sf.basedb.core.SystemItems; … … 290 290 { 291 291 String nameOrId = protocolMapper.getValue(data); 292 ProtocolType type = ProtocolType.getById(dc,293 SystemItems.getId(sample.isPooled() ? Protocol Type.POOLING : ProtocolType.SAMPLING));292 ItemSubtype type = ItemSubtype.getById(dc, 293 SystemItems.getId(sample.isPooled() ? Protocol.POOLING : Protocol.SAMPLING)); 294 294 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 295 295 if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol); -
trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java
r5612 r5630 29 29 import net.sf.basedb.core.Item; 30 30 import net.sf.basedb.core.ItemQuery; 31 import net.sf.basedb.core.ItemSubtype; 31 32 import net.sf.basedb.core.Path; 32 33 import net.sf.basedb.core.PathParameterType; 33 34 import net.sf.basedb.core.PluginParameter; 34 35 import net.sf.basedb.core.Protocol; 35 import net.sf.basedb.core.ProtocolType;36 36 import net.sf.basedb.core.Scan; 37 37 import net.sf.basedb.core.SystemItems; … … 273 273 { 274 274 String nameOrId = protocolMapper.getValue(data); 275 ProtocolType type = ProtocolType.getById(dc, SystemItems.getId(ProtocolType.SCANNING));275 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Protocol.SCANNING)); 276 276 Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type); 277 277 if (nameOrId == null || protocol != null) scan.setProtocol(protocol); … … 280 280 { 281 281 String nameOrId = hardwareMapper.getValue(data); 282 Hardware scanner = findScanner(dc, FallbackIdMethod.NAME_OR_ID, nameOrId); 282 ItemSubtype type = ItemSubtype.getById(dc, SystemItems.getId(Hardware.SCANNER)); 283 Hardware scanner = findHardware(dc, FallbackIdMethod.NAME_OR_ID, nameOrId, type); 283 284 if (nameOrId == null || scanner != null) scan.setScanner(scanner); 284 285 } -
trunk/src/test/TestAll.java
r5616 r5630 61 61 results.put("TestPath", TestPath.test_all()); 62 62 results.put("TestDirectory", TestDirectory.test_all()); 63 results.put("TestFileType", TestFileType.test_all());64 63 results.put("TestFileServer", TestFileServer.test_all()); 65 64 results.put("TestFile", TestFile.test_all()); … … 67 66 results.put("TestPackedFileExporter", TestPackedFileExporter.test_all()); 68 67 69 // Hardware, software, protocols70 results.put("TestHardwareType", TestHardwareType.test_all());68 // Item types, Hardware, software, protocols 69 results.put("TestItemSubtype", TestItemSubtype.test_all()); 71 70 results.put("TestHardware", TestHardware.test_all()); 72 results.put("TestSoftwareType", TestSoftwareType.test_all());73 71 results.put("TestSoftware", TestSoftware.test_all()); 74 results.put("TestProtocolType", TestProtocolType.test_all());75 72 results.put("TestProtocol", TestProtocol.test_all()); 76 73 -
trunk/src/test/TestBasicAnalysis.java
r5230 r5630 36 36 import net.sf.basedb.core.FileSetMember; 37 37 import net.sf.basedb.core.FileStoreUtil; 38 import net.sf.basedb.core.FileType;39 38 import net.sf.basedb.core.FilterBatcher; 40 39 import net.sf.basedb.core.Formula; 41 40 import net.sf.basedb.core.IntensityTransform; 42 41 import net.sf.basedb.core.ItemResultList; 42 import net.sf.basedb.core.ItemSubtype; 43 43 import net.sf.basedb.core.Path; 44 44 import net.sf.basedb.core.PositionExtraValueBatcher; … … 351 351 File f = File.getByPath(dc, new Path(path, Path.Type.FILE), true); 352 352 f.setMimeType("text/plain"); 353 f.set FileType(FileType.getById(dc, SystemItems.getId(FileType.SPOT_DATA)));353 f.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(File.SPOT_DATA))); 354 354 if (!f.isInDatabase()) dc.saveItem(f); 355 355 FileStoreUtil.setDataFile(dc, bas, DataFileType.GENERIC_SPOT_DATA, f); -
trunk/src/test/TestBioPlate.java
r5456 r5630 28 28 import net.sf.basedb.core.Extract; 29 29 import net.sf.basedb.core.Hardware; 30 import net.sf.basedb.core.HardwareType;31 30 import net.sf.basedb.core.Item; 32 31 import net.sf.basedb.core.ItemProxy; … … 37 36 import net.sf.basedb.core.Permission; 38 37 import net.sf.basedb.core.PlateGeometry; 39 import net.sf.basedb.core.Protocol Type;38 import net.sf.basedb.core.Protocol; 40 39 import net.sf.basedb.core.Sample; 41 40 import net.sf.basedb.core.SystemItems; … … 77 76 int labelId = TestLabel.test_create(true); 78 77 int labeledExtractId = TestLabeledExtract.test_create(extractId, labelId, true); 79 int freezerId = TestHardware.test_create(SystemItems.getId(Hardware Type.FREEZER), null, false);80 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.SAMPLING),78 int freezerId = TestHardware.test_create(SystemItems.getId(Hardware.FREEZER), null, false); 79 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SAMPLING), 81 80 "A plate event protocol", false); 82 int hybProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.HYBRIDIZATION),81 int hybProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.HYBRIDIZATION), 83 82 "A hyb event protocol", false); 84 83 -
trunk/src/test/TestBioPlateEvent.java
r5525 r5630 32 32 import net.sf.basedb.core.Extract; 33 33 import net.sf.basedb.core.Hardware; 34 import net.sf.basedb.core.HardwareType;35 34 import net.sf.basedb.core.Item; 36 35 import net.sf.basedb.core.ItemProxy; … … 39 38 import net.sf.basedb.core.Permission; 40 39 import net.sf.basedb.core.Protocol; 41 import net.sf.basedb.core.ProtocolType;42 40 import net.sf.basedb.core.Sample; 43 41 import net.sf.basedb.core.SystemItems; … … 83 81 int sampleId3 = TestSample.test_create(0, "Ref.s3", false); 84 82 85 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.EXTRACTION), "Extract on plate", false);86 int hardwareId = TestHardware.test_create(SystemItems.getId(Hardware Type.OTHER), "Extraction bot", false);83 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.EXTRACTION), "Extract on plate", false); 84 int hardwareId = TestHardware.test_create(SystemItems.getId(Hardware.OTHER), "Extraction bot", false); 87 85 88 86 // Place the biomaterial on a plate using an event -
trunk/src/test/TestDataFileType.java
r5340 r5630 26 26 import net.sf.basedb.core.DbControl; 27 27 import net.sf.basedb.core.DataFileType; 28 import net.sf.basedb.core.File Type;28 import net.sf.basedb.core.File; 29 29 import net.sf.basedb.core.Item; 30 30 import net.sf.basedb.core.ItemProxy; 31 31 import net.sf.basedb.core.ItemResultList; 32 import net.sf.basedb.core.ItemSubtype; 32 33 import net.sf.basedb.core.Permission; 33 34 import net.sf.basedb.core.PlatformVariant; … … 54 55 test_load(SystemItems.getId("affymetrix.cel")); 55 56 56 int id1 = test_create("Test file type", "test.filetype", Item.RAWBIOASSAY, SystemItems.getId(File Type.RAW_DATA));57 int id1 = test_create("Test file type", "test.filetype", Item.RAWBIOASSAY, SystemItems.getId(File.RAW_DATA)); 57 58 test_list(); 58 59 … … 72 73 { 73 74 dc = TestUtil.getDbControl(); 74 FileType genericType = genericTypeId == 0 ? null : FileType.getById(dc, genericTypeId);75 ItemSubtype genericType = genericTypeId == 0 ? null : ItemSubtype.getById(dc, genericTypeId); 75 76 DataFileType type = DataFileType.getNew(dc, externalId, itemType); 76 77 type.setGenericType(genericType); -
trunk/src/test/TestFile.java
r5362 r5630 315 315 { 316 316 if (!TestUtil.getSilent()) System.out.println(i+":\t"+fi.getId()+"\t"+fi.getName()+"\t"+fi.getDescription()+"\t"+ 317 fi.get FileType()+"\t"+fi.isUsed()+"\t"+fi.getLocation()+"\t"+fi.getAction()+"\t"+317 fi.getItemSubtype()+"\t"+fi.isUsed()+"\t"+fi.getLocation()+"\t"+fi.getAction()+"\t"+ 318 318 fi.getSize()+"\t" + fi.getCompressedSize() + "\t"+fi.getMimeType()+"\t"+ 319 319 fi.getCharacterSet()+"\t"+fi.getPath()); -
trunk/src/test/TestGenericOverview.java
r4768 r5630 25 25 import net.sf.basedb.core.DataFileType; 26 26 import net.sf.basedb.core.DbControl; 27 import net.sf.basedb.core.Hardware Type;27 import net.sf.basedb.core.Hardware; 28 28 import net.sf.basedb.core.Item; 29 29 import net.sf.basedb.core.Platform; 30 import net.sf.basedb.core.Protocol Type;30 import net.sf.basedb.core.Protocol; 31 31 import net.sf.basedb.core.Quantity; 32 32 import net.sf.basedb.core.SessionControl; 33 import net.sf.basedb.core.Software Type;33 import net.sf.basedb.core.Software; 34 34 import net.sf.basedb.core.SystemItems; 35 35 import net.sf.basedb.core.Type; … … 62 62 // Protocols 63 63 int scanningProtocol = TestProtocol.test_create( 64 SystemItems.getId(Protocol Type.SCANNING), "Scan protocol", false);64 SystemItems.getId(Protocol.SCANNING), "Scan protocol", false); 65 65 int featureProtocol = TestProtocol.test_create( 66 SystemItems.getId(Protocol Type.FEATURE_EXTRACTION), "Feature protocol", false);66 SystemItems.getId(Protocol.FEATURE_EXTRACTION), "Feature protocol", false); 67 67 int power = SystemItems.getId(Quantity.POWER); 68 68 int milliWatt = TestUnit.test_load_by_symbol(power, "mW"); … … 73 73 // Hardware and software 74 74 int scanner = TestHardware.test_create( 75 SystemItems.getId(Hardware Type.SCANNER), "Overview scanner", false);75 SystemItems.getId(Hardware.SCANNER), "Overview scanner", false); 76 76 int software = TestSoftware.test_create( 77 SystemItems.getId(Software Type.FEATURE_EXTRACTION), "Overview software", false);77 SystemItems.getId(Software.FEATURE_EXTRACTION), "Overview software", false); 78 78 79 79 // Data files -
trunk/src/test/TestHardware.java
r5340 r5630 5 5 import net.sf.basedb.core.DbControl; 6 6 import net.sf.basedb.core.Hardware; 7 import net.sf.basedb.core.HardwareType;8 7 import net.sf.basedb.core.Item; 9 8 import net.sf.basedb.core.ItemProxy; 9 import net.sf.basedb.core.ItemSubtype; 10 10 import net.sf.basedb.core.Permission; 11 11 import net.sf.basedb.core.ItemResultList; … … 52 52 write_header(); 53 53 // Standard tests: create, load, list 54 int id = test_create(SystemItems.getId(Hardware Type.SCANNER), null, true);55 int id2 = test_create(SystemItems.getId(Hardware Type.SCANNER), null, false);54 int id = test_create(SystemItems.getId(Hardware.SCANNER), null, true); 55 int id2 = test_create(SystemItems.getId(Hardware.SCANNER), null, false); 56 56 test_load(id); 57 57 test_list(); … … 75 75 { 76 76 dc = TestUtil.getDbControl(); 77 HardwareType ht = HardwareType.getById(dc, hardwaretypeId); 78 Hardware hw = ht.newHardware(); 77 Hardware hw = Hardware.getNew(dc); 78 if (hardwaretypeId > 0) 79 { 80 hw.setItemSubtype(ItemSubtype.getById(dc, hardwaretypeId)); 81 } 79 82 if (setAll) 80 83 { … … 194 197 { 195 198 if (!TestUtil.getSilent()) System.out.println(i+":\t"+hw.getId()+"\t"+hw.getName()+"\t"+ 196 hw.getDescription()+"\t"+hw.get HardwareType().getName()+"\t"+hw.getVersionString());199 hw.getDescription()+"\t"+hw.getItemSubtype()+"\t"+hw.getVersionString()); 197 200 } 198 201 static void write(String message) -
trunk/src/test/TestIlluminaImporter.java
r5319 r5630 45 45 int hybId = TestHybridization.test_create(0, false, new int[] {}); 46 46 int scanId = TestScan.test_create(hybId, 0, 0, false); 47 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.FEATURE_EXTRACTION), null, false);48 int softwareId = TestSoftware.test_create(SystemItems.getId(Software Type.FEATURE_EXTRACTION), null, false);47 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.FEATURE_EXTRACTION), null, false); 48 int softwareId = TestSoftware.test_create(SystemItems.getId(Software.FEATURE_EXTRACTION), null, false); 49 49 int experimentId = TestExperiment.test_create("illumina", false); 50 50 -
trunk/src/test/TestItemImporter.java
r5445 r5630 24 24 import net.sf.basedb.core.DbControl; 25 25 import net.sf.basedb.core.File; 26 import net.sf.basedb.core.Hardware Type;26 import net.sf.basedb.core.Hardware; 27 27 import net.sf.basedb.core.Item; 28 28 import net.sf.basedb.core.Job; … … 33 33 import net.sf.basedb.core.PluginParameter; 34 34 import net.sf.basedb.core.PluginResponse; 35 import net.sf.basedb.core.Protocol Type;35 import net.sf.basedb.core.Protocol; 36 36 import net.sf.basedb.core.RequestInformation; 37 import net.sf.basedb.core.Software Type;37 import net.sf.basedb.core.Software; 38 38 import net.sf.basedb.core.SystemItems; 39 39 import net.sf.basedb.core.plugin.GuiContext; … … 58 58 59 59 // Create referenced items 60 int samplingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.SAMPLING), "Sampling", false);61 int extractionProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.EXTRACTION), "Extraction", false);62 int labelingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.LABELING), "Labeling", false);63 int poolingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.POOLING), "Pooling", false);64 int hybProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.HYBRIDIZATION), "Hybridization", false);65 int hybStationId = TestHardware.test_create(SystemItems.getId(Hardware Type.HYBRIDIZATION_STATION), "Hybstation", false);66 int scanProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.SCANNING), "Scanning", false);67 int scannerId = TestHardware.test_create(SystemItems.getId(Hardware Type.SCANNER), "Scanner", false);68 int featureProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.FEATURE_EXTRACTION), "Feature", false);69 int featureSoftwareId = TestSoftware.test_create(SystemItems.getId(Software Type.FEATURE_EXTRACTION), "Feature", false);60 int samplingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SAMPLING), "Sampling", false); 61 int extractionProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.EXTRACTION), "Extraction", false); 62 int labelingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.LABELING), "Labeling", false); 63 int poolingProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.POOLING), "Pooling", false); 64 int hybProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.HYBRIDIZATION), "Hybridization", false); 65 int hybStationId = TestHardware.test_create(SystemItems.getId(Hardware.HYBRIDIZATION_STATION), "Hybstation", false); 66 int scanProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SCANNING), "Scanning", false); 67 int scannerId = TestHardware.test_create(SystemItems.getId(Hardware.SCANNER), "Scanner", false); 68 int featureProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.FEATURE_EXTRACTION), "Feature", false); 69 int featureSoftwareId = TestSoftware.test_create(SystemItems.getId(Software.FEATURE_EXTRACTION), "Feature", false); 70 70 int genericId = TestPlatform.test_get(Platform.GENERIC); 71 71 int variantId = TestPlatform.test_create_variant(genericId, "Variant", "test.variant", null, 0, null); 72 int robotId = TestHardware.test_create(SystemItems.getId(Hardware Type.PRINT_ROBOT), "Robot", false);73 int printProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.PRINTING), "Printing", false);74 int freezerId = TestHardware.test_create(SystemItems.getId(Hardware Type.FREEZER), "Freezer", false);72 int robotId = TestHardware.test_create(SystemItems.getId(Hardware.PRINT_ROBOT), "Robot", false); 73 int printProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.PRINTING), "Printing", false); 74 int freezerId = TestHardware.test_create(SystemItems.getId(Hardware.FREEZER), "Freezer", false); 75 75 76 76 // Import bioplates -
trunk/src/test/TestPlate.java
r5340 r5630 58 58 59 59 // Test events 60 int protocolTypeId = Test ProtocolType.test_create(false);60 int protocolTypeId = TestItemSubtype.test_create(Item.PROTOCOL, "Plate protocol type"); 61 61 int protocolId = TestProtocol.test_create(protocolTypeId, null, false); 62 62 int eventTypeId = TestPlateType.test_create_event_type(plateTypeId, protocolTypeId); … … 68 68 TestPlateType.test_delete_event_type(eventTypeId); 69 69 TestProtocol.test_delete(protocolId); 70 Test ProtocolType.test_delete(protocolTypeId);70 TestItemSubtype.test_delete(protocolTypeId); 71 71 72 72 // Standard test: Delete -
trunk/src/test/TestPlateType.java
r5340 r5630 50 50 51 51 // Test events 52 int protocolTypeId = Test ProtocolType.test_create(false);52 int protocolTypeId = TestItemSubtype.test_create(Item.PROTOCOL, "Plate protocol type"); 53 53 int eventTypeId = test_create_event_type(id, protocolTypeId); 54 54 test_list_event_types(id, 1); … … 56 56 if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); 57 57 test_delete_event_type(eventTypeId); 58 Test ProtocolType.test_delete(protocolTypeId);58 TestItemSubtype.test_delete(protocolTypeId); 59 59 60 60 // Standard test: Delete … … 223 223 pet.setDescription("Added at "+new Date()); 224 224 pet.setOrdinal(1); 225 if (protocolTypeId != 0) pet.setProtocolType( ProtocolType.getById(dc, protocolTypeId));225 if (protocolTypeId != 0) pet.setProtocolType(ItemSubtype.getById(dc, protocolTypeId)); 226 226 dc.saveItem(pet); 227 227 dc.commit(); -
trunk/src/test/TestPlatform.java
r5340 r5630 26 26 import net.sf.basedb.core.DbControl; 27 27 import net.sf.basedb.core.DataFileType; 28 import net.sf.basedb.core.File Type;28 import net.sf.basedb.core.File; 29 29 import net.sf.basedb.core.Item; 30 30 import net.sf.basedb.core.ItemProxy; … … 69 69 70 70 // File types 71 int fileTypeId = TestDataFileType.test_create("test.datafile", "test.datafile", Item.RAWBIOASSAY, SystemItems.getId(File Type.RAW_DATA));71 int fileTypeId = TestDataFileType.test_create("test.datafile", "test.datafile", Item.RAWBIOASSAY, SystemItems.getId(File.RAW_DATA)); 72 72 int celId = TestDataFileType.get_id_for_external("affymetrix.cel"); 73 73 int cdfId = TestDataFileType.get_id_for_external("affymetrix.cdf"); -
trunk/src/test/TestProject.java
r5368 r5630 73 73 // Extra test: set default item. 74 74 int samplingId = TestProtocol.test_create( 75 SystemItems.getId(Protocol Type.SAMPLING), "Sampling protocol", false);75 SystemItems.getId(Protocol.SAMPLING), "Sampling protocol", false); 76 76 int hybStationId = TestHardware.test_create( 77 SystemItems.getId(Hardware Type.HYBRIDIZATION_STATION), "Hyb station", false);77 SystemItems.getId(Hardware.HYBRIDIZATION_STATION), "Hyb station", false); 78 78 test_defaultItem(id, Project.Default.SAMPLING_PROTOCOL, samplingId); 79 79 test_defaultItem(id, Project.Default.HYBRIDIZATION_HARDWARE, hybStationId); -
trunk/src/test/TestProtocol.java
r5340 r5630 7 7 import net.sf.basedb.core.File; 8 8 import net.sf.basedb.core.ItemProxy; 9 import net.sf.basedb.core.ItemSubtype; 9 10 import net.sf.basedb.core.Protocol; 10 import net.sf.basedb.core.ProtocolType;11 11 import net.sf.basedb.core.ItemResultList; 12 12 import net.sf.basedb.core.SystemItems; … … 52 52 write_header(); 53 53 // Standard tests: create, load, list 54 int id1 = test_create(SystemItems.getId(Protocol Type.SAMPLING), null, true);55 int id2 = test_create(SystemItems.getId(Protocol Type.LABELING), null, false);54 int id1 = test_create(SystemItems.getId(Protocol.SAMPLING), null, true); 55 int id2 = test_create(SystemItems.getId(Protocol.LABELING), null, false); 56 56 test_load(id1); 57 57 test_list(); … … 79 79 { 80 80 dc = TestUtil.getDbControl(); 81 ProtocolType pt = ProtocolType.getById(dc, protocoltypeId); 82 Protocol p = Protocol.getNew(dc, pt); 81 Protocol p = Protocol.getNew(dc); 82 if (protocoltypeId > 0) 83 { 84 p.setItemSubtype(ItemSubtype.getById(dc, protocoltypeId)); 85 } 83 86 if(setAll) 84 87 { … … 202 205 { 203 206 if (!TestUtil.getSilent()) 204 write(i+":\t"+p.getId()+"\t"+p.getName()+"\t"+p.getDescription()+"\t"+p.get ProtocolType().getName()+207 write(i+":\t"+p.getId()+"\t"+p.getName()+"\t"+p.getDescription()+"\t"+p.getItemSubtype()+ 205 208 "\t" + p.getExternalId() + "\t"+p.getFile()); 206 209 } -
trunk/src/test/TestRawBioAssay.java
r5340 r5630 66 66 "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4); 67 67 68 int softwareId = TestSoftware.test_create(SystemItems.getId(Software Type.FEATURE_EXTRACTION), null, false);69 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.FEATURE_EXTRACTION), null, false);68 int softwareId = TestSoftware.test_create(SystemItems.getId(Software.FEATURE_EXTRACTION), null, false); 69 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.FEATURE_EXTRACTION), null, false); 70 70 71 71 // Standard tests: create, load, list -
trunk/src/test/TestScan.java
r5340 r5630 44 44 45 45 int hybridizationId = TestHybridization.test_create(0, false); 46 int scannerId = TestHardware.test_create(SystemItems.getId(Hardware Type.SCANNER), null, false);47 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol Type.SCANNING), null, false);46 int scannerId = TestHardware.test_create(SystemItems.getId(Hardware.SCANNER), null, false); 47 int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SCANNING), null, false); 48 48 49 49 // Standard tests: create, load, list -
trunk/src/test/TestSoftware.java
r5340 r5630 6 6 import net.sf.basedb.core.Item; 7 7 import net.sf.basedb.core.ItemProxy; 8 import net.sf.basedb.core.ItemSubtype; 8 9 import net.sf.basedb.core.Permission; 9 10 import net.sf.basedb.core.ItemResultList; 10 11 import net.sf.basedb.core.Software; 11 import net.sf.basedb.core.SoftwareType;12 12 import net.sf.basedb.core.SystemItems; 13 13 … … 51 51 write_header(); 52 52 // Standard tests: create, load, list 53 int id1 = test_create(SystemItems.getId(Software Type.FEATURE_EXTRACTION),null, true);54 int id2 = test_create(SystemItems.getId(Software Type.FEATURE_EXTRACTION), null, false);53 int id1 = test_create(SystemItems.getId(Software.FEATURE_EXTRACTION),null, true); 54 int id2 = test_create(SystemItems.getId(Software.FEATURE_EXTRACTION), null, false); 55 55 test_load(id1); 56 56 test_list(); … … 74 74 { 75 75 dc = TestUtil.getDbControl(); 76 SoftwareType st = SoftwareType.getById(dc, softwareTypeId); 77 Software sw = Software.getNew(dc, st); 76 Software sw = Software.getNew(dc); 77 if (softwareTypeId > 0) 78 { 79 sw.setItemSubtype(ItemSubtype.getById(dc, softwareTypeId)); 80 } 78 81 if (setAll) 79 82 { … … 192 195 throws BaseException 193 196 { 194 if (!TestUtil.getSilent()) System.out.println(i+":\t"+sw.getId()+"\t"+sw.getName()+"\t"+sw.getDescription()+"\t"+sw.getVersionString()+"\t"+sw.getSoftwareType().getName()); 197 if (!TestUtil.getSilent()) 198 { 199 System.out.println(i+":\t"+sw.getId()+"\t"+sw.getName()+"\t"+sw.getDescription()+"\t"+ 200 sw.getVersionString()+"\t"+sw.getItemSubtype()); 201 } 195 202 } 196 203 static void write(String message) -
trunk/src/test/net/sf/basedb/test/FileUtil.java
r5623 r5630 34 34 import net.sf.basedb.core.FileStoreEnabled; 35 35 import net.sf.basedb.core.FileStoreUtil; 36 import net.sf.basedb.core. FileType;36 import net.sf.basedb.core.ItemSubtype; 37 37 import net.sf.basedb.core.Nameable; 38 38 import net.sf.basedb.core.SystemItems; … … 83 83 if (fileTypeId != null) 84 84 { 85 file.set FileType(FileType.getById(dc, SystemItems.getId(fileTypeId)));85 file.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(fileTypeId))); 86 86 } 87 87 if (!file.isInDatabase()) -
trunk/src/test/net/sf/basedb/test/performance/PrepareTest.java
r4514 r5630 32 32 import net.sf.basedb.core.File; 33 33 import net.sf.basedb.core.FileParameterType; 34 import net.sf.basedb.core.FileType;35 34 import net.sf.basedb.core.ItemParameterType; 36 35 import net.sf.basedb.core.ItemQuery; … … 104 103 105 104 // Upload files 106 reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File Type.REPORTER);107 rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", File Type.RAW_DATA);108 rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", File Type.RAW_DATA);105 reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.REPORTER); 106 rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", File.RAW_DATA); 107 rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", File.RAW_DATA); 109 108 110 109 // Create importers -
trunk/src/test/net/sf/basedb/test/roles/AdminTest.java
r5327 r5630 32 32 import net.sf.basedb.core.Directory; 33 33 import net.sf.basedb.core.File; 34 import net.sf.basedb.core.FileType;35 34 import net.sf.basedb.core.Group; 36 35 import net.sf.basedb.core.MultiPermissions; … … 140 139 //Upload file with reporters 141 140 dc = TestUtil.getDbControl(); 142 File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File Type.PLATE);143 File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", File Type.REPORTER);141 File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.PLATE); 142 File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", File.REPORTER); 144 143 dc.commit(); 145 144 -
trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java
r5623 r5630 37 37 import net.sf.basedb.core.File; 38 38 import net.sf.basedb.core.FileParameterType; 39 import net.sf.basedb.core.FileType;40 39 import net.sf.basedb.core.Group; 41 40 import net.sf.basedb.core.Hardware; 42 import net.sf.basedb.core.HardwareType;43 41 import net.sf.basedb.core.IntegerParameterType; 44 42 import net.sf.basedb.core.Item; 45 43 import net.sf.basedb.core.ItemParameterType; 44 import net.sf.basedb.core.ItemSubtype; 46 45 import net.sf.basedb.core.Job; 47 46 import net.sf.basedb.core.Permission; … … 54 53 import net.sf.basedb.core.Project; 55 54 import net.sf.basedb.core.Protocol; 56 import net.sf.basedb.core.ProtocolType;57 55 import net.sf.basedb.core.Quantity; 58 56 import net.sf.basedb.core.RawDataType; 59 57 import net.sf.basedb.core.RawDataTypes; 60 58 import net.sf.basedb.core.Software; 61 import net.sf.basedb.core.SoftwareType;62 59 import net.sf.basedb.core.StringParameterType; 63 60 import net.sf.basedb.core.SystemItems; … … 141 138 142 139 // Protocols, hardware and software 143 Protocol sampling = createProtocol(dc, "Sampling A", Protocol Type.SAMPLING);144 Protocol extraction = createProtocol(dc, "Extraction A", Protocol Type.EXTRACTION);145 Protocol labeling = createProtocol(dc, "Labeling A", Protocol Type.LABELING);146 Protocol hybridization = createProtocol(dc, "Hybridization A", Protocol Type.HYBRIDIZATION);147 Protocol scanning = createProtocol(dc, "Scanning A", Protocol Type.SCANNING, pmtGain);148 Protocol feature = createProtocol(dc, "Feature extraction A", Protocol Type.FEATURE_EXTRACTION);149 Protocol printing = createProtocol(dc, "Printing A", Protocol Type.PRINTING);150 151 Hardware hybStation = createHardware(dc, "Hybridization station A", Hardware Type.HYBRIDIZATION_STATION);152 Hardware robot = createHardware(dc, "Print robot A", Hardware Type.PRINT_ROBOT);153 Hardware scanner = createHardware(dc, "Scanner A", Hardware Type.SCANNER);154 Software software = createSoftware(dc, "Software A", Software Type.FEATURE_EXTRACTION);140 Protocol sampling = createProtocol(dc, "Sampling A", Protocol.SAMPLING); 141 Protocol extraction = createProtocol(dc, "Extraction A", Protocol.EXTRACTION); 142 Protocol labeling = createProtocol(dc, "Labeling A", Protocol.LABELING); 143 Protocol hybridization = createProtocol(dc, "Hybridization A", Protocol.HYBRIDIZATION); 144 Protocol scanning = createProtocol(dc, "Scanning A", Protocol.SCANNING, pmtGain); 145 Protocol feature = createProtocol(dc, "Feature extraction A", Protocol.FEATURE_EXTRACTION); 146 Protocol printing = createProtocol(dc, "Printing A", Protocol.PRINTING); 147 148 Hardware hybStation = createHardware(dc, "Hybridization station A", Hardware.HYBRIDIZATION_STATION); 149 Hardware robot = createHardware(dc, "Print robot A", Hardware.PRINT_ROBOT); 150 Hardware scanner = createHardware(dc, "Scanner A", Hardware.SCANNER); 151 Software software = createSoftware(dc, "Software A", Software.FEATURE_EXTRACTION); 155 152 156 153 PlateType plateType = createPlateType(dc, "Plate type A", 16, 24); … … 181 178 dc = TestUtil.getDbControl(); 182 179 183 File plates = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File Type.PLATE);184 File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", File Type.PRINT_MAP);185 File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", File Type.REPORTER_MAP);180 File plates = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", File.PLATE); 181 File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", File.PRINT_MAP); 182 File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", File.REPORTER_MAP); 186 183 File batchImportFile_ArrayBatch = null; 187 184 File batchImportFile_ArrayDesign = null; … … 297 294 { 298 295 TestUtil.write("--Creating protocol: " + name + "\n"); 299 ProtocolType pt = ProtocolType.getById(dc, SystemItems.getId(type)); 300 Protocol p = Protocol.getNew(dc, pt); 296 ItemSubtype pt = ItemSubtype.getById(dc, SystemItems.getId(type)); 297 Protocol p = Protocol.getNew(dc); 298 p.setItemSubtype(pt); 301 299 p.setName(name); 302 300 if (parameters != null) … … 317 315 { 318 316 TestUtil.write("--Creating hardware: " + name + "\n"); 319 HardwareType ht = HardwareType.getById(dc, SystemItems.getId(type)); 320 Hardware hw = Hardware.getNew(dc, ht); 317 ItemSubtype ht = ItemSubtype.getById(dc, SystemItems.getId(type)); 318 Hardware hw = Hardware.getNew(dc); 319 hw.setItemSubtype(ht); 321 320 hw.setName(name); 322 321 dc.saveItem(hw); … … 330 329 { 331 330 TestUtil.write("--Creating software: " + name + "\n"); 332 SoftwareType st = SoftwareType.getById(dc, SystemItems.getId(type)); 333 Software sw = Software.getNew(dc, st); 331 ItemSubtype st = ItemSubtype.getById(dc, SystemItems.getId(type)); 332 Software sw = Software.getNew(dc); 333 sw.setItemSubtype(st); 334 334 sw.setName(name); 335 335 dc.saveItem(sw); -
trunk/src/test/net/sf/basedb/test/roles/UserTest.java
r5623 r5630 37 37 import net.sf.basedb.core.File; 38 38 import net.sf.basedb.core.FileParameterType; 39 import net.sf.basedb.core.FileType;40 39 import net.sf.basedb.core.Hybridization; 41 40 import net.sf.basedb.core.Include; … … 155 154 156 155 // Upload raw data files 157 File rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", File Type.RAW_DATA);158 File rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", File Type.RAW_DATA);159 File rawData1DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.dyeswap.gpr", File Type.RAW_DATA);160 File rawData2DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.dyeswap.gpr", File Type.RAW_DATA);161 162 File affy1 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1761.cel.tar.bz2", File Type.RAW_DATA);163 File affy2 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1762.cel.tar.bz2", File Type.RAW_DATA);164 File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", File Type.RAW_DATA);156 File rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", File.RAW_DATA); 157 File rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", File.RAW_DATA); 158 File rawData1DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.dyeswap.gpr", File.RAW_DATA); 159 File rawData2DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.dyeswap.gpr", File.RAW_DATA); 160 161 File affy1 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1761.cel.tar.bz2", File.RAW_DATA); 162 File affy2 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1762.cel.tar.bz2", File.RAW_DATA); 163 File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", File.RAW_DATA); 165 164 dc.commit(); 166 165 -
trunk/www/admin/datafiletypes/edit_filetype.jsp
r5623 r5630 32 32 import="net.sf.basedb.core.Permission" 33 33 import="net.sf.basedb.core.DataFileType" 34 import="net.sf.basedb.core. FileType"34 import="net.sf.basedb.core.ItemSubtype" 35 35 import="net.sf.basedb.core.ItemResultList" 36 36 import="net.sf.basedb.core.ItemQuery" … … 73 73 if (currentFileTypeId == 0) 74 74 { 75 currentFileTypeId = Values.getInt(cc.getRecent(Item. FILETYPE.name(), 0), 0);75 currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0); 76 76 } 77 77 } … … 84 84 try 85 85 { 86 FileType ft = fileType.getGenericType();86 ItemSubtype ft = fileType.getGenericType(); 87 87 if (ft != null) currentFileTypeId = ft.getId(); 88 88 } … … 93 93 } 94 94 // Query to retrieve file types 95 final ItemQuery< FileType> fileTypeQuery = FileType.getQuery();95 final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(Item.FILE); 96 96 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 97 97 fileTypeQuery.setCacheResult(true); … … 223 223 <option value="0">- none - 224 224 <% 225 ItemResultList< FileType> fileTypes = fileTypeQuery.list(dc);226 for ( FileType ft : fileTypes)225 ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); 226 for (ItemSubtype ft : fileTypes) 227 227 { 228 228 int id = ft.getId(); -
trunk/www/admin/datafiletypes/index.jsp
r5623 r5630 29 29 import="net.sf.basedb.core.Include" 30 30 import="net.sf.basedb.core.DataFileType" 31 import="net.sf.basedb.core. FileType"31 import="net.sf.basedb.core.ItemSubtype" 32 32 import="net.sf.basedb.core.ItemQuery" 33 33 import="net.sf.basedb.core.Permission" … … 156 156 if (genericTypeId >= 0) // < 0 = denied or unchanged 157 157 { 158 FileType ft = genericTypeId == 0 ? null : FileType.getById(dc, genericTypeId);158 ItemSubtype ft = genericTypeId == 0 ? null : ItemSubtype.getById(dc, genericTypeId); 159 159 fileType.setGenericType(ft); 160 160 if (ft != null) cc.setRecent(ft, maxRecent); -
trunk/www/admin/datafiletypes/list_filetypes.jsp
r5623 r5630 28 28 import="net.sf.basedb.core.Item" 29 29 import="net.sf.basedb.core.DataFileType" 30 import="net.sf.basedb.core. FileType"30 import="net.sf.basedb.core.ItemSubtype" 31 31 import="net.sf.basedb.core.PlatformFileType" 32 32 import="net.sf.basedb.core.Platform" … … 102 102 103 103 // Get all file types 104 final ItemQuery< FileType> typeQuery = FileType.getQuery();104 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.FILE); 105 105 typeQuery.order(Orders.asc(Hql.property("name"))); 106 106 typeQuery.setCacheResult(true); 107 107 Enumeration<String, String> genericTypes = new Enumeration<String, String>(); 108 for ( FileType ft : typeQuery.list(dc))108 for (ItemSubtype ft : typeQuery.list(dc)) 109 109 { 110 110 genericTypes.add(Integer.toString(ft.getId()), ft.getName()); -
trunk/www/admin/hardware/edit_hardware.jsp
r5506 r5630 32 32 import="net.sf.basedb.core.Permission" 33 33 import="net.sf.basedb.core.Hardware" 34 import="net.sf.basedb.core. HardwareType"34 import="net.sf.basedb.core.ItemSubtype" 35 35 import="net.sf.basedb.core.ItemQuery" 36 36 import="net.sf.basedb.core.ItemResultList" … … 71 71 if (currentHardwareTypeId == 0) 72 72 { 73 int recentHardwareTypeId = Values.getInt(cc.getRecent(Item. HARDWARETYPE.name(), 0));74 currentHardwareTypeId = Values.getInt(cc.getPropertyValue(" hardwareType"), recentHardwareTypeId);73 int recentHardwareTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); 74 currentHardwareTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentHardwareTypeId); 75 75 } 76 76 } … … 82 82 try 83 83 { 84 HardwareType ht = hardware.getHardwareType();84 ItemSubtype ht = hardware.getItemSubtype(); 85 85 if (ht != null) currentHardwareTypeId = ht.getId(); 86 86 } … … 96 96 97 97 // Query to retrieve file types 98 final ItemQuery< HardwareType> hardwareTypeQuery = HardwareType.getQuery();98 final ItemQuery<ItemSubtype> hardwareTypeQuery = ItemSubtype.getQuery(itemType); 99 99 hardwareTypeQuery.order(Orders.asc(Hql.property("name"))); 100 100 … … 184 184 else 185 185 { 186 for ( HardwareType hardwareType : hardwareTypeQuery.list(dc))186 for (ItemSubtype hardwareType : hardwareTypeQuery.list(dc)) 187 187 { 188 188 int id = hardwareType.getId(); -
trunk/www/admin/hardware/index.jsp
r5590 r5630 30 30 import="net.sf.basedb.core.Include" 31 31 import="net.sf.basedb.core.Hardware" 32 import="net.sf.basedb.core. HardwareType"32 import="net.sf.basedb.core.ItemSubtype" 33 33 import="net.sf.basedb.core.ItemQuery" 34 34 import="net.sf.basedb.core.Permission" … … 60 60 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 61 61 <%! 62 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,version, hardwareType,description");62 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,version,itemSubtype,description"); 63 63 private static final Item itemType = Item.HARDWARE; 64 64 %> … … 135 135 dc = sc.newDbControl(); 136 136 Hardware hardware = (Hardware)cc.getObject("item"); 137 int hardwareTypeId = Values.getInt(request.getParameter("hardwaretype_id"), -1);138 137 if (hardware == null) 139 138 { 140 hardware = Hardware.getNew(dc , HardwareType.getById(dc, hardwareTypeId));139 hardware = Hardware.getNew(dc); 141 140 message = "Hardware created"; 142 141 dc.saveItem(hardware); … … 154 153 hardware.setVersionString(Values.getStringOrNull(request.getParameter("version"))); 155 154 hardware.setDescription(Values.getStringOrNull(request.getParameter("description"))); 155 int hardwareTypeId = Values.getInt(request.getParameter("hardwaretype_id"), -1); 156 156 if (hardwareTypeId >= 0) // < 0 = denied or unchanged 157 157 { 158 HardwareType hwt = hardwareTypeId == 0 ? null : HardwareType.getById(dc, hardwareTypeId);159 hardware.set HardwareType(hwt);158 ItemSubtype hwt = hardwareTypeId == 0 ? null : ItemSubtype.getById(dc, hardwareTypeId); 159 hardware.setItemSubtype(hwt); 160 160 if (hwt != null) cc.setRecent(hwt, maxRecent); 161 161 } -
trunk/www/admin/hardware/list_hardware.jsp
r5590 r5630 29 29 import="net.sf.basedb.core.Item" 30 30 import="net.sf.basedb.core.Hardware" 31 import="net.sf.basedb.core. HardwareType"31 import="net.sf.basedb.core.ItemSubtype" 32 32 import="net.sf.basedb.core.ItemQuery" 33 33 import="net.sf.basedb.core.Include" … … 83 83 Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); 84 84 85 final ItemQuery< HardwareType> typeQuery = HardwareType.getQuery();85 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.HARDWARE); 86 86 typeQuery.order(Orders.asc(Hql.property("name"))); 87 87 typeQuery.setCacheResult(true); … … 255 255 <% 256 256 Enumeration<String, String> hardwareTypes = new Enumeration<String, String>(); 257 for ( HardwareType st : typeQuery.list(dc))257 for (ItemSubtype st : typeQuery.list(dc)) 258 258 { 259 259 hardwareTypes.add(Integer.toString(st.getId()), HTML.encodeTags(st.getName())); … … 261 261 %> 262 262 <tbl:columndef 263 id=" hardwareType"264 property=" hardwareType"265 sortproperty=" hardwareType.name"266 exportproperty=" hardwareType.name"263 id="itemSubtype" 264 property="itemSubtype" 265 sortproperty="itemSubtype.name" 266 exportproperty="itemSubtype.name" 267 267 datatype="int" 268 268 enumeration="<%=hardwareTypes%>" … … 475 475 /></tbl:cell> 476 476 <tbl:cell column="version"><%=HTML.encodeTags(item.getVersionString())%></tbl:cell> 477 <tbl:cell column=" hardwareType"477 <tbl:cell column="itemSubtype" 478 478 ><base:propertyvalue 479 479 item="<%=item%>" 480 property=" hardwareType"480 property="itemSubtype" 481 481 enableEditLink="<%=mode.hasEditLink()%>" 482 482 enablePropertyLink="<%=mode.hasPropertyLink()%>" -
trunk/www/admin/hardware/view_hardware.jsp
r5507 r5630 34 34 import="net.sf.basedb.core.Permission" 35 35 import="net.sf.basedb.core.Hardware" 36 import="net.sf.basedb.core.HardwareType"37 36 import="net.sf.basedb.core.User" 38 37 import="net.sf.basedb.core.MultiPermissions" … … 248 247 <tr> 249 248 <td class="prompt">Type</td> 250 <td><base:propertyvalue item="<%=hardware%>" property=" hardwareType" /></td>249 <td><base:propertyvalue item="<%=hardware%>" property="itemSubtype" /></td> 251 250 </tr> 252 251 <tr> -
trunk/www/admin/mimetypes/edit_mimetype.jsp
r5629 r5630 33 33 import="net.sf.basedb.core.Permission" 34 34 import="net.sf.basedb.core.MimeType" 35 import="net.sf.basedb.core. FileType"35 import="net.sf.basedb.core.ItemSubtype" 36 36 import="net.sf.basedb.core.ItemQuery" 37 37 import="net.sf.basedb.core.ItemResultList" … … 73 73 if (currentFileTypeId == 0) 74 74 { 75 currentFileTypeId = Values.getInt(cc.getRecent(Item. FILETYPE.name(), 0), 0);75 currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0); 76 76 } 77 77 autoCompress = Values.getBoolean(cc.getPropertyValue("autoCompress"), autoCompress); … … 85 85 try 86 86 { 87 FileType ft = mimeType.getFileType();87 ItemSubtype ft = mimeType.getFileType(); 88 88 if (ft != null) currentFileTypeId = ft.getId(); 89 89 } … … 96 96 97 97 // Query to retrieve file types 98 final ItemQuery< FileType> fileTypeQuery = FileType.getQuery();98 final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(Item.FILE); 99 99 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 100 100 fileTypeQuery.setCacheResult(true); … … 193 193 <option value="0">- none - 194 194 <% 195 ItemResultList< FileType> fileTypes = fileTypeQuery.list(dc);196 for ( FileType fileType : fileTypes)195 ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); 196 for (ItemSubtype fileType : fileTypes) 197 197 { 198 198 int id = fileType.getId(); -
trunk/www/admin/mimetypes/index.jsp
r5590 r5630 30 30 import="net.sf.basedb.core.Include" 31 31 import="net.sf.basedb.core.MimeType" 32 import="net.sf.basedb.core. FileType"32 import="net.sf.basedb.core.ItemSubtype" 33 33 import="net.sf.basedb.core.ItemQuery" 34 34 import="net.sf.basedb.core.Permission" … … 154 154 if (fileTypeId >= 0) // < 0 = denied or unchanged 155 155 { 156 FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);156 ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId); 157 157 mimeType.setFileType(ft); 158 158 if (ft != null) cc.setRecent(ft, maxRecent); -
trunk/www/admin/mimetypes/list_mimetypes.jsp
r5590 r5630 29 29 import="net.sf.basedb.core.Item" 30 30 import="net.sf.basedb.core.MimeType" 31 import="net.sf.basedb.core. FileType"31 import="net.sf.basedb.core.ItemSubtype" 32 32 import="net.sf.basedb.core.ItemQuery" 33 33 import="net.sf.basedb.core.Include" … … 83 83 84 84 // Get all file types 85 final ItemQuery< FileType> typeQuery = FileType.getQuery();85 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.FILE); 86 86 typeQuery.order(Orders.asc(Hql.property("name"))); 87 87 typeQuery.setCacheResult(true); … … 246 246 Enumeration<String, String> fileTypes = new Enumeration<String, String>(); 247 247 fileTypes.add("", "- none -"); 248 for ( FileType ft : typeQuery.list(dc))248 for (ItemSubtype ft : typeQuery.list(dc)) 249 249 { 250 250 fileTypes.add(Integer.toString(ft.getId()), ft.getName()); -
trunk/www/admin/protocols/edit_protocol.jsp
r5506 r5630 32 32 import="net.sf.basedb.core.Permission" 33 33 import="net.sf.basedb.core.Protocol" 34 import="net.sf.basedb.core. ProtocolType"34 import="net.sf.basedb.core.ItemSubtype" 35 35 import="net.sf.basedb.core.AnnotationType" 36 36 import="net.sf.basedb.core.File" 37 import="net.sf.basedb.core.FileType"38 37 import="net.sf.basedb.core.SystemItems" 39 38 import="net.sf.basedb.core.ItemQuery" … … 83 82 if (currentProtocolTypeId == 0) 84 83 { 85 int recentProtocolTypeId = Values.getInt(cc.getRecent(Item. PROTOCOLTYPE.name(), 0));86 currentProtocolTypeId = Values.getInt(cc.getPropertyValue(" protocolType"), recentProtocolTypeId);84 int recentProtocolTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); 85 currentProtocolTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentProtocolTypeId); 87 86 } 88 87 cc.removeObject("item"); … … 96 95 try 97 96 { 98 ProtocolType pt = protocol.getProtocolType();97 ItemSubtype pt = protocol.getItemSubtype(); 99 98 if (pt != null) currentProtocolTypeId = pt.getId(); 100 99 } … … 118 117 119 118 // Query to retrieve protocol types 120 final ItemQuery< ProtocolType> protocolTypeQuery = ProtocolType.getQuery();119 final ItemQuery<ItemSubtype> protocolTypeQuery = ItemSubtype.getQuery(itemType); 121 120 protocolTypeQuery.include(Include.ALL); 122 121 protocolTypeQuery.order(Orders.asc(Hql.property("name"))); … … 184 183 var frm = document.forms['protocol']; 185 184 var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&title=Select+protocol&callback=setFileCallback'; 186 url += '&resetTemporary=1&tmpfilter:INT: fileType=<%=SystemItems.getId(FileType.PROTOCOL)%>';185 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(File.PROTOCOL)%>'; 187 186 if (frm.file_id.length > 1) 188 187 { … … 286 285 else 287 286 { 288 for ( ProtocolType protocolType : protocolTypeQuery.list(dc))287 for (ItemSubtype protocolType : protocolTypeQuery.list(dc)) 289 288 { 290 289 int id = protocolType.getId(); -
trunk/www/admin/protocols/index.jsp
r5590 r5630 30 30 import="net.sf.basedb.core.Include" 31 31 import="net.sf.basedb.core.Protocol" 32 import="net.sf.basedb.core. ProtocolType"32 import="net.sf.basedb.core.ItemSubtype" 33 33 import="net.sf.basedb.core.AnnotationType" 34 34 import="net.sf.basedb.core.File" … … 62 62 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 63 63 <%! 64 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name, protocolType,description");64 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,description"); 65 65 private static final Item itemType = Item.PROTOCOL; 66 66 %> … … 137 137 dc = sc.newDbControl(); 138 138 Protocol protocol = (Protocol)cc.getObject("item"); 139 int protocolTypeId = Values.getInt(request.getParameter("protocoltype_id"), -1);140 139 if (protocol == null) 141 140 { 142 protocol = Protocol.getNew(dc , ProtocolType.getById(dc, protocolTypeId));141 protocol = Protocol.getNew(dc); 143 142 message = "Protocol created"; 144 143 dc.saveItem(protocol); … … 156 155 protocol.setDescription(Values.getStringOrNull(request.getParameter("description"))); 157 156 protocol.setExternalId(Values.getStringOrNull(request.getParameter("external_id"))); 157 int protocolTypeId = Values.getInt(request.getParameter("protocoltype_id"), -1); 158 158 if (protocolTypeId >= 0) // < 0 = denied or unchanged 159 159 { 160 ProtocolType pt = protocolTypeId == 0 ? null : ProtocolType.getById(dc, protocolTypeId);161 protocol.set ProtocolType(pt);160 ItemSubtype pt = protocolTypeId == 0 ? null : ItemSubtype.getById(dc, protocolTypeId); 161 protocol.setItemSubtype(pt); 162 162 if (pt != null) cc.setRecent(pt, maxRecent); 163 163 } -
trunk/www/admin/protocols/list_protocol.jsp
r5590 r5630 29 29 import="net.sf.basedb.core.Item" 30 30 import="net.sf.basedb.core.Protocol" 31 import="net.sf.basedb.core. ProtocolType"31 import="net.sf.basedb.core.ItemSubtype" 32 32 import="net.sf.basedb.core.Annotation" 33 33 import="net.sf.basedb.core.AnnotationType" … … 91 91 final ItemQuery<Protocol> query = Base.getConfiguredQuery(dc, cc, true, Protocol.getQuery(), mode); 92 92 93 final ItemQuery< ProtocolType> typeQuery = ProtocolType.getQuery();93 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType); 94 94 typeQuery.order(Orders.asc(Hql.property("name"))); 95 95 typeQuery.setCacheResult(true); … … 253 253 <% 254 254 Enumeration<String, String> protocolTypes = new Enumeration<String, String>(); 255 for ( ProtocolType pt : typeQuery.list(dc))255 for (ItemSubtype pt : typeQuery.list(dc)) 256 256 { 257 257 protocolTypes.add(Integer.toString(pt.getId()), HTML.encodeTags(pt.getName())); … … 268 268 /> 269 269 <tbl:columndef 270 id=" protocolType"271 property=" protocolType"272 sortproperty=" protocolType.name"273 exportproperty=" protocolType.name"270 id="itemSubtype" 271 property="itemSubtype" 272 sortproperty="itemSubtype.name" 273 exportproperty="itemSubtype.name" 274 274 datatype="int" 275 275 enumeration="<%=protocolTypes%>" … … 529 529 enablePropertyLink="<%=mode.hasPropertyLink()%>" 530 530 /></tbl:cell> 531 <tbl:cell column=" protocolType"531 <tbl:cell column="itemSubtype" 532 532 ><base:propertyvalue 533 533 item="<%=item%>" 534 property=" protocolType"534 property="itemSubtype" 535 535 enableEditLink="<%=mode.hasEditLink()%>" 536 536 enablePropertyLink="<%=mode.hasPropertyLink()%>" -
trunk/www/admin/protocols/view_protocol.jsp
r5507 r5630 33 33 import="net.sf.basedb.core.Permission" 34 34 import="net.sf.basedb.core.Protocol" 35 import="net.sf.basedb.core.ProtocolType"36 35 import="net.sf.basedb.core.AnnotationType" 37 36 import="net.sf.basedb.core.File" … … 264 263 <tr> 265 264 <td class="prompt">Type</td> 266 <td><base:propertyvalue item="<%=protocol%>" property=" protocolType" /></td>265 <td><base:propertyvalue item="<%=protocol%>" property="itemSubtype" /></td> 267 266 </tr> 268 267 <tr> -
trunk/www/admin/software/edit_software.jsp
r5506 r5630 32 32 import="net.sf.basedb.core.Permission" 33 33 import="net.sf.basedb.core.Software" 34 import="net.sf.basedb.core. SoftwareType"34 import="net.sf.basedb.core.ItemSubtype" 35 35 import="net.sf.basedb.core.ItemQuery" 36 36 import="net.sf.basedb.core.ItemResultList" … … 71 71 if (currentSoftwareTypeId == 0) 72 72 { 73 int recentSoftwareTypeId = Values.getInt(cc.getRecent(Item. SOFTWARETYPE.name(), 0));74 currentSoftwareTypeId = Values.getInt(cc.getPropertyValue(" softwareType"), recentSoftwareTypeId);73 int recentSoftwareTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0)); 74 currentSoftwareTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSoftwareTypeId); 75 75 } 76 76 } … … 82 82 try 83 83 { 84 SoftwareType st = software.getSoftwareType();84 ItemSubtype st = software.getItemSubtype(); 85 85 if (st != null) currentSoftwareTypeId = st.getId(); 86 86 } … … 96 96 97 97 // Query to retrieve file types 98 final ItemQuery< SoftwareType> softwareTypeQuery = SoftwareType.getQuery();98 final ItemQuery<ItemSubtype> softwareTypeQuery = ItemSubtype.getQuery(itemType); 99 99 softwareTypeQuery.order(Orders.asc(Hql.property("name"))); 100 100 final String clazz = "class=\"text\""; … … 183 183 else 184 184 { 185 for ( SoftwareType softwareType : softwareTypeQuery.list(dc))185 for (ItemSubtype softwareType : softwareTypeQuery.list(dc)) 186 186 { 187 187 int id = softwareType.getId(); -
trunk/www/admin/software/index.jsp
r5590 r5630 30 30 import="net.sf.basedb.core.Include" 31 31 import="net.sf.basedb.core.Software" 32 import="net.sf.basedb.core. SoftwareType"32 import="net.sf.basedb.core.ItemSubtype" 33 33 import="net.sf.basedb.core.ItemQuery" 34 34 import="net.sf.basedb.core.Permission" … … 60 60 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 61 61 <%! 62 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,version, softwareType,description");62 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,version,itemSubtype,description"); 63 63 private static final Item itemType = Item.SOFTWARE; 64 64 %> … … 135 135 dc = sc.newDbControl(); 136 136 Software software = (Software)cc.getObject("item"); 137 int softwareTypeId = Values.getInt(request.getParameter("softwaretype_id"), -1);138 137 if (software == null) 139 138 { 140 software = Software.getNew(dc , SoftwareType.getById(dc, softwareTypeId));139 software = Software.getNew(dc); 141 140 message = "Software created"; 142 141 dc.saveItem(software); … … 154 153 software.setVersionString(Values.getStringOrNull(request.getParameter("version"))); 155 154 software.setDescription(Values.getStringOrNull(request.getParameter("description"))); 155 int softwareTypeId = Values.getInt(request.getParameter("softwaretype_id"), -1); 156 156 if (softwareTypeId >= 0) // < 0 = denied or unchanged 157 157 { 158 SoftwareType swt = softwareTypeId == 0 ? null : SoftwareType.getById(dc, softwareTypeId);159 software.set SoftwareType(swt);158 ItemSubtype swt = softwareTypeId == 0 ? null : ItemSubtype.getById(dc, softwareTypeId); 159 software.setItemSubtype(swt); 160 160 if (swt != null) cc.setRecent(swt, maxRecent); 161 161 } -
trunk/www/admin/software/list_software.jsp
r5590 r5630 29 29 import="net.sf.basedb.core.Item" 30 30 import="net.sf.basedb.core.Software" 31 import="net.sf.basedb.core. SoftwareType"31 import="net.sf.basedb.core.ItemSubtype" 32 32 import="net.sf.basedb.core.ItemQuery" 33 33 import="net.sf.basedb.core.Include" … … 83 83 Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); 84 84 85 final ItemQuery< SoftwareType> typeQuery = SoftwareType.getQuery();85 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType); 86 86 typeQuery.order(Orders.asc(Hql.property("name"))); 87 87 typeQuery.setCacheResult(true); … … 255 255 <% 256 256 Enumeration<String, String> softwareTypes = new Enumeration<String, String>(); 257 for ( SoftwareType st : typeQuery.list(dc))257 for (ItemSubtype st : typeQuery.list(dc)) 258 258 { 259 259 softwareTypes.add(Integer.toString(st.getId()), HTML.encodeTags(st.getName())); … … 261 261 %> 262 262 <tbl:columndef 263 id=" softwareType"264 property=" softwareType"265 sortproperty=" softwareType.name"266 exportproperty=" softwareType.name"263 id="itemSubtype" 264 property="itemSubtype" 265 sortproperty="itemSubtype.name" 266 exportproperty="itemSubtype.name" 267 267 datatype="int" 268 268 enumeration="<%=softwareTypes%>" … … 475 475 /></tbl:cell> 476 476 <tbl:cell column="version"><%=HTML.encodeTags(item.getVersionString())%></tbl:cell> 477 <tbl:cell column=" softwareType"477 <tbl:cell column="itemSubtype" 478 478 ><base:propertyvalue 479 479 item="<%=item%>" 480 property=" softwareType"480 property="itemSubtype" 481 481 enableEditLink="<%=mode.hasEditLink()%>" 482 482 enablePropertyLink="<%=mode.hasPropertyLink()%>" -
trunk/www/admin/software/view_software.jsp
r5507 r5630 34 34 import="net.sf.basedb.core.Permission" 35 35 import="net.sf.basedb.core.Software" 36 import="net.sf.basedb.core.SoftwareType"37 36 import="net.sf.basedb.core.User" 38 37 import="net.sf.basedb.core.MultiPermissions" … … 247 246 <tr> 248 247 <td class="prompt">Type</td> 249 <td><base:propertyvalue item="<%=software%>" property=" softwareType" /></td>248 <td><base:propertyvalue item="<%=software%>" property="itemSubtype" /></td> 250 249 </tr> 251 250 <tr> -
trunk/www/biomaterials/bioplates/edit_bioplate.jsp
r5492 r5630 30 30 import="net.sf.basedb.core.Item" 31 31 import="net.sf.basedb.core.Hardware" 32 import="net.sf.basedb.core.HardwareType"33 32 import="net.sf.basedb.core.ItemContext" 34 33 import="net.sf.basedb.core.SystemItems" … … 272 271 url += '&item_id='+id; 273 272 } 274 url += '&resetTemporary=1&tmpfilter:INT: hardwareType=<%=SystemItems.getId(HardwareType.FREEZER)%>';273 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.FREEZER)%>'; 275 274 Main.openPopup(url, 'SelectFreezer', 1000, 700); 276 275 } -
trunk/www/biomaterials/extracts/edit_extract.jsp
r5492 r5630 38 38 import="net.sf.basedb.core.BioWell" 39 39 import="net.sf.basedb.core.Protocol" 40 import="net.sf.basedb.core.ProtocolType"41 40 import="net.sf.basedb.core.Project" 42 41 import="net.sf.basedb.core.PermissionDeniedException" … … 316 315 url += '&item_id='+id; 317 316 } 318 url += '&resetTemporary=1&tmpfilter:INT: protocolType=<%=SystemItems.getId(ProtocolType.EXTRACTION)%>';317 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.EXTRACTION)%>'; 319 318 Main.openPopup(url, 'SelectProtocol', 1000, 700); 320 319 } -
trunk/www/biomaterials/labeledextracts/edit_labeledextract.jsp
r5492 r5630 39 39 import="net.sf.basedb.core.BioWell" 40 40 import="net.sf.basedb.core.Protocol" 41 import="net.sf.basedb.core.ProtocolType"42 41 import="net.sf.basedb.core.Project" 43 42 import="net.sf.basedb.core.PermissionDeniedException" … … 347 346 url += '&item_id='+id; 348 347 } 349 url += '&resetTemporary=1&tmpfilter:INT: protocolType=<%=SystemItems.getId(ProtocolType.LABELING)%>';348 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.LABELING)%>'; 350 349 Main.openPopup(url, 'SelectProtocol', 1000, 700); 351 350 } -
trunk/www/biomaterials/samples/edit_sample.jsp
r5490 r5630 38 38 import="net.sf.basedb.core.BioWell" 39 39 import="net.sf.basedb.core.Protocol" 40 import="net.sf.basedb.core.ProtocolType"41 40 import="net.sf.basedb.core.Project" 42 41 import="net.sf.basedb.core.PermissionDeniedException" … … 318 317 url += '&item_id='+id; 319 318 } 320 url += '&resetTemporary=1&tmpfilter:INT: protocolType=<%=SystemItems.getId(ProtocolType.SAMPLING)%>';319 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.SAMPLING)%>'; 321 320 Main.openPopup(url, 'SelectProtocol', 1000, 700); 322 321 } -
trunk/www/biomaterials/wizards/create_child_bioplate_step1.jsp
r5561 r5630 30 30 import="net.sf.basedb.core.MeasuredBioMaterial" 31 31 import="net.sf.basedb.core.Hardware" 32 import="net.sf.basedb.core.HardwareType"33 32 import="net.sf.basedb.core.Protocol" 34 33 import="net.sf.basedb.core.Label" … … 225 224 url += '&item_id='+id; 226 225 } 227 url += '&resetTemporary=1&tmpfilter:INT: hardwareType=<%=SystemItems.getId(HardwareType.FREEZER)%>';226 url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.FREEZER)%>'; 228 227 Main.openPopup(url, 'SelectFreezer', 1000, 700); 229 228 } -
trunk/www/biomaterials/wizards/create_child_bioplate_step2.jsp
r5561 r5630 30 30 import="net.sf.basedb.core.MeasuredBioMaterial" 31 31 import="net.sf.basedb.core.Hardware" 32 import="net.sf.basedb.core.HardwareType"33 32 import="net.sf.basedb.core.Protocol" 34 33 import="net.sf.basedb.core.DbControl" -
trunk/www/filemanager/files/download_file.jsp
r5426 r5630 31 31 import="net.sf.basedb.core.Permission" 32 32 import="net.sf.basedb.core.File" 33 import="net.sf.basedb.core.FileType"34 33 import="net.sf.basedb.core.Location" 35 34 import="net.sf.basedb.core.User" -
trunk/www/filemanager/files/edit_file.jsp
r5570 r5630 36 36 import="net.sf.basedb.core.File" 37 37 import="net.sf.basedb.core.FileServer" 38 import="net.sf.basedb.core. FileType"38 import="net.sf.basedb.core.ItemSubtype" 39 39 import="net.sf.basedb.core.Location" 40 40 import="net.sf.basedb.core.ItemQuery" … … 81 81 { 82 82 title = "Create file"; 83 currentFileTypeId = Values.getInt(cc.getPropertyValue(" fileType"), 0);83 currentFileTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), 0); 84 84 if (currentFileTypeId == 0) 85 85 { 86 currentFileTypeId = Values.getInt(cc.getRecent(Item. FILETYPE.name(), 0), 0);86 currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0); 87 87 } 88 88 if (cc.getPropertyFilter("fileServer.name") != null) … … 102 102 try 103 103 { 104 FileType ft = file.getFileType();104 ItemSubtype ft = file.getItemSubtype(); 105 105 if (ft != null) currentFileTypeId = ft.getId(); 106 106 } … … 124 124 125 125 // Query to retrieve file types 126 final ItemQuery< FileType> fileTypeQuery = FileType.getQuery();126 final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType); 127 127 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 128 128 fileTypeQuery.setCacheResult(true); … … 305 305 <option value="0">- none - 306 306 <% 307 ItemResultList< FileType> fileTypes = fileTypeQuery.list(dc);308 for ( FileType fileType : fileTypes)307 ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); 308 for (ItemSubtype fileType : fileTypes) 309 309 { 310 310 int id = fileType.getId(); -
trunk/www/filemanager/files/edit_multiple_file.jsp
r5570 r5630 36 36 import="net.sf.basedb.core.File" 37 37 import="net.sf.basedb.core.FileServer" 38 import="net.sf.basedb.core. FileType"38 import="net.sf.basedb.core.ItemSubtype" 39 39 import="net.sf.basedb.core.Location" 40 40 import="net.sf.basedb.core.ItemQuery" … … 72 72 73 73 // Query to retrieve file types 74 final ItemQuery< FileType> fileTypeQuery = FileType.getQuery();74 final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType); 75 75 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 76 76 fileTypeQuery.setCacheResult(true); … … 150 150 <option value="0">- none - 151 151 <% 152 ItemResultList< FileType> fileTypes = fileTypeQuery.list(dc);153 for ( FileType fileType : fileTypes)152 ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); 153 for (ItemSubtype fileType : fileTypes) 154 154 { 155 155 int id = fileType.getId(); -
trunk/www/filemanager/files/index.jsp
r5599 r5630 35 35 import="net.sf.basedb.core.File" 36 36 import="net.sf.basedb.core.FileServer" 37 import="net.sf.basedb.core. FileType"37 import="net.sf.basedb.core.ItemSubtype" 38 38 import="net.sf.basedb.core.Location" 39 39 import="net.sf.basedb.core.ItemQuery" … … 66 66 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 67 67 <%! 68 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,size, fileType,description,actions");68 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,size,itemSubtype,description,actions"); 69 69 private static final ItemContext searchContext = Base.createDefaultContext("name", "path,name,size,description,actions"); 70 70 private static final Item itemType = Item.FILE; … … 200 200 if (fileTypeId >= 0) // < 0 = denied or unchanged 201 201 { 202 FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);203 file.set FileType(ft);202 ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId); 203 file.setItemSubtype(ft); 204 204 if (ft != null) cc.setRecent(ft, maxRecent); 205 205 } … … 241 241 int fileTypeId = Values.getInt(request.getParameter("filetype_id"), -1); 242 242 boolean setFileType = fileTypeId >= 0; 243 FileType fileType = setFileType && fileTypeId > 0 ? FileType.getById(dc, fileTypeId) : null;243 ItemSubtype fileType = setFileType && fileTypeId > 0 ? ItemSubtype.getById(dc, fileTypeId) : null; 244 244 boolean setCharacterSet = !"keep".equals(request.getParameter("characterSet")); 245 245 String characterSet = Values.getStringOrNull(request.getParameter("characterSet")); … … 257 257 { 258 258 if (setWriteProtected) file.setWriteProtected(writeProtected); 259 if (setFileType) file.set FileType(fileType);259 if (setFileType) file.setItemSubtype(fileType); 260 260 if (setCharacterSet) file.setCharacterSet(characterSet); 261 261 if (setMimeType) file.setMimeType(mimeType); -
trunk/www/filemanager/files/list_files.jsp
r5590 r5630 34 34 import="net.sf.basedb.core.File" 35 35 import="net.sf.basedb.core.Directory" 36 import="net.sf.basedb.core. FileType"36 import="net.sf.basedb.core.ItemSubtype" 37 37 import="net.sf.basedb.core.ItemQuery" 38 38 import="net.sf.basedb.core.ItemResultIterator" … … 106 106 107 107 // Get all file types 108 final ItemQuery< FileType> typeQuery = FileType.getQuery();108 final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType); 109 109 typeQuery.order(Orders.asc(Hql.property("name"))); 110 110 typeQuery.setCacheResult(true); … … 587 587 Enumeration<String, String> fileTypes = new Enumeration<String, String>(); 588 588 fileTypes.add("", "- none -"); 589 for ( FileType ft : typeQuery.list(dc))589 for (ItemSubtype ft : typeQuery.list(dc)) 590 590 { 591 591 fileTypes.add(Integer.toString(ft.getId()), ft.getName()); … … 593 593 %> 594 594 <tbl:columndef 595 id=" fileType"596 property=" fileType"597 sortproperty=" fileType.name"598 exportproperty=" fileType.name"595 id="itemSubtype" 596 property="itemSubtype" 597 sortproperty="itemSubtype.name" 598 exportproperty="itemSubtype.name" 599 599 datatype="int" 600 600 enumeration="<%=fileTypes%>" … … 1079 1079 <tbl:cell column="compressed"><%=item.isCompressed() ? "yes" : "no"%></tbl:cell> 1080 1080 <tbl:cell column="writeProtected"><%=item.isWriteProtected() ? "yes" : "no"%></tbl:cell> 1081 <tbl:cell column=" fileType"1081 <tbl:cell column="itemSubtype" 1082 1082 ><base:propertyvalue 1083 1083 item="<%=item%>" 1084 property=" fileType"1084 property="itemSubtype" 1085 1085 enableEditLink="<%=mode.hasEditLink()%>" 1086 1086 enablePropertyLink="<%=mode.hasPropertyLink()%>" -
trunk/www/filemanager/files/view_file.jsp
r5502 r5630 34 34 import="net.sf.basedb.core.Permission" 35 35 import="net.sf.basedb.core.File" 36 import="net.sf.basedb.core.FileType"37 36 import="net.sf.basedb.core.Location" 38 37 import="net.sf.basedb.core.MultiPermissions" … … 313 312 <tr> 314 313 <td class="prompt">Type</td> 315 <td><base:propertyvalue item="<%=file%>" property=" fileType" /></td>314 <td><base:propertyvalue item="<%=file%>" property="itemSubtype" /></td> 316 315 </tr> 317 316 <tr> -
trunk/www/filemanager/index.jsp
r5426 r5630 36 36 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> 37 37 <%! 38 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,size, fileType,description,actions");38 private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,size,itemSubtype,description,actions"); 39 39 private static final Item itemType = Item.FILE; 40 40 %> -
trunk/www/filemanager/upload/select.jsp
r5595 r5630 26 26 @version 2.0 27 27 --%> 28 <%@page import="net.sf.basedb.core.ItemSubtype"%> 28 29 <%@ page pageEncoding="UTF-8" session="false" 29 30 import="net.sf.basedb.core.Application" … … 37 38 import="net.sf.basedb.core.Directory" 38 39 import="net.sf.basedb.core.File" 39 import="net.sf.basedb.core.FileType"40 40 import="net.sf.basedb.core.User" 41 41 import="net.sf.basedb.core.Group" … … 82 82 { 83 83 title = "Upload new file"; 84 currentFileTypeId = Values.getInt(cc.getPropertyValue(" fileType"), 0);84 currentFileTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), 0); 85 85 if (currentFileTypeId == 0) 86 86 { 87 currentFileTypeId = Values.getInt(cc.getRecent(Item. FILETYPE.name(), 0), 0);87 currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0); 88 88 } 89 89 directory = Directory.getById(dc, Values.getInt(request.getParameter("directory_id"), SystemItems.getId(Directory.ROOT))); … … 99 99 try 100 100 { 101 FileType ft = file.getFileType();101 ItemSubtype ft = file.getItemSubtype(); 102 102 if (ft != null) currentFileTypeId = ft.getId(); 103 103 } … … 128 128 129 129 // Query to retrieve file types 130 final ItemQuery< FileType> fileTypeQuery = FileType.getQuery();130 final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType); 131 131 fileTypeQuery.order(Orders.asc(Hql.property("name"))); 132 132 fileTypeQuery.setCacheResult(true); … … 463 463 <option value="0">- none - 464 464 <% 465 ItemResultList< FileType> fileTypes = fileTypeQuery.list(dc);466 for ( FileType fileType : fileTypes)465 ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); 466 for (ItemSubtype fileType : fileTypes) 467 467 { 468 468 int id = fileType.getId(); -
trunk/www/include/menu.jsp
r5616 r5630 801 801 // Administrate -> Types menu 802 802 final boolean hasQuotaTypes = sc.hasPermission(Permission.READ, Item.QUOTATYPE); 803 final boolean hasProtocolTypes = sc.hasPermission(Permission.READ, Item.PROTOCOLTYPE);804 final boolean hasFileTypes = sc.hasPermission(Permission.READ, Item.FILETYPE);805 803 final boolean hasMimeTypes = sc.hasPermission(Permission.READ, Item.MIMETYPE); 806 final boolean hasHardwareTypes = sc.hasPermission(Permission.READ, Item.HARDWARETYPE);807 final boolean hasSoftwareTypes = sc.hasPermission(Permission.READ, Item.SOFTWARETYPE);808 804 final boolean hasAnnotationTypeCategories = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPECATEGORY); 809 805 final boolean hasAnnotationTypes = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPE); … … 811 807 final boolean hasExtraValueTypes = !sc.hasPermission(Permission.DENIED, Item.EXTRAVALUETYPE); 812 808 final boolean hasQuantities = !sc.hasPermission(Permission.DENIED, Item.QUANTITY); 813 final boolean hasTypes = hasFileTypes || hasProtocolTypes || hasMimeTypes || hasQuotaTypes || 814 hasSoftwareTypes || hasHardwareTypes || hasAnnotationTypeCategories || hasAnnotationTypes || 815 hasReporterTypes || hasExtraValueTypes || hasQuantities; 809 final boolean hasItemSubtypes = sc.hasPermission(Permission.READ, Item.ITEMSUBTYPE); 810 final boolean hasTypes = hasMimeTypes || hasQuotaTypes || 811 hasAnnotationTypeCategories || hasAnnotationTypes || 812 hasReporterTypes || hasExtraValueTypes || hasQuantities || hasItemSubtypes; 816 813 if (hasTypes) 817 814 { … … 822 819 > 823 820 <m:menuitem 821 title="<%=common.getString("item.itemsubtype+")%>" 822 onclick="<%="Menu.openUrl('"+root+"admin/itemsubtypes/index.jsp?ID="+ID+"')"%>" 823 tooltip="<%=menu.getString("itemsubtypes.tooltip", hasItemSubtypes)%>" 824 enabled="<%=hasItemSubtypes%>" 825 /> 826 <m:menuitem 827 title="<%=common.getString("item.annotationtype+")%>" 828 onclick="<%="Menu.openUrl('"+root+"admin/annotationtypes/index.jsp?ID="+ID+"')"%>" 829 tooltip="<%=menu.getString("annotationtypes.tooltip", hasAnnotationTypes)%>" 830 enabled="<%=hasAnnotationTypes%>" 831 /> 832 <m:menuitem 833 title="<%=common.getString("item.annotationtypecategory+")%>" 834 onclick="<%="Menu.openUrl('"+root+"admin/annotationtypecategories/index.jsp?ID="+ID+"')"%>" 835 tooltip="<%=menu.getString("annotationtypecategories.tooltip", hasAnnotationTypeCategories)%>" 836 enabled="<%=hasAnnotationTypeCategories%>" 837 /> 838 <m:menuseparator /> 839 <m:menuitem 840 title="<%=common.getString("item.mimetype+")%>" 841 onclick="<%="Menu.openUrl('"+root+"admin/mimetypes/index.jsp?ID="+ID+"')"%>" 842 tooltip="<%=menu.getString("mimetypes.tooltip", hasMimeTypes)%>" 843 enabled="<%=hasMimeTypes%>" 844 /> 845 <m:menuitem 824 846 title="<%=common.getString("item.quotatype+")%>" 825 847 onclick="<%="Menu.openUrl('"+root+"admin/quotatypes/index.jsp?ID="+ID+"')"%>" … … 828 850 /> 829 851 <m:menuitem 830 title="<%=common.getString("item.protocoltype+")%>" 831 onclick="<%="Menu.openUrl('"+root+"admin/protocoltypes/index.jsp?ID="+ID+"')"%>" 832 tooltip="<%=menu.getString("protocoltypes.tooltip", hasProtocolTypes)%>" 833 enabled="<%=hasProtocolTypes%>" 834 /> 835 <m:menuitem 836 title="<%=common.getString("item.filetype+")%>" 837 onclick="<%="Menu.openUrl('"+root+"admin/filetypes/index.jsp?ID="+ID+"')"%>" 838 tooltip="<%=menu.getString("filetypes.tooltip", hasFileTypes)%>" 839 enabled="<%=hasFileTypes%>" 840 /> 841 <m:menuitem 842 title="<%=common.getString("item.mimetype+")%>" 843 onclick="<%="Menu.openUrl('"+root+"admin/mimetypes/index.jsp?ID="+ID+"')"%>" 844 tooltip="<%=menu.getString("mimetypes.tooltip", hasMimeTypes)%>" 845 enabled="<%=hasMimeTypes%>" 846 /> 847 <m:menuitem 848 title="<%=common.getString("item.softwaretype+")%>" 849 onclick="<%="Menu.openUrl('"+root+"admin/softwaretypes/index.jsp?ID="+ID+"')"%>" 850 tooltip="<%=menu.getString("softwaretypes.tooltip", hasSoftwareTypes)%>" 851 enabled="<%=hasSoftwareTypes%>" 852 /> 853 <m:menuitem 854 title="<%=common.getString("item.hardwaretype+")%>" 855 onclick="<%="Menu.openUrl('"+root+"admin/hardwaretypes/index.jsp?ID="+ID+"')"%>" 856 tooltip="<%=menu.getString("hardwaretypes.tooltip", hasHardwareTypes)%>" 857 enabled="<%=hasHardwareTypes%>" 858 /> 859 <m:menuitem 860 title="<%=common.getString("item.annotationtypecategory+")%>" 861 onclick="<%="Menu.openUrl('"+root+"admin/annotationtypecategories/index.jsp?ID="+ID+"')"%>" 862 tooltip="<%=menu.getString("annotationtypecategories.tooltip", hasAnnotationTypeCategories)%>" 863 enabled="<%=hasAnnotationTypeCategories%>" 864 /> 865 <m:menuitem 866 title="<%=common.getString("item.annotationtype+")%>" 867 onclick="<%="Menu.openUrl('"+root+"admin/annotationtypes/index.jsp?ID="+ID+"')"%>" 868 tooltip="<%=menu.getString("annotationtypes.tooltip", hasAnnotationTypes)%>" 869 enabled="<%=hasAnnotationTypes%>" 870 /> 852 title="<%=common.getString("item.reportertype+")%>" 853 onclick="<%="Menu.openUrl('"+root+"admin/reportertypes/index.jsp?ID="+ID+"')"%>" 854 tooltip="<%=menu.getString("reportertypes.tooltip", hasReporterTypes)%>" 855 enabled="<%=hasReporterTypes%>" 856 /> 857 <m:menuitem 858 title="<%=common.getString("item.extravaluetype+")%>" 859 onclick="<%="Menu.openUrl('"+root+"admin/extravaluetypes/index.jsp?ID="+ID+"')"%>" 860 tooltip="<%=menu.getString("extravaluetypes.tooltip", hasExtraValueTypes)%>" 861 enabled="<%=hasExtraValueTypes%>" 862 /> 863 <m:menuseparator /> 871 864 <m:menuitem 872 865 title="<%=menu.getString("units+quantities.title")%>" … … 874 867 tooltip="<%=menu.getString("units+quantities.tooltip", hasQuantities)%>" 875 868 enabled="<%=hasQuantities%>" 876 />877 <m:menuitem878 title="<%=common.getString("item.reportertype+")%>"879 onclick="<%="Menu.openUrl('"+root+"admin/reportertypes/index.jsp?ID="+ID+"')"%>"880