Changeset 6752


Ignore:
Timestamp:
Feb 20, 2015, 11:13:36 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1325: Lists of items (similar funcion as biomaterial lists)

Adding check for item lists using a subtype to keep trashcan functionality is up to date.

Location:
trunk/src/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r6741 r6752  
    33793379  </query>
    33803380 
     3381  <query id="GET_ITEMLISTS_FOR_SUBTYPE" type="HQL">
     3382    <sql>
     3383      SELECT {1}
     3384      FROM ItemListData il
     3385      WHERE il.itemSubtype = :subtype
     3386    </sql>
     3387    <description>
     3388      A Hibernate query that gets ITEMLISTS for a given item subtype.
     3389    </description>
     3390  </query>
     3391 
    33813392  <query id="GET_MIMETYPES_FOR_FILETYPE" type="HQL">
    33823393    <sql>
  • trunk/src/core/net/sf/basedb/core/ItemSubtype.java

    r6465 r6752  
    416416    query.setEntity("subtype", this.getData());
    417417    boolean used = HibernateUtil.loadData(Long.class, query) > 0;
     418    if (!used)
     419    {
     420      // Item lists
     421      query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", "count(*)");
     422      query.setEntity("subtype", this.getData());
     423      used = HibernateUtil.loadData(Long.class, query) > 0;
     424    }
    418425    if (!used && mainType == Item.FILE)
    419426    {
     
    460467    query.setEntity("subtype", this.getData());
    461468    addUsingItems(using, mainType, query);
     469   
     470    // Item lists
     471    query = HibernateUtil.getPredefinedQuery(session, "GET_ITEMLISTS_FOR_SUBTYPE", "il.id");
     472    query.setEntity("subtype", this.getData());
     473    addUsingItems(using, Item.ITEMLIST, query);
     474   
     475    // File-related
    462476    if (mainType == Item.FILE)
    463477    {
     
    470484      addUsingItems(using, Item.DATAFILETYPE, query);
    471485    }
     486    // Protocol-related
    472487    if (mainType == Item.PROTOCOL)
    473488    {
Note: See TracChangeset for help on using the changeset viewer.