Changeset 5630


Ignore:
Timestamp:
May 13, 2011, 2:54:50 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #1597: Subtypes of items

Added Subtypable interface and ItemSubtype item (and corresponding data-layer classes). File, Protocol, Software and Hardware are implementing the new interface and the FileType, ProtocolType, SoftwareType and HardwareType + data-layer classes have been deleted.

The rest of the changes are dependencies that have been updated to use the new subtype functionality.

There is no updgrade script yet. This will need to move existing *Type items into ItemSubtype and update all links from the other items. Then it can remove the old columns and tables. We also need to fix context-related information, but I think we have most functionality for this.

Location:
trunk
Files:
10 added
16 deleted
131 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/dist/ehcache.xml

    r5523 r5630  
    103103  />
    104104  <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   <cache
    113105    name="net.sf.basedb.core.data.FormulaData"
    114106    maxElementsInMemory="100"
     
    135127  />
    136128  <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   <cache
    145129    name="net.sf.basedb.core.data.HelpData"
    146130    maxElementsInMemory="100"
     
    159143  />
    160144  <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
    161153    name="net.sf.basedb.core.data.LabelData"
    162154    maxElementsInMemory="100"
     
    263255  />
    264256  <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   <cache
    273257    name="net.sf.basedb.core.data.QuantityData"
    274258    maxElementsInMemory="100"
     
    319303  />
    320304  <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   <cache
    329305    name="net.sf.basedb.core.data.UnitData"
    330306    maxElementsInMemory="100"
  • trunk/config/dist/hibernate.cfg.xml

    r5523 r5630  
    8383    />
    8484    <class-cache
    85       class="net.sf.basedb.core.data.FileTypeData"
    86       usage="nonstrict-read-write"
    87     />
    88     <class-cache
    8985      class="net.sf.basedb.core.data.FormulaData"
    9086      usage="nonstrict-read-write"
     
    9995    />
    10096    <class-cache
    101       class="net.sf.basedb.core.data.HardwareTypeData"
    102       usage="nonstrict-read-write"
    103     />
    104     <class-cache
    10597      class="net.sf.basedb.core.data.HelpData"
    10698      usage="nonstrict-read-write"
     
    111103    />
    112104    <class-cache
     105      class="net.sf.basedb.core.data.ItemSubtypeData"
     106      usage="nonstrict-read-write"
     107    />
     108    <class-cache
    113109      class="net.sf.basedb.core.data.LabelData"
    114110      usage="nonstrict-read-write"
     
    163159    />
    164160    <class-cache
    165       class="net.sf.basedb.core.data.ProtocolTypeData"
    166       usage="nonstrict-read-write"
    167     />
    168     <class-cache
    169161      class="net.sf.basedb.core.data.QuantityData"
    170162      usage="nonstrict-read-write"
     
    191183    />
    192184    <class-cache
    193       class="net.sf.basedb.core.data.SoftwareTypeData"
    194       usage="nonstrict-read-write"
    195     />
    196     <class-cache
    197185      class="net.sf.basedb.core.data.UnitData"
    198186      usage="nonstrict-read-write"
  • trunk/src/clients/web/net/sf/basedb/clients/web/PermissionUtil.java

    r5523 r5630  
    186186        Arrays.asList(new Item[]
    187187        {
    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,
    191191          Item.PLATFORM, Item.DATAFILETYPE, Item.QUANTITY, Item.UNIT
    192192        })
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/edit/EditUtil.java

    r5525 r5630  
    7070      Item.PLUGINTYPE, Item.PLUGINDEFINITION, Item.PLUGINCONFIGURATION, Item.JOBAGENT,
    7171      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,
    7474      Item.QUANTITY, Item.UNIT, Item.EXTRAVALUETYPE, Item.REPORTERTYPE
    7575    };
  • trunk/src/clients/web/net/sf/basedb/clients/web/extensions/toolbar/ToolbarUtil.java

    r5525 r5630  
    7171      Item.FEATURE,
    7272      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,
    7676      Item.PLUGINDEFINITION, Item.PLUGINTYPE, Item.PLUGINCONFIGURATION, Item.JOBAGENT,
    7777      Item.MIMETYPE, Item.REPORTERTYPE, Item.EXTRAVALUETYPE,
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/common.properties

    r5525 r5630  
    178178item.quotatype  Quota type
    179179item.quotatype+ Quota types
    180 item.protocoltype Protocol type
    181 item.protocoltype+  Protocol types
    182 item.filetype File type
    183 item.filetype+  File types
     180item.itemsubtype  Item subtype
     181item.itemsubtype+ Item subtypes
    184182item.mimetype MIME type
    185183item.mimetype+  MIME types
    186 item.softwaretype Software type
    187 item.softwaretype+  Software types
    188 item.hardwaretype Hardware type
    189 item.hardwaretype+  Hardware types
    190184item.annotationtype Annotation type
    191185item.annotationtype+  Annotation types
  • trunk/src/clients/web/net/sf/basedb/clients/web/resources/menu.properties

    r5616 r5630  
    215215quotatypes.tooltip.1  Administrate quota types
    216216quotatypes.tooltip.0  You do not have permission to administrate quota types
    217 protocoltypes.tooltip.1 Administrate protocol types
    218 protocoltypes.tooltip.0 You do not have permission to administrate protocol types
    219 filetypes.tooltip.1 Administrate file types
    220 filetypes.tooltip.0 You do not have permission to administrate file types
    221217mimetypes.tooltip.1 Administrate MIME types
    222218mimetypes.tooltip.0 You do not have permission to administrate mime types
    223 softwaretypes.tooltip.1 Administrate software types
    224 softwaretypes.tooltip.0 You do not have permission to administrate software types
    225 hardwaretypes.tooltip.1 Administrate hardware types
    226 hardwaretypes.tooltip.0 You do not have permission to administrate hardware types
    227219annotationtypes.tooltip.1 Administrate annotation types
    228220annotationtypes.tooltip.0 You do not have permission to administrate annotation types
     
    236228extravaluetypes.tooltip.1 Administrate extra value types
    237229extravaluetypes.tooltip.0 You do not have permission to administrate extra value types
     230itemsubtypes.tooltip.1  Administrate item subtypes
     231itemsubtypes.tooltip.0  You do not have permission to administrate item subtypes
    238232
    239233## Extensions menu ##
  • trunk/src/clients/web/net/sf/basedb/clients/web/servlet/Upload.java

    r5595 r5630  
    3737import net.sf.basedb.core.Directory;
    3838import net.sf.basedb.core.File;
    39 import net.sf.basedb.core.FileType;
    4039import net.sf.basedb.core.Item;
    4140import net.sf.basedb.core.ItemContext;
     41import net.sf.basedb.core.ItemSubtype;
    4242import net.sf.basedb.core.Path;
    4343import net.sf.basedb.core.Permission;
     
    189189          if (fileTypeId >= 0) // < 0 = denied or unchanged
    190190          {
    191             FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);
    192             f.setFileType(ft);
     191            ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId);
     192            f.setItemSubtype(ft);
    193193            if (ft != null) cc.setRecent(ft, maxRecent);
    194194          }
  • trunk/src/core/common-queries.xml

    r5629 r5630  
    588588    </description>
    589589  </query>
    590  
    591   <query id="GET_FILES_FOR_FILETYPE" type="HQL">
    592     <sql>
    593       SELECT {1}
    594       FROM FileData f
    595       WHERE f.fileType = :filetype
    596     </sql>
    597     <description>
    598       A Hibernate query that gets the files
    599       with a given filetype.
    600     </description>
    601   </query>
    602590
    603591  <query id="GET_FILES_FOR_FILESERVER" type="HQL">
     
    673661    </description>
    674662  </query>
    675 
    676   <query id="GET_FILE_TYPE_WITH_NAME" type="HQL">
    677     <sql>
    678       SELECT ft
    679       FROM FileTypeData ft
    680       WHERE ft.name = :name
    681     </sql>
    682     <description>
    683       A Hibernate query that returns the file type with the specified
    684       name.
    685     </description>
    686   </query>
    687663 
    688664  <query id="GET_QUOTA_TYPE_WITH_NAME" type="HQL">
     
    734710  </query>
    735711 
    736   <query id="GET_PROTOCOL_TYPE_WITH_NAME" type="HQL">
    737     <sql>
    738       SELECT pt
    739       FROM ProtocolTypeData pt
    740       WHERE pt.name = :name
    741     </sql>
    742     <description>
    743       A Hibernate query that returns the protocol type with the specified
    744       name.
    745     </description>
    746   </query>
    747  
    748   <query id="GET_SOFTWARE_TYPE_WITH_NAME" type="HQL">
    749     <sql>
    750       SELECT st
    751       FROM SoftwareTypeData st
    752       WHERE st.name = :name
    753     </sql>
    754     <description>
    755       A Hibernate query that returns the software type with the specified
    756       name.
    757     </description>
    758   </query>
    759  
    760712  <query id="GET_SOFTWARE_WITH_NAME" type="HQL">
    761713    <sql>
     
    766718    <description>
    767719      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 ht
    775       FROM HardwareTypeData ht
    776       WHERE ht.name = :name
    777     </sql>
    778     <description>
    779       A Hibernate query that returns the hardware type with the specified
    780720      name.
    781721    </description>
     
    868808  </query>
    869809
    870   <query id="GET_PROTOCOLS_FOR_PROTOCOLTYPE" type="HQL">
    871     <sql>
    872       SELECT {1}
    873       FROM ProtocolData p
    874       WHERE p.protocolType = :protocolType
    875     </sql>
    876     <description>
    877       Get the protocols the uses a protocol type.
    878     </description>
    879   </query>
    880 
    881810  <query id="GET_PLATEEVENTTYPES_FOR_PROTOCOLTYPE" type="HQL">
    882811    <sql>
    883812      SELECT {1}
    884813      FROM PlateEventTypeData pet
    885       WHERE pet.protocolType = :protocolType
     814      WHERE pet.protocolType = :subtype
    886815    </sql>
    887816    <description>
     
    988917  </query>
    989918 
    990   <query id="GET_HARDWARE_FOR_TYPE" type="HQL">
    991     <sql>
    992       SELECT {1}
    993       FROM HardwareData hw
    994       WHERE hw.hardwareType = :hardwaretype
    995     </sql>
    996     <description>
    997       A Hibernate query that gets hardware items
    998       of the given hardware type.
    999     </description>
    1000   </query>
    1001 
    1002919  <query id="GET_SCANS_FOR_SCANNER" type="HQL">
    1003920    <sql>
     
    1068985    <description>
    1069986      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 sw
    1077       WHERE sw.softwareType = :softwaretype
    1078     </sql>
    1079     <description>
    1080       A Hibernate query that gets software items
    1081       of the given software type.
    1082987    </description>
    1083988  </query>
     
    29372842    </description>
    29382843  </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>
    29392877 
    29402878</predefined-queries>
  • trunk/src/core/net/sf/basedb/core/Application.java

    r5622 r5630  
    954954  /**
    955955    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)}
    957957    and will automaically be compressed if auto-compression is enabled and
    958958    the {@link MimeType#getAutoCompress()} returns TRUE.
  • trunk/src/core/net/sf/basedb/core/ArrayBatch.java

    r4889 r5630  
    265265    Set the {@link Protocol} used for printing the arrays.
    266266    @param protocol A <code>Protocol</code> item of the {@link
    267       ProtocolType#PRINTING} protocol type
     267      Protocol#PRINTING} protocol type
    268268    @throws PermissionDeniedException If the
    269269      logged in user doesn't have write
     
    283283    Get the {@link Hardware print robot} used for printing the arrays.
    284284    @return A <code>Hardware</code> item of type
    285       {@link HardwareType#PRINT_ROBOT}
     285      {@link Hardware#PRINT_ROBOT}
    286286    @throws PermissionDeniedException If
    287287      the logged in user doesn't have read
     
    298298    Set the {@link Hardware print robot} used for this array batch.
    299299    @param printRobot A <code>Hardware</code> item of type
    300       {@link HardwareType#PRINT_ROBOT }
     300      {@link Hardware#PRINT_ROBOT }
    301301    @throws PermissionDeniedException If the
    302302      logged in user doesn't have write
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r5623 r5630  
    260260   */
    261261  public static ItemQuery<DataFileType> getQuery(Platform platform, PlatformVariant variant,
    262     Item itemType, FileType genericType)
     262    Item itemType, ItemSubtype genericType)
    263263  {
    264264    ItemQuery<DataFileType> query = getQuery();
     
    492492  /**
    493493    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());
    499500  }
    500501 
    501502  /**
    502503    Set the generic file type of this item. Null is not allowed.
    503     @param genericType The generic type
     504    @param genericType The generic file type
    504505    @throws PermissionDeniedException If the logged in user doesn't
    505506      have write permission
    506   */
    507   public void setGenericType(FileType genericType)
     507    @since 3.0
     508  */
     509  public void setGenericType(ItemSubtype genericType)
    508510  {
    509511    checkPermission(Permission.WRITE);
     512    if (genericType != null) genericType.checkItemType(Item.FILE);
    510513    getData().setGenericType(genericType == null ? null : genericType.getData());
    511514  }
  • trunk/src/core/net/sf/basedb/core/File.java

    r5599 r5630  
    2828import net.sf.basedb.core.data.FileData;
    2929import net.sf.basedb.core.data.FileSetData;
    30 import net.sf.basedb.core.data.FileTypeData;
     30import net.sf.basedb.core.data.ItemSubtypeData;
    3131import net.sf.basedb.core.data.MimeTypeData;
    3232import net.sf.basedb.util.EqualsHelper;
     
    7979public class File
    8080  extends CommonItem<FileData>
    81   implements Transactional, DiskConsumable
     81  implements Transactional, DiskConsumable, Subtypable
    8282{
    8383  /**
     
    8888  public static final Item TYPE = Item.FILE;
    8989
     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 
    90168  /**
    91169    Create a new <code>File</code> item.
     
    386464  // -------------------------------------------
    387465  /*
     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  /*
    388489    From BasicItem
    389490    -------------------------------------------
     
    596697 
    597698  /**
    598     Get the associated {@link FileType} item.
    599     @return The <code>FileType</code> item, or null if no type has been specified
    600     @throws PermissionDeniedException This exception is thrown if
    601       the logged in user doesn't have {@link Permission#READ READ}
    602       permission to the items
    603     @throws BaseException If there is another error
    604   */
    605   public FileType getFileType()
    606     throws PermissionDeniedException, BaseException
    607   {
    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 null
    614     @throws PermissionDeniedException If the logged in user doesn't have
    615       write permission
    616   */
    617   public void setFileType(FileType filetype)
    618     throws PermissionDeniedException
    619   {
    620     checkPermission(Permission.WRITE);
    621     getData().setFileType(filetype == null ? null : filetype.getData());
    622   }
    623  
    624   /**
    625699    Get the internal name of this file.
    626700   
     
    10381112      {@link Permission#WRITE} permission
    10391113    @see #uploadCompressed()
    1040   */
    1041   public void setMimeTypeAuto(String defaultMimeType, FileType defaultFileType)
     1114    @since 3.0
     1115  */
     1116  public void setMimeTypeAuto(String defaultMimeType, ItemSubtype defaultFileType)
    10421117    throws PermissionDeniedException
    10431118  {
     
    10591134        query.setString("extension", extension);
    10601135        MimeTypeData mimeType = HibernateUtil.loadData(MimeTypeData.class, query);
    1061         FileTypeData fileType = null;
     1136        ItemSubtypeData fileType = null;
    10621137        if (mimeType != null)
    10631138        {
     
    10721147        if (fileType != null)
    10731148        {
    1074           getData().setFileType(fileType);
     1149          getData().setItemSubtype(fileType);
    10751150        }
    10761151        else if (defaultFileType != null)
    10771152        {
    1078           setFileType(defaultFileType);
     1153          setItemSubtype(defaultFileType);
    10791154        }
    10801155      }
     
    10861161  /**
    10871162    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)}.
    10891164    If this method returns true, the next call to {@link #upload(InputStream, boolean)}
    10901165    or {@link #getUploadStream(boolean)} will store the uploaded file in a
     
    11901265    @param compress TRUE to store the file in a compressed format, or null
    11911266      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)}
    11931268      found
    11941269    @throws PermissionDeniedException If the logged in user doesn't have
     
    12491324    @param compress TRUE to store the file in a compressed format, or null
    12501325      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)}
    12521327      found
    12531328    @return An <code>OutputStream</code> object
  • trunk/src/core/net/sf/basedb/core/FileSet.java

    r5623 r5630  
    261261  /**
    262262    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 the
    264     {@link DataFileType#getGenericType()}, not the {@link File#getFileType()}.
     263    generic {@link ItemSubtype}. Note! The query checks the generic type from the
     264    {@link DataFileType#getGenericType()}, not the {@link File#getItemSubtype()}.
    265265   
    266266    @param genericType The system ID of a generic type as defined
    267       by {@link FileType#getSystemId()}
     267      by {@link ItemSubtype#getSystemId()}
    268268    @return A query returning <code>FileSetMember</code> items
    269269  */
  • trunk/src/core/net/sf/basedb/core/FileStoreUtil.java

    r5623 r5630  
    120120 
    121121  /**
    122     Get all files with a specific generic {@link FileType} in a given item's file
     122    Get all files with a specific generic {@link ItemSubtype} in a given item's file
    123123    set. Note! This method will only return files that the logged in user
    124124    has permission to read. Other files in the file set will be ignored.
    125125    Note! This method checks the file type from {@link DataFileType#getGenericType()},
    126     not the file type from {@link File#getFileType()}.
     126    not the file type from {@link File#getItemSubtype()}.
    127127   
    128128    @param dc A DbControl to use for database access
    129129    @param item The {@link FileStoreEnabled} item to check
    130     @param genericType The system ID of the {@link FileType} to check for
     130    @param genericType The system ID of the {@link ItemSubtype} to check for
    131131    @return A list of file items that matches
    132132  */
     
    185185  /**
    186186    Set or remove a file to {@link FileStoreEnabled} item based
    187     on the file's generic {@link FileType}. Note! This method checks the file
     187    on the file's generic {@link ItemSubtype}. Note! This method checks the file
    188188    type from {@link DataFileType#getGenericType()},
    189     not the file type from {@link File#getFileType()}.
     189    not the file type from {@link File#getItemSubtype()}.
    190190 
    191191    @param dc A DbControl to use for database access
    192192    @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}
    194194    @param fallbackDataFileType The external ID of a {@link DataFileType} that is used
    195195      if the specified generic file type isn't found among the file types
  • trunk/src/core/net/sf/basedb/core/Hardware.java

    r5452 r5630  
    3535  @author enell
    3636  @version 2.0
    37   @see HardwareType HardwareType
    3837  @base.modified $Date$
    39  */
     38*/
    4039public class Hardware
    4140  extends CommonItem<HardwareData>
    42   implements Registered
     41  implements Registered, Subtypable
    4342{
    4443  /**
     
    4847  */
    4948  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";
    5084
    5185  /**
     
    6296    @param dc The {@link DbControl} which will be used for
    6397      permission checking and database access.
    64     @param hardwareType The {@link HardwareType} connected to this hardware. It
    65       cannot be null.
    6698    @return The new <code>Hardware</code> item
    6799    @throws BaseException If there is an error
    68100  */
    69   public static Hardware getNew(DbControl dc, HardwareType hardwareType)
     101  public static Hardware getNew(DbControl dc)
    70102    throws BaseException
    71103  {
    72104    Hardware hardware = dc.newItem(Hardware.class);
    73105    hardware.setName("New hardware");
    74     hardware.setHardwareType(hardwareType);
    75106    hardware.getData().setEntryDate(new Date());
    76107    return hardware;
     
    136167  {
    137168    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    }
    138192  }
    139193  // -------------------------------------------
     
    284338  }
    285339  // -------------------------------------------
    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> item
    291     @throws PermissionDeniedException If the logged in user doesn't have
    292       {@link Permission#READ } permission to the item
    293     @throws BaseException If there is any error
    294   */
    295   public HardwareType getHardwareType()
    296     throws PermissionDeniedException, BaseException
    297   {
    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 have
    306       {@link Permission#WRITE} permission for the hardware or
    307       {@link Permission#USE} permission for the hardware type
    308     @throws InvalidUseOfNullException If the hardware type is null
    309   */
    310   public void setHardwareType(HardwareType hardwareType)
    311     throws PermissionDeniedException, InvalidUseOfNullException
    312   {
    313     checkPermission(Permission.WRITE);
    314     if (hardwareType == null) throw new InvalidUseOfNullException("hardwareType");
    315     hardwareType.checkPermission(Permission.USE);
    316     getData().setHardwareType(hardwareType.getData());
    317   }
    318340 
    319341  /**
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5629 r5630  
    3030import net.sf.basedb.core.data.DirectoryData;
    3131import net.sf.basedb.core.data.DataFileTypeData;
    32 import net.sf.basedb.core.data.FileTypeData;
    3332import net.sf.basedb.core.data.FormulaData;
    3433import net.sf.basedb.core.data.HardwareData;
    35 import net.sf.basedb.core.data.HardwareTypeData;
     34import net.sf.basedb.core.data.ItemSubtypeData;
    3635import net.sf.basedb.core.data.MimeTypeData;
    3736import net.sf.basedb.core.data.PlatformData;
     
    3938import net.sf.basedb.core.data.PluginConfigurationData;
    4039import net.sf.basedb.core.data.ProjectKeyData;
    41 import net.sf.basedb.core.data.ProtocolTypeData;
    4240import net.sf.basedb.core.data.QuantityData;
    4341import net.sf.basedb.core.data.QuotaData;
     
    4745import net.sf.basedb.core.data.SchemaVersionData;
    4846import net.sf.basedb.core.data.ShareableData;
    49 import net.sf.basedb.core.data.SoftwareTypeData;
    5047import net.sf.basedb.core.data.SoftwareData;
    5148import net.sf.basedb.core.data.UnitData;
     
    164161    throws BaseException
    165162  {
    166     final int totalProgressSteps = 26;
     163    final int totalProgressSteps = 27;
    167164    final float progress_factor = 100 / totalProgressSteps;
    168165    int progressStep = 0;
     
    321318      // Files, directories and quota
    322319      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);
    324320      createRoleKey(Item.FILESERVER, "File servers", "Gives access to file servers", guests_create);
    325321      createRoleKey(Item.FILE, "Files", "Gives access to files", guests_create);
     
    329325 
    330326      // Protocols, hardware, software
    331       createRoleKey(Item.PROTOCOLTYPE, "Protocol types", "Gives access to protocol types", guests_use_power_users_all);
    332327      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);
    334328      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);
    336329      createRoleKey(Item.SOFTWARE, "Software", "Gives access to software", power_users_create);
    337330     
     
    397390      createRoleKey(Item.MESSAGE, "Messages", "Gives access to messages", users_create);
    398391      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);
    399393     
    400394      // Permissions for job agents are only added for new installations
     
    427421      installUnits("/units.xml", update);
    428422     
    429       // ProtocolTypes
     423      // Protocol subtypes
    430424      progressStep++;
    431       if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating protocol types...");
    432       createProtocolType(ProtocolType.SAMPLING, "Sampling", "Protocols used for creating samples.");
    433       createProtocolType(ProtocolType.EXTRACTION, "Extraction", "Protocols used for creating extracts.");
    434       createProtocolType(ProtocolType.LABELING, "Labeling", "Protocols used for creating labeled extracts.");
    435       createProtocolType(ProtocolType.POOLING, "Pooling", "Protocols used for creating pooled biomaterails.");
    436       createProtocolType(ProtocolType.HYBRIDIZATION, "Hybridization", "Protocols used for creating hybridizations.");
    437       createProtocolType(ProtocolType.PRINTING, "Printing", "Protocols used for printing a bathc of array slides.");
    438       createProtocolType(ProtocolType.SCANNING, "Scanning", "Protocols used for scanning microarray images.");
    439       createProtocolType(ProtocolType.FEATURE_EXTRACTION, "Feature extraction", "Protocols used for extracting features from microarray images.");
    440  
    441       // HardwareTypes
     425      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
    442436      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.");
    449443 
    450444      // Hardware
     
    464458      // SoftwareTypes
    465459      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.");
    468462 
    469463      // Software
     
    482476      createSoftware("Illumina BeadStudio", null, null, feature, rootUser, keyEveryoneUse);
    483477 
     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     
    484483      // Directory
    485484      progressStep++;
     
    495494      progressStep++;
    496495      if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating file types...");
    497       createFileType(FileType.PROTOCOL, "Protocol", "Protocol files");
    498       FileTypeData rawDataType = createFileType(FileType.RAW_DATA, "Raw data", "Raw data files");
    499       createFileType(FileType.PLATE, "Plate", "Plate files");
    500       createFileType(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       createFileType(FileType.REPORTER, "Reporter", "Reporter files");
    504       FileTypeData imageType = createFileType(FileType.IMAGE, "Image", "Image files");
    505       createFileType(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");
    508507 
    509508      // MimeTypes
     
    957956    Create a {@link MimeType}.
    958957  */
    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)
    960959    throws BaseException
    961960  {
     
    1000999  }
    10011000 
    1002   /**
    1003     Create a {@link FileType}.
    1004   */
    1005   private static FileTypeData createFileType(String systemId, String name, String description)
    1006     throws BaseException
    1007   {
    1008     int id = SystemItems.getId(systemId);
    1009     org.hibernate.Transaction tx = null;
    1010     FileTypeData fileType = null;
    1011     try
    1012     {
    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       else
    1031       {
    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 
    10521001  /**
    10531002    Create a {@link QuotaType}.
     
    14931442  }
    14941443
    1495   /**
    1496     Create a {@link ProtocolType}.
    1497   */
    1498   private static ProtocolTypeData createProtocolType(String systemId, String name, String description)
    1499     throws BaseException
    1500   {
    1501     int id = SystemItems.getId(systemId);
    1502     org.hibernate.Transaction tx = null;
    1503     ProtocolTypeData pt = null;
    1504     try
    1505     {
    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       else
    1524       {
    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 BaseException
    1549   {
    1550     int id = SystemItems.getId(systemId);
    1551     org.hibernate.Transaction tx = null;
    1552     SoftwareTypeData st = null;
    1553     try
    1554     {
    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       else
    1573       {
    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   }
    15931444
    15941445  /**
    15951446    Create a {@link Software}.
    15961447  */
    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)
    15981449    throws BaseException
    15991450  {
     
    16231474        sw.setDescription(description);
    16241475        sw.setVersionString(version);
    1625         sw.setSoftwareType(type);
     1476        sw.setItemSubtype(type);
    16261477        sw.setOwner(owner);
    16271478        sw.setItemKey(shareTo);
     
    16411492
    16421493  /**
    1643     Create a {@link HardwareType}.
    1644   */
    1645   private static HardwareTypeData createHardwareType(String systemId, String name, String description)
    1646     throws BaseException
    1647   {
    1648     int id = SystemItems.getId(systemId);
    1649     org.hibernate.Transaction tx = null;
    1650     HardwareTypeData ht = null;
    1651     try
    1652     {
    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       else
    1671       {
    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   /**
    16931494    Create a {@link HardwareData}.
    16941495  */
    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)
    16961497    throws BaseException
    16971498  {
     
    17211522        hw.setDescription(description);
    17221523        hw.setVersionString(version);
    1723         hw.setHardwareType(type);
     1524        hw.setItemSubtype(type);
    17241525        hw.setOwner(owner);
    17251526        hw.setItemKey(shareTo);
     
    17381539  }
    17391540
     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 
    17401592  /**
    17411593    Create a {@link BioPlateType}.
     
    27272579  private static DataFileTypeData createDataFileType(
    27282580    String externalId, String name, String description,
    2729     Item itemType, String extension, FileTypeData genericType)
     2581    Item itemType, String extension, ItemSubtypeData genericType)
    27302582    throws BaseException
    27312583  {
  • trunk/src/core/net/sf/basedb/core/Item.java

    r5523 r5630  
    157157  FILE(81, "File", "fle", File.class, FileData.class, DefinedPermissions.shareable,
    158158    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
    164160  /**
    165161    The item is a {@link Directory}.
     
    183179  PROTOCOL(101, "Protocol", "prl", Protocol.class, ProtocolData.class, DefinedPermissions.shareable,
    184180    740),
    185   /**
    186     The item is a {@link ProtocolType}.
    187   */
    188   PROTOCOLTYPE(102, "Protocol type", "ptp", ProtocolType.class, ProtocolTypeData.class, DefinedPermissions.basic,
    189     750),
    190181
    191182  /**
     
    195186    700),
    196187  /**
    197     The item is a {@link HardwareType}.
    198   */
    199   HARDWARETYPE(122, "Hardware type", "htp", HardwareType.class, HardwareTypeData.class, DefinedPermissions.basic,
    200     710),
    201   /**
    202188    The item is a {@link Software}.
    203189  */
    204190  SOFTWARE(123, "Software", "sw", Software.class, SoftwareData.class, DefinedPermissions.shareable,
    205191    720),
    206   /**
    207     The item is a {@link SoftwareType}.
    208   */
    209   SOFTWARETYPE(124, "Software type", "stp", SoftwareType.class, SoftwareTypeData.class, DefinedPermissions.write,
    210     730),
    211192
    212193  /**
     
    234215    ChangeHistoryDetailData.class, DefinedPermissions.read, 9999),
    235216
     217  /**
     218    The item is a {@link ItemSubtype}.
     219  */
     220  ITEMSUBTYPE(145, "Item subtype", "ist", ItemSubtype.class, ItemSubtypeData.class, DefinedPermissions.basic,
     221      1510),
     222   
    236223  /**
    237224    The item is a {@link Reporter}.
  • trunk/src/core/net/sf/basedb/core/MeasuredBioMaterial.java

    r5566 r5630  
    5555public abstract class MeasuredBioMaterial<D extends MeasuredBioMaterialData>
    5656  extends BioMaterial<D>
    57   implements Registered
     57  implements Registered, Subtypable
    5858{
    5959
     
    172172  }
    173173  // -------------------------------------------
    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 
    175198  /**
    176199    Get the event that represents the creation of this biomaterial.
  • trunk/src/core/net/sf/basedb/core/Metadata.java

    r5590 r5630  
    6767  private static Set<Item> diskConsumableItems;
    6868  private static Set<Item> fileStoreEnabledItems;
     69  private static Set<Item> subtypableItems;
    6970
    7071  private static boolean isInitialised = false;
     
    7980    diskConsumableItems = Collections.unmodifiableSet(getImplementingItems(DiskConsumable.class));
    8081    fileStoreEnabledItems = Collections.unmodifiableSet(getImplementingItems(FileStoreEnabled.class));
     82    subtypableItems = Collections.unmodifiableSet(getImplementingItems(Subtypable.class));
    8183    isInitialised = true;
    8284  }
     
    9496    diskConsumableItems = null;
    9597    fileStoreEnabledItems = null;
     98    subtypableItems = null;
    9699  }
    97100
     
    168171  }
    169172 
     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
    170183 
    171184  /**
  • trunk/src/core/net/sf/basedb/core/MimeType.java

    r4889 r5630  
    258258
    259259  /**
    260     Get the associated {@link FileType} item.
     260    Get the associated file subtype item.
    261261    @return The <code>FileType</code> item, or null if no type has been specified
    262262    @throws PermissionDeniedException This exception is thrown if
     
    264264      permission to the item
    265265    @throws BaseException If there is another error
    266   */
    267   public FileType getFileType()
     266    @since 3.0
     267  */
     268  public ItemSubtype getFileType()
    268269    throws PermissionDeniedException, BaseException
    269270  {
    270     return getDbControl().getItem(FileType.class, getData().getFileType());
     271    return getDbControl().getItem(ItemSubtype.class, getData().getFileType());
    271272  }
    272273 
    273274  /**
    274275    Set the filetype of this item.
    275     @param filetype The new <code>FileType</code>, or null
     276    @param filetype The new file subtype, or null
    276277    @throws PermissionDeniedException If the logged in user doesn't have
    277278      write permission
    278279  */
    279   public void setFileType(FileType filetype)
     280  public void setFileType(ItemSubtype filetype)
    280281    throws PermissionDeniedException
    281282  {
    282283    checkPermission(Permission.WRITE);
     284    if (filetype != null)
     285    {
     286      filetype.checkItemType(Item.FILE);
     287    }
    283288    getData().setFileType(filetype == null ? null : filetype.getData());
    284289  }
  • trunk/src/core/net/sf/basedb/core/PlateEvent.java

    r4889 r5630  
    232232  /**
    233233    Set the protocol that was followed in this event. It is recommended
    234     that the {@link ProtocolType} of the protocol matches the
     234    that the {@link ItemSubtype} of the protocol matches the
    235235    protocol type set by the {@link PlateEventType}, but the core doesn't
    236236    check this.
  • trunk/src/core/net/sf/basedb/core/PlateEventType.java

    r4889 r5630  
    273273
    274274  /**
    275     Get the associated {@link ProtocolType} item. When creating
     275    Get the associated protocol type item. When creating
    276276    {@link PlateEvent} items for a {@link Plate} the protocol for the
    277277    event must be of this type.
     
    281281      have read permission to the protocol type
    282282    @throws BaseException If there is another error
    283   */
    284   public ProtocolType getProtocolType()
     283    @since 3.0
     284  */
     285  public ItemSubtype getProtocolType()
    285286    throws PermissionDeniedException, BaseException
    286287  {
    287     return getDbControl().getItem(ProtocolType.class, getData().getProtocolType());
     288    return getDbControl().getItem(ItemSubtype.class, getData().getProtocolType());
    288289  }
    289290
     
    298299      protocol type
    299300    @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)
    302304    throws PermissionDeniedException, BaseException
    303305  {
    304306    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    }
    306312    getData().setProtocolType(protocolType == null ? null : protocolType.getData());
    307313  }
  • trunk/src/core/net/sf/basedb/core/Project.java

    r5590 r5630  
    833833  public enum Default
    834834  {   
    835     SOFTWARE("default_software", "Software", Item.SOFTWARE, SoftwareType.FEATURE_EXTRACTION, Item.RAWBIOASSAY),
     835    SOFTWARE("default_software", "Software", Item.SOFTWARE, Software.FEATURE_EXTRACTION, Item.RAWBIOASSAY),
    836836    ARRAYDESIGN("default_arraydesign", "Array design", Item.ARRAYDESIGN, null, null),
    837     HYBRIDIZATION_HARDWARE("default_hybridization_hardware", "Hybridization station", Item.HARDWARE, HardwareType.HYBRIDIZATION_STATION, Item.HYBRIDIZATION),
    838     SCANNER_HARDWARE("default_scanner_hardware", "Scanner", Item.HARDWARE, HardwareType.SCANNER, Item.SCAN), 
    839     PRINTROBOT_HARDWARE("default_print_robot_hardware", "Print robot", Item.HARDWARE, HardwareType.PRINT_ROBOT, Item.ARRAYBATCH),
    840     SCANNING_PROTOCOL("default_scanning_protocol", "Scanning protocol", Item.PROTOCOL, ProtocolType.SCANNING, Item.SCAN),
    841     SAMPLING_PROTOCOL("default_sampling_protocol", "Sampling protocol", Item.PROTOCOL, ProtocolType.SAMPLING, Item.SAMPLE),
    842     EXTRACTING_PROTOCOL("default_extracting_protocol", "Extracting protocol", Item.PROTOCOL, ProtocolType.EXTRACTION, Item.EXTRACT),   
    843     LABELING_PROTOCOL("default_labeling_protocol", "Labeling protocol", Item.PROTOCOL, ProtocolType.LABELING, Item.LABELEDEXTRACT),
    844     HYBRIDIZATION_PROTOCOL("default_hybridization_protocol", "Hybridization protocol", Item.PROTOCOL, ProtocolType.HYBRIDIZATION, Item.HYBRIDIZATION),
    845     FEATURE_EXTRACTION_PROTOCOL("default_feature_extraction_protocol", "Feat. extraction protocol", Item.PROTOCOL, ProtocolType.FEATURE_EXTRACTION, Item.RAWBIOASSAY),
    846     POOLING_PROTOCOL("default_pooling_protocol", "Pooling protocol", Item.PROTOCOL, ProtocolType.POOLING, null),
    847     PRINTING_PROTOCOL("default_printing_protocol", "Printing protocol", Item.PROTOCOL, ProtocolType.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),
    848848    RAW_DATA_TYPE("default_raw_data_type", "Raw data type", null, null, null),
    849849    PLATFORM("default_platform", "Platform", Item.PLATFORM, null, null),
  • trunk/src/core/net/sf/basedb/core/Protocol.java

    r5452 r5630  
    3939public class Protocol
    4040  extends AnnotatedItem<ProtocolData>
    41   implements FileAttachable, Registered
     41  implements FileAttachable, Registered, Subtypable
    4242{
    4343  /**
     
    4949
    5050  /**
     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  /**
    51114    The maximum length of the external id that can be stored in the database.
    52115    @see #setExternalId(String)
     
    61124    @param dc The <code>DbControl</code> which will be used for
    62125      permission checking and database access
    63     @param protocolType The type of the protocol
    64126    @return The new <code>Protocol</code> item
    65127    @throws BaseException If there is an error
    66128  */
    67   public static Protocol getNew(DbControl dc, ProtocolType protocolType)
     129  public static Protocol getNew(DbControl dc)
    68130    throws  BaseException
    69131  {
    70132    Protocol p = dc.newItem(Protocol.class);
    71133    p.setName("New protocol");
    72     p.setProtocolType(protocolType);
    73134    p.getData().setEntryDate(new Date());
    74135    return p;
     
    169230  // ---------------------------------------------
    170231  /*
     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  /*
    171255    From the BasicItem class
    172256    -------------------------------------------
     
    337421
    338422  /**
    339     Get the associated {@link ProtocolType} item.
    340     All <code>Protocol</code> items must have a type.
    341     @return The <code>ProtocolType</code> item
    342     @throws PermissionDeniedException If the logged in user doesn't have
    343       {@link Permission#READ} permission for the protocol type
    344     @throws BaseException If there is any error
    345   */
    346   public ProtocolType getProtocolType()
    347     throws PermissionDeniedException, BaseException
    348   {
    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 have
    357       {@link Permission#WRITE} permission to this protocol or
    358       {@link Permission#USE} permission for the protocol type
    359     @throws InvalidUseOfNullException If protocoltype is null
    360   */
    361   public void setProtocolType(ProtocolType protocolType)
    362     throws PermissionDeniedException, InvalidUseOfNullException
    363   {
    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   /**
    371423    Get the external id of the protocol. This value can be used to link
    372424    with information in external databases. It is not used by the BASE core
  • trunk/src/core/net/sf/basedb/core/Software.java

    r4889 r5630  
    3939public class Software
    4040  extends CommonItem<SoftwareData>
    41   implements Registered
     41  implements Registered, Subtypable
    4242{
    4343  /**
     
    5050  private static final Item TYPE = Item.SOFTWARE;
    5151
     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 
    5260  /**
    5361    The maximum length of the version variable that can be stored in the
     
    6270    @param dc The {@link DbControl} which will be used for
    6371      permission checking and database access.
    64     @param softwareType The type of this software
    6572    @return The new <code>Software</code> item
    6673    @throws BaseException This exception is thrown if there is another
    6774      error
    6875  */
    69   public static Software getNew(DbControl dc, SoftwareType softwareType)
     76  public static Software getNew(DbControl dc)
    7077    throws BaseException
    7178  {
    7279    Software software = dc.newItem(Software.class);
    7380    software.setName("New software");
    74     software.setSoftwareType(softwareType);
    7581    software.getData().setEntryDate(new Date());
    7682    return software;
     
    135141  {
    136142    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    }
    137166  }
    138167  // -------------------------------------------
     
    189218
    190219  /**
    191     Get the associated {@link SoftwareType} item.
    192     All <code>Software</code> items must have a type.
    193     @return The <code>SoftwareType</code> item
    194     @throws PermissionDeniedException If the logged in user doesn't have
    195       {@link Permission#READ} permission for the software type
    196     @throws BaseException If there is another error
    197   */
    198   public SoftwareType getSoftwareType()
    199     throws PermissionDeniedException, BaseException
    200   {
    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 have
    209       {@link Permission#WRITE} permission for the software or
    210       {@link Permission#USE} permission for the software type
    211     @throws InvalidUseOfNullException If software type is null
    212   */
    213   public void setSoftwareType(SoftwareType softwareType)
    214     throws PermissionDeniedException, InvalidUseOfNullException
    215   {
    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   /**
    223220    Get the versionstring of this <code>Software</code> item.
    224221    @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  
    403403    setBlueImageFile(blueImageFile);
    404404    getData().setSpotImagesFile(spotImagesFile.getData());
    405     spotImagesFile.setFileType(FileType.getById(getDbControl(), SystemItems.getId(FileType.SPOT_IMAGES)));
     405    spotImagesFile.setItemSubtype(ItemSubtype.getById(getDbControl(), SystemItems.getId(File.SPOT_IMAGES)));
    406406    spotImagesFile.setMimeType("application/zip");
    407407
  • trunk/src/core/net/sf/basedb/core/Update.java

    r5624 r5630  
    305305
    306306 
     307  @SuppressWarnings("unchecked")
    307308  private static void copyJarPathToJarFile(org.hibernate.Session session, String tableName)
    308309  {
     
    315316
    316317      query = HibernateUtil.getPredefinedSQLQuery(session, "GET_JAR_PATH_FROM_TABLE", tableName);
    317       @SuppressWarnings("unchecked")
    318318      List<Object[]> result = query.list();
    319319      query = HibernateUtil.getPredefinedSQLQuery(session, "SET_JAR_FILE_IN_TABLE", tableName);
  • trunk/src/core/net/sf/basedb/core/data/DataFileTypeData.java

    r5623 r5630  
    138138  }
    139139 
    140   private FileTypeData genericType;
     140  private ItemSubtypeData genericType;
    141141  /**
    142142    Get the generic file type of files with this member type.
    143143    @hibernate.many-to-one outer-join="false"
    144     @hibernate.column name="`filetype_id`" not-null="false"
     144    @hibernate.column name="`filesubtype_id`" not-null="false"
    145145  */
    146   public FileTypeData getGenericType()
     146  public ItemSubtypeData getGenericType()
    147147  {
    148148    return genericType;
    149149  }
    150   public void setGenericType(FileTypeData genericType)
     150  public void setGenericType(ItemSubtypeData genericType)
    151151  {
    152152    this.genericType = genericType;
  • trunk/src/core/net/sf/basedb/core/data/FileData.java

    r5360 r5630  
    3838public class FileData
    3939  extends CommonData
    40   implements DiskConsumableData, LoggableData
     40  implements DiskConsumableData, LoggableData, SubtypableData
    4141{
    4242  /*
     
    7070  }
    7171  // -------------------------------------------
     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  // ------------------------------
    7288
    7389  private long size;
     
    176192  {
    177193    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;
    192194  }
    193195 
  • trunk/src/core/net/sf/basedb/core/data/HardwareData.java

    r4889 r5630  
    3737public class HardwareData
    3838  extends CommonData
    39   implements RegisteredData
     39  implements RegisteredData, SubtypableData
    4040{
    4141  public HardwareData()
     
    5656  // -------------------------------------------
    5757 
     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
    5875  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   }
    7276 
    7377  private String versionString;
  • trunk/src/core/net/sf/basedb/core/data/MeasuredBioMaterialData.java

    r5119 r5630  
    3838public abstract class MeasuredBioMaterialData
    3939  extends BioMaterialData
     40  implements SubtypableData
    4041{
    4142
    4243  public MeasuredBioMaterialData()
    4344  {}
     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
    4463 
    4564  private BioMaterialData parent;
     
    166185  }
    167186 
    168 
    169187}
  • trunk/src/core/net/sf/basedb/core/data/MimeTypeData.java

    r4889 r5630  
    112112  }
    113113 
    114   private FileTypeData fileType;
     114  private ItemSubtypeData fileType;
    115115  /**
    116     Get the associated {@link FileTypeData} item.
    117     @hibernate.many-to-one column="`filetype_id`" not-null="false"
     116    Get the associated {@link ItemSubtypeData} item.
     117    @hibernate.many-to-one column="`filesubtype_id`" not-null="false"
    118118  */
    119   public FileTypeData getFileType()
     119  public ItemSubtypeData getFileType()
    120120  {
    121121    return fileType;
    122122  }
    123   public void setFileType(FileTypeData fileType)
     123  public void setFileType(ItemSubtypeData fileType)
    124124  {
    125125    this.fileType = fileType;
  • trunk/src/core/net/sf/basedb/core/data/PlateEventTypeData.java

    r4889 r5630  
    110110  }
    111111 
    112   private ProtocolTypeData protocolType;
     112  private ItemSubtypeData protocolType;
    113113  /**
    114114    The protocol type that events of this event type should pick their protocols from.
    115     @hibernate.many-to-one column="`protocoltype_id`" outer-join="false" not-null="false"
     115    @hibernate.many-to-one column="`protocolsubtype_id`" outer-join="false" not-null="false"
    116116  */
    117   public ProtocolTypeData getProtocolType()
     117  public ItemSubtypeData getProtocolType()
    118118  {
    119119    return protocolType;
    120120  }
    121   public void setProtocolType(ProtocolTypeData protocolType)
     121  public void setProtocolType(ItemSubtypeData protocolType)
    122122  {
    123123    this.protocolType = protocolType;
  • trunk/src/core/net/sf/basedb/core/data/ProtocolData.java

    r5248 r5630  
    3636public class ProtocolData
    3737  extends AnnotatedData
    38   implements FileAttachableData, RegisteredData
     38  implements FileAttachableData, RegisteredData, SubtypableData
    3939{
    4040
     
    7272  // -------------------------------------------
    7373
    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    ----------------------------------
    7877  */
    79   public ProtocolTypeData getProtocolType()
     78  private ItemSubtypeData subtype;
     79  @Override
     80  public ItemSubtypeData getItemSubtype()
    8081  {
    81     return protocolType;
     82     return subtype;
    8283  }
    83   public void setProtocolType(ProtocolTypeData protocolType)
     84  @Override
     85  public void setItemSubtype(ItemSubtypeData subtype)
    8486  {
    85     this.protocolType = protocolType;
     87     this.subtype = subtype;
    8688  }
    87  
     89  // ------------------------------
     90
    8891  /**
    8992    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  
    3737public class SoftwareData
    3838  extends CommonData
    39   implements RegisteredData
     39  implements RegisteredData, SubtypableData
    4040{
    4141  public SoftwareData()
     
    5656  // -------------------------------------------
    5757 
    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  // ------------------------------
    5974 
    6075  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   }
    7376 
    7477  private String versionString;
  • trunk/src/core/net/sf/basedb/util/overview/validator/HardwareValidator.java

    r4764 r5630  
    2525import net.sf.basedb.core.DbControl;
    2626import net.sf.basedb.core.Hardware;
    27 import net.sf.basedb.core.HardwareType;
    2827import net.sf.basedb.core.Item;
     28import net.sf.basedb.core.ItemSubtype;
    2929import net.sf.basedb.core.PermissionDeniedException;
    3030import net.sf.basedb.core.Project;
     
    9696    try
    9797    {
    98       HardwareType ht = hardware.getHardwareType();
     98      ItemSubtype ht = hardware.getItemSubtype();
    9999      String requiredId = defaultType == null ? null : defaultType.getType();
    100100      if (requiredId != null && !requiredId.equals(ht.getSystemId()))
  • trunk/src/core/net/sf/basedb/util/overview/validator/ProtocolValidator.java

    r4764 r5630  
    2525import net.sf.basedb.core.DbControl;
    2626import net.sf.basedb.core.Item;
     27import net.sf.basedb.core.ItemSubtype;
    2728import net.sf.basedb.core.PermissionDeniedException;
    2829import net.sf.basedb.core.Project;
    2930import net.sf.basedb.core.Protocol;
    30 import net.sf.basedb.core.ProtocolType;
    3131import net.sf.basedb.util.overview.Fix;
    3232import net.sf.basedb.util.overview.OverviewContext;
     
    9696    try
    9797    {
    98       ProtocolType pt = protocol.getProtocolType();
     98      ItemSubtype pt = protocol.getItemSubtype();
    9999      String requiredId = defaultType == null ? null : defaultType.getType();
    100100      if (requiredId != null && !requiredId.equals(pt.getSystemId()))
  • trunk/src/core/net/sf/basedb/util/overview/validator/SoftwareValidator.java

    r4764 r5630  
    2525import net.sf.basedb.core.DbControl;
    2626import net.sf.basedb.core.Item;
     27import net.sf.basedb.core.ItemSubtype;
    2728import net.sf.basedb.core.PermissionDeniedException;
    2829import net.sf.basedb.core.Project;
    2930import net.sf.basedb.core.Software;
    30 import net.sf.basedb.core.SoftwareType;
    3131import net.sf.basedb.util.overview.Fix;
    3232import net.sf.basedb.util.overview.OverviewContext;
     
    9696    try
    9797    {
    98       SoftwareType st = software.getSoftwareType();
     98      ItemSubtype st = software.getItemSubtype();
    9999      String requiredId = defaultType == null ? null : defaultType.getType();
    100100      if (requiredId != null && !requiredId.equals(st.getSystemId()))
  • trunk/src/plugins/core/net/sf/basedb/plugins/CdfFileReporterImporter.java

    r5623 r5630  
    4747import net.sf.basedb.core.FileParameterType;
    4848import net.sf.basedb.core.FileStoreUtil;
    49 import net.sf.basedb.core.FileType;
    5049import net.sf.basedb.core.InvalidDataException;
    5150import net.sf.basedb.core.Item;
     
    238237      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    239238      fileContext.removeAllTemporaryFilters();
    240       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER, PropertyFilter.TEMPORARY));
    241239      fileContext.setPropertyFilter(new PropertyFilter("name", Operator.LIKE,
    242240          "%.cdf", Type.STRING, PropertyFilter.TEMPORARY));
  • trunk/src/plugins/core/net/sf/basedb/plugins/IlluminaRawDataImporter.java

    r5612 r5630  
    5555import net.sf.basedb.core.PluginParameter;
    5656import net.sf.basedb.core.Protocol;
    57 import net.sf.basedb.core.ProtocolType;
    5857import net.sf.basedb.core.RawBioAssay;
    5958import net.sf.basedb.core.RawDataBatcher;
     
    6463import net.sf.basedb.core.Scan;
    6564import net.sf.basedb.core.Software;
    66 import net.sf.basedb.core.SoftwareType;
    6765import net.sf.basedb.core.StringParameterType;
    6866import net.sf.basedb.core.SystemItems;
     
    737735        List<Protocol> protocols = getItems(dc, Protocol.getQuery(),
    738736            Restrictions.eq(
    739               Hql.property("protocolType.id"),
    740               Expressions.integer(SystemItems.getId(ProtocolType.FEATURE_EXTRACTION))
     737              Hql.property("itemSubtype.id"),
     738              Expressions.integer(SystemItems.getId(Protocol.FEATURE_EXTRACTION))
    741739            )
    742740          );
    743741        List<Software> software = getItems(dc, Software.getQuery(),
    744742          Restrictions.eq(
    745               Hql.property("softwareType.id"),
    746               Expressions.integer(SystemItems.getId(SoftwareType.FEATURE_EXTRACTION))
     743              Hql.property("itemSubtype.id"),
     744              Expressions.integer(SystemItems.getId(Software.FEATURE_EXTRACTION))
    747745            )
    748746          );
  • trunk/src/plugins/core/net/sf/basedb/plugins/PlateFlatFileImporter.java

    r5612 r5630  
    2828import net.sf.basedb.core.DbControl;
    2929import net.sf.basedb.core.File;
    30 import net.sf.basedb.core.FileType;
    3130import net.sf.basedb.core.Include;
    3231import net.sf.basedb.core.IntegerParameterType;
     
    4342import net.sf.basedb.core.PlateType;
    4443import net.sf.basedb.core.PluginParameter;
    45 import net.sf.basedb.core.PropertyFilter;
    4644import net.sf.basedb.core.ReporterBatcher;
    4745import net.sf.basedb.core.RequestInformation;
     
    268266      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    269267      fileContext.removeAllTemporaryFilters();
    270       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.PLATE, PropertyFilter.TEMPORARY));
    271268    }
    272269    return requestInformation;
  • trunk/src/plugins/core/net/sf/basedb/plugins/PrintMapFlatFileImporter.java

    r5612 r5630  
    3636import net.sf.basedb.core.FileSetMember;
    3737import net.sf.basedb.core.FileStoreUtil;
    38 import net.sf.basedb.core.FileType;
    3938import net.sf.basedb.core.IntegerUtil;
    4039import net.sf.basedb.core.InvalidDataException;
     
    4948import net.sf.basedb.core.Plate;
    5049import net.sf.basedb.core.PluginParameter;
    51 import net.sf.basedb.core.PropertyFilter;
    5250import net.sf.basedb.core.RequestInformation;
    5351import net.sf.basedb.core.StringParameterType;
     
    224222      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    225223      fileContext.removeAllTemporaryFilters();
    226       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.PRINT_MAP, PropertyFilter.TEMPORARY));
    227224    }
    228225    return requestInformation;
     
    301298    File reporterMapFile = (File)job.getValue("file");
    302299    printMapMember = FileStoreUtil.setGenericDataFile(dc, arrayDesign,
    303         FileType.PRINT_MAP, DataFileType.GENERIC_PRINT_MAP, reporterMapFile);
     300        File.PRINT_MAP, DataFileType.GENERIC_PRINT_MAP, reporterMapFile);
    304301    if (arrayDesign.getNumDbFeatures() > 0)
    305302    {
     
    520517      {
    521518        design = ArrayDesign.getById(dc, currentArrayDesignId);
    522         printMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, FileType.PRINT_MAP);
     519        printMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File.PRINT_MAP);
    523520      }
    524521      catch (Throwable t)
  • trunk/src/plugins/core/net/sf/basedb/plugins/RawDataFlatFileImporter.java

    r5612 r5630  
    3636import net.sf.basedb.core.FileSetMember;
    3737import net.sf.basedb.core.FileStoreUtil;
    38 import net.sf.basedb.core.FileType;
    3938import net.sf.basedb.core.Include;
    4039import net.sf.basedb.core.Item;
     
    4443import net.sf.basedb.core.ItemParameterType;
    4544import net.sf.basedb.core.ItemQuery;
     45import net.sf.basedb.core.ItemSubtype;
    4646import net.sf.basedb.core.Permission;
    4747import net.sf.basedb.core.PermissionDeniedException;
     
    5050import net.sf.basedb.core.PluginConfiguration;
    5151import net.sf.basedb.core.PluginParameter;
    52 import net.sf.basedb.core.PropertyFilter;
    5352import net.sf.basedb.core.RawBioAssay;
    5453import net.sf.basedb.core.RawDataBatcher;
     
    327326      permissions.add(new Permissions(Item.PLATFORM, null, EnumSet.of(Permission.READ)));
    328327      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)));
    330329      permissions.add(new Permissions(Item.PLUGINCONFIGURATION, null, EnumSet.of(Permission.READ)));
    331330    }
     
    432431      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    433432      fileContext.removeAllTemporaryFilters();
    434       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.RAW_DATA, PropertyFilter.TEMPORARY));
    435433    }
    436434    return requestInformation;
     
    616614          else
    617615          {
    618             List<File> rawFiles = FileStoreUtil.getGenericDataFiles(dc, rba, FileType.RAW_DATA);
     616            List<File> rawFiles = FileStoreUtil.getGenericDataFiles(dc, rba, File.RAW_DATA);
    619617            if (rawFiles != null && rawFiles.size() > 0) dataFile = rawFiles.get(0);
    620618          }
     
    678676    rawBioAssay = RawBioAssay.getById(dc, fileIterator.getCurrentRawBioAssay().getId());
    679677    rawDataMember = FileStoreUtil.setGenericDataFile(dc, rawBioAssay,
    680       FileType.RAW_DATA, DataFileType.GENERIC_RAW_DATA, fileIterator.getCurrentFile());
     678      File.RAW_DATA, DataFileType.GENERIC_RAW_DATA, fileIterator.getCurrentFile());
    681679   
    682680    PluginConfiguration cfg = getCurrentConfiguration(dc);
     
    10791077      try
    10801078      {
    1081         rawDataFiles = FileStoreUtil.getGenericDataFiles(dc, currentRaw, FileType.RAW_DATA);
     1079        rawDataFiles = FileStoreUtil.getGenericDataFiles(dc, currentRaw, File.RAW_DATA);
    10821080      }
    10831081      catch (Throwable t)
     
    11171115      variant = type.getVariant(dc);
    11181116    }
    1119     FileType rawData = FileType.getById(dc, SystemItems.getId(FileType.RAW_DATA));
     1117    ItemSubtype rawData = ItemSubtype.getById(dc, SystemItems.getId(File.RAW_DATA));
    11201118    ItemQuery<DataFileType> query = DataFileType.getQuery(platform, variant,
    11211119      Item.RAWBIOASSAY, rawData);
  • trunk/src/plugins/core/net/sf/basedb/plugins/ReporterFlatFileImporter.java

    r5612 r5630  
    2525
    2626import net.sf.basedb.core.File;
    27 import net.sf.basedb.core.FileType;
    2827import net.sf.basedb.core.HibernateUtil;
    2928import net.sf.basedb.core.InvalidUseOfNullException;
     
    3231import net.sf.basedb.core.Permission;
    3332import net.sf.basedb.core.PermissionDeniedException;
    34 import net.sf.basedb.core.PropertyFilter;
    3533import net.sf.basedb.core.ReporterList;
    3634import net.sf.basedb.core.RequestInformation;
     
    271269      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    272270      fileContext.removeAllTemporaryFilters();
    273       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER, PropertyFilter.TEMPORARY));
    274271    }
    275272    return requestInformation;
  • trunk/src/plugins/core/net/sf/basedb/plugins/ReporterMapFlatFileImporter.java

    r5612 r5630  
    3636import net.sf.basedb.core.FileSetMember;
    3737import net.sf.basedb.core.FileStoreUtil;
    38 import net.sf.basedb.core.FileType;
    3938import net.sf.basedb.core.InvalidDataException;
    4039import net.sf.basedb.core.InvalidUseOfNullException;
     
    4342import net.sf.basedb.core.ItemNotFoundException;
    4443import net.sf.basedb.core.Permission;
    45 import net.sf.basedb.core.PropertyFilter;
    4644import net.sf.basedb.core.ReporterBatcher;
    4745import net.sf.basedb.core.ItemParameterType;
     
    350348      ItemContext fileContext = sc.getCurrentContext(Item.FILE);
    351349      fileContext.removeAllTemporaryFilters();
    352       fileContext.setPropertyFilter(FileType.getPropertyFilter(FileType.REPORTER_MAP, PropertyFilter.TEMPORARY));
    353350    }
    354351    return requestInformation;
     
    504501      FeatureIdentificationMethod.valueOf(fiParameter);
    505502    reporterMapMember = FileStoreUtil.setGenericDataFile(dc, arrayDesign,
    506         FileType.REPORTER_MAP, DataFileType.GENERIC_REPORTER_MAP, reporterMapFile);
     503        File.REPORTER_MAP, DataFileType.GENERIC_REPORTER_MAP, reporterMapFile);
    507504    batcher = arrayDesign.getFeatureBatcher(fiMethod, job.getJob());
    508505    reporterBatcher = ReporterBatcher.getNew(dc);
     
    673670      {
    674671        design = ArrayDesign.getById(dc, currentArrayDesignId);
    675         reporterMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, FileType.REPORTER_MAP);
     672        reporterMapFiles = FileStoreUtil.getGenericDataFiles(dc, design, File.REPORTER_MAP);
    676673      }
    677674      catch (Throwable t)
  • trunk/src/plugins/core/net/sf/basedb/plugins/SpotImageCreator.java

    r5612 r5630  
    8686      permissions.add(new Permissions(Item.RAWBIOASSAY, null, EnumSet.of(Permission.WRITE)));
    8787      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));
    8989      permissions.add(new Permissions(Item.DIRECTORY, null, EnumSet.of(Permission.USE)));
    9090    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java

    r5481 r5630  
    4848import net.sf.basedb.core.File;
    4949import net.sf.basedb.core.Hardware;
    50 import net.sf.basedb.core.HardwareType;
    5150import net.sf.basedb.core.Hybridization;
    5251import net.sf.basedb.core.Image;
     
    6059import net.sf.basedb.core.ItemNotFoundException;
    6160import net.sf.basedb.core.ItemQuery;
     61import net.sf.basedb.core.ItemSubtype;
    6262import net.sf.basedb.core.Job;
    6363import net.sf.basedb.core.Label;
     
    7474import net.sf.basedb.core.ProjectKey;
    7575import net.sf.basedb.core.Protocol;
    76 import net.sf.basedb.core.ProtocolType;
    7776import net.sf.basedb.core.RawDataType;
    7877import net.sf.basedb.core.RawDataTypes;
     
    8382import net.sf.basedb.core.ShareableUtil;
    8483import net.sf.basedb.core.Software;
    85 import net.sf.basedb.core.SoftwareType;
    8684import net.sf.basedb.core.StringParameterType;
    8785import net.sf.basedb.core.StringTooLongException;
    8886import net.sf.basedb.core.StringUtil;
    89 import net.sf.basedb.core.SystemItems;
    9087import net.sf.basedb.core.Type;
    9188import net.sf.basedb.core.plugin.GuiContext;
     
    10141011  private ItemQuery<Protocol> protocolQuery;
    10151012  /**
    1016     Same as {@link #findProtocol(DbControl, IdMethod, String, ProtocolType)} with
    1017     a null protocol type.
     1013    Same as {@link #findProtocol(DbControl, IdMethod, String, ItemSubtype)} with
     1014    a null item subtype.
    10181015  */
    10191016  protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier)
     
    10311028    called with the same id method object, otherwise the result is undefined.
    10321029    <p>
    1033     NOTE! If this method is called with a non-null protocol type parameter and
    1034     no protocol is found the query will be retried without any protocol type.
     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.
    10351032   
    10361033    @param dc The DbControl to use for database access
    10371034    @param identifier The identifier protocol
    1038     @param type The protocol type of the protocol, or null if the type doesn't matter
     1035    @param subtype The protocol subtype, or null if the type doesn't matter
    10391036    @return A protocol, or null if no item could be found
    1040     @since 2.9
    1041   */
    1042   protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier, ProtocolType type)
     1037    @since 3.0
     1038  */
     1039  protected Protocol findProtocol(DbControl dc, IdMethod idMethod, String identifier, ItemSubtype subtype)
    10431040  {
    10441041    if (identifier == null) return null;
    10451042    if (protocolQuery == null)
    10461043    {
    1047       // where ... (protocolType = :protocolType AND checkType = 1) || checkType = 0
     1044      // where ... (itemSubtype = :subtype AND checkType = 1) || checkType = 0
    10481045      Expression checkType = Expressions.parameter("checkType");
    10491046      protocolQuery = initReferenceQuery(dc, idMethod, Protocol.getQuery());
     
    10511048        Restrictions.or(
    10521049          Restrictions.and(
    1053             Restrictions.eq(Hql.property("protocolType"), Expressions.parameter("protocolType")),
     1050            Restrictions.eq(Hql.property("itemSubtype"), Expressions.parameter("subtype")),
    10541051            Restrictions.eq(checkType, Expressions.integer(1))
    10551052          ),
     
    10581055      );
    10591056    }
    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);
    10621059    Protocol protocol = findReferencedItem(dc, idMethod, protocolQuery, identifier, true);
    10631060    if (protocol == null)
     
    10901087  }
    10911088
    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.
    11011103    <p>
    11021104    NOTE! The first time this method is called a query object is initialised
     
    11041106    Subsequent calls uses the same query. Thus, this method should always be
    11051107    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.
    11061111   
    11071112    @param dc The DbControl to use for database access
    11081113    @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)
    11121119  {
    11131120    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        )
    11201134      );
    11211135    }
    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.
    11341160    <p>
    11351161    NOTE! The first time this method is called a query object is initialised
     
    11371163    Subsequent calls uses the same query. Thus, this method should always be
    11381164    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.
    11391168   
    11401169    @param dc The DbControl to use for database access
    11411170    @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)
    11451176  {
    11461177    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        )
    11531191      );
    11541192    }
    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 
    12581204  private ItemQuery<Platform> platformQuery;
    12591205  /**
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ArrayBatchImporter.java

    r5612 r5630  
    3232import net.sf.basedb.core.Item;
    3333import net.sf.basedb.core.ItemQuery;
     34import net.sf.basedb.core.ItemSubtype;
    3435import net.sf.basedb.core.PluginParameter;
    3536import net.sf.basedb.core.Protocol;
    36 import net.sf.basedb.core.ProtocolType;
    3737import net.sf.basedb.core.SystemItems;
    3838import net.sf.basedb.core.plugin.GuiContext;
     
    174174    {
    175175      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));
    177177      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    178178      if (nameOrId == null || protocol != null) batch.setProtocol(protocol);
     
    181181    {
    182182      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);
    184185      if (nameOrId == null || robot != null) batch.setPrintRobot(robot);
    185186    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/BioPlateImporter.java

    r5612 r5630  
    3333import net.sf.basedb.core.Item;
    3434import net.sf.basedb.core.ItemQuery;
     35import net.sf.basedb.core.ItemSubtype;
    3536import net.sf.basedb.core.LabeledExtract;
    3637import net.sf.basedb.core.PlateGeometry;
    3738import net.sf.basedb.core.PluginParameter;
     39import net.sf.basedb.core.SystemItems;
    3840import net.sf.basedb.core.plugin.GuiContext;
    3941import net.sf.basedb.util.parser.FlatFileParser;
     
    208210    {
    209211      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);
    211214      if (nameOrId == null || freezer != null) plate.setFreezer(freezer);
    212215    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ExtractImporter.java

    r5612 r5630  
    3333import net.sf.basedb.core.Item;
    3434import net.sf.basedb.core.ItemQuery;
     35import net.sf.basedb.core.ItemSubtype;
    3536import net.sf.basedb.core.PluginParameter;
    3637import net.sf.basedb.core.Protocol;
    37 import net.sf.basedb.core.ProtocolType;
    3838import net.sf.basedb.core.Sample;
    3939import net.sf.basedb.core.SystemItems;
     
    184184    {
    185185      String nameOrId = protocolMapper.getValue(data);
    186       ProtocolType type = ProtocolType.getById(dc,
    187           SystemItems.getId(extract.isPooled() ? ProtocolType.POOLING : ProtocolType.EXTRACTION));
     186      ItemSubtype type = ItemSubtype.getById(dc,
     187          SystemItems.getId(extract.isPooled() ? Protocol.POOLING : Protocol.EXTRACTION));
    188188      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    189189      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/HybridizationImporter.java

    r5612 r5630  
    3535import net.sf.basedb.core.Item;
    3636import net.sf.basedb.core.ItemQuery;
     37import net.sf.basedb.core.ItemSubtype;
    3738import net.sf.basedb.core.LabeledExtract;
    3839import net.sf.basedb.core.Permission;
     
    4041import net.sf.basedb.core.PluginParameter;
    4142import net.sf.basedb.core.Protocol;
    42 import net.sf.basedb.core.ProtocolType;
    4343import net.sf.basedb.core.StringParameterType;
    4444import net.sf.basedb.core.SystemItems;
     
    237237    {
    238238      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));
    240240      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    241241      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
     
    244244    {
    245245      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);
    247248      if (nameOrId == null || hybStation != null) creationEvent.setHardware(hybStation);
    248249    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/LabeledExtractImporter.java

    r5612 r5630  
    3333import net.sf.basedb.core.Item;
    3434import net.sf.basedb.core.ItemQuery;
     35import net.sf.basedb.core.ItemSubtype;
    3536import net.sf.basedb.core.Label;
    3637import net.sf.basedb.core.LabeledExtract;
    3738import net.sf.basedb.core.PluginParameter;
    3839import net.sf.basedb.core.Protocol;
    39 import net.sf.basedb.core.ProtocolType;
    4040import net.sf.basedb.core.SystemItems;
    4141import net.sf.basedb.core.plugin.GuiContext;
     
    214214    {
    215215      String nameOrId = protocolMapper.getValue(data);
    216       ProtocolType type = ProtocolType.getById(dc,
    217           SystemItems.getId(extract.isPooled() ? ProtocolType.POOLING : ProtocolType.LABELING));
     216      ItemSubtype type = ItemSubtype.getById(dc,
     217          SystemItems.getId(extract.isPooled() ? Protocol.POOLING : Protocol.LABELING));
    218218      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    219219      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/RawBioAssayImporter.java

    r5623 r5630  
    3232import net.sf.basedb.core.Item;
    3333import net.sf.basedb.core.ItemQuery;
     34import net.sf.basedb.core.ItemSubtype;
    3435import net.sf.basedb.core.Path;
    3536import net.sf.basedb.core.PathParameterType;
     
    3940import net.sf.basedb.core.PluginParameter;
    4041import net.sf.basedb.core.Protocol;
    41 import net.sf.basedb.core.ProtocolType;
    4242import net.sf.basedb.core.RawBioAssay;
    4343import net.sf.basedb.core.RawDataType;
     
    406406    {
    407407      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));
    409409      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    410410      if (nameOrId == null || protocol != null) rba.setProtocol(protocol);
     
    413413    {
    414414      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);
    416417      if (nameOrId == null || software != null) rba.setSoftware(software);
    417418    }
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/SampleImporter.java

    r5612 r5630  
    3333import net.sf.basedb.core.Item;
    3434import net.sf.basedb.core.ItemQuery;
     35import net.sf.basedb.core.ItemSubtype;
    3536import net.sf.basedb.core.PluginParameter;
    3637import net.sf.basedb.core.Protocol;
    37 import net.sf.basedb.core.ProtocolType;
    3838import net.sf.basedb.core.Sample;
    3939import net.sf.basedb.core.SystemItems;
     
    290290    {
    291291      String nameOrId = protocolMapper.getValue(data);
    292       ProtocolType type = ProtocolType.getById(dc,
    293           SystemItems.getId(sample.isPooled() ? ProtocolType.POOLING : ProtocolType.SAMPLING));
     292      ItemSubtype type = ItemSubtype.getById(dc,
     293          SystemItems.getId(sample.isPooled() ? Protocol.POOLING : Protocol.SAMPLING));
    294294      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    295295      if (nameOrId == null || protocol != null) creationEvent.setProtocol(protocol);
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java

    r5612 r5630  
    2929import net.sf.basedb.core.Item;
    3030import net.sf.basedb.core.ItemQuery;
     31import net.sf.basedb.core.ItemSubtype;
    3132import net.sf.basedb.core.Path;
    3233import net.sf.basedb.core.PathParameterType;
    3334import net.sf.basedb.core.PluginParameter;
    3435import net.sf.basedb.core.Protocol;
    35 import net.sf.basedb.core.ProtocolType;
    3636import net.sf.basedb.core.Scan;
    3737import net.sf.basedb.core.SystemItems;
     
    273273    {
    274274      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));
    276276      Protocol protocol = findProtocol(dc, FallbackIdMethod.NAME_OR_EXTERNALID_OR_ID, nameOrId, type);
    277277      if (nameOrId == null || protocol != null) scan.setProtocol(protocol);
     
    280280    {
    281281      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);
    283284      if (nameOrId == null || scanner != null) scan.setScanner(scanner);
    284285    }
  • trunk/src/test/TestAll.java

    r5616 r5630  
    6161    results.put("TestPath", TestPath.test_all());
    6262    results.put("TestDirectory", TestDirectory.test_all());
    63     results.put("TestFileType", TestFileType.test_all());
    6463    results.put("TestFileServer", TestFileServer.test_all());
    6564    results.put("TestFile", TestFile.test_all());
     
    6766    results.put("TestPackedFileExporter", TestPackedFileExporter.test_all());
    6867
    69     // Hardware, software, protocols
    70     results.put("TestHardwareType", TestHardwareType.test_all());
     68    // Item types, Hardware, software, protocols
     69    results.put("TestItemSubtype", TestItemSubtype.test_all());
    7170    results.put("TestHardware", TestHardware.test_all());
    72     results.put("TestSoftwareType", TestSoftwareType.test_all());
    7371    results.put("TestSoftware", TestSoftware.test_all());
    74     results.put("TestProtocolType", TestProtocolType.test_all());
    7572    results.put("TestProtocol", TestProtocol.test_all());
    7673
  • trunk/src/test/TestBasicAnalysis.java

    r5230 r5630  
    3636import net.sf.basedb.core.FileSetMember;
    3737import net.sf.basedb.core.FileStoreUtil;
    38 import net.sf.basedb.core.FileType;
    3938import net.sf.basedb.core.FilterBatcher;
    4039import net.sf.basedb.core.Formula;
    4140import net.sf.basedb.core.IntensityTransform;
    4241import net.sf.basedb.core.ItemResultList;
     42import net.sf.basedb.core.ItemSubtype;
    4343import net.sf.basedb.core.Path;
    4444import net.sf.basedb.core.PositionExtraValueBatcher;
     
    351351      File f = File.getByPath(dc, new Path(path, Path.Type.FILE), true);
    352352      f.setMimeType("text/plain");
    353       f.setFileType(FileType.getById(dc, SystemItems.getId(FileType.SPOT_DATA)));
     353      f.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(File.SPOT_DATA)));
    354354      if (!f.isInDatabase()) dc.saveItem(f);
    355355      FileStoreUtil.setDataFile(dc, bas, DataFileType.GENERIC_SPOT_DATA, f);
  • trunk/src/test/TestBioPlate.java

    r5456 r5630  
    2828import net.sf.basedb.core.Extract;
    2929import net.sf.basedb.core.Hardware;
    30 import net.sf.basedb.core.HardwareType;
    3130import net.sf.basedb.core.Item;
    3231import net.sf.basedb.core.ItemProxy;
     
    3736import net.sf.basedb.core.Permission;
    3837import net.sf.basedb.core.PlateGeometry;
    39 import net.sf.basedb.core.ProtocolType;
     38import net.sf.basedb.core.Protocol;
    4039import net.sf.basedb.core.Sample;
    4140import net.sf.basedb.core.SystemItems;
     
    7776    int labelId = TestLabel.test_create(true);
    7877    int labeledExtractId = TestLabeledExtract.test_create(extractId, labelId, true);
    79     int freezerId = TestHardware.test_create(SystemItems.getId(HardwareType.FREEZER), null, false);
    80     int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.SAMPLING),
     78    int freezerId = TestHardware.test_create(SystemItems.getId(Hardware.FREEZER), null, false);
     79    int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SAMPLING),
    8180      "A plate event protocol", false);
    82     int hybProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.HYBRIDIZATION),
     81    int hybProtocolId = TestProtocol.test_create(SystemItems.getId(Protocol.HYBRIDIZATION),
    8382        "A hyb event protocol", false);
    8483   
  • trunk/src/test/TestBioPlateEvent.java

    r5525 r5630  
    3232import net.sf.basedb.core.Extract;
    3333import net.sf.basedb.core.Hardware;
    34 import net.sf.basedb.core.HardwareType;
    3534import net.sf.basedb.core.Item;
    3635import net.sf.basedb.core.ItemProxy;
     
    3938import net.sf.basedb.core.Permission;
    4039import net.sf.basedb.core.Protocol;
    41 import net.sf.basedb.core.ProtocolType;
    4240import net.sf.basedb.core.Sample;
    4341import net.sf.basedb.core.SystemItems;
     
    8381    int sampleId3 = TestSample.test_create(0, "Ref.s3", false);
    8482
    85     int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.EXTRACTION), "Extract on plate", false);
    86     int hardwareId = TestHardware.test_create(SystemItems.getId(HardwareType.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);
    8785   
    8886    // Place the biomaterial on a plate using an event
  • trunk/src/test/TestDataFileType.java

    r5340 r5630  
    2626import net.sf.basedb.core.DbControl;
    2727import net.sf.basedb.core.DataFileType;
    28 import net.sf.basedb.core.FileType;
     28import net.sf.basedb.core.File;
    2929import net.sf.basedb.core.Item;
    3030import net.sf.basedb.core.ItemProxy;
    3131import net.sf.basedb.core.ItemResultList;
     32import net.sf.basedb.core.ItemSubtype;
    3233import net.sf.basedb.core.Permission;
    3334import net.sf.basedb.core.PlatformVariant;
     
    5455    test_load(SystemItems.getId("affymetrix.cel"));
    5556   
    56     int id1 = test_create("Test file type", "test.filetype", Item.RAWBIOASSAY, SystemItems.getId(FileType.RAW_DATA));
     57    int id1 = test_create("Test file type", "test.filetype", Item.RAWBIOASSAY, SystemItems.getId(File.RAW_DATA));
    5758    test_list();
    5859
     
    7273    {
    7374      dc = TestUtil.getDbControl();
    74       FileType genericType = genericTypeId == 0 ? null : FileType.getById(dc, genericTypeId);
     75      ItemSubtype genericType = genericTypeId == 0 ? null : ItemSubtype.getById(dc, genericTypeId);
    7576      DataFileType type = DataFileType.getNew(dc, externalId, itemType);
    7677      type.setGenericType(genericType);
  • trunk/src/test/TestFile.java

    r5362 r5630  
    315315  {
    316316    if (!TestUtil.getSilent()) System.out.println(i+":\t"+fi.getId()+"\t"+fi.getName()+"\t"+fi.getDescription()+"\t"+
    317       fi.getFileType()+"\t"+fi.isUsed()+"\t"+fi.getLocation()+"\t"+fi.getAction()+"\t"+
     317      fi.getItemSubtype()+"\t"+fi.isUsed()+"\t"+fi.getLocation()+"\t"+fi.getAction()+"\t"+
    318318      fi.getSize()+"\t" + fi.getCompressedSize() + "\t"+fi.getMimeType()+"\t"+
    319319      fi.getCharacterSet()+"\t"+fi.getPath());
  • trunk/src/test/TestGenericOverview.java

    r4768 r5630  
    2525import net.sf.basedb.core.DataFileType;
    2626import net.sf.basedb.core.DbControl;
    27 import net.sf.basedb.core.HardwareType;
     27import net.sf.basedb.core.Hardware;
    2828import net.sf.basedb.core.Item;
    2929import net.sf.basedb.core.Platform;
    30 import net.sf.basedb.core.ProtocolType;
     30import net.sf.basedb.core.Protocol;
    3131import net.sf.basedb.core.Quantity;
    3232import net.sf.basedb.core.SessionControl;
    33 import net.sf.basedb.core.SoftwareType;
     33import net.sf.basedb.core.Software;
    3434import net.sf.basedb.core.SystemItems;
    3535import net.sf.basedb.core.Type;
     
    6262    // Protocols
    6363    int scanningProtocol = TestProtocol.test_create(
    64         SystemItems.getId(ProtocolType.SCANNING), "Scan protocol", false);
     64        SystemItems.getId(Protocol.SCANNING), "Scan protocol", false);
    6565    int featureProtocol = TestProtocol.test_create(
    66         SystemItems.getId(ProtocolType.FEATURE_EXTRACTION), "Feature protocol", false);
     66        SystemItems.getId(Protocol.FEATURE_EXTRACTION), "Feature protocol", false);
    6767    int power = SystemItems.getId(Quantity.POWER);
    6868    int milliWatt = TestUnit.test_load_by_symbol(power, "mW");
     
    7373    // Hardware and software
    7474    int scanner = TestHardware.test_create(
    75         SystemItems.getId(HardwareType.SCANNER), "Overview scanner", false);
     75        SystemItems.getId(Hardware.SCANNER), "Overview scanner", false);
    7676    int software = TestSoftware.test_create(
    77         SystemItems.getId(SoftwareType.FEATURE_EXTRACTION), "Overview software", false);
     77        SystemItems.getId(Software.FEATURE_EXTRACTION), "Overview software", false);
    7878   
    7979    // Data files
  • trunk/src/test/TestHardware.java

    r5340 r5630  
    55import net.sf.basedb.core.DbControl;
    66import net.sf.basedb.core.Hardware;
    7 import net.sf.basedb.core.HardwareType;
    87import net.sf.basedb.core.Item;
    98import net.sf.basedb.core.ItemProxy;
     9import net.sf.basedb.core.ItemSubtype;
    1010import net.sf.basedb.core.Permission;
    1111import net.sf.basedb.core.ItemResultList;
     
    5252    write_header();
    5353    // Standard tests: create, load, list
    54     int id = test_create(SystemItems.getId(HardwareType.SCANNER), null, true);
    55     int id2 = test_create(SystemItems.getId(HardwareType.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);
    5656    test_load(id);
    5757    test_list();
     
    7575    {
    7676      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      }
    7982      if (setAll)
    8083      {
     
    194197  {
    195198    if (!TestUtil.getSilent()) System.out.println(i+":\t"+hw.getId()+"\t"+hw.getName()+"\t"+
    196       hw.getDescription()+"\t"+hw.getHardwareType().getName()+"\t"+hw.getVersionString());
     199      hw.getDescription()+"\t"+hw.getItemSubtype()+"\t"+hw.getVersionString());
    197200  }
    198201  static void write(String message)
  • trunk/src/test/TestIlluminaImporter.java

    r5319 r5630  
    4545    int hybId = TestHybridization.test_create(0, false, new int[] {});
    4646    int scanId = TestScan.test_create(hybId, 0, 0, false);
    47     int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.FEATURE_EXTRACTION), null, false);
    48     int softwareId = TestSoftware.test_create(SystemItems.getId(SoftwareType.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);
    4949    int experimentId = TestExperiment.test_create("illumina", false);
    5050   
  • trunk/src/test/TestItemImporter.java

    r5445 r5630  
    2424import net.sf.basedb.core.DbControl;
    2525import net.sf.basedb.core.File;
    26 import net.sf.basedb.core.HardwareType;
     26import net.sf.basedb.core.Hardware;
    2727import net.sf.basedb.core.Item;
    2828import net.sf.basedb.core.Job;
     
    3333import net.sf.basedb.core.PluginParameter;
    3434import net.sf.basedb.core.PluginResponse;
    35 import net.sf.basedb.core.ProtocolType;
     35import net.sf.basedb.core.Protocol;
    3636import net.sf.basedb.core.RequestInformation;
    37 import net.sf.basedb.core.SoftwareType;
     37import net.sf.basedb.core.Software;
    3838import net.sf.basedb.core.SystemItems;
    3939import net.sf.basedb.core.plugin.GuiContext;
     
    5858   
    5959    // Create referenced items
    60     int samplingProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.SAMPLING), "Sampling", false);
    61     int extractionProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.EXTRACTION), "Extraction", false);
    62     int labelingProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.LABELING), "Labeling", false);
    63     int poolingProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.POOLING), "Pooling", false);
    64     int hybProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.HYBRIDIZATION), "Hybridization", false);
    65     int hybStationId = TestHardware.test_create(SystemItems.getId(HardwareType.HYBRIDIZATION_STATION), "Hybstation", false);
    66     int scanProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.SCANNING), "Scanning", false);
    67     int scannerId = TestHardware.test_create(SystemItems.getId(HardwareType.SCANNER), "Scanner", false);
    68     int featureProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.FEATURE_EXTRACTION), "Feature", false);
    69     int featureSoftwareId = TestSoftware.test_create(SystemItems.getId(SoftwareType.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);
    7070    int genericId = TestPlatform.test_get(Platform.GENERIC);
    7171    int variantId = TestPlatform.test_create_variant(genericId, "Variant", "test.variant", null, 0, null);
    72     int robotId = TestHardware.test_create(SystemItems.getId(HardwareType.PRINT_ROBOT), "Robot", false);
    73     int printProtocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.PRINTING), "Printing", false);
    74     int freezerId = TestHardware.test_create(SystemItems.getId(HardwareType.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);
    7575   
    7676    // Import bioplates
  • trunk/src/test/TestPlate.java

    r5340 r5630  
    5858
    5959    // Test events
    60     int protocolTypeId = TestProtocolType.test_create(false);
     60    int protocolTypeId = TestItemSubtype.test_create(Item.PROTOCOL, "Plate protocol type");
    6161    int protocolId = TestProtocol.test_create(protocolTypeId, null, false);
    6262    int eventTypeId = TestPlateType.test_create_event_type(plateTypeId, protocolTypeId);
     
    6868    TestPlateType.test_delete_event_type(eventTypeId);
    6969    TestProtocol.test_delete(protocolId);
    70     TestProtocolType.test_delete(protocolTypeId);
     70    TestItemSubtype.test_delete(protocolTypeId);
    7171
    7272    // Standard test: Delete
  • trunk/src/test/TestPlateType.java

    r5340 r5630  
    5050
    5151    // Test events
    52     int protocolTypeId = TestProtocolType.test_create(false);
     52    int protocolTypeId = TestItemSubtype.test_create(Item.PROTOCOL, "Plate protocol type");
    5353    int eventTypeId = test_create_event_type(id, protocolTypeId);
    5454    test_list_event_types(id, 1);
     
    5656    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
    5757    test_delete_event_type(eventTypeId);
    58     TestProtocolType.test_delete(protocolTypeId);
     58    TestItemSubtype.test_delete(protocolTypeId);
    5959   
    6060    // Standard test: Delete
     
    223223      pet.setDescription("Added at "+new Date());
    224224      pet.setOrdinal(1);
    225       if (protocolTypeId != 0) pet.setProtocolType(ProtocolType.getById(dc, protocolTypeId));
     225      if (protocolTypeId != 0) pet.setProtocolType(ItemSubtype.getById(dc, protocolTypeId));
    226226      dc.saveItem(pet);
    227227      dc.commit();
  • trunk/src/test/TestPlatform.java

    r5340 r5630  
    2626import net.sf.basedb.core.DbControl;
    2727import net.sf.basedb.core.DataFileType;
    28 import net.sf.basedb.core.FileType;
     28import net.sf.basedb.core.File;
    2929import net.sf.basedb.core.Item;
    3030import net.sf.basedb.core.ItemProxy;
     
    6969   
    7070    // File types
    71     int fileTypeId = TestDataFileType.test_create("test.datafile", "test.datafile", Item.RAWBIOASSAY, SystemItems.getId(FileType.RAW_DATA));
     71    int fileTypeId = TestDataFileType.test_create("test.datafile", "test.datafile", Item.RAWBIOASSAY, SystemItems.getId(File.RAW_DATA));
    7272    int celId = TestDataFileType.get_id_for_external("affymetrix.cel");
    7373    int cdfId = TestDataFileType.get_id_for_external("affymetrix.cdf");
  • trunk/src/test/TestProject.java

    r5368 r5630  
    7373    // Extra test: set default item.
    7474    int samplingId = TestProtocol.test_create(
    75         SystemItems.getId(ProtocolType.SAMPLING), "Sampling protocol", false);
     75        SystemItems.getId(Protocol.SAMPLING), "Sampling protocol", false);
    7676    int hybStationId = TestHardware.test_create(
    77         SystemItems.getId(HardwareType.HYBRIDIZATION_STATION), "Hyb station", false);
     77        SystemItems.getId(Hardware.HYBRIDIZATION_STATION), "Hyb station", false);
    7878    test_defaultItem(id, Project.Default.SAMPLING_PROTOCOL, samplingId);
    7979    test_defaultItem(id, Project.Default.HYBRIDIZATION_HARDWARE, hybStationId);
  • trunk/src/test/TestProtocol.java

    r5340 r5630  
    77import net.sf.basedb.core.File;
    88import net.sf.basedb.core.ItemProxy;
     9import net.sf.basedb.core.ItemSubtype;
    910import net.sf.basedb.core.Protocol;
    10 import net.sf.basedb.core.ProtocolType;
    1111import net.sf.basedb.core.ItemResultList;
    1212import net.sf.basedb.core.SystemItems;
     
    5252    write_header();
    5353    // Standard tests: create, load, list
    54     int id1 = test_create(SystemItems.getId(ProtocolType.SAMPLING), null, true);
    55     int id2 = test_create(SystemItems.getId(ProtocolType.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);
    5656    test_load(id1);
    5757    test_list();
     
    7979    {
    8080      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      }
    8386      if(setAll)
    8487      {
     
    202205  {
    203206    if (!TestUtil.getSilent())
    204       write(i+":\t"+p.getId()+"\t"+p.getName()+"\t"+p.getDescription()+"\t"+p.getProtocolType().getName()+
     207      write(i+":\t"+p.getId()+"\t"+p.getName()+"\t"+p.getDescription()+"\t"+p.getItemSubtype()+
    205208        "\t" + p.getExternalId() + "\t"+p.getFile());
    206209  }
  • trunk/src/test/TestRawBioAssay.java

    r5340 r5630  
    6666        "\"Block\"\\t\"Column\"\\t\"Row\"\\t\"Name\"\\t\"ID\".*", null, 0, 2, 1, 4);
    6767   
    68     int softwareId = TestSoftware.test_create(SystemItems.getId(SoftwareType.FEATURE_EXTRACTION), null, false);
    69     int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.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);
    7070   
    7171    // Standard tests: create, load, list
  • trunk/src/test/TestScan.java

    r5340 r5630  
    4444   
    4545    int hybridizationId = TestHybridization.test_create(0, false);
    46     int scannerId = TestHardware.test_create(SystemItems.getId(HardwareType.SCANNER), null, false);
    47     int protocolId = TestProtocol.test_create(SystemItems.getId(ProtocolType.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);
    4848   
    4949    // Standard tests: create, load, list
  • trunk/src/test/TestSoftware.java

    r5340 r5630  
    66import net.sf.basedb.core.Item;
    77import net.sf.basedb.core.ItemProxy;
     8import net.sf.basedb.core.ItemSubtype;
    89import net.sf.basedb.core.Permission;
    910import net.sf.basedb.core.ItemResultList;
    1011import net.sf.basedb.core.Software;
    11 import net.sf.basedb.core.SoftwareType;
    1212import net.sf.basedb.core.SystemItems;
    1313
     
    5151    write_header();
    5252    // Standard tests: create, load, list
    53     int id1 = test_create(SystemItems.getId(SoftwareType.FEATURE_EXTRACTION),null, true);
    54     int id2 = test_create(SystemItems.getId(SoftwareType.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);
    5555    test_load(id1);
    5656    test_list();
     
    7474    {
    7575      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      }
    7881      if (setAll)
    7982      {
     
    192195    throws BaseException
    193196  {
    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    }
    195202  }
    196203  static void write(String message)
  • trunk/src/test/net/sf/basedb/test/FileUtil.java

    r5623 r5630  
    3434import net.sf.basedb.core.FileStoreEnabled;
    3535import net.sf.basedb.core.FileStoreUtil;
    36 import net.sf.basedb.core.FileType;
     36import net.sf.basedb.core.ItemSubtype;
    3737import net.sf.basedb.core.Nameable;
    3838import net.sf.basedb.core.SystemItems;
     
    8383    if (fileTypeId != null)
    8484    {
    85       file.setFileType(FileType.getById(dc, SystemItems.getId(fileTypeId)));
     85      file.setItemSubtype(ItemSubtype.getById(dc, SystemItems.getId(fileTypeId)));
    8686    }
    8787    if (!file.isInDatabase())
  • trunk/src/test/net/sf/basedb/test/performance/PrepareTest.java

    r4514 r5630  
    3232import net.sf.basedb.core.File;
    3333import net.sf.basedb.core.FileParameterType;
    34 import net.sf.basedb.core.FileType;
    3534import net.sf.basedb.core.ItemParameterType;
    3635import net.sf.basedb.core.ItemQuery;
     
    104103     
    105104      // Upload files
    106       reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.REPORTER);
    107       rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", FileType.RAW_DATA);
    108       rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", FileType.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);
    109108     
    110109      // Create importers
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r5327 r5630  
    3232import net.sf.basedb.core.Directory;
    3333import net.sf.basedb.core.File;
    34 import net.sf.basedb.core.FileType;
    3534import net.sf.basedb.core.Group;
    3635import net.sf.basedb.core.MultiPermissions;
     
    140139      //Upload file with reporters
    141140      dc = TestUtil.getDbControl();
    142       File reporters = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.PLATE);
    143       File affyReporters = FileUtil.uploadFile(dc, "/affymetrix/annotations", "MG_U74Av2_annot.csv.tar.bz2", FileType.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);
    144143      dc.commit();
    145144     
  • trunk/src/test/net/sf/basedb/test/roles/PowerUserTest.java

    r5623 r5630  
    3737import net.sf.basedb.core.File;
    3838import net.sf.basedb.core.FileParameterType;
    39 import net.sf.basedb.core.FileType;
    4039import net.sf.basedb.core.Group;
    4140import net.sf.basedb.core.Hardware;
    42 import net.sf.basedb.core.HardwareType;
    4341import net.sf.basedb.core.IntegerParameterType;
    4442import net.sf.basedb.core.Item;
    4543import net.sf.basedb.core.ItemParameterType;
     44import net.sf.basedb.core.ItemSubtype;
    4645import net.sf.basedb.core.Job;
    4746import net.sf.basedb.core.Permission;
     
    5453import net.sf.basedb.core.Project;
    5554import net.sf.basedb.core.Protocol;
    56 import net.sf.basedb.core.ProtocolType;
    5755import net.sf.basedb.core.Quantity;
    5856import net.sf.basedb.core.RawDataType;
    5957import net.sf.basedb.core.RawDataTypes;
    6058import net.sf.basedb.core.Software;
    61 import net.sf.basedb.core.SoftwareType;
    6259import net.sf.basedb.core.StringParameterType;
    6360import net.sf.basedb.core.SystemItems;
     
    141138     
    142139      // Protocols, hardware and software
    143       Protocol sampling = createProtocol(dc, "Sampling A", ProtocolType.SAMPLING);
    144       Protocol extraction = createProtocol(dc, "Extraction A", ProtocolType.EXTRACTION);
    145       Protocol labeling = createProtocol(dc, "Labeling A", ProtocolType.LABELING);
    146       Protocol hybridization = createProtocol(dc, "Hybridization A", ProtocolType.HYBRIDIZATION);
    147       Protocol scanning = createProtocol(dc, "Scanning A", ProtocolType.SCANNING, pmtGain);
    148       Protocol feature = createProtocol(dc, "Feature extraction A", ProtocolType.FEATURE_EXTRACTION);
    149       Protocol printing = createProtocol(dc, "Printing A", ProtocolType.PRINTING);
    150      
    151       Hardware hybStation = createHardware(dc, "Hybridization station A", HardwareType.HYBRIDIZATION_STATION);
    152       Hardware robot = createHardware(dc, "Print robot A", HardwareType.PRINT_ROBOT);
    153       Hardware scanner = createHardware(dc, "Scanner A", HardwareType.SCANNER);
    154       Software software = createSoftware(dc, "Software A", SoftwareType.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);
    155152     
    156153      PlateType plateType = createPlateType(dc, "Plate type A", 16, 24);
     
    181178      dc = TestUtil.getDbControl();
    182179
    183       File plates = FileUtil.uploadFile(dc, "/mouse", "plates_and_reporters.mouse.v4.37k.txt", FileType.PLATE);     
    184       File printMap = FileUtil.uploadFile(dc, "/mouse", "printmap.mouse.v4.37k.tam", FileType.PRINT_MAP);
    185       File cdfFile = FileUtil.uploadFile(dc, "/affymetrix/cdf", "MG_U74Av2.cdf.tar.bz2", FileType.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);
    186183      File batchImportFile_ArrayBatch = null;
    187184      File batchImportFile_ArrayDesign = null;
     
    297294  {
    298295    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);
    301299    p.setName(name);
    302300    if (parameters != null)
     
    317315  {
    318316    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);
    321320    hw.setName(name);
    322321    dc.saveItem(hw);
     
    330329  {
    331330    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);
    334334    sw.setName(name);
    335335    dc.saveItem(sw);
  • trunk/src/test/net/sf/basedb/test/roles/UserTest.java

    r5623 r5630  
    3737import net.sf.basedb.core.File;
    3838import net.sf.basedb.core.FileParameterType;
    39 import net.sf.basedb.core.FileType;
    4039import net.sf.basedb.core.Hybridization;
    4140import net.sf.basedb.core.Include;
     
    155154     
    156155      // Upload raw data files
    157       File rawData1 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.gpr", FileType.RAW_DATA);
    158       File rawData2 = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.gpr", FileType.RAW_DATA);
    159       File rawData1DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.00h.dyeswap.gpr", FileType.RAW_DATA);
    160       File rawData2DyeSwap = FileUtil.uploadFile(dc, "/mouse", "genepix.mouse.v4.37k.24h.dyeswap.gpr", FileType.RAW_DATA);
    161      
    162       File affy1 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1761.cel.tar.bz2", FileType.RAW_DATA);
    163       File affy2 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1762.cel.tar.bz2", FileType.RAW_DATA);
    164       File affy3 = FileUtil.uploadFile(dc, "/affymetrix/E-TEST-1.ebi.ac.uk", "jos1763.cel.tar.bz2", FileType.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);
    165164      dc.commit();
    166165     
  • trunk/www/admin/datafiletypes/edit_filetype.jsp

    r5623 r5630  
    3232  import="net.sf.basedb.core.Permission"
    3333  import="net.sf.basedb.core.DataFileType"
    34   import="net.sf.basedb.core.FileType"
     34  import="net.sf.basedb.core.ItemSubtype"
    3535  import="net.sf.basedb.core.ItemResultList"
    3636  import="net.sf.basedb.core.ItemQuery"
     
    7373    if (currentFileTypeId == 0)
    7474    {
    75       currentFileTypeId = Values.getInt(cc.getRecent(Item.FILETYPE.name(), 0), 0);
     75      currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0);
    7676    }
    7777  }
     
    8484    try
    8585    {
    86       FileType ft = fileType.getGenericType();
     86      ItemSubtype ft = fileType.getGenericType();
    8787      if (ft != null) currentFileTypeId = ft.getId();
    8888    }
     
    9393  }
    9494  // Query to retrieve file types
    95   final ItemQuery<FileType> fileTypeQuery = FileType.getQuery();
     95  final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(Item.FILE);
    9696  fileTypeQuery.order(Orders.asc(Hql.property("name")));
    9797  fileTypeQuery.setCacheResult(true);
     
    223223            <option value="0">- none -
    224224            <%
    225             ItemResultList<FileType> fileTypes = fileTypeQuery.list(dc);
    226             for (FileType ft : fileTypes)
     225            ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc);
     226            for (ItemSubtype ft : fileTypes)
    227227            {
    228228              int id = ft.getId();
  • trunk/www/admin/datafiletypes/index.jsp

    r5623 r5630  
    2929  import="net.sf.basedb.core.Include"
    3030  import="net.sf.basedb.core.DataFileType"
    31   import="net.sf.basedb.core.FileType"
     31  import="net.sf.basedb.core.ItemSubtype"
    3232  import="net.sf.basedb.core.ItemQuery"
    3333  import="net.sf.basedb.core.Permission"
     
    156156      if (genericTypeId >= 0) // < 0 = denied or unchanged
    157157      {
    158         FileType ft = genericTypeId == 0 ? null : FileType.getById(dc, genericTypeId);
     158        ItemSubtype ft = genericTypeId == 0 ? null : ItemSubtype.getById(dc, genericTypeId);
    159159        fileType.setGenericType(ft);
    160160        if (ft != null) cc.setRecent(ft, maxRecent);
  • trunk/www/admin/datafiletypes/list_filetypes.jsp

    r5623 r5630  
    2828  import="net.sf.basedb.core.Item"
    2929  import="net.sf.basedb.core.DataFileType"
    30   import="net.sf.basedb.core.FileType"
     30  import="net.sf.basedb.core.ItemSubtype"
    3131  import="net.sf.basedb.core.PlatformFileType"
    3232  import="net.sf.basedb.core.Platform"
     
    102102 
    103103  // Get all file types
    104   final ItemQuery<FileType> typeQuery = FileType.getQuery();
     104  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.FILE);
    105105  typeQuery.order(Orders.asc(Hql.property("name")));
    106106  typeQuery.setCacheResult(true);
    107107  Enumeration<String, String> genericTypes = new Enumeration<String, String>();
    108   for (FileType ft : typeQuery.list(dc))
     108  for (ItemSubtype ft : typeQuery.list(dc))
    109109  {
    110110    genericTypes.add(Integer.toString(ft.getId()), ft.getName());
  • trunk/www/admin/hardware/edit_hardware.jsp

    r5506 r5630  
    3232  import="net.sf.basedb.core.Permission"
    3333  import="net.sf.basedb.core.Hardware"
    34   import="net.sf.basedb.core.HardwareType"
     34  import="net.sf.basedb.core.ItemSubtype"
    3535  import="net.sf.basedb.core.ItemQuery"
    3636  import="net.sf.basedb.core.ItemResultList"
     
    7171    if (currentHardwareTypeId == 0)
    7272    {
    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);
    7575    }
    7676  }
     
    8282    try
    8383    {
    84       HardwareType ht = hardware.getHardwareType();
     84      ItemSubtype ht = hardware.getItemSubtype();
    8585      if (ht != null) currentHardwareTypeId = ht.getId();
    8686    }
     
    9696 
    9797  // Query to retrieve file types
    98   final ItemQuery<HardwareType> hardwareTypeQuery = HardwareType.getQuery();
     98  final ItemQuery<ItemSubtype> hardwareTypeQuery = ItemSubtype.getQuery(itemType);
    9999  hardwareTypeQuery.order(Orders.asc(Hql.property("name")));
    100100 
     
    184184          else
    185185          {
    186             for (HardwareType hardwareType : hardwareTypeQuery.list(dc))
     186            for (ItemSubtype hardwareType : hardwareTypeQuery.list(dc))
    187187            {
    188188              int id = hardwareType.getId();
  • trunk/www/admin/hardware/index.jsp

    r5590 r5630  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Hardware"
    32   import="net.sf.basedb.core.HardwareType"
     32  import="net.sf.basedb.core.ItemSubtype"
    3333  import="net.sf.basedb.core.ItemQuery"
    3434  import="net.sf.basedb.core.Permission"
     
    6060<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    6161<%!
    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");
    6363  private static final Item itemType = Item.HARDWARE;
    6464%>
     
    135135    dc = sc.newDbControl();
    136136    Hardware hardware = (Hardware)cc.getObject("item");
    137     int hardwareTypeId = Values.getInt(request.getParameter("hardwaretype_id"), -1);
    138137    if (hardware == null)
    139138    {
    140       hardware = Hardware.getNew(dc, HardwareType.getById(dc, hardwareTypeId));
     139      hardware = Hardware.getNew(dc);
    141140      message = "Hardware created";
    142141      dc.saveItem(hardware);
     
    154153      hardware.setVersionString(Values.getStringOrNull(request.getParameter("version")));
    155154      hardware.setDescription(Values.getStringOrNull(request.getParameter("description")));
     155      int hardwareTypeId = Values.getInt(request.getParameter("hardwaretype_id"), -1);
    156156      if (hardwareTypeId >= 0) // < 0 = denied or unchanged
    157157      {
    158         HardwareType hwt = hardwareTypeId == 0 ? null : HardwareType.getById(dc, hardwareTypeId);
    159         hardware.setHardwareType(hwt);
     158        ItemSubtype hwt = hardwareTypeId == 0 ? null : ItemSubtype.getById(dc, hardwareTypeId);
     159        hardware.setItemSubtype(hwt);
    160160        if (hwt != null) cc.setRecent(hwt, maxRecent);
    161161      }
  • trunk/www/admin/hardware/list_hardware.jsp

    r5590 r5630  
    2929  import="net.sf.basedb.core.Item"
    3030  import="net.sf.basedb.core.Hardware"
    31   import="net.sf.basedb.core.HardwareType"
     31  import="net.sf.basedb.core.ItemSubtype"
    3232  import="net.sf.basedb.core.ItemQuery"
    3333  import="net.sf.basedb.core.Include"
     
    8383  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
    8484
    85   final ItemQuery<HardwareType> typeQuery = HardwareType.getQuery();
     85  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.HARDWARE);
    8686  typeQuery.order(Orders.asc(Hql.property("name")));
    8787  typeQuery.setCacheResult(true);
     
    255255      <%
    256256      Enumeration<String, String> hardwareTypes = new Enumeration<String, String>();
    257       for (HardwareType st : typeQuery.list(dc))
     257      for (ItemSubtype st : typeQuery.list(dc))
    258258      {
    259259        hardwareTypes.add(Integer.toString(st.getId()), HTML.encodeTags(st.getName()));
     
    261261      %>
    262262      <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"
    267267        datatype="int"
    268268        enumeration="<%=hardwareTypes%>"
     
    475475                  /></tbl:cell>
    476476                <tbl:cell column="version"><%=HTML.encodeTags(item.getVersionString())%></tbl:cell>
    477                 <tbl:cell column="hardwareType"
     477                <tbl:cell column="itemSubtype"
    478478                  ><base:propertyvalue
    479479                    item="<%=item%>"
    480                     property="hardwareType"
     480                    property="itemSubtype"
    481481                    enableEditLink="<%=mode.hasEditLink()%>"
    482482                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
  • trunk/www/admin/hardware/view_hardware.jsp

    r5507 r5630  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.Hardware"
    36   import="net.sf.basedb.core.HardwareType"
    3736  import="net.sf.basedb.core.User"
    3837  import="net.sf.basedb.core.MultiPermissions"
     
    248247      <tr>
    249248        <td class="prompt">Type</td>
    250         <td><base:propertyvalue item="<%=hardware%>" property="hardwareType" /></td>
     249        <td><base:propertyvalue item="<%=hardware%>" property="itemSubtype" /></td>
    251250      </tr>
    252251      <tr>
  • trunk/www/admin/mimetypes/edit_mimetype.jsp

    r5629 r5630  
    3333  import="net.sf.basedb.core.Permission"
    3434  import="net.sf.basedb.core.MimeType"
    35   import="net.sf.basedb.core.FileType"
     35  import="net.sf.basedb.core.ItemSubtype"
    3636  import="net.sf.basedb.core.ItemQuery"
    3737  import="net.sf.basedb.core.ItemResultList"
     
    7373    if (currentFileTypeId == 0)
    7474    {
    75       currentFileTypeId = Values.getInt(cc.getRecent(Item.FILETYPE.name(), 0), 0);
     75      currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0);
    7676    }
    7777    autoCompress = Values.getBoolean(cc.getPropertyValue("autoCompress"), autoCompress);
     
    8585    try
    8686    {
    87       FileType ft = mimeType.getFileType();
     87      ItemSubtype ft = mimeType.getFileType();
    8888      if (ft != null) currentFileTypeId = ft.getId();
    8989    }
     
    9696 
    9797  // Query to retrieve file types
    98   final ItemQuery<FileType> fileTypeQuery = FileType.getQuery();
     98  final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(Item.FILE);
    9999  fileTypeQuery.order(Orders.asc(Hql.property("name")));
    100100  fileTypeQuery.setCacheResult(true);
     
    193193            <option value="0">- none -
    194194            <%
    195             ItemResultList<FileType> fileTypes = fileTypeQuery.list(dc);
    196             for (FileType fileType : fileTypes)
     195            ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc);
     196            for (ItemSubtype fileType : fileTypes)
    197197            {
    198198              int id = fileType.getId();
  • trunk/www/admin/mimetypes/index.jsp

    r5590 r5630  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.MimeType"
    32   import="net.sf.basedb.core.FileType"
     32  import="net.sf.basedb.core.ItemSubtype"
    3333  import="net.sf.basedb.core.ItemQuery"
    3434  import="net.sf.basedb.core.Permission"
     
    154154      if (fileTypeId >= 0) // < 0 = denied or unchanged
    155155      {
    156         FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);
     156        ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId);
    157157        mimeType.setFileType(ft);
    158158        if (ft != null) cc.setRecent(ft, maxRecent);
  • trunk/www/admin/mimetypes/list_mimetypes.jsp

    r5590 r5630  
    2929  import="net.sf.basedb.core.Item"
    3030  import="net.sf.basedb.core.MimeType"
    31   import="net.sf.basedb.core.FileType"
     31  import="net.sf.basedb.core.ItemSubtype"
    3232  import="net.sf.basedb.core.ItemQuery"
    3333  import="net.sf.basedb.core.Include"
     
    8383
    8484  // Get all file types
    85   final ItemQuery<FileType> typeQuery = FileType.getQuery();
     85  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(Item.FILE);
    8686  typeQuery.order(Orders.asc(Hql.property("name")));
    8787  typeQuery.setCacheResult(true);
     
    246246      Enumeration<String, String> fileTypes = new Enumeration<String, String>();
    247247      fileTypes.add("", "- none -");
    248       for (FileType ft : typeQuery.list(dc))
     248      for (ItemSubtype ft : typeQuery.list(dc))
    249249      {
    250250        fileTypes.add(Integer.toString(ft.getId()), ft.getName());
  • trunk/www/admin/protocols/edit_protocol.jsp

    r5506 r5630  
    3232  import="net.sf.basedb.core.Permission"
    3333  import="net.sf.basedb.core.Protocol"
    34   import="net.sf.basedb.core.ProtocolType"
     34  import="net.sf.basedb.core.ItemSubtype"
    3535  import="net.sf.basedb.core.AnnotationType"
    3636  import="net.sf.basedb.core.File"
    37   import="net.sf.basedb.core.FileType"
    3837  import="net.sf.basedb.core.SystemItems"
    3938  import="net.sf.basedb.core.ItemQuery"
     
    8382    if (currentProtocolTypeId == 0)
    8483    {
    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);
    8786    }
    8887    cc.removeObject("item");
     
    9695    try
    9796    {
    98       ProtocolType pt = protocol.getProtocolType();
     97      ItemSubtype pt = protocol.getItemSubtype();
    9998      if (pt != null) currentProtocolTypeId = pt.getId();
    10099    }
     
    118117 
    119118  // Query to retrieve protocol types
    120   final ItemQuery<ProtocolType> protocolTypeQuery = ProtocolType.getQuery();
     119  final ItemQuery<ItemSubtype> protocolTypeQuery = ItemSubtype.getQuery(itemType);
    121120  protocolTypeQuery.include(Include.ALL);
    122121  protocolTypeQuery.order(Orders.asc(Hql.property("name")));
     
    184183      var frm = document.forms['protocol'];
    185184      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)%>';
    187186      if (frm.file_id.length > 1)
    188187      {
     
    286285          else
    287286          {
    288             for (ProtocolType protocolType : protocolTypeQuery.list(dc))
     287            for (ItemSubtype protocolType : protocolTypeQuery.list(dc))
    289288            {
    290289              int id = protocolType.getId();
  • trunk/www/admin/protocols/index.jsp

    r5590 r5630  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Protocol"
    32   import="net.sf.basedb.core.ProtocolType"
     32  import="net.sf.basedb.core.ItemSubtype"
    3333  import="net.sf.basedb.core.AnnotationType"
    3434  import="net.sf.basedb.core.File"
     
    6262<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    6363<%!
    64   private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,protocolType,description");
     64  private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,description");
    6565  private static final Item itemType = Item.PROTOCOL;
    6666%>
     
    137137    dc = sc.newDbControl();
    138138    Protocol protocol = (Protocol)cc.getObject("item");
    139     int protocolTypeId = Values.getInt(request.getParameter("protocoltype_id"), -1);
    140139    if (protocol == null)
    141140    {
    142       protocol = Protocol.getNew(dc, ProtocolType.getById(dc, protocolTypeId));
     141      protocol = Protocol.getNew(dc);
    143142      message = "Protocol created";
    144143      dc.saveItem(protocol);
     
    156155      protocol.setDescription(Values.getStringOrNull(request.getParameter("description")));
    157156      protocol.setExternalId(Values.getStringOrNull(request.getParameter("external_id")));
     157      int protocolTypeId = Values.getInt(request.getParameter("protocoltype_id"), -1);
    158158      if (protocolTypeId >= 0) // < 0 = denied or unchanged
    159159      {
    160         ProtocolType pt = protocolTypeId == 0 ? null : ProtocolType.getById(dc, protocolTypeId);
    161         protocol.setProtocolType(pt);
     160        ItemSubtype pt = protocolTypeId == 0 ? null : ItemSubtype.getById(dc, protocolTypeId);
     161        protocol.setItemSubtype(pt);
    162162        if (pt != null) cc.setRecent(pt, maxRecent);
    163163      }
  • trunk/www/admin/protocols/list_protocol.jsp

    r5590 r5630  
    2929  import="net.sf.basedb.core.Item"
    3030  import="net.sf.basedb.core.Protocol"
    31   import="net.sf.basedb.core.ProtocolType"
     31  import="net.sf.basedb.core.ItemSubtype"
    3232  import="net.sf.basedb.core.Annotation"
    3333  import="net.sf.basedb.core.AnnotationType"
     
    9191  final ItemQuery<Protocol> query = Base.getConfiguredQuery(dc, cc, true, Protocol.getQuery(), mode);
    9292
    93   final ItemQuery<ProtocolType> typeQuery = ProtocolType.getQuery();
     93  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType);
    9494  typeQuery.order(Orders.asc(Hql.property("name")));
    9595  typeQuery.setCacheResult(true);
     
    253253      <%
    254254      Enumeration<String, String> protocolTypes = new Enumeration<String, String>();
    255       for (ProtocolType pt : typeQuery.list(dc))
     255      for (ItemSubtype pt : typeQuery.list(dc))
    256256      {
    257257        protocolTypes.add(Integer.toString(pt.getId()), HTML.encodeTags(pt.getName()));
     
    268268      />     
    269269      <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"
    274274        datatype="int"
    275275        enumeration="<%=protocolTypes%>"
     
    529529                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    530530                  /></tbl:cell>
    531                 <tbl:cell column="protocolType"
     531                <tbl:cell column="itemSubtype"
    532532                  ><base:propertyvalue
    533533                    item="<%=item%>"
    534                     property="protocolType"
     534                    property="itemSubtype"
    535535                    enableEditLink="<%=mode.hasEditLink()%>"
    536536                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
  • trunk/www/admin/protocols/view_protocol.jsp

    r5507 r5630  
    3333  import="net.sf.basedb.core.Permission"
    3434  import="net.sf.basedb.core.Protocol"
    35   import="net.sf.basedb.core.ProtocolType"
    3635  import="net.sf.basedb.core.AnnotationType"
    3736  import="net.sf.basedb.core.File"
     
    264263      <tr>
    265264        <td class="prompt">Type</td>
    266         <td><base:propertyvalue item="<%=protocol%>" property="protocolType" /></td>
     265        <td><base:propertyvalue item="<%=protocol%>" property="itemSubtype" /></td>
    267266      </tr>
    268267      <tr>
  • trunk/www/admin/software/edit_software.jsp

    r5506 r5630  
    3232  import="net.sf.basedb.core.Permission"
    3333  import="net.sf.basedb.core.Software"
    34   import="net.sf.basedb.core.SoftwareType"
     34  import="net.sf.basedb.core.ItemSubtype"
    3535  import="net.sf.basedb.core.ItemQuery"
    3636  import="net.sf.basedb.core.ItemResultList"
     
    7171    if (currentSoftwareTypeId == 0)
    7272    {
    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);
    7575    }
    7676  }
     
    8282    try
    8383    {
    84       SoftwareType st = software.getSoftwareType();
     84      ItemSubtype st = software.getItemSubtype();
    8585      if (st != null) currentSoftwareTypeId = st.getId();
    8686    }
     
    9696 
    9797  // Query to retrieve file types
    98   final ItemQuery<SoftwareType> softwareTypeQuery = SoftwareType.getQuery();
     98  final ItemQuery<ItemSubtype> softwareTypeQuery = ItemSubtype.getQuery(itemType);
    9999  softwareTypeQuery.order(Orders.asc(Hql.property("name"))); 
    100100  final String clazz = "class=\"text\"";
     
    183183          else
    184184          {
    185             for (SoftwareType softwareType : softwareTypeQuery.list(dc))
     185            for (ItemSubtype softwareType : softwareTypeQuery.list(dc))
    186186            {
    187187              int id = softwareType.getId();
  • trunk/www/admin/software/index.jsp

    r5590 r5630  
    3030  import="net.sf.basedb.core.Include"
    3131  import="net.sf.basedb.core.Software"
    32   import="net.sf.basedb.core.SoftwareType"
     32  import="net.sf.basedb.core.ItemSubtype"
    3333  import="net.sf.basedb.core.ItemQuery"
    3434  import="net.sf.basedb.core.Permission"
     
    6060<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    6161<%!
    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");
    6363  private static final Item itemType = Item.SOFTWARE;
    6464%>
     
    135135    dc = sc.newDbControl();
    136136    Software software = (Software)cc.getObject("item");
    137     int softwareTypeId = Values.getInt(request.getParameter("softwaretype_id"), -1);
    138137    if (software == null)
    139138    {
    140       software = Software.getNew(dc, SoftwareType.getById(dc, softwareTypeId));
     139      software = Software.getNew(dc);
    141140      message = "Software created";
    142141      dc.saveItem(software);
     
    154153      software.setVersionString(Values.getStringOrNull(request.getParameter("version")));
    155154      software.setDescription(Values.getStringOrNull(request.getParameter("description")));
     155      int softwareTypeId = Values.getInt(request.getParameter("softwaretype_id"), -1);
    156156      if (softwareTypeId >= 0) // < 0 = denied or unchanged
    157157      {
    158         SoftwareType swt = softwareTypeId == 0 ? null : SoftwareType.getById(dc, softwareTypeId);
    159         software.setSoftwareType(swt);
     158        ItemSubtype swt = softwareTypeId == 0 ? null : ItemSubtype.getById(dc, softwareTypeId);
     159        software.setItemSubtype(swt);
    160160        if (swt != null) cc.setRecent(swt, maxRecent);
    161161      }
  • trunk/www/admin/software/list_software.jsp

    r5590 r5630  
    2929  import="net.sf.basedb.core.Item"
    3030  import="net.sf.basedb.core.Software"
    31   import="net.sf.basedb.core.SoftwareType"
     31  import="net.sf.basedb.core.ItemSubtype"
    3232  import="net.sf.basedb.core.ItemQuery"
    3333  import="net.sf.basedb.core.Include"
     
    8383  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
    8484
    85   final ItemQuery<SoftwareType> typeQuery = SoftwareType.getQuery();
     85  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType);
    8686  typeQuery.order(Orders.asc(Hql.property("name")));
    8787  typeQuery.setCacheResult(true);
     
    255255      <%
    256256      Enumeration<String, String> softwareTypes = new Enumeration<String, String>();
    257       for (SoftwareType st : typeQuery.list(dc))
     257      for (ItemSubtype st : typeQuery.list(dc))
    258258      {
    259259        softwareTypes.add(Integer.toString(st.getId()), HTML.encodeTags(st.getName()));
     
    261261      %>
    262262      <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"
    267267        datatype="int"
    268268        enumeration="<%=softwareTypes%>"
     
    475475                  /></tbl:cell>
    476476                <tbl:cell column="version"><%=HTML.encodeTags(item.getVersionString())%></tbl:cell>
    477                 <tbl:cell column="softwareType"
     477                <tbl:cell column="itemSubtype"
    478478                  ><base:propertyvalue
    479479                    item="<%=item%>"
    480                     property="softwareType"
     480                    property="itemSubtype"
    481481                    enableEditLink="<%=mode.hasEditLink()%>"
    482482                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
  • trunk/www/admin/software/view_software.jsp

    r5507 r5630  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.Software"
    36   import="net.sf.basedb.core.SoftwareType"
    3736  import="net.sf.basedb.core.User"
    3837  import="net.sf.basedb.core.MultiPermissions"
     
    247246      <tr>
    248247        <td class="prompt">Type</td>
    249         <td><base:propertyvalue item="<%=software%>" property="softwareType" /></td>
     248        <td><base:propertyvalue item="<%=software%>" property="itemSubtype" /></td>
    250249      </tr>
    251250      <tr>
  • trunk/www/biomaterials/bioplates/edit_bioplate.jsp

    r5492 r5630  
    3030  import="net.sf.basedb.core.Item"
    3131  import="net.sf.basedb.core.Hardware"
    32   import="net.sf.basedb.core.HardwareType"
    3332  import="net.sf.basedb.core.ItemContext"
    3433  import="net.sf.basedb.core.SystemItems"
     
    272271        url += '&item_id='+id;
    273272      }
    274       url += '&resetTemporary=1&tmpfilter:INT:hardwareType=<%=SystemItems.getId(HardwareType.FREEZER)%>';
     273      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.FREEZER)%>';
    275274      Main.openPopup(url, 'SelectFreezer', 1000, 700);
    276275    }
  • trunk/www/biomaterials/extracts/edit_extract.jsp

    r5492 r5630  
    3838  import="net.sf.basedb.core.BioWell"
    3939  import="net.sf.basedb.core.Protocol"
    40   import="net.sf.basedb.core.ProtocolType"
    4140  import="net.sf.basedb.core.Project"
    4241  import="net.sf.basedb.core.PermissionDeniedException"
     
    316315        url += '&item_id='+id;
    317316      }
    318       url += '&resetTemporary=1&tmpfilter:INT:protocolType=<%=SystemItems.getId(ProtocolType.EXTRACTION)%>';
     317      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.EXTRACTION)%>';
    319318      Main.openPopup(url, 'SelectProtocol', 1000, 700);
    320319    }
  • trunk/www/biomaterials/labeledextracts/edit_labeledextract.jsp

    r5492 r5630  
    3939  import="net.sf.basedb.core.BioWell"
    4040  import="net.sf.basedb.core.Protocol"
    41   import="net.sf.basedb.core.ProtocolType"
    4241  import="net.sf.basedb.core.Project"
    4342  import="net.sf.basedb.core.PermissionDeniedException"
     
    347346        url += '&item_id='+id;
    348347      }
    349       url += '&resetTemporary=1&tmpfilter:INT:protocolType=<%=SystemItems.getId(ProtocolType.LABELING)%>';
     348      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.LABELING)%>';
    350349      Main.openPopup(url, 'SelectProtocol', 1000, 700);
    351350    }
  • trunk/www/biomaterials/samples/edit_sample.jsp

    r5490 r5630  
    3838  import="net.sf.basedb.core.BioWell"
    3939  import="net.sf.basedb.core.Protocol"
    40   import="net.sf.basedb.core.ProtocolType"
    4140  import="net.sf.basedb.core.Project"
    4241  import="net.sf.basedb.core.PermissionDeniedException"
     
    318317        url += '&item_id='+id;
    319318      }
    320       url += '&resetTemporary=1&tmpfilter:INT:protocolType=<%=SystemItems.getId(ProtocolType.SAMPLING)%>';
     319      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Protocol.SAMPLING)%>';
    321320      Main.openPopup(url, 'SelectProtocol', 1000, 700);
    322321    }
  • trunk/www/biomaterials/wizards/create_child_bioplate_step1.jsp

    r5561 r5630  
    3030  import="net.sf.basedb.core.MeasuredBioMaterial"
    3131  import="net.sf.basedb.core.Hardware"
    32   import="net.sf.basedb.core.HardwareType"
    3332  import="net.sf.basedb.core.Protocol"
    3433  import="net.sf.basedb.core.Label"
     
    225224        url += '&item_id='+id;
    226225      }
    227       url += '&resetTemporary=1&tmpfilter:INT:hardwareType=<%=SystemItems.getId(HardwareType.FREEZER)%>';
     226      url += '&resetTemporary=1&tmpfilter:INT:itemSubtype=<%=SystemItems.getId(Hardware.FREEZER)%>';
    228227      Main.openPopup(url, 'SelectFreezer', 1000, 700);
    229228    }
  • trunk/www/biomaterials/wizards/create_child_bioplate_step2.jsp

    r5561 r5630  
    3030  import="net.sf.basedb.core.MeasuredBioMaterial"
    3131  import="net.sf.basedb.core.Hardware"
    32   import="net.sf.basedb.core.HardwareType"
    3332  import="net.sf.basedb.core.Protocol"
    3433  import="net.sf.basedb.core.DbControl"
  • trunk/www/filemanager/files/download_file.jsp

    r5426 r5630  
    3131  import="net.sf.basedb.core.Permission"
    3232  import="net.sf.basedb.core.File"
    33   import="net.sf.basedb.core.FileType"
    3433  import="net.sf.basedb.core.Location"
    3534  import="net.sf.basedb.core.User"
  • trunk/www/filemanager/files/edit_file.jsp

    r5570 r5630  
    3636  import="net.sf.basedb.core.File"
    3737  import="net.sf.basedb.core.FileServer"
    38   import="net.sf.basedb.core.FileType"
     38  import="net.sf.basedb.core.ItemSubtype"
    3939  import="net.sf.basedb.core.Location"
    4040  import="net.sf.basedb.core.ItemQuery"
     
    8181  {
    8282    title = "Create file";
    83     currentFileTypeId = Values.getInt(cc.getPropertyValue("fileType"), 0);
     83    currentFileTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), 0);
    8484    if (currentFileTypeId == 0)
    8585    {
    86       currentFileTypeId = Values.getInt(cc.getRecent(Item.FILETYPE.name(), 0), 0);
     86      currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0);
    8787    }
    8888    if (cc.getPropertyFilter("fileServer.name") != null)
     
    102102    try
    103103    {
    104       FileType ft = file.getFileType();
     104      ItemSubtype ft = file.getItemSubtype();
    105105      if (ft != null) currentFileTypeId = ft.getId();
    106106    }
     
    124124 
    125125  // Query to retrieve file types
    126   final ItemQuery<FileType> fileTypeQuery = FileType.getQuery();
     126  final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType);
    127127  fileTypeQuery.order(Orders.asc(Hql.property("name")));
    128128  fileTypeQuery.setCacheResult(true);
     
    305305            <option value="0">- none -
    306306            <%
    307             ItemResultList<FileType> fileTypes = fileTypeQuery.list(dc);
    308             for (FileType fileType : fileTypes)
     307            ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc);
     308            for (ItemSubtype fileType : fileTypes)
    309309            {
    310310              int id = fileType.getId();
  • trunk/www/filemanager/files/edit_multiple_file.jsp

    r5570 r5630  
    3636  import="net.sf.basedb.core.File"
    3737  import="net.sf.basedb.core.FileServer"
    38   import="net.sf.basedb.core.FileType"
     38  import="net.sf.basedb.core.ItemSubtype"
    3939  import="net.sf.basedb.core.Location"
    4040  import="net.sf.basedb.core.ItemQuery"
     
    7272
    7373  // Query to retrieve file types
    74   final ItemQuery<FileType> fileTypeQuery = FileType.getQuery();
     74  final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType);
    7575  fileTypeQuery.order(Orders.asc(Hql.property("name")));
    7676  fileTypeQuery.setCacheResult(true);
     
    150150          <option value="0">- none -
    151151          <%
    152           ItemResultList<FileType> fileTypes = fileTypeQuery.list(dc);
    153           for (FileType fileType : fileTypes)
     152          ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc);
     153          for (ItemSubtype fileType : fileTypes)
    154154          {
    155155            int id = fileType.getId();
  • trunk/www/filemanager/files/index.jsp

    r5599 r5630  
    3535  import="net.sf.basedb.core.File"
    3636  import="net.sf.basedb.core.FileServer"
    37   import="net.sf.basedb.core.FileType"
     37  import="net.sf.basedb.core.ItemSubtype"
    3838  import="net.sf.basedb.core.Location"
    3939  import="net.sf.basedb.core.ItemQuery"
     
    6666<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    6767<%!
    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");
    6969  private static final ItemContext searchContext = Base.createDefaultContext("name", "path,name,size,description,actions");
    7070  private static final Item itemType = Item.FILE;
     
    200200      if (fileTypeId >= 0) // < 0 = denied or unchanged
    201201      {
    202         FileType ft = fileTypeId == 0 ? null : FileType.getById(dc, fileTypeId);
    203         file.setFileType(ft);
     202        ItemSubtype ft = fileTypeId == 0 ? null : ItemSubtype.getById(dc, fileTypeId);
     203        file.setItemSubtype(ft);
    204204        if (ft != null) cc.setRecent(ft, maxRecent);
    205205      }
     
    241241    int fileTypeId = Values.getInt(request.getParameter("filetype_id"), -1);
    242242    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;
    244244    boolean setCharacterSet = !"keep".equals(request.getParameter("characterSet"));
    245245    String characterSet = Values.getStringOrNull(request.getParameter("characterSet"));
     
    257257        {
    258258          if (setWriteProtected) file.setWriteProtected(writeProtected);
    259           if (setFileType) file.setFileType(fileType);
     259          if (setFileType) file.setItemSubtype(fileType);
    260260          if (setCharacterSet) file.setCharacterSet(characterSet);
    261261          if (setMimeType) file.setMimeType(mimeType);
  • trunk/www/filemanager/files/list_files.jsp

    r5590 r5630  
    3434  import="net.sf.basedb.core.File"
    3535  import="net.sf.basedb.core.Directory"
    36   import="net.sf.basedb.core.FileType"
     36  import="net.sf.basedb.core.ItemSubtype"
    3737  import="net.sf.basedb.core.ItemQuery"
    3838  import="net.sf.basedb.core.ItemResultIterator"
     
    106106
    107107  // Get all file types
    108   final ItemQuery<FileType> typeQuery = FileType.getQuery();
     108  final ItemQuery<ItemSubtype> typeQuery = ItemSubtype.getQuery(itemType);
    109109  typeQuery.order(Orders.asc(Hql.property("name")));
    110110  typeQuery.setCacheResult(true);
     
    587587      Enumeration<String, String> fileTypes = new Enumeration<String, String>();
    588588      fileTypes.add("", "- none -");
    589       for (FileType ft : typeQuery.list(dc))
     589      for (ItemSubtype ft : typeQuery.list(dc))
    590590      {
    591591        fileTypes.add(Integer.toString(ft.getId()), ft.getName());
     
    593593      %>
    594594      <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"
    599599        datatype="int"
    600600        enumeration="<%=fileTypes%>"
     
    10791079                <tbl:cell column="compressed"><%=item.isCompressed() ? "yes" : "no"%></tbl:cell>
    10801080                <tbl:cell column="writeProtected"><%=item.isWriteProtected() ? "yes" : "no"%></tbl:cell>
    1081                 <tbl:cell column="fileType"
     1081                <tbl:cell column="itemSubtype"
    10821082                  ><base:propertyvalue
    10831083                    item="<%=item%>"
    1084                     property="fileType"
     1084                    property="itemSubtype"
    10851085                    enableEditLink="<%=mode.hasEditLink()%>"
    10861086                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
  • trunk/www/filemanager/files/view_file.jsp

    r5502 r5630  
    3434  import="net.sf.basedb.core.Permission"
    3535  import="net.sf.basedb.core.File"
    36   import="net.sf.basedb.core.FileType"
    3736  import="net.sf.basedb.core.Location"
    3837  import="net.sf.basedb.core.MultiPermissions"
     
    313312      <tr>
    314313        <td class="prompt">Type</td>
    315         <td><base:propertyvalue item="<%=file%>" property="fileType" /></td>
     314        <td><base:propertyvalue item="<%=file%>" property="itemSubtype" /></td>
    316315      </tr>
    317316      <tr>
  • trunk/www/filemanager/index.jsp

    r5426 r5630  
    3636<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
    3737<%!
    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");
    3939  private static final Item itemType = Item.FILE;
    4040%>
  • trunk/www/filemanager/upload/select.jsp

    r5595 r5630  
    2626  @version 2.0
    2727--%>
     28<%@page import="net.sf.basedb.core.ItemSubtype"%>
    2829<%@ page pageEncoding="UTF-8" session="false"
    2930  import="net.sf.basedb.core.Application"
     
    3738  import="net.sf.basedb.core.Directory"
    3839  import="net.sf.basedb.core.File"
    39   import="net.sf.basedb.core.FileType"
    4040  import="net.sf.basedb.core.User"
    4141  import="net.sf.basedb.core.Group"
     
    8282  {
    8383    title = "Upload new file";
    84     currentFileTypeId = Values.getInt(cc.getPropertyValue("fileType"), 0);
     84    currentFileTypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), 0);
    8585    if (currentFileTypeId == 0)
    8686    {
    87       currentFileTypeId = Values.getInt(cc.getRecent(Item.FILETYPE.name(), 0), 0);
     87      currentFileTypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0);
    8888    }
    8989    directory = Directory.getById(dc, Values.getInt(request.getParameter("directory_id"), SystemItems.getId(Directory.ROOT)));
     
    9999    try
    100100    {
    101       FileType ft = file.getFileType();
     101      ItemSubtype ft = file.getItemSubtype();
    102102      if (ft != null) currentFileTypeId = ft.getId();
    103103    }
     
    128128 
    129129  // Query to retrieve file types
    130   final ItemQuery<FileType> fileTypeQuery = FileType.getQuery();
     130  final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType);
    131131  fileTypeQuery.order(Orders.asc(Hql.property("name")));
    132132  fileTypeQuery.setCacheResult(true);
     
    463463            <option value="0">- none -
    464464            <%
    465             ItemResultList<FileType> fileTypes = fileTypeQuery.list(dc);
    466             for (FileType fileType : fileTypes)
     465            ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc);
     466            for (ItemSubtype fileType : fileTypes)
    467467            {
    468468              int id = fileType.getId();
  • trunk/www/include/menu.jsp

    r5616 r5630  
    801801    // Administrate -> Types menu
    802802    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);
    805803    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);
    808804    final boolean hasAnnotationTypeCategories = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPECATEGORY);   
    809805    final boolean hasAnnotationTypes = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPE);
     
    811807    final boolean hasExtraValueTypes = !sc.hasPermission(Permission.DENIED, Item.EXTRAVALUETYPE);
    812808    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;
    816813    if (hasTypes)
    817814    {
     
    822819        >
    823820        <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
    824846          title="<%=common.getString("item.quotatype+")%>"
    825847          onclick="<%="Menu.openUrl('"+root+"admin/quotatypes/index.jsp?ID="+ID+"')"%>"
     
    828850        />
    829851        <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 />
    871864        <m:menuitem
    872865          title="<%=menu.getString("units+quantities.title")%>"
     
    874867          tooltip="<%=menu.getString("units+quantities.tooltip", hasQuantities)%>"
    875868          enabled="<%=hasQuantities%>"
    876         />
    877         <m:menuitem
    878           title="<%=common.getString("item.reportertype+")%>"
    879           onclick="<%="Menu.openUrl('"+root+"admin/reportertypes/index.jsp?ID="+ID+"')"%>"
    880